Skip to content

Commit

Permalink
build: add distribution task
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Apr 17, 2022
1 parent ea0b8ce commit 94d0fee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
env:
TERM: dumb
with:
arguments: clean build --warning-mode=all
arguments: clean build dist --warning-mode=all
24 changes: 23 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spotless {
if (JavaVersion.current() < JavaVersion.VERSION_16) {
removeUnusedImports()
} else {
// google-format broken on java 16 (https://github.com/diffplug/spotless/issues/834)
// google-format broken on java 16+ (https://github.com/diffplug/spotless/issues/834)
println("Warning! Unused imports remove is disabled for Java 16+")
}
encoding("UTF-8")
Expand All @@ -48,12 +48,34 @@ spotless {
var libProjects = listOf(":raung-common", ":raung-asm", ":raung-disasm")

tasks.register("publishLocal") {
group = "raung"
description = "Public library packages into Maven local repo"

libProjects.forEach {
dependsOn(tasks.getByPath("$it:publishToMavenLocal"))
}
}
tasks.register("publish") {
group = "raung"
description = "Public library packages into Maven Central repo"

libProjects.forEach {
dependsOn(tasks.getByPath("$it:publish"))
}
}

tasks.register("dist", Copy::class) {
group = "raung"
description = "Build raung-cli distribution package"

from(tasks.getByPath(":raung-cli:distZip"))
into(layout.buildDirectory)
}

tasks.register("clean", Delete::class) {
group = "raung"
description = "Remove all build directories"

delete(layout.buildDirectory)
subprojects.forEach { sp -> dependsOn(sp.tasks.named("clean")) }
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/raung.java-common.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "io.github.skylot.raung"
version = "0.0.1"
version = System.getenv("RAUNG_VERSION") ?: "dev"

java {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
9 changes: 6 additions & 3 deletions buildSrc/src/main/kotlin/raung.java-library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
}

group = "io.github.skylot"
version = "0.0.1"
version = System.getenv("RAUNG_VERSION") ?: "dev"

java {
withJavadocJar()
Expand Down Expand Up @@ -58,7 +58,6 @@ publishing {
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
Expand All @@ -71,11 +70,15 @@ publishing {
}

signing {
setRequired(gradle.taskGraph.hasTask("publish"))
sign(publishing.publications["mavenJava"])
}

tasks.javadoc {
val stdOptions = options as StandardJavadocDocletOptions
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
stdOptions.addBooleanOption("html5", true)
}
// disable 'missing' warnings
stdOptions.addStringOption("Xdoclint:all,-missing", "-quiet")
}

0 comments on commit 94d0fee

Please sign in to comment.