diff --git a/annotations-processor/build.gradle.kts b/annotations-processor/build.gradle.kts index 67135cbe..a8c1818d 100644 --- a/annotations-processor/build.gradle.kts +++ b/annotations-processor/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/annotations/build.gradle.kts b/annotations/build.gradle.kts index 369a64c2..c87dad96 100644 --- a/annotations/build.gradle.kts +++ b/annotations/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/build.gradle.kts b/build.gradle.kts index c7a8e915..b088d9c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -172,8 +172,8 @@ allprojects { plugins.withType { configure { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 withSourcesJar() if (!skipJavadoc && isRelease) { withJavadocJar() @@ -271,14 +271,6 @@ allprojects { withType().configureEach { (options as StandardJavadocDocletOptions).apply { - // -add-exports requires target 9 - // The library is built with target=1.8, so add-exports - if (project.the().targetCompatibility.isJava9Compatible) { - addStringOption("-add-exports", "java.desktop/sun.swing=ALL-UNNAMED") - addStringOption("-add-exports", "java.desktop/sun.awt=ALL-UNNAMED") - addStringOption("-add-exports", "java.desktop/com.sun.java.swing=ALL-UNNAMED") - addStringOption("-add-exports", "java.desktop/sun.awt.shell=ALL-UNNAMED") - } quiet() locale = "en" docEncoding = "UTF-8" diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 58ba1948..18e765df 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -28,9 +28,5 @@ gradlePlugin { id = "apple-m1-toolchain" implementationClass = "AppleM1ToolChainRule" } - create("module-info-compile") { - id = "module-info-compile" - implementationClass = "ModuleInfoCompilePlugin" - } } } diff --git a/compatibility/build.gradle.kts b/compatibility/build.gradle.kts index 54ccf642..2679b5d4 100644 --- a/compatibility/build.gradle.kts +++ b/compatibility/build.gradle.kts @@ -3,19 +3,9 @@ import com.github.vlsi.gradle.crlf.LineEndings plugins { `java-library` - `module-info-compile` id("com.github.vlsi.crlf") } -configure { - version = JavaVersion.VERSION_11 - extraArgs = listOf( - "--add-exports", - "java.desktop/sun.awt=darklaf.compatibility" - ) - stubModule("darklaf.core") -} - dependencies { implementation(projects.darklafUtils) implementation(projects.darklafPlatformBase) diff --git a/compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java b/compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java index cc2c7d90..fdc4a51c 100644 --- a/compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java +++ b/compatibility/src/main/java/com/github/weisj/darklaf/compatibility/SwingUtil.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2019-2022 Jannis Weis + * Copyright (c) 2019-2023 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -31,9 +31,6 @@ import java.awt.Toolkit; import java.awt.Window; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.util.logging.Logger; import javax.swing.JComponent; @@ -48,9 +45,9 @@ import javax.swing.plaf.synth.SynthContext; import javax.swing.plaf.synth.SynthGraphicsUtils; import javax.swing.plaf.synth.SynthStyle; +import jdk.swing.interop.SwingInterOpUtils; + import com.github.weisj.darklaf.platform.SystemInfo; -import com.github.weisj.darklaf.util.Lambdas; -import com.github.weisj.darklaf.util.LazyValue; import com.github.weisj.darklaf.util.LogUtil; import com.intellij.util.ui.UIUtilities; @@ -62,31 +59,12 @@ public final class SwingUtil { private SwingUtil() {} - private static boolean swingInteropAvailable; - private static Class swingInteropClass; - private static final LazyValue grabMethod = new LazyValue<>( - Lambdas.orDefault(() -> MethodHandles.lookup().findStatic(swingInteropClass, "grab", - MethodType.methodType(void.class, Toolkit.class, Window.class)), null)); - private static final LazyValue ungrabMethod = new LazyValue<>( - Lambdas.orDefault(() -> MethodHandles.lookup().findStatic(swingInteropClass, "ungrab", - MethodType.methodType(void.class, Toolkit.class, Window.class)), null)); - - static { - try { - swingInteropClass = Class.forName("jdk.swing.interop.SwingInterOpUtils"); - swingInteropAvailable = true; - } catch (Throwable e) { - swingInteropAvailable = false; - } - LOGGER.fine("SwingInterOpUtils available: " + swingInteropAvailable); - } - public static boolean isSunToolkit(final Toolkit toolkit) { return toolkit != null && isInstanceOf(toolkit.getClass(), "sun.awt.SunToolkit"); } public static boolean isUngrabEvent(final AWTEvent event) { - return event != null && isInstanceOf(event.getClass(), "sun.awt.UngrabEvent"); + return SwingInterOpUtils.isUngrabEvent(event); } private static boolean isInstanceOf(final Class cls, final String type) { @@ -99,31 +77,11 @@ public final class SwingUtil { } public static void grab(final Toolkit toolkit, final Window window) { - if (swingInteropAvailable) { - try { - grabMethod.get().invokeExact(toolkit, window); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } else { - if (toolkit instanceof sun.awt.SunToolkit) { - ((sun.awt.SunToolkit) toolkit).grab(window); - } - } + SwingInterOpUtils.grab(toolkit, window); } public static void ungrab(final Toolkit toolkit, final Window window) { - if (swingInteropAvailable) { - try { - ungrabMethod.get().invokeExact(toolkit, window); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } else { - if (toolkit instanceof sun.awt.SunToolkit) { - ((sun.awt.SunToolkit) toolkit).ungrab(window); - } - } + SwingInterOpUtils.ungrab(toolkit, window); } public static void drawStringUnderlineCharAt(final JComponent c, final Graphics g, diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 02f6d034..6eddccfe 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,7 +4,6 @@ import com.github.vlsi.gradle.properties.dsl.props plugins { `java-library` - `module-info-compile` id("com.github.vlsi.crlf") } @@ -41,12 +40,12 @@ dependencies { testCompileOnly(libs.nullabilityAnnotations) } -moduleInfo { - modularExec { - addExports.add("java.desktop/com.sun.java.swing=darklaf.core") - openTestPackagesTo("darklaf.properties") - } -} +// moduleInfo { +// modularExec { +// addExports.add("java.desktop/com.sun.java.swing=darklaf.core") +// openTestPackagesTo("darklaf.properties") +// } +// } tasks.test { doFirst { diff --git a/iconset/build.gradle.kts b/iconset/build.gradle.kts index 85cb8007..29d283dd 100644 --- a/iconset/build.gradle.kts +++ b/iconset/build.gradle.kts @@ -3,7 +3,6 @@ import com.github.vlsi.gradle.crlf.LineEndings plugins { `java-library` - `module-info-compile` id("com.github.vlsi.crlf") } diff --git a/macos/build.gradle.kts b/macos/build.gradle.kts index 9dee7513..3dd532da 100644 --- a/macos/build.gradle.kts +++ b/macos/build.gradle.kts @@ -1,6 +1,5 @@ plugins { java - `module-info-compile` id("dev.nokee.jni-library") id("dev.nokee.objective-cpp-language") `uber-jni-jar` @@ -8,12 +7,6 @@ plugins { `apple-m1-toolchain` } -moduleInfo { - stubModule("darklaf.core") - stubModule("darklaf.platform.preferences") - stubModule("darklaf.platform.decorations") -} - val nativeResourcePath = "com/github/weisj/darklaf/platform/${project.name}" library { @@ -22,8 +15,8 @@ library { jvmImplementation(projects.darklafUtils) jvmImplementation(projects.darklafNativeUtils) jvmImplementation(projects.darklafPlatformBase) - nativeLibImplementation(macOsFrameworks.appKit) - nativeLibImplementation(macOsFrameworks.cocoa) +// nativeLibImplementation(macOsFrameworks.appKit) +// nativeLibImplementation(macOsFrameworks.cocoa) } targetMachines.addAll(machines.macOS.x86_64, machines.macOS.architecture("arm64")) @@ -40,9 +33,11 @@ library { linkTask.configure { linkerArgs.addAll( "-lobjc", - "-mmacosx-version-min=$minOs" - // "-framework", "AppKit", - // "-framework", "Cocoa", + "-mmacosx-version-min=$minOs", + "-framework", + "AppKit", + "-framework", + "Cocoa" ) } } diff --git a/native-utils/build.gradle.kts b/native-utils/build.gradle.kts index 84359ad1..191e1488 100644 --- a/native-utils/build.gradle.kts +++ b/native-utils/build.gradle.kts @@ -3,7 +3,6 @@ import com.github.vlsi.gradle.crlf.LineEndings plugins { `java-library` - `module-info-compile` } tasks.jar { diff --git a/platform-base/build.gradle.kts b/platform-base/build.gradle.kts index 3124513a..f6727627 100644 --- a/platform-base/build.gradle.kts +++ b/platform-base/build.gradle.kts @@ -1,4 +1,3 @@ plugins { `java-library` - `module-info-compile` } diff --git a/platform-decorations/build.gradle.kts b/platform-decorations/build.gradle.kts index 770b234d..4582bb8a 100644 --- a/platform-decorations/build.gradle.kts +++ b/platform-decorations/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/platform-preferences/build.gradle.kts b/platform-preferences/build.gradle.kts index f62395af..bc9914d4 100644 --- a/platform-preferences/build.gradle.kts +++ b/platform-preferences/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/property-loader/build.gradle.kts b/property-loader/build.gradle.kts index 9e6fcfa2..2f62a60d 100644 --- a/property-loader/build.gradle.kts +++ b/property-loader/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/theme-spec/build.gradle.kts b/theme-spec/build.gradle.kts index 3124513a..f6727627 100644 --- a/theme-spec/build.gradle.kts +++ b/theme-spec/build.gradle.kts @@ -1,4 +1,3 @@ plugins { `java-library` - `module-info-compile` } diff --git a/theme/build.gradle.kts b/theme/build.gradle.kts index 53f06735..4b9c050b 100644 --- a/theme/build.gradle.kts +++ b/theme/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/utils/build.gradle.kts b/utils/build.gradle.kts index 22088f50..946649b8 100644 --- a/utils/build.gradle.kts +++ b/utils/build.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `module-info-compile` } dependencies { diff --git a/windows/build.gradle.kts b/windows/build.gradle.kts index a149fac7..b46c3db3 100644 --- a/windows/build.gradle.kts +++ b/windows/build.gradle.kts @@ -1,18 +1,11 @@ plugins { java - `module-info-compile` id("dev.nokee.jni-library") id("dev.nokee.cpp-language") `uber-jni-jar` `use-prebuilt-binaries` } -moduleInfo { - stubModule("darklaf.core") - stubModule("darklaf.platform.preferences") - stubModule("darklaf.platform.decorations") -} - library { dependencies { jvmImplementation(projects.darklafNativeUtils)