adapt for workflow
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
name: Publish Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK 25
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 25
|
||||||
|
distribution: 'temurin'
|
||||||
|
# GPG setup for signing
|
||||||
|
gpg-private-key: ${{ secrets.SIGNING_KEY }}
|
||||||
|
gpg-passphrase: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Make Gradle executable
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
|
- name: Check JAVA_HOME
|
||||||
|
run: echo $JAVA_HOME
|
||||||
|
|
||||||
|
- name: Build, Test, Publish
|
||||||
|
run: ./gradlew test publish -Djava.awt.headless=true
|
||||||
|
env:
|
||||||
|
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
||||||
|
# OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
|
||||||
|
# GITHUB_ACTOR: ${{ secrets.ACTOR }}
|
||||||
|
# GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
|
||||||
|
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
+132
-85
@@ -1,4 +1,5 @@
|
|||||||
import static org.apache.tools.ant.taskdefs.condition.Os.*
|
import static org.apache.tools.ant.taskdefs.condition.Os.*
|
||||||
|
import static groovy.lang.Tuple.tuple
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
@@ -17,8 +18,8 @@ To run Sparkle, you only need this module; if you want additional functionality,
|
|||||||
'$group'."""
|
'$group'."""
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
add(mavenCentral())
|
||||||
mavenCentral()
|
add(mavenLocal())
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -26,21 +27,36 @@ java {
|
|||||||
targetCompatibility = 25
|
targetCompatibility = 25
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.register('natives')
|
|
||||||
|
|
||||||
def lombokVersion = "1.18.44"
|
def lombokVersion = "1.18.44"
|
||||||
def lwjglVersion = "3.4.1"
|
def lwjglVersion = "3.4.1"
|
||||||
def lwjglNatives = findLWJGLNatives()
|
def lwjglNativesAll = [
|
||||||
def lwjglVersionNatives = "$lwjglVersion:$lwjglNatives"
|
'windows': tuple('nativesWindows', 'Windows x64', '*.dll'),
|
||||||
|
'linux': tuple('nativesLinux', 'Linux x64', '*.so'),
|
||||||
def lwjglNativeLibs = [
|
'macos-arm64': tuple('nativesMacOSArm64', 'macOS arm64', '*.dylib'),
|
||||||
"org.lwjgl:lwjgl:$lwjglVersionNatives",
|
'macos': tuple('nativesMacOS', 'macOS x86_64', '*.dylib'),
|
||||||
"org.lwjgl:lwjgl-glfw:$lwjglVersionNatives",
|
|
||||||
"org.lwjgl:lwjgl-nanovg:$lwjglVersionNatives",
|
|
||||||
"org.lwjgl:lwjgl-openal:$lwjglVersionNatives",
|
|
||||||
"org.lwjgl:lwjgl-opengl:$lwjglVersionNatives",
|
|
||||||
"org.lwjgl:lwjgl-stb:$lwjglVersionNatives"
|
|
||||||
]
|
]
|
||||||
|
def lwjglNativesCurrent = findLWJGLNatives()
|
||||||
|
def lwjglNativeLibsCurrent = [
|
||||||
|
"org.lwjgl:lwjgl:$lwjglVersion:$lwjglNativesCurrent",
|
||||||
|
"org.lwjgl:lwjgl-glfw:$lwjglVersion:$lwjglNativesCurrent",
|
||||||
|
"org.lwjgl:lwjgl-nanovg:$lwjglVersion:$lwjglNativesCurrent",
|
||||||
|
"org.lwjgl:lwjgl-openal:$lwjglVersion:$lwjglNativesCurrent",
|
||||||
|
"org.lwjgl:lwjgl-opengl:$lwjglVersion:$lwjglNativesCurrent",
|
||||||
|
"org.lwjgl:lwjgl-stb:$lwjglVersion:$lwjglNativesCurrent"
|
||||||
|
]
|
||||||
|
List<String> lwjglNativeLibsAll = []
|
||||||
|
lwjglNativesAll.each {
|
||||||
|
sourceSets.register(it.value.v1)
|
||||||
|
def classifier = "natives-$it.key"
|
||||||
|
lwjglNativeLibsAll.addAll([
|
||||||
|
"org.lwjgl:lwjgl:$lwjglVersion:$classifier",
|
||||||
|
"org.lwjgl:lwjgl-glfw:$lwjglVersion:$classifier",
|
||||||
|
"org.lwjgl:lwjgl-nanovg:$lwjglVersion:$classifier",
|
||||||
|
"org.lwjgl:lwjgl-openal:$lwjglVersion:$classifier",
|
||||||
|
"org.lwjgl:lwjgl-opengl:$lwjglVersion:$classifier",
|
||||||
|
"org.lwjgl:lwjgl-stb:$lwjglVersion:$classifier"
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'it.unimi.dsi:fastutil:8.5.15'
|
implementation 'it.unimi.dsi:fastutil:8.5.15'
|
||||||
@@ -57,7 +73,7 @@ dependencies {
|
|||||||
|
|
||||||
runtimeOnly 'ch.qos.logback:logback-classic:1.5.18' // SLF4J implementation
|
runtimeOnly 'ch.qos.logback:logback-classic:1.5.18' // SLF4J implementation
|
||||||
|
|
||||||
lwjglNativeLibs.forEach {lib ->
|
lwjglNativeLibsAll.forEach {lib ->
|
||||||
compileOnly lib
|
compileOnly lib
|
||||||
}
|
}
|
||||||
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
||||||
@@ -68,7 +84,7 @@ dependencies {
|
|||||||
|
|
||||||
testRuntimeOnly 'ch.qos.logback:logback-classic:1.5.18' // SLF4J implementation
|
testRuntimeOnly 'ch.qos.logback:logback-classic:1.5.18' // SLF4J implementation
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.1.0'
|
||||||
lwjglNativeLibs.forEach {lib ->
|
lwjglNativeLibsCurrent.forEach {lib ->
|
||||||
testRuntimeOnly lib
|
testRuntimeOnly lib
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,62 +119,49 @@ processTestResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('generateNativesModule') {
|
tasks.register('generateNativesModules') {
|
||||||
doLast {
|
doLast {
|
||||||
println "OS Name: ${System.getProperty('os.name')}"
|
lwjglNativesAll.each { entry ->
|
||||||
println "OS Arch: ${System.getProperty('os.arch')}"
|
def nativesNameLower = entry.key
|
||||||
println "LWJGL natives: $lwjglNatives"
|
def sourceSetName = entry.value.v1
|
||||||
def nativesNameLower = lwjglNatives.replace('natives-', '').replace('-', '.')
|
def nativesNameFriendly = entry.value.v2
|
||||||
def nativesName = String.valueOf(nativesNameLower.charAt(0)).toUpperCase(Locale.ENGLISH) + nativesNameLower.substring(1)
|
def sourcesDir = new File(temporaryDir, "$sourceSetName/java")
|
||||||
def sourcesDir = new File(temporaryDir, 'java')
|
def resourcesDir = new File(temporaryDir, "$sourceSetName/resources")
|
||||||
def resourcesDir = new File(temporaryDir, 'resources')
|
|
||||||
|
|
||||||
copy {
|
copy {
|
||||||
from new File(projectDir, '/src/nativeTemplate/java')
|
from new File(projectDir, '/src/nativeTemplate/java')
|
||||||
into sourcesDir
|
into sourcesDir
|
||||||
|
|
||||||
filter { String line ->
|
filter { String line ->
|
||||||
line
|
line
|
||||||
.replace('NATIVES_NAME_LOWER', nativesNameLower)
|
.replace('NATIVES_NAME_LOWER_NODASH', nativesNameLower.replace('-', '.'))
|
||||||
.replace('NATIVES_NAME', nativesName)
|
.replace('NATIVES_NAME_LOWER', nativesNameLower)
|
||||||
|
.replace('NATIVES_NAME_FRIENDLY', nativesNameFriendly)
|
||||||
|
}
|
||||||
|
|
||||||
|
include '**/*.java'
|
||||||
}
|
}
|
||||||
|
|
||||||
include '**/*.java'
|
sourceSets.named(sourceSetName).get().java.srcDir sourcesDir
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.natives.java.srcDir sourcesDir
|
def nativesDir = new File(resourcesDir, "natives/$nativesNameLower")
|
||||||
|
sourceSets.main.compileClasspath.files.each { jar ->
|
||||||
def nativesDir = new File(resourcesDir, "natives/$nativesNameLower")
|
if (jar.name.contains("natives-$nativesNameLower")) {
|
||||||
sourceSets.main.compileClasspath.files.each { jar ->
|
copy {
|
||||||
if (jar.name.contains('natives')) {
|
from zipTree(jar).files // flatten
|
||||||
copy {
|
include '*.dll', '*.so', '*.dylib'
|
||||||
from zipTree(jar).files // flatten
|
into nativesDir
|
||||||
include '*.so', '*.dll', '*.dylib'
|
}
|
||||||
into nativesDir
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets.named(sourceSetName).get().resources.srcDir resourcesDir
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.natives.resources.srcDir resourcesDir
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileNativesJava {
|
|
||||||
dependsOn generateNativesModule, jar
|
|
||||||
doFirst {
|
|
||||||
def coreJar = files(new File(layout.buildDirectory.get().asFile, "libs/${project.name}-${version}.jar"))
|
|
||||||
sourceSets.natives.compileClasspath += coreJar
|
|
||||||
sourceSets.natives.runtimeClasspath += coreJar
|
|
||||||
classpath += coreJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processNativesResources {
|
|
||||||
dependsOn generateNativesModule
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
dependsOn compileJava
|
dependsOn compileJava, processResources
|
||||||
from compileJava.destinationDirectory.get().asFile, processResources.destinationDir
|
from compileJava.destinationDirectory.get().asFile, processResources.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,34 +170,71 @@ tasks.register('jarSources', Jar) {
|
|||||||
from sourceSets.main.java.asFileTree
|
from sourceSets.main.java.asFileTree
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('jarNatives', Jar) {
|
lwjglNativesAll.each { entry ->
|
||||||
dependsOn compileNativesJava, processNativesResources
|
def sourceSetName = entry.value.v1
|
||||||
archiveClassifier = lwjglNatives
|
def sourceSetNameUpper = sourceSetName.substring(0, 1).toUpperCase(Locale.ENGLISH) + sourceSetName.substring(1)
|
||||||
from compileNativesJava.destinationDirectory.get().asFile, processNativesResources.destinationDir
|
|
||||||
|
def compile = tasks.named("compile${sourceSetNameUpper}Java") {
|
||||||
|
dependsOn generateNativesModules, jar
|
||||||
|
doFirst {
|
||||||
|
def coreJar = files(jar.archiveFile.get().asFile)
|
||||||
|
classpath += coreJar
|
||||||
|
}
|
||||||
|
}.get() as JavaCompile
|
||||||
|
|
||||||
|
def resources = tasks.named("process${sourceSetNameUpper}Resources") {
|
||||||
|
dependsOn generateNativesModules
|
||||||
|
}.get() as ProcessResources
|
||||||
|
|
||||||
|
tasks.register("jar${sourceSetNameUpper}", Jar) {
|
||||||
|
dependsOn compile, resources
|
||||||
|
archiveClassifier = "natives-$entry.key"
|
||||||
|
from compile.destinationDirectory.get().asFile, resources.destinationDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('jarNativesAll') {
|
||||||
|
lwjglNativesAll.each { entry ->
|
||||||
|
def sourceSetName = entry.value.v1
|
||||||
|
def sourceSetNameUpper = sourceSetName.substring(0, 1).toUpperCase(Locale.ENGLISH) + sourceSetName.substring(1)
|
||||||
|
|
||||||
|
dependsOn "jar$sourceSetNameUpper"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble {
|
assemble {
|
||||||
dependsOn jarSources, jarNatives
|
dependsOn jar, jarSources, jarNativesAll
|
||||||
}
|
}
|
||||||
|
|
||||||
def project = project // prevent 'cannot resolve' warnings
|
def project = project // prevent 'cannot resolve' warnings
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
|
// maven {
|
||||||
|
// name = 'Central'
|
||||||
|
// url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
||||||
|
// credentials {
|
||||||
|
// username = project.findProperty('ossrh.username') ?: System.getenv('OSSRH_USERNAME')
|
||||||
|
// password = project.findProperty('ossrh.password') ?: System.getenv('OSSRH_PASSWORD')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// maven {
|
||||||
|
// name = 'GitHubPackages'
|
||||||
|
// url = 'https://maven.pkg.github.com/SparkleJ-Framework/sparkle-core'
|
||||||
|
// credentials {
|
||||||
|
// username = project.findProperty('gpr.user') ?: System.getenv('GITHUB_ACTOR')
|
||||||
|
// password = project.findProperty('gpr.token') ?: System.getenv('GITHUB_TOKEN')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
maven {
|
maven {
|
||||||
name = 'Central'
|
name = 'GiteaPackages'
|
||||||
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
url = 'https://gitea.darktale.keenetic.link/api/packages/michael/maven'
|
||||||
credentials {
|
credentials(HttpHeaderCredentials) {
|
||||||
username = project.findProperty('ossrh.username') ?: System.getenv('OSSRH_USERNAME')
|
name 'Authorization'
|
||||||
password = project.findProperty('ossrh.password') ?: System.getenv('OSSRH_PASSWORD')
|
value "token ${project.findProperty('giteaAccessToken') ?: System.getenv('GITEA_TOKEN')}"
|
||||||
}
|
}
|
||||||
}
|
authentication {
|
||||||
maven {
|
register('header', HttpHeaderAuthentication)
|
||||||
name = 'GitHubPackages'
|
|
||||||
url = 'https://maven.pkg.github.com/SparkleJ-Framework/sparkle-core'
|
|
||||||
credentials {
|
|
||||||
username = project.findProperty('gpr.user') ?: System.getenv('GITHUB_ACTOR')
|
|
||||||
password = project.findProperty('gpr.token') ?: System.getenv('GITHUB_TOKEN')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,20 +267,27 @@ publishing {
|
|||||||
artifact(jarSources) {
|
artifact(jarSources) {
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
}
|
}
|
||||||
artifact(jarNatives) {
|
lwjglNativesAll.each { entry ->
|
||||||
classifier = lwjglNatives
|
def sourceSetName = entry.value.v1
|
||||||
|
def sourceSetNameUpper = sourceSetName.substring(0, 1).toUpperCase(Locale.ENGLISH) + sourceSetName.substring(1)
|
||||||
|
artifact(project.tasks.named("jar$sourceSetNameUpper").get()) {
|
||||||
|
classifier = "natives-$entry.key"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//signing {
|
def key = project.findProperty('signingKey').toString() ?: System.getenv('SIGNING_KEY')
|
||||||
// useInMemoryPgpKeys(
|
def password = project.findProperty('signingPassword').toString() ?: System.getenv('SIGNING_PASSWORD')
|
||||||
// project.findProperty('signingKey').toString() ?: System.getenv('SIGNING_KEY'),
|
if (key != "null" && password != "null") {
|
||||||
// project.findProperty('signingPassword').toString() ?: System.getenv('SIGNING_PASSWORD')
|
signing {
|
||||||
// )
|
useInMemoryPgpKeys(key, password)
|
||||||
// sign publishing.publications
|
sign publishing.publications
|
||||||
//}
|
}
|
||||||
|
} else {
|
||||||
|
logger.log(LogLevel.WARN, 'Signing disabled: no key or password specified')
|
||||||
|
}
|
||||||
|
|
||||||
static String findLWJGLNatives() {
|
static String findLWJGLNatives() {
|
||||||
String lwjglNatives = null
|
String lwjglNatives = null
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Native library provider for NATIVES_NAME.
|
* Native library provider for NATIVES_NAME_FRIENDLY.
|
||||||
*/
|
*/
|
||||||
module net.fokinatorr.sparkle.core.natives.NATIVES_NAME_LOWER {
|
module net.fokinatorr.sparkle.core.natives.NATIVES_NAME_LOWER_NODASH {
|
||||||
requires net.fokinatorr.sparkle.core;
|
requires net.fokinatorr.sparkle.core;
|
||||||
|
|
||||||
provides net.fokinatorr.sparkle.NativeExtractor with net.fokinatorr.sparkle.natives.NativeExtractorImpl;
|
provides net.fokinatorr.sparkle.NativeExtractor with net.fokinatorr.sparkle.natives.NativeExtractorImpl;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class NativeExtractorImpl implements NativeExtractor {
|
|||||||
try {
|
try {
|
||||||
jarFs.close();
|
jarFs.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.print("[NativeExtractor NATIVES_NAME] Failed to close JAR filesystem: ");
|
System.err.print("[NativeExtractor NATIVES_NAME_FRIENDLY] Failed to close JAR filesystem: ");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user