Updated how SWT gets artifact info

master Version_3.4
Robinson 2022-12-31 02:41:41 +01:00
parent 0ce013b595
commit 8d6058ce81
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
3 changed files with 41 additions and 18 deletions

View File

@ -34,7 +34,7 @@ object Extras {
// set for the project
const val description = "Gradle Plugin to manage various Gradle tasks, such as updating gradle and dependencies"
const val group = "com.dorkbox"
const val version = "3.3.1"
const val version = "3.4"
// set as project.ext
const val name = "Gradle Utils"
@ -84,6 +84,9 @@ dependencies {
// the kotlin version is taken from the plugin, so it is not necessary to set it here
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin")
// for easier OS identification
api("com.dorkbox:OS:1.0")
// for parsing JSON
implementation("org.json:json:20220924")

View File

@ -18,6 +18,8 @@ package dorkbox.gradle
import dorkbox.gradle.deps.DependencyScanner
import dorkbox.gradle.jpms.JavaXConfiguration
import dorkbox.gradle.jpms.SourceSetContainer2
import dorkbox.os.OS
import dorkbox.os.OS.osArch
import org.gradle.api.*
import org.gradle.api.execution.TaskExecutionGraph
import org.gradle.api.file.DuplicatesStrategy
@ -673,19 +675,33 @@ open class StaticMethodsAndTools(private val project: Project) {
// macos
// org.eclipse.swt.cocoa.macosx.x86_64
val currentOS = org.gradle.internal.os.OperatingSystem.current()
val swtType = if (System.getProperty("os.arch").matches(".*64.*".toRegex())) {
when {
currentOS.isWindows -> SwtType.WIN_64
currentOS.isMacOsX -> SwtType.MAC_64
else -> SwtType.LINUX_64
val swtType = when {
OS.isMacOsX -> {
when {
OS.is32bit -> SwtType.UNKNOWN
OS.is64bit -> SwtType.MAC_64
OS.isArm -> SwtType.MAC_AARCH64
else -> SwtType.UNKNOWN
}
}
} else {
when {
currentOS.isWindows -> SwtType.WIN_32
currentOS.isMacOsX -> SwtType.MAC_64 // not possible on mac, but here for completeness
else -> SwtType.LINUX_32
OS.isWindows -> {
when {
OS.is32bit -> SwtType.WIN_32
OS.is64bit -> SwtType.WIN_64
else -> SwtType.UNKNOWN
}
}
OS.isLinux -> {
when {
OS.is32bit -> SwtType.LINUX_32
OS.is64bit -> SwtType.LINUX_64
OS.isArm -> SwtType.LINUX_AARCH64
else -> SwtType.UNKNOWN
}
}
else -> SwtType.UNKNOWN
}
val fullId = swtType.fullId(version)

View File

@ -18,7 +18,7 @@ package dorkbox.gradle
/**
* contains the different SWT maven configurations that we support
*/
enum class SwtType(val id: String, val is64bit: Boolean) {
enum class SwtType(val id: String) {
// SEE: https://repo1.maven.org/maven2/org/eclipse/platform/
// windows
@ -31,15 +31,19 @@ enum class SwtType(val id: String, val is64bit: Boolean) {
// macoxs
// org.eclipse.swt.cocoa.macosx.x86_64
// org.eclipse.swt.cocoa.macosx.aarch64
// This is really SWT version 4.xx? no idea how the internal versions are tracked
// 4.4 is the oldest version that works with us, and the release of SWT is sPecIaL!
// version 3.108.0 is the MOST RECENT version supported by x86. Newer versions no longer support x86
LINUX_32("org.eclipse.swt.gtk.linux.x86", false),
LINUX_64("org.eclipse.swt.gtk.linux.x86_64", true),
MAC_64("org.eclipse.swt.cocoa.macosx.x86_64", true),
WIN_32("org.eclipse.swt.win32.win32.x86", false),
WIN_64("org.eclipse.swt.win32.win32.x86_64", true);
LINUX_32("org.eclipse.swt.gtk.linux.x86"),
LINUX_64("org.eclipse.swt.gtk.linux.x86_64"),
LINUX_AARCH64("org.eclipse.swt.gtk.linux.aarch64"),
MAC_64("org.eclipse.swt.cocoa.macosx.x86_64"),
MAC_AARCH64("org.eclipse.swt.cocoa.macosx.aarch64"),
WIN_32("org.eclipse.swt.win32.win32.x86"),
WIN_64("org.eclipse.swt.win32.win32.x86_64"),
UNKNOWN("UNKNOWN_SYSTEM_ARCH");
fun fullId(version: String): String {