1+ import org.gradle.api.attributes.LibraryElements.CLASSES_AND_RESOURCES
12import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23import org.sdkotlin.buildlogic.attributes.CustomResources.CUSTOM_RESOURCES
34import org.sdkotlin.buildlogic.attributes.LibraryElementsAttributes.applyLibraryElementsAttributes
@@ -58,6 +59,10 @@ tasks {
5859
5960 val fileCollection: Provider <FileCollection > = provider {
6061 configurations.runtimeClasspath.get().incoming.artifactView {
62+
63+ @Suppress(" UnstableApiUsage" )
64+ withVariantReselection()
65+
6166 attributes {
6267 applyLibraryElementsAttributes(objects, CUSTOM_RESOURCES )
6368 }
@@ -66,9 +71,40 @@ tasks {
6671
6772 doLast {
6873
69- val customResourcesAsPath = fileCollection.get().asPath
74+ val classpathAsPath = fileCollection.get().asPath
75+
76+ val wrappedClasspath = classpathAsPath.replace(" :" , " \n " )
77+
78+ println (" wrappedClasspath: \n $wrappedClasspath " )
79+ }
80+ }
81+
82+ register(" printRuntimeClasspathWithoutCustomResources" ) {
83+
84+ group = " custom-resources"
85+ description =
86+ " Prints the runtime classpath without the custom resources"
87+
88+ val fileCollection: Provider <FileCollection > = provider {
89+ configurations.runtimeClasspath.get().incoming.artifactView {
90+
91+ @Suppress(" UnstableApiUsage" )
92+ withVariantReselection()
93+
94+ attributes {
95+ applyLibraryElementsAttributes(objects,
96+ CLASSES_AND_RESOURCES )
97+ }
98+ }.files
99+ }
100+
101+ doLast {
102+
103+ val classpathAsPath = fileCollection.get().asPath
104+
105+ val wrappedClasspath = classpathAsPath.replace(" :" , " \n " )
70106
71- println (" customResourcesAsPath: $customResourcesAsPath " )
107+ println (" wrappedClasspath: \n $wrappedClasspath " )
72108 }
73109 }
74110
@@ -83,9 +119,11 @@ tasks {
83119
84120 doLast {
85121
86- val runtimeClasspathAsPath = fileCollection.get().asPath
122+ val classpathAsPath = fileCollection.get().asPath
123+
124+ val wrappedClasspath = classpathAsPath.replace(" :" , " \n " )
87125
88- println (" runtimeClasspathAsPath: $runtimeClasspathAsPath " )
126+ println (" wrappedClasspath: \n $wrappedClasspath " )
89127 }
90128 }
91129}
0 commit comments