Skip to content

Commit

Permalink
Fix the environment setter not being initialized to Map of the correc…
Browse files Browse the repository at this point in the history
…t type (#99)
  • Loading branch information
Azurelol committed Jun 18, 2021
1 parent e8c6687 commit 908ab9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ abstract class UnityTaskIntegrationSpec<T extends UnityTask> extends UnityIntegr
method = (useSetter) ? "setLogCategory" : "logCategory.set"
}

def "set environment for task exec"() {
@Unroll
def "set environment variable #rawValue for task exec"() {
given:
appendToSubjectTask("$method($value)")
addProviderQueryTask("custom", "${subjectUnderTestName}.environment", ".get()")
Expand All @@ -236,8 +237,14 @@ abstract class UnityTaskIntegrationSpec<T extends UnityTask> extends UnityIntegr

where:
property | useSetter | rawValue
"environment" | true | ["A": "7"]
"environment" | false | ["A": "7"]
"environment" | true | ["A": "foo"]
"environment" | false | ["A": "bar"]
"environment" | true | ["A": 7]
"environment" | false | ["A": 7]
"environment" | true | ["A": file("foo.bar")]
"environment" | false | ["A": file("foo.bar")]
"environment" | true | ["A": true]
"environment" | false | ["A": false]

method = (useSetter) ? "set${property.capitalize()}" : "${property}.set"
value = wrapValueBasedOnType(rawValue, Map)
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/wooga/gradle/unity/UnityTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abstract class UnityTask extends DefaultTask
// and also an additional one for our custom use
wooga_gradle_unity_traits_ArgumentsSpec__arguments = project.provider({ getUnityCommandLineOptions() })
wooga_gradle_unity_traits_ArgumentsSpec__additionalArguments = project.objects.listProperty(String)
wooga_gradle_unity_traits_ArgumentsSpec__environment = project.objects.mapProperty(String, String)
wooga_gradle_unity_traits_ArgumentsSpec__environment = project.objects.mapProperty(String, Object)
}

@TaskAction
Expand Down

0 comments on commit 908ab9b

Please sign in to comment.