diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 6326dec4..80f9b72d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -45,7 +45,9 @@ jobs: with: java-version: 8 - name: Build & Test - run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipAutostyle --info --no-daemon + env: + PROPS_GITHUB: "-PgithubAccessToken=${{ secrets.GITHUB_TOKEN }}" + run: xvfb-run -a -server-num=1 --server-args="-screen 0 2000x3000x16" ./gradlew build test -PskipAutostyle -PfailIfLibraryMissing=true $(echo $PROPS_GITHUB) --info --no-daemon - name: Upload Test Results if: ${{ always() }} uses: actions/upload-artifact@v1 diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 820ab922..ef864f78 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -25,7 +25,7 @@ jobs: java-version: 8 - name: Publish env: - PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle" + PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle -PfailIfLibraryMissing" PROPS_GIT: "-PghGitSourceUsername=${{ secrets.GH_GIT_USERNAME }} -PghGitSourcePassword=${{ secrets.GITHUB_TOKEN }}" PROPS_NEXUS: "-PghNexusUsername=${{ secrets.GH_NEXUS_USERNAME }} -PghNexusPassword=${{ secrets.GH_NEXUS_PASSWORD }}" PROPS_SIGNING: "-PuseInMemoryKey=true -Psigning.inMemoryKey=${{ secrets.IN_MEMORY_KEY }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }}" diff --git a/.gitignore b/.gitignore index cb851649..9c9938a4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ repo/ /buildSrc/out/ /*/out/ *.iml +*.ipr +*.iws .run/ # VS Code diff --git a/annotations-processor/build.gradle.kts b/annotations-processor/build.gradle.kts index 22c94518..a8c1818d 100644 --- a/annotations-processor/build.gradle.kts +++ b/annotations-processor/build.gradle.kts @@ -3,5 +3,5 @@ plugins { } dependencies { - api(project(":darklaf-annotations")) + api(projects.darklafAnnotations) } diff --git a/build.gradle.kts b/build.gradle.kts index 59a0da12..b3242a26 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ import com.github.vlsi.gradle.publishing.dsl.simplifyXml import com.github.vlsi.gradle.publishing.dsl.versionFromResolution plugins { + idea id("com.github.autostyle") id("com.github.vlsi.crlf") id("com.github.vlsi.gradle-extensions") @@ -16,9 +17,9 @@ plugins { } val skipJavadoc by props() -val enableMavenLocal by props() +val enableMavenLocal by props(false) val enableGradleMetadata by props() -val skipAutostyle by props() +val skipAutostyle by props(false) val isRelease = project.stringProperty("release").toBool() val snapshotName by props("") @@ -56,6 +57,7 @@ tasks.closeRepository.configure { enabled = isRelease } val buildVersion = "$projectVersion$snapshotIdentifier${releaseParams.snapshotSuffix}" println("Building: Darklaf $buildVersion") println(" JDK: " + System.getProperty("java.home")) +println(" Gradle: " + gradle.gradleVersion) fun BaseFormatExtension.license(addition: String = "") { val extra = if (addition.isEmpty()) "" else "\n$addition" @@ -107,9 +109,10 @@ allprojects { val githubAccessToken by props("") plugins.withType { + val failIfLibraryMissing by props(false) prebuiltBinaries { prebuiltLibrariesFolder = "pre-build-libraries" - failIfLibraryIsMissing = false + failIfLibraryIsMissing = failIfLibraryMissing github( user = "weisj", repository = "darklaf", @@ -168,13 +171,6 @@ allprojects { fileMode = "664".toInt(8) } - plugins.withType { - dependencies { - "api"(platform(project(":darklaf-dependencies-bom"))) - "annotationProcessor"(platform(project(":darklaf-dependencies-bom"))) - } - } - if (!enableGradleMetadata) { tasks.withType { enabled = false @@ -227,6 +223,7 @@ allprojects { from(source) { include("**/*.properties") filteringCharset = "UTF-8" + duplicatesStrategy = DuplicatesStrategy.INCLUDE // apply native2ascii conversion since Java 8 expects properties to have ascii symbols only filter(org.apache.tools.ant.filters.EscapeUnicode::class) } @@ -289,10 +286,8 @@ allprojects { } configure { - if (project.path.startsWith(":darklaf-dependencies-bom") || - project.path == ":" - ) { - // We don't it to Central for now + if (project.path == ":") { + // Skip the root project return@configure } diff --git a/buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt b/buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt index 1c7b9b8f..f93d316e 100644 --- a/buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt +++ b/buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt @@ -117,7 +117,7 @@ open class DownloadPrebuiltBinariesTask @Inject constructor( private val Json.latestRun: Json? get() { - val runs = this["workflow_runs"] as List + val runs = this["workflow_runs"] as? List ?: return null val candidates = runs.asSequence().filter { val completed = "completed" == it["status"] val success = "success" == it["conclusion"] diff --git a/buildSrc/src/main/kotlin/JniUtils.kt b/buildSrc/src/main/kotlin/JniUtils.kt index d7f59fcb..63e89b97 100644 --- a/buildSrc/src/main/kotlin/JniUtils.kt +++ b/buildSrc/src/main/kotlin/JniUtils.kt @@ -1,7 +1,35 @@ +import dev.nokee.platform.jni.JniLibraryDependencies import dev.nokee.runtime.nativebase.OperatingSystemFamily import dev.nokee.runtime.nativebase.TargetMachine +import org.gradle.api.Action import org.gradle.api.GradleException import org.gradle.api.Project +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.artifacts.ModuleDependency +import org.gradle.api.artifacts.ModuleDependencyCapabilitiesHandler +import org.gradle.api.provider.Provider + +fun MinimalExternalModuleDependency.dependencyNotation() = + "${module.group}:${module.name}:${versionConstraint.requiredVersion}" + +fun JniLibraryDependencies.jvmLibImplementation(notation: Provider) { + jvmImplementation(notation.map { it.dependencyNotation() }.get()) +} + +fun JniLibraryDependencies.nativeLibImplementation(notation: Provider) { + nativeImplementation(notation.map { it.dependencyNotation() }.get()) +} + +fun JniLibraryDependencies.nativeLibImplementation( + notation: Provider, + action: Action +) { + nativeImplementation(notation.map { it.dependencyNotation() }.get(), action) +} + +fun ModuleDependencyCapabilitiesHandler.requireLibCapability(notation: Provider) { + requireCapabilities(notation.get().dependencyNotation()) +} val TargetMachine.variantName: String get() { @@ -11,11 +39,25 @@ val TargetMachine.variantName: String operatingSystemFamily.isMacOS -> "macos" else -> GradleException("Unknown operating system family '${operatingSystemFamily}'.") } - val architecture = if (architecture.is32Bit) "x86" else "x86-64" - return "$osFamily-$architecture" + return "$osFamily-$architectureString" } -fun libraryFileNameFor(project : Project, osFamily: OperatingSystemFamily) : String = when { +val TargetMachine.targetsHost: Boolean + get() { + val osName = System.getProperty("os.name").toLowerCase().replace(" ", "") + val osFamily = operatingSystemFamily + return when { + osFamily.isWindows && osName.contains("windows") -> true + osFamily.isLinux && osName.contains("linux") -> true + osFamily.isMacOS && osName.contains("macos") -> true + else -> false + } + } + +val TargetMachine.architectureString: String + get() = if (architecture.is32Bit) "x86" else "x86-64" + +fun libraryFileNameFor(project: Project, osFamily: OperatingSystemFamily): String = when { osFamily.isWindows -> "${project.name}.dll" osFamily.isLinux -> "lib${project.name}.so" osFamily.isMacOS -> "lib${project.name}.dylib" diff --git a/buildSrc/src/main/kotlin/UberJniJarPlugin.kt b/buildSrc/src/main/kotlin/UberJniJarPlugin.kt index 30fafc33..e1908d6d 100644 --- a/buildSrc/src/main/kotlin/UberJniJarPlugin.kt +++ b/buildSrc/src/main/kotlin/UberJniJarPlugin.kt @@ -1,12 +1,11 @@ -import dev.nokee.platform.base.VariantView +import dev.nokee.platform.jni.JarBinary import dev.nokee.platform.jni.JniJarBinary -import dev.nokee.platform.jni.JniLibrary import dev.nokee.platform.jni.JniLibraryExtension import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.file.FileTree import org.gradle.api.provider.Provider import org.gradle.jvm.tasks.Jar -import dev.nokee.runtime.nativebase.TargetMachine class UberJniJarPlugin : Plugin { @@ -20,34 +19,17 @@ class UberJniJarPlugin : Plugin { val project = task.project val logger = task.logger val library = project.extensions.getByType(JniLibraryExtension::class.java) - library.binaries.withType(JniJarBinary::class.java).configureEach { - jarTask.configure { enabled = false } - } + logger.info("${project.name}: Merging binaries into the JVM Jar.") - when (library.targetMachines.get().size) { - 0 -> logger.info("No native target for project ${project.name}") - 1 -> { - library.variants.configureEach { - task.into(this@configureEach.resourcePath) { - from(this@configureEach.nativeRuntimeFiles) - } - } - } - else -> { - for (targetMachine in library.targetMachines.get()) { - val variant = library.variants.withTarget(targetMachine) - task.into(variant.map { it.resourcePath }) { - from(variant.map { it.nativeRuntimeFiles }) - } - } - } - } + task.from(library.variants.flatMap { variant -> + if (variant.targetMachine.targetsHost) { + variant.binaries.withType(JniJarBinary::class.java) + .map { it.asZipTree(project) }.get() + } else listOf() + }) } - private fun VariantView.withTarget(target: TargetMachine): Provider { - return filter { it.targetMachine == target }.map { - check(it.size == 1) - it.first() - } - } + private fun JarBinary.asZipTree(project: Project): Provider = + jarTask.map { project.zipTree(it.archiveFile) } + } diff --git a/buildSrc/src/main/kotlin/XCode.kt b/buildSrc/src/main/kotlin/XCode.kt new file mode 100644 index 00000000..459c0ba8 --- /dev/null +++ b/buildSrc/src/main/kotlin/XCode.kt @@ -0,0 +1,20 @@ +import org.gradle.util.VersionNumber +import java.util.concurrent.TimeUnit + +fun String.runCommand(): String? { + return runCatching { + val process = ProcessBuilder(*split(" ").toTypedArray()).start() + val output = process.inputStream.reader(Charsets.UTF_8).use { + it.readText() + } + process.waitFor(10, TimeUnit.SECONDS) + output.trim() + }.getOrNull() +} + +fun getXCodeVersion(): VersionNumber? { + val version = "/usr/bin/xcodebuild -version".runCommand() ?: return null + val extracted = Regex("""Xcode\s+([0-9\\.]*).*""") + .find(version)?.groupValues?.getOrNull(1) ?: return null + return VersionNumber.parse(extracted) +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index dd1f2932..0050efe6 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,31 +7,30 @@ plugins { } dependencies { - api(project(":darklaf-theme")) - api(project(":darklaf-property-loader")) - api(project(":darklaf-utils")) - implementation(project(":darklaf-native-utils")) - implementation(project(":darklaf-platform-base")) - implementation(project(":darklaf-windows")) - implementation(project(":darklaf-macos")) - implementation("org.swinglabs:jxlayer") - implementation("com.formdev:svgSalamander") - implementation("com.github.weisj:swing-dsl-laf-support") - - compileOnly("org.jetbrains:annotations") - compileOnly("org.swinglabs:swingx") - - testImplementation("com.formdev:svgSalamander") - testImplementation("com.miglayout:miglayout-core") - testImplementation("com.miglayout:miglayout-swing") - testImplementation("org.swinglabs:swingx") - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("com.fifesoft:rsyntaxtextarea") - testImplementation("com.github.lgooddatepicker:LGoodDatePicker") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - - annotationProcessor("com.google.auto.service:auto-service") - compileOnly("com.google.auto.service:auto-service-annotations") + api(projects.darklafTheme) + api(projects.darklafPropertyLoader) + api(projects.darklafUtils) + implementation(projects.darklafNativeUtils) + implementation(projects.darklafPlatformBase) + implementation(projects.darklafWindows) + implementation(projects.darklafMacos) + implementation(libs.swingDsl) + implementation(libs.svgSalamander) + implementation(libs.jxlayer) + + compileOnly(libs.nullabilityAnnotations) + compileOnly(libs.swingx) + + testImplementation(libs.svgSalamander) + testImplementation(libs.bundles.test.miglayout) + testImplementation(libs.swingx) + testImplementation(libs.test.rsyntaxtextarea) + testImplementation(libs.test.lGoodDatePicker) + testImplementation(libs.test.junit.api) + testRuntimeOnly(libs.test.junit.engine) + + compileOnly(libs.autoservice.annotations) + annotationProcessor(libs.autoservice.processor) } tasks.test { @@ -44,6 +43,7 @@ fun Jar.includeLicenses() { CrLfSpec(LineEndings.LF).run { into("META-INF") { filteringCharset = "UTF-8" + duplicatesStrategy = DuplicatesStrategy.EXCLUDE textFrom("$rootDir/licenses/DARCULA_LICENSE.txt") textFrom("$rootDir/licenses/INTELLIJ_LICENSE.txt") textFrom("$rootDir/licenses/INTELLIJ_NOTICE.txt") diff --git a/core/src/test/java/test/AbstractImageTest.java b/core/src/test/java/test/AbstractImageTest.java index 1d6f4aa4..ad4f6513 100644 --- a/core/src/test/java/test/AbstractImageTest.java +++ b/core/src/test/java/test/AbstractImageTest.java @@ -30,7 +30,6 @@ import java.nio.file.Files; import javax.imageio.ImageIO; import com.github.weisj.darklaf.util.ImageUtil; -import com.github.weisj.darklaf.util.Scale; import com.github.weisj.darklaf.util.graphics.ScaledImage; abstract class AbstractImageTest { @@ -79,7 +78,7 @@ abstract class AbstractImageTest { Robot robot = new Robot(); Point p = w.getLocationOnScreen(); BufferedImage image = robot.createScreenCapture( - new Rectangle(p.x, p.y, Scale.scaleWidth(w.getWidth()), Scale.scaleHeight(w.getHeight()))); + new Rectangle(p.x, p.y, w.getWidth(), w.getHeight())); ImageIO.write(image, "png", file); return image; } catch (IOException | AWTException e) { diff --git a/core/src/test/java/test/CustomTitleBarTest.java b/core/src/test/java/test/CustomTitleBarTest.java index 5c1bb583..e35fae1a 100644 --- a/core/src/test/java/test/CustomTitleBarTest.java +++ b/core/src/test/java/test/CustomTitleBarTest.java @@ -91,6 +91,7 @@ class CustomTitleBarTest extends AbstractImageTest { }); } }); + f.setAlwaysOnTop(true); f.setVisible(true); frameModifier.accept(f); }); @@ -104,6 +105,11 @@ class CustomTitleBarTest extends AbstractImageTest { Thread.currentThread().interrupt(); } } + try { + new Robot().waitForIdle(); + } catch (AWTException e) { + e.printStackTrace(); + } return frame; } @@ -201,7 +207,7 @@ class CustomTitleBarTest extends AbstractImageTest { @Test @EnabledOnOs({OS.MAC, OS.WINDOWS}) void checkTitleBarHidden() { - SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); + TestUtils.runOnSwingThreadNotThrowing(() -> LafManager.install(new IntelliJTheme())); UIManager.put("macos.coloredTitleBar", true); Assertions.assertTrue(LafManager.isDecorationsEnabled()); checkImage("title_bar_hidden_" + SystemInfo.getOsName(), diff --git a/core/src/test/java/test/NativeLibraryTest.java b/core/src/test/java/test/NativeLibraryTest.java index 6f7a2b07..6b0836be 100644 --- a/core/src/test/java/test/NativeLibraryTest.java +++ b/core/src/test/java/test/NativeLibraryTest.java @@ -44,9 +44,9 @@ class NativeLibraryTest { @EnabledOnOs(OS.WINDOWS) void testWindowsLibraryLoading() { WindowsLibrary library = new TestWindowsLibrary(); - Assertions.assertNotNull(getClass().getResource(library.getX64Path() + library.getLibraryName()), + Assertions.assertNotNull(WindowsLibrary.class.getResource(library.getX64Path() + library.getLibraryName()), "x64 library doesn't exist"); - Assertions.assertNotNull(getClass().getResource(library.getX86Path() + library.getLibraryName()), + Assertions.assertNotNull(WindowsLibrary.class.getResource(library.getX86Path() + library.getLibraryName()), "x86 library doesn't exist"); // Assertions.assertDoesNotThrow(library::updateLibrary); // Assertions.assertTrue(library.isLoaded(), "Windows library isn't loaded"); diff --git a/dependencies-bom/build.gradle.kts b/dependencies-bom/build.gradle.kts deleted file mode 100644 index 04d65fed..00000000 --- a/dependencies-bom/build.gradle.kts +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - `java-platform` -} - -val String.v: String get() = rootProject.extra["$this.version"] as String - -// Note: Gradle allows to declare dependency on "bom" as "api", -// and it makes the constraints to be transitively visible -// However Maven can't express that, so the approach is to use Gradle resolution -// and generate pom files with resolved versions -// See https://github.com/gradle/gradle/issues/9866 - -fun DependencyConstraintHandlerScope.apiv( - notation: String, - versionProp: String = notation.substringAfterLast(':') -) = - "api"("$notation:${versionProp.v}") - -fun DependencyConstraintHandlerScope.runtimev( - notation: String, - versionProp: String = notation.substringAfterLast(':') -) = - "runtimeOnly"("$notation:${versionProp.v}") - -dependencies { - // Parenthesis are needed here: https://github.com/gradle/gradle/issues/9248 - (constraints) { - // api means "the dependency is for both compilation and runtime" - // runtime means "the dependency is only for runtime, not for compilation" - // In other words, marking dependency as "runtime" would avoid accidental - // dependency on it during compilation - apiv("net.java.dev.jna:jna") - apiv("org.swinglabs:jxlayer") - apiv("org.swinglabs:swingx") - apiv("com.formdev:svgSalamander") - apiv("com.fifesoft:rsyntaxtextarea") - apiv("com.miglayout:miglayout-core", "miglayout") - apiv("com.miglayout:miglayout-swing", "miglayout") - apiv("org.junit.jupiter:junit-jupiter-api", "junit") - apiv("org.junit.jupiter:junit-jupiter-engine", "junit") - apiv("com.google.auto.service:auto-service-annotations", "auto-service") - apiv("com.google.auto.service:auto-service", "auto-service") - apiv("com.github.lgooddatepicker:LGoodDatePicker") - apiv("com.github.weisj:swing-dsl-laf-support", "swing-dsl") - apiv("org.jetbrains:annotations") - } -} diff --git a/gradle.properties b/gradle.properties index 9f59e7f8..7bd1e857 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ # suppress inspection "UnusedProperty" for whole file org.gradle.parallel = true +org.gradle.caching = true kotlin.code.style = official # See https://github.com/gradle/gradle/pull/11358 , https://issues.apache.org/jira/browse/INFRA-14923 @@ -10,19 +11,6 @@ systemProp.org.gradle.internal.publish.checksums.insecure = true darklaf.version = 2.6.0 # Plugins -com.github.vlsi.vlsi-release-plugins.version = 1.70 +com.github.vlsi.vlsi-release-plugins.version = 1.74 com.github.autostyle.version = 3.1 nokee.version = 0.4.0 - -# Dependencies -jna.version = 5.5.0 -jxlayer.version = 3.0.4 -miglayout.version = 5.2 -swingx.version = 1.6.1 -svgSalamander.version = 1.1.2.4 -junit.version = 5.6.2 -rsyntaxtextarea.version = 3.1.1 -auto-service.version = 1.0-rc7 -LGoodDatePicker.version = 11.0.2 -swing-dsl.version = latest.integration -annotations.version = 16.0.2 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..f465e329 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,42 @@ +[versions] +jna = "5.5.0" +jxlayer = "3.0.4" +swingx = "1.6.1" +miglayout = "5.2" +svgSalamander = "1.1.2.4" +rsyntaxtextarea = "3.1.1" +junit = "5.6.2" +autoservice = "1.0-rc7" +miglayout = "5.2" +lGoodDatePicker = "11.0.2" +swingDsl = "latest.integration" +nullabilityAnnotations = "16.0.2" +macOSFramework = "latest.integration" + +[libraries] +jna = { module = "net.java.dev.jna:jna", version.ref = "jna" } +jxlayer = { module = "org.swinglabs:jxlayer", version.ref = "jxlayer" } +swingx = { module = "org.swinglabs:swingx", version.ref = "swingx" } +svgSalamander = { module = "com.formdev:svgSalamander", version.ref = "svgSalamander" } +swingDsl = { module = "com.github.weisj:swing-dsl-laf-support", version.ref = "swingDsl" } +autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "autoservice" } +autoservice-processor = { module = "com.google.auto.service:auto-service", version.ref = "autoservice" } +nullabilityAnnotations = { module = "org.jetbrains:annotations", version.ref = "nullabilityAnnotations" } + +# 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-appKit = { module = "dev.nokee.framework:AppKit", version.ref = "macOSFramework" } +macos-cocoa = { module = "dev.nokee.framework:Cocoa", version.ref = "macOSFramework" } + +# Test libraries +test-junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } +test-junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } +test-miglayout-core = { module = "com.miglayout:miglayout-core", version.ref = "miglayout" } +test-miglayout-swing = { module = "com.miglayout:miglayout-swing", version.ref = "miglayout" } +test-lGoodDatePicker = { module = "com.github.lgooddatepicker:LGoodDatePicker", version.ref = "lGoodDatePicker" } +test-rsyntaxtextarea = { module = "com.fifesoft:rsyntaxtextarea", version.ref = "rsyntaxtextarea" } + +[bundles] +test-miglayout = ["test-miglayout-core", "test-miglayout-swing"] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c2de0917..f371643e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ -distributionBase = GRADLE_USER_HOME -distributionPath = wrapper/dists -distributionUrl = https\://services.gradle.org/distributions/gradle-6.5-bin.zip -zipStoreBase = GRADLE_USER_HOME -zipStorePath = wrapper/dists +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c515..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 5093609d..107acd32 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/macos/build.gradle.kts b/macos/build.gradle.kts index 9cdfec4e..6233fb70 100644 --- a/macos/build.gradle.kts +++ b/macos/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.util.VersionNumber + plugins { java id("dev.nokee.jni-library") @@ -7,29 +9,32 @@ plugins { } library { - val minOs = "10.10" - val frameworkVersion = "10.15" - dependencies { - jvmImplementation(project(":darklaf-theme")) - jvmImplementation(project(":darklaf-native-utils")) - jvmImplementation(project(":darklaf-utils")) - jvmImplementation(project(":darklaf-platform-base")) - jvmImplementation(project(":darklaf-property-loader")) - nativeImplementation("dev.nokee.framework:JavaVM:[$frameworkVersion,)") - nativeImplementation("dev.nokee.framework:JavaVM:[$frameworkVersion,)") { - capabilities { - requireCapability("JavaVM:JavaNativeFoundation:[$frameworkVersion,)") + jvmImplementation(projects.darklafTheme) + jvmImplementation(projects.darklafNativeUtils) + 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) + } } } - nativeImplementation("dev.nokee.framework:AppKit:[$frameworkVersion,)") - nativeImplementation("dev.nokee.framework:Cocoa:[$frameworkVersion,)") } targetMachines.addAll(machines.macOS.x86_64) variants.configureEach { resourcePath.set("com/github/weisj/darklaf/platform/${project.name}/${targetMachine.variantName}") sharedLibrary { + val minOs = "10.10" compileTasks.configureEach { compilerArgs.addAll("-mmacosx-version-min=$minOs") // Build type not modeled yet, assuming release diff --git a/native-utils/build.gradle.kts b/native-utils/build.gradle.kts index 48c13fe4..191e1488 100644 --- a/native-utils/build.gradle.kts +++ b/native-utils/build.gradle.kts @@ -9,6 +9,7 @@ tasks.jar { CrLfSpec(LineEndings.LF).run { into("META-INF") { filteringCharset = "UTF-8" + duplicatesStrategy = DuplicatesStrategy.EXCLUDE textFrom("$rootDir/licenses/NATIVEUTIL_LICENSE.txt") } } diff --git a/property-loader/build.gradle.kts b/property-loader/build.gradle.kts index 453320d9..c2b28ba0 100644 --- a/property-loader/build.gradle.kts +++ b/property-loader/build.gradle.kts @@ -3,10 +3,10 @@ plugins { } dependencies { - api(project(":darklaf-utils")) - implementation("com.formdev:svgSalamander") - testImplementation("org.junit.jupiter:junit-jupiter-api") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") + api(projects.darklafUtils) + implementation(libs.svgSalamander) + testImplementation(libs.test.junit.api) + testRuntimeOnly(libs.test.junit.engine) } tasks.test { diff --git a/settings.gradle.kts b/settings.gradle.kts index 156537cc..4a9dfec0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,8 +1,10 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +enableFeaturePreview("VERSION_CATALOGS") + pluginManagement { plugins { fun String.v() = extra["$this.version"].toString() - fun PluginDependenciesSpec.idv(id: String, key: String = id) = id(id) version key.v() - + fun idv(id: String, key: String = id) = id(id) version key.v() idv("com.github.autostyle") idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins") idv("com.github.vlsi.gradle-extensions", "com.github.vlsi.vlsi-release-plugins") @@ -10,11 +12,9 @@ pluginManagement { idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins") } } - rootProject.name = "darklaf" include( - "dependencies-bom", "annotations", "annotations-processor", "native-utils", diff --git a/theme/build.gradle.kts b/theme/build.gradle.kts index 8d937d3e..f882c2a3 100644 --- a/theme/build.gradle.kts +++ b/theme/build.gradle.kts @@ -3,12 +3,12 @@ plugins { } dependencies { - implementation(project(":darklaf-property-loader")) - implementation(project(":darklaf-utils")) + implementation(projects.darklafPropertyLoader) + implementation(projects.darklafUtils) - compileOnly(project(":darklaf-annotations")) - annotationProcessor(project(":darklaf-annotations-processor")) + compileOnly(projects.darklafAnnotations) + annotationProcessor(projects.darklafAnnotationsProcessor) - annotationProcessor("com.google.auto.service:auto-service") - compileOnly("com.google.auto.service:auto-service-annotations") + compileOnly(libs.autoservice.annotations) + annotationProcessor(libs.autoservice.processor) } diff --git a/windows/build.gradle.kts b/windows/build.gradle.kts index a61d1989..2f98f0bc 100644 --- a/windows/build.gradle.kts +++ b/windows/build.gradle.kts @@ -8,12 +8,12 @@ plugins { library { dependencies { - jvmImplementation(project(":darklaf-native-utils")) - jvmImplementation(project(":darklaf-utils")) - jvmImplementation(project(":darklaf-platform-base")) - jvmImplementation(project(":darklaf-theme")) - jvmImplementation(project(":darklaf-property-loader")) - jvmImplementation("net.java.dev.jna:jna") + jvmImplementation(projects.darklafNativeUtils) + jvmImplementation(projects.darklafUtils) + jvmImplementation(projects.darklafPlatformBase) + jvmImplementation(projects.darklafTheme) + jvmImplementation(projects.darklafPropertyLoader) + jvmLibImplementation(libs.jna) } targetMachines.addAll(machines.windows.x86, machines.windows.x86_64) @@ -23,17 +23,8 @@ library { compileTasks.configureEach { compilerArgs.addAll(toolChain.map { when (it) { - is Gcc, is Clang -> listOf("--std=c++11", "-Wall", "-Wextra", "-pedantic", "-Werror") - is VisualCpp -> listOf("/EHsc", "/W4", "/permissive", "/WX") - else -> emptyList() - } - }) - - // Build type not modeled yet, assuming release - compilerArgs.addAll(toolChain.map { - when (it) { - is Gcc, is Clang -> listOf("-O2") - is VisualCpp -> listOf("/O2") + is Gcc, is Clang -> listOf("--std=c++17", "-Wall", "-Wextra", "-pedantic", "-O2") + is VisualCpp -> listOf("/std:c++17", "/EHsc", "/W4", "/permissive", "/WX", "/02") else -> emptyList() } }) @@ -41,7 +32,7 @@ library { linkTask.configure { linkerArgs.addAll(toolChain.map { when (it) { - is Gcc, is Clang -> listOf("-ldwmapi", "-lGdi32", "-luser32", "-ladvapi32", "-Shell32") + is Gcc, is Clang -> listOf("-ldwmapi", "-lGdi32", "-luser32", "-ladvapi32", "-lShell32") is VisualCpp -> listOf("dwmapi.lib", "user32.lib", "Gdi32.lib", "Advapi32.lib", "Shell32.lib") else -> emptyList() }