-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve multiple provisioning profiles support (#162)
Description =========== This patch adds a new fastlane task type `SighRenewBatch` which allows to set a map of `bundleId` -> `profileName`. This allows to set the map pulled from the `exportOption.plist` into the `importProvisioningProfiles` task. I'm not 100% happy with the implementation but one could revisit this with another patch to rework the inner workings. At the moment the new task type simply extends `SighRenew` and adds a `profiles` property which gets looped over. The task action of `SighRenew` is called multiple times. This has the desired effect but can cause issues with input caching etc. I'm fine with this from a first version prespective Changes ======= * ![IMPROVE] multiple provisioning profiles support
- Loading branch information
Showing
13 changed files
with
271 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
71 changes: 71 additions & 0 deletions
71
src/integrationTest/groovy/wooga/gradle/fastlane/tasks/SighRenewBatchIntegrationSpec.groovy
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package wooga.gradle.fastlane.tasks | ||
|
||
import spock.lang.Requires | ||
import spock.lang.Unroll | ||
|
||
@Requires({ os.macOs }) | ||
class SighRenewBatchIntegrationSpec extends SighRenewIntegrationSpec { | ||
String testTaskName = "sighRenewBatch" | ||
Class taskType = SighRenewBatch | ||
|
||
String workingFastlaneTaskConfig = """ | ||
task("${testTaskName}", type: ${taskType.name}) { | ||
appIdentifier = 'test' | ||
teamId = "fakeTeamId" | ||
destinationDir = file('build') | ||
profiles = ["foo.bar.baz":"fooBar"] | ||
} | ||
""".stripIndent() | ||
|
||
def "imports multiple profiles"() { | ||
given: "set multiple profiles" | ||
buildFile << """ | ||
${testTaskName} { | ||
profiles = ${wrapValueBasedOnType(profiles, "Map<String,String>")} | ||
} | ||
""" | ||
|
||
when: | ||
def result = runTasksSuccessfully(testTaskName) | ||
|
||
then: | ||
profiles.each { bundleId, profileName -> | ||
result.standardOutput.contains("import provisioning profile '${profileName}' for bundleIdentifier '${bundleId}' to file '${profileName}.mobileprovision'") | ||
} | ||
|
||
where: | ||
profileNames = ["profile1", "profile2", "profile3"] | ||
bundleIds = ["net.test.app1", "net.test.app2", "net.test.app3"] | ||
profiles = [bundleIds, profileNames].transpose().collectEntries() | ||
} | ||
|
||
@Unroll | ||
def "imports configured profileName/appIdentifier when set"() { | ||
given: "set multiple profiles" | ||
buildFile << """ | ||
${testTaskName} { | ||
profiles = ${wrapValueBasedOnType(profiles, "Map<String,String>")} | ||
appIdentifier = ${appIdentifier ? wrapValueBasedOnType(appIdentifier, String) : null} | ||
provisioningName = ${provisioningName ? wrapValueBasedOnType(provisioningName, String) : null} | ||
} | ||
""" | ||
|
||
when: | ||
def result = runTasksSuccessfully(testTaskName) | ||
|
||
then: | ||
result.standardOutput.contains("import ${expectedProfiles.size()} profiles") | ||
profiles.each { bundleId, profileName -> | ||
result.standardOutput.contains("import provisioning profile '${profileName}' for bundleIdentifier '${bundleId}' to file '${profileName}.mobileprovision'") | ||
} | ||
|
||
where: | ||
provisioningName | appIdentifier | profiles || expectedProfiles | ||
null | null | ["foo.bar.baz": "FooBar"] || profiles | ||
"FooBar" | "foo.bar.baz" | ["foo.bar.baz": "FooBar"] || profiles | ||
"FooBar" | null | ["foo.bar.baz": "FooBar"] || profiles | ||
null | "foo.bar.baz" | ["foo.bar.baz": "FooBar"] || profiles | ||
"FooBar2" | "foo.bar.baz" | ["foo.bar.baz": "FooBar"] || ["foo.bar.baz": "FooBar", (appIdentifier): (provisioningName)] | ||
"BazBar" | "baz.foo.bar" | ["foo.bar.baz": "FooBar"] || ["foo.bar.baz": "FooBar", (appIdentifier): (provisioningName)] | ||
} | ||
} |
This file contains 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
Oops, something went wrong.