Skip to content

Commit

Permalink
Avoid potential Gradle issue of mutating immutable property (#3121)
Browse files Browse the repository at this point in the history
* Avoid mutating immutable property

* Update jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java

Co-authored-by: Mridula <[email protected]>

* Update jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java

Co-authored-by: Mridula <[email protected]>

Co-authored-by: Mridula <[email protected]>
  • Loading branch information
chanseokoh and mpeddada1 committed Mar 8, 2021
1 parent e4ca3d5 commit 5421070
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,14 @@ public JibExtension(Project project) {
pluginExtensions = objectFactory.listProperty(ExtensionParameters.class).empty();
extensionParametersSpec =
objectFactory.newInstance(ExtensionParametersSpec.class, pluginExtensions);
allowInsecureRegistries = objectFactory.property(Boolean.class);
containerizingMode = objectFactory.property(String.class);
allowInsecureRegistries =
objectFactory.property(Boolean.class).convention(DEFAULT_ALLOW_INSECURE_REGISTIRIES);
containerizingMode =
objectFactory.property(String.class).convention(DEFAULT_CONTAINERIZING_MODE);
configurationName =
objectFactory
.property(String.class)
.convention(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);

// Sets defaults.
allowInsecureRegistries.set(DEFAULT_ALLOW_INSECURE_REGISTIRIES);
containerizingMode.set(DEFAULT_CONTAINERIZING_MODE);
}

public void from(Action<? super BaseImageParameters> action) {
Expand Down Expand Up @@ -237,7 +235,7 @@ public String getContainerizingMode() {
@Optional
public Property<String> getConfigurationName() {
String property = System.getProperty(PropertyNames.CONFIGURATION_NAME);
if (property != null) {
if (property != null && !property.equals(configurationName.get())) {
configurationName.set(property);
}
return configurationName;
Expand Down
Loading

0 comments on commit 5421070

Please sign in to comment.