From e5cbbbc87cf9a2000db63d4614855841408b5bbc Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Mon, 6 Nov 2017 14:53:34 +0800 Subject: [PATCH 1/2] gulpfile: refine gen-simulator --- native/gulpfile.js | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/native/gulpfile.js b/native/gulpfile.js index 983b3d66f6..b18976991e 100644 --- a/native/gulpfile.js +++ b/native/gulpfile.js @@ -18,7 +18,7 @@ gulp.task('publish-prebuilt', gulpSequence('init', 'make-simulator', 'make-prebu function execSync(cmd, workPath) { var execOptions = { - cwd: workPath, + cwd: workPath || '.', stdio: 'inherit' }; ExecSync(cmd, execOptions); @@ -91,8 +91,8 @@ function getCurrentBranch() { } gulp.task('init', function(cb) { - execSync('python download-deps.py --remove-download no', '.'); - execSync('git submodule update --init', '.'); + execSync('python download-deps.py --remove-download no'); + execSync('git submodule update --init'); execSync('python download-bin.py --remove-download no', './tools/cocos2d-console'); cb(); }); @@ -105,7 +105,7 @@ gulp.task('gen-libs', function(cb) { } else { cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos.bat'); } - execSync(cocosConsoleBin + ' gen-libs -m release --vs 2015 --android-studio --app-abi armeabi:arm64-v8a:armeabi-v7a:x86', '.'); + execSync(cocosConsoleBin + ' gen-libs -m release --vs 2015 --android-studio --app-abi armeabi:arm64-v8a:armeabi-v7a:x86'); cb(); }); @@ -119,11 +119,15 @@ gulp.task('gen-simulator', function(cb) { var cocosConsoleBin; if (process.platform === 'darwin') { cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos'); - // copy mac xcode project with signing info - if (fs.existsSync('simulator.xcodeproj')) { + if (fs.existsSync('./simulator.xcodeproj')) { + // copy mac xcode project with signing info fs.copySync('./simulator.xcodeproj', './tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); } - } else { + else { + return cb('Failed to generate simulator, xcode project not signed. Run "gulp sign-simulator" please.'); + } + } + else { cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos.bat'); } var args; @@ -142,21 +146,26 @@ gulp.task('gen-simulator', function(cb) { }); child.on('close', (code) => { if (code !== 0) { - console.error('Generate simulator failed'); + cb('Generate simulator failed'); + return; + } + if (process.platform === 'darwin') { + //reset project file to hide code sign information. + ExecSync('git checkout -- ./tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); } - //reset project file to hide code sign information. - ExecSync('git checkout -- ./tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); - cb(); - return; }); child.on('error', function() { - console.error('Generate simulator failed'); - cb(); + cb('Generate simulator failed'); }); } catch (err) { - console.error(err); - cb(); - return; + cb(err); + } +}); + +gulp.task('sign-simulator', function () { + if (process.platform === 'darwin') { + execSync('/Applications/Xcode.app/Contents/MacOS/Xcode ./tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); + fs.copySync('./tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj', './simulator.xcodeproj'); } }); From 228ff3e0ac1761311304f5cacfff53d53c43a24f Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Mon, 6 Nov 2017 16:44:31 +0800 Subject: [PATCH 2/2] update gradle projects --- .../runtime-src/proj.android-studio/app/build.gradle | 2 +- .../frameworks/runtime-src/proj.android-studio/build.gradle | 4 +++- .../runtime-src/proj.android-studio/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle index 7c529111af..2fed8512f4 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 - buildToolsVersion "25.0.0" + buildToolsVersion "26.0.2" defaultConfig { applicationId "org.cocos2d.helloworld" diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/build.gradle b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/build.gradle index f46d6535c5..c7ae573ffe 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/build.gradle +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/build.gradle @@ -2,10 +2,11 @@ buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' + classpath 'com.android.tools.build:gradle:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +15,7 @@ buildscript { allprojects { repositories { + google() jcenter() } } diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties index b0fc42cea2..8391069f2a 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle.properties @@ -18,4 +18,4 @@ # org.gradle.parallel=true PROP_TARGET_SDK_VERSION=22 -PROP_APP_ABI=armeabi-v7a +PROP_APP_ABI=armeabi:armeabi-v7a:arm64-v8a:x86 diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties index 5695367ecb..baa0e0f5c6 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip