我们可以使用Gulp创建cordova项目的.ipa和.apk吗?
有没有办法使用Gulp为Cordova项目创建ipa和apk?我们可以使用Gulp创建cordova项目的.ipa和.apk吗?,cordova,gulp,Cordova,Gulp,有没有办法使用Gulp为Cordova项目创建ipa和apk? 我只想定期运行任务,这样两个版本都应该保存在给定的位置。是的,您可以。看看这个示例脚本(适用于android target): 这是针对多平台构建的(带有): 或者,如果您愿意,也可以使用类似的方法:是的,您可以。看看这个示例脚本(适用于android target): 这是针对多平台构建的(带有): 如果您愿意,也可以使用类似的方法:看看这个插件。 它有所有任务的列表,您还可以指定FTP、配置文件等 你甚至可以搭建基本结构 基本
我只想定期运行任务,这样两个版本都应该保存在给定的位置。是的,您可以。看看这个示例脚本(适用于android target): 这是针对多平台构建的(带有):
或者,如果您愿意,也可以使用类似的方法:是的,您可以。看看这个示例脚本(适用于android target): 这是针对多平台构建的(带有):
如果您愿意,也可以使用类似的方法:看看这个插件。 它有所有任务的列表,您还可以指定FTP、配置文件等 你甚至可以搭建基本结构 基本构建任务
看看这个插件。 它有所有任务的列表,您还可以指定FTP、配置文件等 你甚至可以搭建基本结构 基本构建任务
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);
});
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)));
});
});
});