Last active
August 29, 2015 14:04
-
-
Save mikesorae/e2f30e8341183d72d74e to your computer and use it in GitHub Desktop.
gradle build script for xcode project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------- | |
// load default config file | |
//------------------------------- | |
def default_env_conf_url = file("default.gradle").toURL() | |
def config = new ConfigSlurper().parse(default_env_conf_url) | |
// load environment config file | |
if (hasProperty('env')) { | |
def env_config_url = file("${env}.gradle").toURL() | |
config = config.merge(new ConfigSlurper().parse(env_config_url)) | |
} | |
//------------------------------- | |
// default settings of gradle | |
//------------------------------- | |
buildscript { | |
repositories { | |
maven { | |
url('http://openbakery.org/repository/') | |
} | |
mavenCentral() | |
} | |
dependencies { | |
classpath group: 'org.openbakery', name: 'xcodePlugin', version: '0.10.+' | |
} | |
} | |
apply plugin: 'xcode' | |
//------------------------------- | |
// settings of xcode plugin | |
//------------------------------- | |
xcodebuild { | |
sdk = config.app.sdk | |
scheme = config.app.scheme | |
bundleNameSuffix = config.app.bundleNameSuffix | |
configuration = config.app.configuration | |
signing { | |
certificateURI = config.certificate.certificateURI | |
certificatePassword = config.certificate.certificatePassword | |
mobileProvisionURI = config.certificate.mobileProvisionURI | |
identity = config.certificate.identity | |
} | |
infoPlist = config.plist.infoPlist | |
} | |
infoplist { | |
bundleDisplayName = config.plist.bundleDisplayName | |
bundleDisplayNameSuffix = config.plist.bundleDisplayNameSuffix | |
bundleIdentifier = config.plist.bundleIdentifier | |
bundleIdentifierSuffix = config.plist.bundleIdentifierSuffix | |
} | |
//------------------------------- | |
// custom tasks | |
//------------------------------- | |
task adhoc(dependsOn: ["clean", "infoplistModify", "package"]) << { | |
description = 'creating ipa file' | |
} | |
// adhoc.dependsOn "package" | |
task release(dependsOn: ["clean", "infoplistModify", "package"]) << { | |
description = 'creating xcodearchive' | |
} | |
gradle.taskGraph.whenReady { taskGraph -> | |
def revisionHash = ["sh", "-c", "cd ${project.rootDir} ; git rev-parse --short HEAD"].execute().in.text.trim() | |
if (taskGraph.hasTask(adhoc)) { | |
println "CONFIGURE Adhoc" | |
xcodebuild { | |
// additionalParameters = ["PRODUCT_NAME=${config.plist.bundleDisplayName}_${revisionHash}"] | |
} | |
infoplist { | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app { | |
sdk = "iphoneos" | |
scheme = 'GradleTest' | |
bundleNameSuffix = "-debug" | |
configuration = 'Debug' | |
} | |
plist { | |
infoPlist = 'GradleTest/GradleTest-Info.plist' | |
bundleIdentifier = 'me.247jp.gradle-test' | |
bundleDisplayName = 'Gradle' | |
bundleIdentifierSuffix = '.debug' | |
bundleDisplayNameSuffix = "-db" | |
} | |
certificate { | |
certificateURI = 'http://localhost/release.p12' | |
certificatePassword = 'xxxxx' | |
mobileProvisionURI = 'http://localhost/adhoc.mobileprovision' | |
identity = 'iPhone Distribution: xxxxxx' | |
} | |
fixed that xcode plugin does not use specified mobileProvisionURI
adapt to xcode-plugin 0.10+.
now it will fail if bundleDisplaySuffix in default.gradle was set.
pls make it empty for now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
gradle adhoc
gradle adhoc -Penv=${env_name}