File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/main/java/org/gradlex/javamodule/moduleinfo Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 6464 */
6565public abstract class ExtraJavaModuleInfoPlugin implements Plugin <Project > {
6666
67+ private static final GradleVersion MINIMUM_SUPPORTED_VERSION = GradleVersion .version ("6.8" );
68+ private static final boolean MIN_GRADLE_9_0 = GradleVersion .current ().compareTo (GradleVersion .version ("9.0.0" )) >= 0 ;
69+
6770 @ Override
6871 public void apply (Project project ) {
69- if (GradleVersion .current ().compareTo (GradleVersion . version ( "6.8" ) ) < 0 ) {
70- throw new RuntimeException ("This plugin requires Gradle 6.8 +" );
72+ if (GradleVersion .current ().compareTo (MINIMUM_SUPPORTED_VERSION ) < 0 ) {
73+ throw new RuntimeException ("This plugin requires Gradle " + MINIMUM_SUPPORTED_VERSION + " +" );
7174 }
7275
7376 // register the plugin extension as 'extraJavaModuleInfo {}' configuration block
@@ -134,7 +137,7 @@ private void configureModuleDescriptorTasks(Project project) {
134137
135138 private void configureTransform (Project project , ExtraJavaModuleInfoPluginExtension extension ) {
136139 Configuration javaModulesMergeJars = project .getConfigurations ().create ("javaModulesMergeJars" , c -> {
137- c . setVisible ( false );
140+ setInvisible ( c );
138141 c .setCanBeConsumed (false );
139142 c .setCanBeResolved (true );
140143 c .getAttributes ().attribute (USAGE_ATTRIBUTE , project .getObjects ().named (Usage .class , JAVA_RUNTIME ));
@@ -297,4 +300,11 @@ public List<RegularFile> transform(Collection<ResolvedArtifactResult> artifacts)
297300 return artifacts .stream ().map (a -> projectDirectory .file (a .getFile ().getAbsolutePath ())).collect (Collectors .toList ());
298301 }
299302 }
303+
304+ @ SuppressWarnings ("deprecation" )
305+ private void setInvisible (Configuration c ) {
306+ if (!MIN_GRADLE_9_0 ) {
307+ c .setVisible (false );
308+ }
309+ }
300310}
You can’t perform that action at this time.
0 commit comments