有沒有什麼方法可以爲Cordova項目創建一個使用Gulp的ipa和apk? 我只是想定期運行任務,以便這兩個版本應保存在給定的位置。我們可以使用Gulp創建cordova項目的.ipa和.apk嗎?
1
A
回答
0
是的,你可以。就這個示例腳本看看(Android的目標):
var gulp = require("gulp"),
cordova = require("cordova-lib").cordova;
gulp.task("default", function (callback) {
cordova.build({
"platforms": ["android"],
"options": {
argv: ["--release","--gradleArg=--no-daemon"]
}
}, callback);
});
這是多平臺版本(與taco team build):
var gulp = require("gulp"),
fs = require("fs"),
es = require('event-stream'),
cordovaBuild = require("taco-team-build");
// Setup platforms to build that are supported on current hardware
var winPlatforms = ["android", "windows"],
linuxPlatforms = ["android"],
osxPlatforms = ["ios"],
platformsToBuild = process.platform === "darwin" ? osxPlatforms :
(process.platform === "linux" ? linuxPlatforms : winPlatforms),
// Build config to use for build - Use Pascal case to match paths set by VS
buildConfig = "Release",
// Arguments for build by platform. Warning: Omit the
// extra "--" when referencing platform specific options
// (Ex:"-- --gradleArg" is "--gradleArg").
buildArgs = {
android: ["--" + buildConfig.toLocaleLowerCase(),"--device",
"--gradleArg=--no-daemon"],
ios: ["--" + buildConfig.toLocaleLowerCase(), "--device"],
windows: ["--" + buildConfig.toLocaleLowerCase(), "--device"]
},
// Paths used by build
paths = {
apk:["./platforms/android/ant-build/*.apk",
"./platforms/android/bin/*.apk",
"./platforms/android/build/outputs/apk/*.apk"],
binApk: "./bin/Android/" + buildConfig,
ipa: ["./platforms/ios/build/device/*.ipa",
"./platforms/ios/build/device/*.app.dSYM"],
binIpa: "./bin/iOS/" + buildConfig,
appx: "./platforms/windows/AppPackages/**/*",
binAppx: "./bin/Windows/" + buildConfig
};
// Set the default to the build task
gulp.task("default", ["build"]);
// Executes taks specified in winPlatforms, linuxPlatforms, or osxPlatforms based on
// the hardware Gulp is running on which are then placed in platformsToBuild
gulp.task("build", function() {
return cordovaBuild.buildProject(platformsToBuild, buildArgs)
.then(function() {
// ** NOTE: Package not required in recent versions of Cordova
return cordovaBuild.packageProject(platformsToBuild)
.then(function() {
return es.concat(
gulp.src(paths.apk).pipe(gulp.dest(paths.binApk)),
gulp.src(paths.ipa).pipe(gulp.dest(paths.binIpa)),
gulp.src(paths.appx).pipe(gulp.dest(paths.binAppx)));
});
});
});
或者你可以用這樣的事情,如果你喜歡:gulp-cordova-build-android
0
相關問題
- 1. 使用xcodebuild命令從Cordova項目創建IPA
- 2. 我可以在cordova項目中使用原生插件嗎?
- 3. 可以用cmake創建WinRT項目嗎?
- 4. 我們可以降級InstallShield項目嗎?
- 5. 我可以使用更新的API來構建我的apk嗎?
- 6. 我們可以在我們的項目中部署IWSHRUNTIMELIBRARY嗎?
- 7. 我可以從.ipa將庫提取到iOS項目中嗎?
- 8. 我們可以在apk文件中捆綁一個目錄嗎?
- 9. 我們可以直接使用MonkeyTalk IDE和沒有項目源的APK文件嗎?
- 10. 我們可以使用JasperReports和AngularJS嗎?
- 11. 我們可以使用AJAX和XHTML嗎?
- 12. 我可以使用cordova角材嗎?
- 13. 我可以使用PCL和共享代碼來創建Xamarin.Forms項目嗎?
- 14. 我可以用gulp-watch使用gulp-imagemin嗎?
- 15. 我們可以在C#項目中使用COM對象嗎?
- 16. 我們可以使用Item Template添加多個項目嗎?
- 17. 我們可以將GIT用於Oracle Service Bus項目和BPEL項目嗎?
- 18. 我們可以在JAVAFX中使用創建和使用自定義EventHandler類嗎?
- 19. knockoutjs:我們可以使用參數創建dependentObservable函數嗎?
- 20. 我們可以使用Outlook插件創建並運行宏嗎?
- 21. 我們可以使用UIPickerView創建自定義單元嗎?
- 22. 我們可以使用reportlab創建交互式PDF表單嗎?
- 23. 我們可以使用API創建Amazon聯合身份池嗎?
- 24. 我們可以使用EditText創建超鏈接嗎?
- 25. 我們可以使用WATIN創建測試套件嗎?
- 26. 我們可以在C#中使用QT來創建GUI嗎?
- 27. 我們可以使用php創建一個單詞模板嗎?
- 28. 我們可以使用PHP創建增量計數器嗎?
- 29. 我們可以使用EXTJS創建報告嗎?
- 30. 我們可以在SBT項目中定義嵌套項目嗎?