From 764a592ee09156bf3146e0cf3f838143b06315ff Mon Sep 17 00:00:00 2001 From: Walter Oggioni Date: Sun, 16 Jan 2022 19:39:04 +0800 Subject: [PATCH] switched to envelope for cli tool --- Jenkinsfile | 25 +++++++++++++++++++ settings.gradle | 4 +-- {cli => wson-cli}/build.gradle | 20 ++++++++++++--- .../main/kotlin/net/woggioni/wson/cli/main.kt | 0 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 Jenkinsfile rename {cli => wson-cli}/build.gradle (58%) rename {cli => wson-cli}/src/main/kotlin/net/woggioni/wson/cli/main.kt (100%) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..7cb6770 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,25 @@ +import java.nio.file.Path +import java.nio.file.Files + +pipeline { + agent any + stages { + stage("Build") { + steps { + sh "./gradlew clean build" + junit testResults: "build/test-results/test/*.xml" + javadoc javadocDir: "build/docs/javadoc", keepAll: true + archiveArtifacts artifacts: 'build/libs/*.jar,benchmark/build/libs/*.jar,wson-cli/build/distributions/wson-cli-envelope-*.jar', + allowEmptyArchive: true, + fingerprint: true, + onlyIfSuccessful: true + } + } + stage("Publish") { + steps { + sh "./gradlew publish" + } + } + } +} + diff --git a/settings.gradle b/settings.gradle index f9db6d3..7b6ed08 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,7 +8,7 @@ pluginManagement { } plugins { - id "net.woggioni.gradle.executable.jar" version "0.1" + id "net.woggioni.gradle.envelope" version "0.1" id "net.woggioni.gradle.lombok" version "0.1" id 'org.jetbrains.kotlin.jvm' version getProperty('version.kotlin') } @@ -16,7 +16,7 @@ pluginManagement { rootProject.name = 'wson' -def includeDirs = ['antlr', 'benchmark', 'test-utils', 'cli'] +def includeDirs = ['antlr', 'benchmark', 'test-utils', 'wson-cli'] includeDirs.each { include(it) diff --git a/cli/build.gradle b/wson-cli/build.gradle similarity index 58% rename from cli/build.gradle rename to wson-cli/build.gradle index 4ca19b9..2733c97 100644 --- a/cli/build.gradle +++ b/wson-cli/build.gradle @@ -1,5 +1,6 @@ plugins { - id 'application' + id 'maven-publish' + id 'net.woggioni.gradle.envelope' id 'org.jetbrains.kotlin.jvm' } @@ -10,8 +11,8 @@ dependencies { implementation rootProject } -application { - mainClassName = 'net.woggioni.wson.cli.MainKt' +envelopeJar { + mainClass = 'net.woggioni.wson.cli.MainKt' } @@ -20,3 +21,16 @@ compileKotlin { jvmTarget = '1.8' } } + +publishing { + repositories { + maven { + url = "https://mvn.woggioni.net/" + } + } + publications { + myDistribution(MavenPublication) { + artifact envelopeJar + } + } +} \ No newline at end of file diff --git a/cli/src/main/kotlin/net/woggioni/wson/cli/main.kt b/wson-cli/src/main/kotlin/net/woggioni/wson/cli/main.kt similarity index 100% rename from cli/src/main/kotlin/net/woggioni/wson/cli/main.kt rename to wson-cli/src/main/kotlin/net/woggioni/wson/cli/main.kt