Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build updates #5313

Merged
merged 4 commits into from Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cnf/ext/junit.bnd
Expand Up @@ -17,7 +17,7 @@ hamcrest.version=2.2
mockito.version=4.6.0
bytebuddy.version=1.12.10
objenesis.version=3.2
osgi-test.version=1.1.0
osgi-test.version=1.2.0

junit: ${junit-osgi},\
org.osgi.dto;version='[1.0,1.1)',\
Expand Down
37 changes: 15 additions & 22 deletions gradle-plugins/biz.aQute.bnd.gradle/build.gradle.kts
Expand Up @@ -3,7 +3,7 @@ import java.util.*
plugins {
groovy
`kotlin-dsl`
id("com.gradle.plugin-publish") version "1.0.0"
id("com.gradle.plugin-publish")
}

interface Injected {
Expand Down Expand Up @@ -40,8 +40,9 @@ repositories {
}

// SourceSet for Kotlin DSL code so that it can be built after the main SourceSet
val dsl by sourceSets.registering
sourceSets {
val dsl by registering {
dsl {
compileClasspath += main.get().output
runtimeClasspath += main.get().output
}
Expand Down Expand Up @@ -131,6 +132,15 @@ publishing {
name.set(artifactId)
description.set("The Bnd Gradle plugins.")
}
val publication = this
tasks.register<WriteProperties>("generatePomPropertiesFor${publication.name.capitalize()}Publication") {
description = "Generates the Maven pom.properties file for publication '${publication.name}'."
group = PublishingPlugin.PUBLISH_TASK_GROUP
setOutputFile(layout.buildDirectory.file("publications/${publication.name}/pom-default.properties"))
property("groupId", provider { publication.groupId })
property("artifactId", provider { publication.artifactId })
property("version", provider { publication.version })
}
}
// Configure pom metadata
withType<MavenPublication> {
Expand Down Expand Up @@ -167,27 +177,10 @@ publishing {
}
}
}
val publication = this
tasks.register<WriteProperties>("generatePomPropertiesFor${publication.name.capitalize()}Publication") {
description = "Generates the Maven pom.properties file for publication '${publication.name}'."
group = PublishingPlugin.PUBLISH_TASK_GROUP
setOutputFile(layout.buildDirectory.file("publications/${publication.name}/pom-default.properties"))
property("groupId", provider { publication.groupId })
property("artifactId", provider { publication.artifactId })
property("version", provider { publication.version })
}
}
}
}

// Handle JPMS options
val jpmsOptions: List<String>? by rootProject.extra
jpmsOptions?.let {
tasks.withType<GroovyCompile>().configureEach {
groovyOptions.fork(mapOf("jvmArgs" to it))
}
}

// Disable gradle module metadata
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
Expand All @@ -209,12 +202,12 @@ tasks.withType<Javadoc>().configureEach {

tasks.pluginUnderTestMetadata {
// Include dsl SourceSet
pluginClasspath.from(sourceSets["dsl"].output)
pluginClasspath.from(dsl.get().output)
}

tasks.jar {
// Include dsl SourceSet
from(sourceSets["dsl"].output)
from(dsl.get().output)
// META-INF/maven folder
val metaInfMaven = publishing.publications.named<MavenPublication>("pluginMaven").map {
"META-INF/maven/${it.groupId}/${it.artifactId}"
Expand All @@ -233,7 +226,7 @@ tasks.jar {

tasks.named<Jar>("sourcesJar") {
// Include dsl SourceSet
from(sourceSets["dsl"].allSource)
from(dsl.get().allSource)
}

val testresourcesOutput = layout.buildDirectory.dir("testresources")
Expand Down
22 changes: 0 additions & 22 deletions gradle-plugins/build.gradle.kts
@@ -1,25 +1,3 @@
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9)) {
val jpmsOptions by extra(listOf(
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.jar=ALL-UNNAMED",
"--add-opens=java.base/java.util.regex=ALL-UNNAMED",
"--add-opens=java.base/java.util.zip=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED",
"--add-opens=java.base/sun.net.www.protocol.jrt=ALL-UNNAMED"
))
}

val localrepo: String? = System.getProperty("maven.repo.local")
localrepo?.let {
var rootGradle: Gradle = gradle
Expand Down
6 changes: 6 additions & 0 deletions gradle-plugins/settings.gradle.kts
@@ -1,2 +1,8 @@
pluginManagement {
plugins {
id("com.gradle.plugin-publish") version "1.0.0"
}
}

rootProject.name = "gradle-plugins"
include("biz.aQute.bnd.gradle")