forked from abayer/gradle-hpi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from rpalcolea/remove-project-convention-usage
Upgrade to Gradle 7.1 and remove usage of Gradle deprecated APIs
- Loading branch information
Showing
16 changed files
with
309 additions
and
39 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
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionSha256Sum=3e240228538de9f18772a574e99a0ba959e83d6ef351014381acd9631781389a | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip | ||
distributionSha256Sum=2debee19271e1b82c6e41137d78e44e6e841035230a1a169ca47fd3fb09ed87b | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
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
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
32 changes: 32 additions & 0 deletions
32
src/main/groovy/org/jenkinsci/gradle/plugins/jpi/internal/ConfigureUtil.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,32 @@ | ||
package org.jenkinsci.gradle.plugins.jpi.internal | ||
|
||
import org.codehaus.groovy.runtime.GeneratedClosure | ||
import org.gradle.internal.metaobject.ConfigureDelegate | ||
import org.gradle.util.Configurable | ||
import org.gradle.util.internal.ClosureBackedAction | ||
import javax.annotation.Nullable | ||
|
||
class ConfigureUtil { | ||
static <T> T configure(@Nullable Closure configureClosure, T target) { | ||
if (configureClosure == null) { | ||
target | ||
} else { | ||
if (target instanceof Configurable) { | ||
((Configurable)target).configure(configureClosure) | ||
} else { | ||
configureTarget(configureClosure, target, new ConfigureDelegate(configureClosure, target)) | ||
} | ||
|
||
target | ||
} | ||
} | ||
|
||
private static <T> void configureTarget(Closure configureClosure, T target, ConfigureDelegate closureDelegate) { | ||
if (configureClosure instanceof GeneratedClosure) { | ||
Closure withNewOwner = configureClosure.rehydrate(target, closureDelegate, configureClosure.thisObject) | ||
(new ClosureBackedAction(withNewOwner, 2, false)).execute(target) | ||
} else { | ||
(new ClosureBackedAction(configureClosure, 1, false)).execute(target) | ||
} | ||
} | ||
} |