Skip to content

Commit

Permalink
build: prepare for Maven publication
Browse files Browse the repository at this point in the history
  • Loading branch information
kris7t committed Nov 17, 2023
1 parent 62058e0 commit 958f619
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import tools.refinery.gradle.utils.EclipseUtils
plugins {
jacoco
java
`maven-publish`
id("tools.refinery.gradle.eclipse")
}

Expand Down Expand Up @@ -40,8 +41,13 @@ dependencies {
testImplementation(libs.slf4j.log4j)
}

java.toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
java {
withJavadocJar()
withSourcesJar()

toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks {
Expand All @@ -68,6 +74,18 @@ tasks {
}
}

tasks.named<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

javadoc {
options {
this as StandardJavadocDocletOptions
addBooleanOption("Xdoclint:none", true)
quiet()
}
}

val generateEclipseSourceFolders by tasks.registering

register("prepareEclipse") {
Expand All @@ -80,6 +98,14 @@ tasks {
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}

eclipse {
EclipseUtils.patchClasspathEntries(this) { entry ->
if (entry.path.endsWith("-gen")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks {
into(xtextGenPath)
}

for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) {
for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders", "sourcesJar")) {
tasks.named(taskName) {
dependsOn(syncXtextGeneratedSources)
}
Expand Down
2 changes: 1 addition & 1 deletion subprojects/interpreter-rete-recipes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks {
"-p", "rootPath=/$projectDir")
}

for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) {
for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders", "sourcesJar")) {
named(taskName) {
dependsOn(generateEPackage)
}
Expand Down
2 changes: 1 addition & 1 deletion subprojects/language-model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tasks {
args("src/main/java/tools/refinery/language/model/GenerateProblemModel.mwe2", "-p", "rootPath=/$projectDir")
}

for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) {
for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders", "sourcesJar")) {
named(taskName) {
dependsOn(generateEPackage)
}
Expand Down
2 changes: 1 addition & 1 deletion subprojects/language/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ tasks {
}

for (taskName in listOf("compileJava", "processResources", "compileTestFixturesJava",
"processTestFixturesResources", "generateEclipseSourceFolders")) {
"processTestFixturesResources", "generateEclipseSourceFolders", "sourcesJar")) {
named(taskName) {
dependsOn(generateXtextLanguage)
}
Expand Down

0 comments on commit 958f619

Please sign in to comment.