我使用this超棒的Gradle插件来编译我的iOS项目。
根据文档,我的build.gradle看起来像这样:
buildscript {
repositories {
maven {
url('http://openbakery.org/repository/')
}
mavenCentral()
}
dependencies {
classpath group: 'org.openbakery', name: 'xcodePlugin', version: '0.9.+'
}
}
apply plugin: 'xcode'
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
xcodebuild {
workspace = 'WORKSPACE'
sdk = 'iphoneos'
target = 'TARGET'
signing {
mobileProvisionURI = 'URI'
certificateURI = 'URI'
certificatePassword = 'PASSWORD'
}
scheme = 'SCHEME'
configuration = 'CONFIGURATION'
}
如何管理xcodebuild任务的多个配置? 我想要像
这样的东西...
xcodebuild-staging {
workspace = 'STAGING_WORKSPACE'
sdk = 'iphoneos'
target = 'STAGING_TARGET'
signing {
mobileProvisionURI = 'URI'
certificateURI = 'URI'
certificatePassword = 'STAGING_PASSWORD'
}
scheme = 'STAGING_SCHEME'
configuration = 'STAGING_CONFIGURATION'
}
xcodebuild-production {
workspace = 'PRODUCTION_WORKSPACE'
sdk = 'iphoneos'
target = 'PRODUCTION_TARGET'
signing {
mobileProvisionURI = 'PRODUCTION_URI'
certificateURI = 'PRODUCTION_URI'
certificatePassword = 'PRODUCTION_PASSWORD'
}
scheme = 'PRODUCTION_SCHEME'
configuration = 'PRODUCTION_CONFIGURATION'
}
...
我尝试了多种方法:创建一个调用xcodebuild.execute()或扩展xcodebuild的新任务。他们都没有像我想的那样工作。 我结束了不同的build.gradle文件......
你知道怎么做吗?
答案 0 :(得分:0)
在对源代码进行快速调查之后,看起来,你需要的东西是不可能的(而且看起来有点奇怪 - 这样的插件应该允许用户构建多个方案)。我建议你联系作者。
答案 1 :(得分:0)
有可能!您是否尝试过将任务类型添加为属性?像...
task xcodebuild-staging (type: org.openbakery.XcodeBuildTask) {
workspace = 'STAGING_WORKSPACE'
sdk = 'iphoneos'
target = 'STAGING_TARGET'
signing {
mobileProvisionURI = 'URI'
certificateURI = 'URI'
certificatePassword = 'STAGING_PASSWORD'
}
scheme = 'STAGING_SCHEME'
configuration = 'STAGING_CONFIGURATION'
}
task xcodebuild-production (type: org.openbakery.XcodeBuildTask){
workspace = 'PRODUCTION_WORKSPACE'
sdk = 'iphoneos'
target = 'PRODUCTION_TARGET'
signing {
mobileProvisionURI = 'PRODUCTION_URI'
certificateURI = 'PRODUCTION_URI'
certificatePassword = 'PRODUCTION_PASSWORD'
}
scheme = 'PRODUCTION_SCHEME'
configuration = 'PRODUCTION_CONFIGURATION'
}
这取决于插件的编写方式,但是只要插件提供的配置不多,您就可以覆盖此类任务。我发现插件也可以扩展https://docs.gradle.org/current/userguide/custom_plugins.html#custom_plugins 但这更复杂。