1+ import org.gradle.api.publish.maven.internal.publication.DefaultMavenPom
2+
13plugins {
24 embeddedKotlin(" jvm" )
3- id(" org.gradlex.java-ecosystem-capabilities-base" )
5+ id(" org.gradlex.java-ecosystem-capabilities" ) version " 1.5.2.00"
6+ id(" dev.jacomet.logging-capabilities" ) version " 0.11.1"
7+ id(" io.fuchs.gradle.classpath-collision-detector" ) version " 0.3"
8+ `maven- publish`
49}
510
611repositories {
@@ -9,11 +14,13 @@ repositories {
914 maven(" https://maven.scijava.org/content/groups/public" )
1015}
1116
12- // it will appear as this was the original downloaded metadata of the dependency
13- // @CacheableRule is more verbose but more efficient, because the rule will be applied before the dependency get cached,
17+ // @CacheableRule is more verbose but more efficient, because the rule will be applied before the dependency get cached
18+ // in Gradle, it will appear as this was the original downloaded metadata of the given dependency
19+
1420inline fun <reified T : ComponentMetadataRule > ComponentMetadataHandler.withModules (vararg modules : String ) {
1521 for (module in modules) withModule<T >(module)
1622}
23+
1724abstract class Rule : ComponentMetadataRule {
1825 fun ComponentMetadataContext.remove (vararg modules : String ) = details.allVariants { withDependencies { removeIf { it.module.toString() in modules } } }
1926}
@@ -62,12 +69,51 @@ dependencies {
6269 withModules<NoJogampNatives >(" org.jzy3d:jzy3d-native-jogl-awt" , " org.jzy3d:jzy3d-native-jogl-core" )
6370
6471 @CacheableRule open class Weka : Rule () {
65- override fun execute ( context : ComponentMetadataContext ) = context.remove (
72+ val exclusions = listOf (
6673 " com.github.fommil.netlib:all" , " com.googlecode.netlib-java:netlib-java" , " net.sourceforge.f2j:arpack_combined_all" ,
6774 " nz.ac.waikato.cms.weka.thirdparty:java-cup-11b" , " nz.ac.waikato.cms.weka.thirdparty:java-cup-11b-runtime" )
75+
76+ override fun execute (context : ComponentMetadataContext ) {
77+ context.details.allVariants {
78+ withDependencies {
79+ removeIf { it.module.toString() in exclusions }
80+ add(" runtimeClasspath" , " com.github.vbmacher:java-cup-runtime" )
81+ }
82+ }
83+ }
6884 }
6985 withModule<Weka >(" nz.ac.waikato.cms.weka:weka-dev" )
7086 }
71- implementation(libs.org.morphonets.snt)
72- implementation(" org.jzy3d:jzy3d-emul-gl-awt:2.1.0" )
87+ // implementation("org.jzy3d:jzy3d-emul-gl:+")
88+ // implementation("org.jzy3d:jzy3d-emul-gl-awt:+")
89+
90+ implementation(" junit:junit:4.4" )
91+ // implementation("org.hamcrest:hamcrest-core:1.2")
92+ }
93+
94+ tasks.detectCollisions {
95+ // detectCollisions() // to detect on configuration time
96+ // configurations.from(project.configurations.testRuntimeClasspath)
97+ }
98+
99+ publishing {
100+ publications.register<MavenPublication >(" maven" ) {
101+ pom {
102+ this as DefaultMavenPom
103+ println (name.orNull)
104+ println (licenses)
105+ this .licenses {
106+ license {
107+ this .name = " Nich"
108+ url = " URL"
109+ comments = " com"
110+ distribution = " dis"
111+ }
112+ }
113+ println (licenses[0 ].name.orNull)
114+ println (licenses[0 ].url.orNull)
115+ println (licenses[0 ].comments.orNull)
116+ println (licenses[0 ].distribution.orNull)
117+ }
118+ }
73119}
0 commit comments