Browse Source

Build: Replace system JavaNativeFramework with openjdk compiled stub.

m1
Jannis Weis 4 years ago committed by weisj
parent
commit
c2cd637c1c
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 3
      gradle.properties
  2. 3
      gradle/libs.versions.toml
  3. 46
      macos/build.gradle.kts

3
gradle.properties

@ -13,4 +13,5 @@ darklaf.version = 2.6.2
# Plugins
com.github.vlsi.vlsi-release-plugins.version = 1.74
com.github.autostyle.version = 3.1
nokee.version = 0.4.0
nokee.version = 0.4.264-202107071245.986a5b8a
org.ajoberstar.grgit.version = 4.1.0

3
gradle/libs.versions.toml

@ -11,6 +11,7 @@ lGoodDatePicker = "11.0.2"
swingDsl = "latest.integration"
nullabilityAnnotations = "16.0.2"
macOSFramework = "latest.release"
javaNativeFoundation = "1.0.0"
[libraries]
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
@ -26,7 +27,7 @@ nullabilityAnnotations = { module = "org.jetbrains:annotations", version.ref = "
# MacOS frameworks
macosLegacy-javaVM-base = { module = "dev.nokee.framework:JavaVM", version.ref = "macOSFramework" }
macosLegacy-javaVM-capability-javaNativeFoundation = { module = "JavaVM:JavaNativeFoundation", version.ref = "macOSFramework" }
macos-javaNativeFoundation = { module = "dev.nokee.framework:JavaNativeFoundation", version.ref = "macOSFramework" }
macos-javaNativeFoundation = { module = "com.github.weisj:java-native-foundation", version.ref = "javaNativeFoundation" }
macos-appKit = { module = "dev.nokee.framework:AppKit", version.ref = "macOSFramework" }
macos-cocoa = { module = "dev.nokee.framework:Cocoa", version.ref = "macOSFramework" }

46
macos/build.gradle.kts

@ -1,4 +1,4 @@
import org.gradle.util.VersionNumber
import com.github.vlsi.gradle.properties.dsl.stringProperty
plugins {
java
@ -6,6 +6,18 @@ plugins {
id("dev.nokee.objective-cpp-language")
`uber-jni-jar`
`use-prebuilt-binaries`
`apple-m1-toolchain`
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/weisj/JavaNativeFoundation")
credentials {
username = project.stringProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.stringProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
library {
@ -15,33 +27,33 @@ library {
jvmImplementation(projects.darklafUtils)
jvmImplementation(projects.darklafPlatformBase)
jvmImplementation(projects.darklafPropertyLoader)
nativeLibImplementation(libs.macos.appKit)
nativeLibImplementation(libs.macos.cocoa)
val xCodeVersion = getXCodeVersion()
if (xCodeVersion != null && xCodeVersion >= VersionNumber.parse("12.2")) {
nativeLibImplementation(libs.macos.javaNativeFoundation)
} else {
nativeLibImplementation(libs.macosLegacy.javaVM.base)
nativeLibImplementation(libs.macosLegacy.javaVM.base) {
capabilities {
requireLibCapability(libs.macosLegacy.javaVM.capability.javaNativeFoundation)
}
}
}
// nativeLibImplementation(libs.macos.appKit)
// nativeLibImplementation(libs.macos.cocoa)
nativeLibImplementation(libs.macos.javaNativeFoundation)
}
targetMachines.addAll(machines.macOS.x86_64)
targetMachines.addAll(machines.macOS.x86_64, machines.macOS.architecture("arm64"))
variants.configureEach {
resourcePath.set("com/github/weisj/darklaf/platform/${project.name}/${targetMachine.variantName}")
sharedLibrary {
val minOs = "10.10"
val isArm = targetMachine.architectureString == "arm64"
val minOs = if (isArm) "11" else "10.10"
compileTasks.configureEach {
compilerArgs.addAll("-mmacosx-version-min=$minOs")
// Build type not modeled yet, assuming release
optimizedBinary()
}
linkTask.configure {
linkerArgs.addAll("-lobjc", "-mmacosx-version-min=$minOs")
linkerArgs.addAll(
"-lobjc", "-mmacosx-version-min=$minOs",
"-framework", "AppKit",
"-framework", "Cocoa",
// The custom JNF framework specified @rpath for searching. As we aren't actually linking
// with the dynamic library of the framework we specifically have to add the system framework
// search paths accordingly.
"-rpath", "/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/",
"-rpath", "/System/Library/Frameworks/"
)
}
}
}

Loading…
Cancel
Save