mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 07:14:50 +01:00
ci(java): basic gradle publish setup
This commit is contained in:
parent
581419bfed
commit
d2b5e413c5
3 changed files with 47 additions and 29 deletions
6
.github/workflows/java.yml
vendored
6
.github/workflows/java.yml
vendored
|
@ -40,5 +40,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: codemp-java-${{ matrix.platform.target }}
|
name: codemp-java-${{ matrix.platform.target }}
|
||||||
path: dist/java/build/libs
|
path: dist/java/build/libs
|
||||||
|
- run: gradle publish
|
||||||
|
env:
|
||||||
|
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
||||||
|
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
||||||
|
MAVEN_CENTRAL_GPG_SECRET_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_SECRET_KEY }}
|
||||||
|
MAVEN_CENTRAL_GPG_PASSWORD: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }}
|
||||||
|
|
||||||
# TODO add a publish step to maven central
|
# TODO add a publish step to maven central
|
||||||
|
|
58
dist/java/build.gradle
vendored
58
dist/java/build.gradle
vendored
|
@ -1,12 +1,12 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
id 'signing'
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||||
id 'com.palantir.git-version' version '3.1.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'mp.code'
|
group = 'mp.code'
|
||||||
version = versionDetails().lastTag.substring(1)
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
@ -61,43 +61,49 @@ build.finalizedBy shadowJar
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifactId = 'my-library'
|
artifactId = rootProject.name
|
||||||
|
version = project.version
|
||||||
from components.java
|
from components.java
|
||||||
versionMapping {
|
|
||||||
usage('java-api') {
|
|
||||||
fromResolutionOf('runtimeClasspath')
|
|
||||||
}
|
|
||||||
usage('java-runtime') {
|
|
||||||
fromResolutionResult()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pom {
|
pom {
|
||||||
name = 'My Library'
|
name = 'codemp'
|
||||||
description = 'A concise description of my library'
|
description = 'A collaborative editor plugin ecosystem'
|
||||||
url = 'http://www.example.com/library'
|
url = 'https://code.mp'
|
||||||
properties = [
|
|
||||||
myProp: "value",
|
|
||||||
"prop.with.dots": "anotherValue"
|
|
||||||
]
|
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name = 'The Apache License, Version 2.0'
|
name = 'The GNU General Public License v3.0'
|
||||||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id = 'johnd'
|
id = 'zaaarf'
|
||||||
name = 'John Doe'
|
email = 'zaaarf@codemp.dev'
|
||||||
email = 'john.doe@example.com'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scm {
|
scm {
|
||||||
connection = 'scm:git:git://example.com/my-library.git'
|
connection = 'scm:git:git://github.com/hexedtech/codemp.git'
|
||||||
developerConnection = 'scm:git:ssh://example.com/my-library.git'
|
developerConnection = 'scm:git:ssh://github.com/hexedtech/codemp.git'
|
||||||
url = 'http://example.com/my-library/'
|
url = 'https://github.com/hexedtech/codemp/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "centralManualTesting"
|
||||||
|
url "https://central.sonatype.com/api/v1/publisher/deployments/download/"
|
||||||
|
credentials {
|
||||||
|
username = System.getenv('MAVEN_CENTRAL_USERNAME')
|
||||||
|
password = System.getenv('MAVEN_CENTRAL_PASSWORD')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
def signingKey = System.getenv('MAVEN_CENTRAL_GPG_SECRET_KEY')
|
||||||
|
def signingPassword = System.getenv('MAVEN_CENTRAL_GPG_PASSWORD')
|
||||||
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||||
|
sign publishing.publications.mavenJava
|
||||||
|
}
|
12
dist/java/src/mp/code/Extensions.java
vendored
12
dist/java/src/mp/code/Extensions.java
vendored
|
@ -41,10 +41,16 @@ public final class Extensions {
|
||||||
static synchronized void loadLibraryIfNotPresent() {
|
static synchronized void loadLibraryIfNotPresent() {
|
||||||
if(loaded) return;
|
if(loaded) return;
|
||||||
try {
|
try {
|
||||||
String filename = System.getProperty("os.name").startsWith("Windows")
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
? "/natives/codemp.dll"
|
|
||||||
: "/natives/libcodemp.so";
|
String filename;
|
||||||
|
if(os.startsWith("windows")) {
|
||||||
|
filename = "/natives/codemp.dll";
|
||||||
|
} else if(os.startsWith("mac")) {
|
||||||
|
filename = "/natives/libcodemp.dylib";;
|
||||||
|
} else filename = "/natives/libcodemp.so";
|
||||||
cz.adamh.utils.NativeUtils.loadLibraryFromJar(filename);
|
cz.adamh.utils.NativeUtils.loadLibraryFromJar(filename);
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
Loading…
Reference in a new issue