Skip to content

Commit

Permalink
Merge pull request #200 from gradle/bamboo/encourage-quoted-system-pr…
Browse files Browse the repository at this point in the history
…operty-keys

Encourage the use of quotes around system-properties keys
  • Loading branch information
bamboo authored Apr 1, 2020
2 parents 5976852 + d1e7681 commit 96093df
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Here is an example:
tasks = ["build"]
gradle-args = ["--parallel"]
system-properties {
key = "value"
"key" = "value"
}
cleanup-tasks = ["clean"]
run-using = tooling-api // value can be "cli" or "tooling-api"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/gradle/profiler/ConfigUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ConfigUtil {
public static Map<String, String> map(Config config, String key, Map<String, String> defaultValues) {
if (config.hasPath(key)) {
Map<String, String> props = new LinkedHashMap<>();
for (Map.Entry<String, ConfigValue> entry : config.getConfig(key).entrySet()) {
for (Map.Entry<String, ConfigValue> entry : config.getObject(key).entrySet()) {
props.put(entry.getKey(), entry.getValue().unwrapped().toString());
}
return props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,14 +777,14 @@ a {
versions = "$minimalSupportedGradleVersion"
tasks = assemble
system-properties {
org.gradle.test = "value-1"
"org.gradle.test" = "value-1"
}
}
b {
versions = "$minimalSupportedGradleVersion"
tasks = assemble
system-properties {
org.gradle.test = "value-2"
"org.gradle.test" = "value-2"
}
}
"""
Expand Down
20 changes: 20 additions & 0 deletions src/test/groovy/org/gradle/profiler/ScenarioLoaderTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,26 @@ class ScenarioLoaderTest extends Specification {
toolingApi.invoker == GradleBuildInvoker.ToolingApi
}

def "scenario can define system properties"() {
def settings = settings()
scenarioFile << """
instantExecution {
system-properties {
"org.gradle.unsafe.instant-execution" = true
"org.gradle.unsafe.instant-execution.fail-on-problems" = false
}
}
"""
def scenarios = loadScenarios(scenarioFile, settings, Mock(GradleBuildConfigurationReader))

expect:
def instantExecution = scenarios[0] as GradleScenarioDefinition
instantExecution.systemProperties == [
"org.gradle.unsafe.instant-execution": "true",
"org.gradle.unsafe.instant-execution.fail-on-problems": "false"
]
}

def "scenario can define what state the daemon should be in for each measured build"() {
def settings = settings(GradleBuildInvoker.ToolingApi)
scenarioFile << """
Expand Down

0 comments on commit 96093df

Please sign in to comment.