8000 shelve · scijava/pom-scijava@9cc0b9f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9cc0b9f

Browse files
elect86ctrueden
authored andcommitted
shelve
1 parent 34b4996 commit 9cc0b9f

File tree

8 files changed

+110
-30
lines changed

8 files changed

+110
-30
lines changed

gradle/catalog/build.gradle.kts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "org.scijava"
11-
version = "0.1"
11+
version = "0.11"
1212

1313
catalog.versionCatalog {
1414

@@ -36,39 +36,50 @@ catalog.versionCatalog {
3636
.joinToString("") { if (it.isEmpty()) "" else it[0].uppercase() + it.substring(1).lowercase() }
3737
.replaceFirstChar { it.lowercase() }
3838

39-
fun getAlias(group: String = "$g".substringAfterLast('.')) =
40-
"$group." + when {
39+
fun getAlias(group: String = "$g".substringAfterLast('.')): String {
40+
val alias = "$group." + when {
4141
camel.startsWith(group) -> camel.substringAfter(group).replaceFirstChar { it.lowercase() }.ifEmpty { group }
4242
else -> camel
43-
}.also { bundles.getOrPut(group, ::ArrayList) += it }
43+
}
44+
bundles.getOrPut(group, ::ArrayList) += alias
45+
return alias
46+
}
4447

4548
val alias = when ("$g") {
4649
in listOf("org.scijava", "net.imagej", "net.imglib2", "sc.fiji", "org.janelia.saalfeldlab") -> getAlias()
4750
"io.scif" -> getAlias("scifio")
4851
else -> "$g.$camel"
4952
}
5053

51-
// println("$alias($gav)")
54+
// println("$alias($gav)")
5255
library(alias, gav)
5356
}
57+
5458
for ((alias, aliases) in bundles)
5559
bundle(alias, aliases)
5660

57-
// jakarta()
61+
// jakarta()
62+
63+
// version("groovy", "3.0.5")
64+
// library("groovy-core", "org.codehaus.groovy", "groovy").versionRef("groovy")
5865
}
5966

6067
//fun VersionCatalogBuilder.jakarta() {
6168
// val bom = URL.of("https://repo1.maven.org/maven2/jakarta/platform/jakarta.jakartaee-bom/10.0.0/jakarta.jakartaee-bom-10.0.0.pom")
6269
// library("jakarta.json", "jakarta.json:jakarta.json-api:")
6370
//}
6471

65-
publishing.publications {
66-
repositories.maven {
67-
name = "sciJava"
68-
credentials(PasswordCredentials::class)
69-
url = uri("https://maven.scijava.org/content/repositories/releases")
70-
}
71-
create<MavenPublication>("sciJavaCatalog") {
72-
from(components["versionCatalog"])
72+
publishing {
73+
publications {
74+
repositories {
75+
maven {
76+
name = "sciJava"
77+
credentials(PasswordCredentials::class)
78+
url = uri("https://maven.scijava.org/content/repositories/releases")
79+
}
80+
}
81+
create<MavenPublication>("sciJavaCatalog") {
82+
from(components["versionCatalog"])
83+
}
7384
}
7485
}

gradle/enforcer/settings.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* The settings file is used to specify which projects to include in your build.
5+
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation.
6+
* This project uses @Incubating APIs which are subject to change.
7+
*/
8+
9+
rootProject.name = "gradle-enforcer"

gradle/platform/build.gradle.kts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = "org.scijava"
14-
version = "0.1" //(effXml / "version").toString()
14+
version = "0.13" //(effXml / "version").toString()
1515

1616
operator fun GPathResult.div(child: String) = children().find { (it!! as NodeChild).name() == child } as GPathResult
1717

@@ -39,13 +39,14 @@ dependencies {
3939
// println("$g:$a:$v")
4040
}
4141
}
42-
// versionCatalogs.forEach { versionCatalog ->
43-
// println("catalog ${versionCatalog.name}")
44-
// versionCatalog.libraryAliases.forEach {
45-
// println(versionCatalog.findLibrary(it).get().get())
46-
// }
47-
// }
42+
// versionCatalogs.forEach { versionCatalog ->
43+
// println("catalog ${versionCatalog.name}")
44+
// versionCatalog.libraryAliases.forEach {
45+
// println(versionCatalog.findLibrary(it).get().get())
46+
// }
47+
// }
4848

49+
// println(libs.groovy.core.get())
4950
api(platform("com.fasterxml.jackson:jackson-bom:" + libs.com.fasterxml.jackson.core.jacksonCore.get().version))
5051
api(platform("jakarta.platform:jakarta.jakartaee-bom:10.0.0"))
5152
// api(platform("com.google.api-client:google-api-client-bom:" + libs.com.google.api.client.googleApiClient.get().version))

gradle/platform/buildSrc/src/main/kotlin/publish.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ publishing {
1313
}
1414
create<MavenPublication>("sciJavaPlatform") {
1515
from(components["javaPlatform"])
16+
groupId = "org.scijava"
17+
println(groupId)
18+
artifactId = "gradle-platform"
19+
println(artifactId)
20+
version = "0.13"
21+
println(version)
1622
/*pom.withXml {
1723
val nodes = Stack<Node>()
1824

gradle/platform/settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dependencyResolutionManagement {
1414
// repositories { .. }
1515
versionCatalogs {
1616
create("libs").from("org.scijava:gradle-catalog")
17+
// maybeCreate("libs").version("groovy", "3.0.9")
18+
// maybeCreate("libs").library("groovy-core", "org.codehaus.groovy:groovy:2.4.15")
1719

1820
// fails with "Could not resolve all artifacts for configuration 'incomingCatalogForLibs0'."
1921
// create("libs").from(files("../catalog/build/version-catalog/libs.versions.toml"))

gradle/playground/build.gradle.kts

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import org.gradle.api.publish.maven.internal.publication.DefaultMavenPom
2+
13
plugins {
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

611
repositories {
@@ -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+
1420
inline fun <reified T : ComponentMetadataRule> ComponentMetadataHandler.withModules(vararg modules: String) {
1521
for (module in modules) withModule<T>(module)
1622
}
23+
1724
abstract 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
}

gradle/playground/settings.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99

1010
rootProject.name = "gradle-playground"
1111

12+
pluginManagement.repositories {
13+
gradlePluginPortal()
14+
maven("https://maven.scijava.org/content/repositories/releases")
15+
}
16+
1217
dependencyResolutionManagement {
1318

1419
// repositories { .. }
1520
versionCatalogs {
1621
create("libs").from("org.scijava:gradle-catalog")
1722

1823
// fails with "Could not resolve all artifacts for configuration 'incomingCatalogForLibs0'."
19-
// create("libs").from(files("../catalog/build/version-catalog/libs.versions.toml"))
24+
// create("libs").from(files("../catalog/build/version-catalog/libs.versions.toml"))
2025
}
2126

2227
includeBuild("../catalog")
23-
// java-ecosystem-capabilities
24-
includeBuild("../../../java-ecosystem-capabilities")
28+
// includeBuild("../../../java-ecosystem-capabilities")
2529
}
2630

2731
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

gradle/settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ rootProject.name = "gradle"
66
includeBuild("catalog")
77
includeBuild("platform")
88
includeBuild("playground")
9+
includeBuild("enforcer")
910

1011
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

0 commit comments

Comments
 (0)
0