mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-22 21:04:53 +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:
|
||||
name: codemp-java-${{ matrix.platform.target }}
|
||||
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
|
||||
|
|
58
dist/java/build.gradle
vendored
58
dist/java/build.gradle
vendored
|
@ -1,12 +1,12 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
id 'com.palantir.git-version' version '3.1.0'
|
||||
}
|
||||
|
||||
group = 'mp.code'
|
||||
version = versionDetails().lastTag.substring(1)
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
|
||||
java {
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
@ -61,43 +61,49 @@ build.finalizedBy shadowJar
|
|||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = 'my-library'
|
||||
artifactId = rootProject.name
|
||||
version = project.version
|
||||
from components.java
|
||||
versionMapping {
|
||||
usage('java-api') {
|
||||
fromResolutionOf('runtimeClasspath')
|
||||
}
|
||||
usage('java-runtime') {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
pom {
|
||||
name = 'My Library'
|
||||
description = 'A concise description of my library'
|
||||
url = 'http://www.example.com/library'
|
||||
properties = [
|
||||
myProp: "value",
|
||||
"prop.with.dots": "anotherValue"
|
||||
]
|
||||
name = 'codemp'
|
||||
description = 'A collaborative editor plugin ecosystem'
|
||||
url = 'https://code.mp'
|
||||
licenses {
|
||||
license {
|
||||
name = 'The Apache License, Version 2.0'
|
||||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
name = 'The GNU General Public License v3.0'
|
||||
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = 'johnd'
|
||||
name = 'John Doe'
|
||||
email = 'john.doe@example.com'
|
||||
id = 'zaaarf'
|
||||
email = 'zaaarf@codemp.dev'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection = 'scm:git:git://example.com/my-library.git'
|
||||
developerConnection = 'scm:git:ssh://example.com/my-library.git'
|
||||
url = 'http://example.com/my-library/'
|
||||
connection = 'scm:git:git://github.com/hexedtech/codemp.git'
|
||||
developerConnection = 'scm:git:ssh://github.com/hexedtech/codemp.git'
|
||||
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() {
|
||||
if(loaded) return;
|
||||
try {
|
||||
String filename = System.getProperty("os.name").startsWith("Windows")
|
||||
? "/natives/codemp.dll"
|
||||
: "/natives/libcodemp.so";
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
|
||||
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);
|
||||
|
||||
loaded = true;
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
Loading…
Reference in a new issue