From 4df8126ca99b2054f2ea931d55a22bb4de2b0b85 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Thu, 12 Dec 2024 12:38:34 +0100 Subject: [PATCH] Publish snapshots --- .github/workflows/ci.yml | 20 ++++++++++++++++++ build.gradle | 16 +++++++++++++++ gradle.properties | 2 ++ parser/build.gradle | 44 ++++++++++++++++++++++++++++++++++++++-- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 gradle.properties diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2e77d06 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: Publish Snapshot + +on: + push: + branches: + - 'main' + workflow_dispatch: + +permissions: + contents: read + pull-requests: read + actions: read + +jobs: + publish-snapshot: + runs-on: ubuntu-latest + steps: + - name: Publish + run: | + ./gradlew publish diff --git a/build.gradle b/build.gradle index 6597836..1febc8b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,21 @@ +plugins { + id "com.diffplug.spotless" version "6.11.0" + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' +} + +project.version="0.0.1-SNAPSHOT" + repositories { mavenCentral() } +nexusPublishing { + repositories { + sonatype { + username = project.hasProperty("sonatype.user") ? project.property("sonatype.user") : System.getenv("SONATYPE_USERNAME") + password = project.hasProperty("sonatype.password") ? project.property("sonatype.password") : System.getenv("SONATYPE_PASSWORD") + } + } +} + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..fb373e8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +sonatype.user=XXSEjG1P +sonatype.password=P5w7F2tDqHdOO5CDCbyK66t1dV93Owtudyaibs2k30mL diff --git a/parser/build.gradle b/parser/build.gradle index 9812432..0e18516 100644 --- a/parser/build.gradle +++ b/parser/build.gradle @@ -1,8 +1,12 @@ plugins { - id 'com.github.johnrengelman.shadow' version '8.1.1' + id("io.github.goooler.shadow") version "8.1.8" id 'java' + id 'maven-publish' } +def libraryName="jafar-parser" +def component_version = project.hasProperty("jafar_version") ? project.jafar_version : rootProject.version + repositories { mavenCentral() } @@ -17,7 +21,7 @@ dependencies { implementation 'org.slf4j:slf4j-api:2.0.5' implementation 'org.slf4j:slf4j-simple:2.0.5' implementation 'it.unimi.dsi:fastutil:8.5.12' - implementation 'org.ow2.asm:asm:9.5' + implementation 'org.ow2.asm:asm:9.7.1' testImplementation 'org.openjdk.jmc:flightrecorder.writer:8.2.1' testImplementation 'org.mockito:mockito-core:5.12.0' @@ -32,3 +36,39 @@ test { jvmArgs '-Xmx8g', '-Xms1g' useJUnitPlatform() } + +tasks.register('sourcesJar', Jar) { + from sourceSets.main.allJava + archiveBaseName = libraryName + archiveClassifier = "sources" + archiveVersion = component_version +} + +tasks.register('javadocJar', Jar) { + dependsOn javadoc + archiveBaseName = libraryName + archiveClassifier = 'javadoc' + archiveVersion = component_version + from javadoc.destinationDir +} + +publishing { + publications { + assembled(MavenPublication) { publication -> + publication.groupId = 'io.btrace' + publication.artifactId = 'jafar-parser' + publication.version = component_version + } + } +} + +shadowJar { + group 'Build' + archiveBaseName = libraryName + archiveVersion = component_version + archiveClassifier.set('') + + relocate 'it.unimi.dsi.fastutil', 'io.jafar.libs.it.unimi.dsi.fastutil' + relocate 'org.objectweb.asm', 'io.jafar.libs.org.objectweb.asm' + relocate 'org.slf4j', 'io.jafar.libs.org.slf4j' +} \ No newline at end of file