-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use Gradle Property and Provider to enable lazy evaluation for …
…jib.extraDirectories parameters (#3737) Enable lazy evaluation in Gradle for various jib.extraDirectories parameters. Lazy evaluation (via a Provider) for configuring the jib.extraDirectories.paths parameter directly is also enabled.
- Loading branch information
Showing
10 changed files
with
216 additions
and
29 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
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
47 changes: 47 additions & 0 deletions
47
jib-gradle-plugin/src/test/resources/gradle/projects/lazy-evaluation/build-extra-dirs.gradle
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,47 @@ | ||
plugins { | ||
id 'java' | ||
id 'com.google.cloud.tools.jib' | ||
} | ||
|
||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'com.google.guava:guava:23.6-jre' | ||
} | ||
|
||
project.ext.value = 'original' | ||
|
||
project.afterEvaluate { | ||
project.ext.value = 'updated' | ||
project.ext.getCustomIncludes = { -> return ['include.txt'] } | ||
project.ext.getCustomExcludes = { -> return ['exclude.txt'] } | ||
} | ||
|
||
jib { | ||
extraDirectories { | ||
paths { | ||
path { | ||
from = project.provider { 'src/main/' + project.ext.value + '-custom-extra-dir' } | ||
into = project.provider { '/' + project.ext.value + '-custom-into-dir' } | ||
includes = project.provider { -> project.ext.getCustomIncludes() } | ||
excludes = project.provider { -> project.ext.getCustomExcludes() } | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.register('check-extra-directories') { | ||
List<Object> from = project.extensions.getByName('jib')['extraDirectories']['paths'].collect{ path -> path['from']} | ||
List<Object> into = project.extensions.getByName('jib')['extraDirectories']['paths'].collect{ path -> path['into']} | ||
List<Object> includes = project.extensions.getByName('jib')['extraDirectories']['paths'].collect{ path -> path['includes'].get()} | ||
List<Object> excludes = project.extensions.getByName('jib')['extraDirectories']['paths'].collect{ path -> path['excludes'].get()} | ||
println('extraDirectories (from): ' + from) | ||
println('extraDirectories (into): ' + into) | ||
println('extraDirectories (includes): ' + includes) | ||
println('extraDirectories (excludes): ' + excludes) | ||
} |
Oops, something went wrong.