Browse Source

Build: Update to Gradle 7

Upgrade gradle version to 7.0. Make use of typesafe project and library accessors. These replace the current bom project.
Handle different xCode version on macOS.
pull/245/head
weisj 4 years ago committed by Jannis Weis
parent
commit
5580656e79
  1. 4
      .github/workflows/gradle.yml
  2. 2
      .github/workflows/snapshot.yml
  3. 2
      .gitignore
  4. 2
      annotations-processor/build.gradle.kts
  5. 23
      build.gradle.kts
  6. 2
      buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt
  7. 48
      buildSrc/src/main/kotlin/JniUtils.kt
  8. 42
      buildSrc/src/main/kotlin/UberJniJarPlugin.kt
  9. 20
      buildSrc/src/main/kotlin/XCode.kt
  10. 50
      core/build.gradle.kts
  11. 3
      core/src/test/java/test/AbstractImageTest.java
  12. 8
      core/src/test/java/test/CustomTitleBarTest.java
  13. 4
      core/src/test/java/test/NativeLibraryTest.java
  14. 47
      dependencies-bom/build.gradle.kts
  15. 16
      gradle.properties
  16. 42
      gradle/libs.versions.toml
  17. BIN
      gradle/wrapper/gradle-wrapper.jar
  18. 10
      gradle/wrapper/gradle-wrapper.properties
  19. 2
      gradlew
  20. 21
      gradlew.bat
  21. 33
      macos/build.gradle.kts
  22. 1
      native-utils/build.gradle.kts
  23. 8
      property-loader/build.gradle.kts
  24. 8
      settings.gradle.kts
  25. 12
      theme/build.gradle.kts
  26. 27
      windows/build.gradle.kts

4
.github/workflows/gradle.yml

@ -45,7 +45,9 @@ jobs:
with: with:
java-version: 8 java-version: 8
- name: Build & Test - 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 - name: Upload Test Results
if: ${{ always() }} if: ${{ always() }}
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1

2
.github/workflows/snapshot.yml

@ -25,7 +25,7 @@ jobs:
java-version: 8 java-version: 8
- name: Publish - name: Publish
env: 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_GIT: "-PghGitSourceUsername=${{ secrets.GH_GIT_USERNAME }} -PghGitSourcePassword=${{ secrets.GITHUB_TOKEN }}"
PROPS_NEXUS: "-PghNexusUsername=${{ secrets.GH_NEXUS_USERNAME }} -PghNexusPassword=${{ secrets.GH_NEXUS_PASSWORD }}" 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 }}" PROPS_SIGNING: "-PuseInMemoryKey=true -Psigning.inMemoryKey=${{ secrets.IN_MEMORY_KEY }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }}"

2
.gitignore vendored

@ -25,6 +25,8 @@ repo/
/buildSrc/out/ /buildSrc/out/
/*/out/ /*/out/
*.iml *.iml
*.ipr
*.iws
.run/ .run/
# VS Code # VS Code

2
annotations-processor/build.gradle.kts

@ -3,5 +3,5 @@ plugins {
} }
dependencies { dependencies {
api(project(":darklaf-annotations")) api(projects.darklafAnnotations)
} }

23
build.gradle.kts

@ -9,6 +9,7 @@ import com.github.vlsi.gradle.publishing.dsl.simplifyXml
import com.github.vlsi.gradle.publishing.dsl.versionFromResolution import com.github.vlsi.gradle.publishing.dsl.versionFromResolution
plugins { plugins {
idea
id("com.github.autostyle") id("com.github.autostyle")
id("com.github.vlsi.crlf") id("com.github.vlsi.crlf")
id("com.github.vlsi.gradle-extensions") id("com.github.vlsi.gradle-extensions")
@ -16,9 +17,9 @@ plugins {
} }
val skipJavadoc by props() val skipJavadoc by props()
val enableMavenLocal by props() val enableMavenLocal by props(false)
val enableGradleMetadata by props() val enableGradleMetadata by props()
val skipAutostyle by props() val skipAutostyle by props(false)
val isRelease = project.stringProperty("release").toBool() val isRelease = project.stringProperty("release").toBool()
val snapshotName by props("") val snapshotName by props("")
@ -56,6 +57,7 @@ tasks.closeRepository.configure { enabled = isRelease }
val buildVersion = "$projectVersion$snapshotIdentifier${releaseParams.snapshotSuffix}" val buildVersion = "$projectVersion$snapshotIdentifier${releaseParams.snapshotSuffix}"
println("Building: Darklaf $buildVersion") println("Building: Darklaf $buildVersion")
println(" JDK: " + System.getProperty("java.home")) println(" JDK: " + System.getProperty("java.home"))
println(" Gradle: " + gradle.gradleVersion)
fun BaseFormatExtension.license(addition: String = "") { fun BaseFormatExtension.license(addition: String = "") {
val extra = if (addition.isEmpty()) "" else "\n$addition" val extra = if (addition.isEmpty()) "" else "\n$addition"
@ -107,9 +109,10 @@ allprojects {
val githubAccessToken by props("") val githubAccessToken by props("")
plugins.withType<UsePrebuiltBinariesWhenUnbuildablePlugin> { plugins.withType<UsePrebuiltBinariesWhenUnbuildablePlugin> {
val failIfLibraryMissing by props(false)
prebuiltBinaries { prebuiltBinaries {
prebuiltLibrariesFolder = "pre-build-libraries" prebuiltLibrariesFolder = "pre-build-libraries"
failIfLibraryIsMissing = false failIfLibraryIsMissing = failIfLibraryMissing
github( github(
user = "weisj", user = "weisj",
repository = "darklaf", repository = "darklaf",
@ -168,13 +171,6 @@ allprojects {
fileMode = "664".toInt(8) fileMode = "664".toInt(8)
} }
plugins.withType<JavaLibraryPlugin> {
dependencies {
"api"(platform(project(":darklaf-dependencies-bom")))
"annotationProcessor"(platform(project(":darklaf-dependencies-bom")))
}
}
if (!enableGradleMetadata) { if (!enableGradleMetadata) {
tasks.withType<GenerateModuleMetadata> { tasks.withType<GenerateModuleMetadata> {
enabled = false enabled = false
@ -227,6 +223,7 @@ allprojects {
from(source) { from(source) {
include("**/*.properties") include("**/*.properties")
filteringCharset = "UTF-8" filteringCharset = "UTF-8"
duplicatesStrategy = DuplicatesStrategy.INCLUDE
// apply native2ascii conversion since Java 8 expects properties to have ascii symbols only // apply native2ascii conversion since Java 8 expects properties to have ascii symbols only
filter(org.apache.tools.ant.filters.EscapeUnicode::class) filter(org.apache.tools.ant.filters.EscapeUnicode::class)
} }
@ -289,10 +286,8 @@ allprojects {
} }
configure<PublishingExtension> { configure<PublishingExtension> {
if (project.path.startsWith(":darklaf-dependencies-bom") || if (project.path == ":") {
project.path == ":" // Skip the root project
) {
// We don't it to Central for now
return@configure return@configure
} }

2
buildSrc/src/main/kotlin/DownloadPrebuiltBinariesTask.kt

@ -117,7 +117,7 @@ open class DownloadPrebuiltBinariesTask @Inject constructor(
private val Json.latestRun: Json? private val Json.latestRun: Json?
get() { get() {
val runs = this["workflow_runs"] as List<Json> val runs = this["workflow_runs"] as? List<Json> ?: return null
val candidates = runs.asSequence().filter { val candidates = runs.asSequence().filter {
val completed = "completed" == it["status"] val completed = "completed" == it["status"]
val success = "success" == it["conclusion"] val success = "success" == it["conclusion"]

48
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.OperatingSystemFamily
import dev.nokee.runtime.nativebase.TargetMachine import dev.nokee.runtime.nativebase.TargetMachine
import org.gradle.api.Action
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.Project 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<MinimalExternalModuleDependency>) {
jvmImplementation(notation.map { it.dependencyNotation() }.get())
}
fun JniLibraryDependencies.nativeLibImplementation(notation: Provider<MinimalExternalModuleDependency>) {
nativeImplementation(notation.map { it.dependencyNotation() }.get())
}
fun JniLibraryDependencies.nativeLibImplementation(
notation: Provider<MinimalExternalModuleDependency>,
action: Action<in ModuleDependency>
) {
nativeImplementation(notation.map { it.dependencyNotation() }.get(), action)
}
fun ModuleDependencyCapabilitiesHandler.requireLibCapability(notation: Provider<MinimalExternalModuleDependency>) {
requireCapabilities(notation.get().dependencyNotation())
}
val TargetMachine.variantName: String val TargetMachine.variantName: String
get() { get() {
@ -11,11 +39,25 @@ val TargetMachine.variantName: String
operatingSystemFamily.isMacOS -> "macos" operatingSystemFamily.isMacOS -> "macos"
else -> GradleException("Unknown operating system family '${operatingSystemFamily}'.") else -> GradleException("Unknown operating system family '${operatingSystemFamily}'.")
} }
val architecture = if (architecture.is32Bit) "x86" else "x86-64" return "$osFamily-$architectureString"
return "$osFamily-$architecture"
} }
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.isWindows -> "${project.name}.dll"
osFamily.isLinux -> "lib${project.name}.so" osFamily.isLinux -> "lib${project.name}.so"
osFamily.isMacOS -> "lib${project.name}.dylib" osFamily.isMacOS -> "lib${project.name}.dylib"

42
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.JniJarBinary
import dev.nokee.platform.jni.JniLibrary
import dev.nokee.platform.jni.JniLibraryExtension import dev.nokee.platform.jni.JniLibraryExtension
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.FileTree
import org.gradle.api.provider.Provider import org.gradle.api.provider.Provider
import org.gradle.jvm.tasks.Jar import org.gradle.jvm.tasks.Jar
import dev.nokee.runtime.nativebase.TargetMachine
class UberJniJarPlugin : Plugin<Project> { class UberJniJarPlugin : Plugin<Project> {
@ -20,34 +19,17 @@ class UberJniJarPlugin : Plugin<Project> {
val project = task.project val project = task.project
val logger = task.logger val logger = task.logger
val library = project.extensions.getByType(JniLibraryExtension::class.java) 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.") logger.info("${project.name}: Merging binaries into the JVM Jar.")
when (library.targetMachines.get().size) { task.from(library.variants.flatMap { variant ->
0 -> logger.info("No native target for project ${project.name}") if (variant.targetMachine.targetsHost) {
1 -> { variant.binaries.withType(JniJarBinary::class.java)
library.variants.configureEach { .map { it.asZipTree(project) }.get()
task.into(this@configureEach.resourcePath) { } else listOf()
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 })
}
}
}
}
} }
private fun VariantView<JniLibrary>.withTarget(target: TargetMachine): Provider<JniLibrary> { private fun JarBinary.asZipTree(project: Project): Provider<FileTree> =
return filter { it.targetMachine == target }.map { jarTask.map { project.zipTree(it.archiveFile) }
check(it.size == 1)
it.first()
}
}
} }

20
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)
}

50
core/build.gradle.kts

@ -7,31 +7,30 @@ plugins {
} }
dependencies { dependencies {
api(project(":darklaf-theme")) api(projects.darklafTheme)
api(project(":darklaf-property-loader")) api(projects.darklafPropertyLoader)
api(project(":darklaf-utils")) api(projects.darklafUtils)
implementation(project(":darklaf-native-utils")) implementation(projects.darklafNativeUtils)
implementation(project(":darklaf-platform-base")) implementation(projects.darklafPlatformBase)
implementation(project(":darklaf-windows")) implementation(projects.darklafWindows)
implementation(project(":darklaf-macos")) implementation(projects.darklafMacos)
implementation("org.swinglabs:jxlayer") implementation(libs.swingDsl)
implementation("com.formdev:svgSalamander") implementation(libs.svgSalamander)
implementation("com.github.weisj:swing-dsl-laf-support") implementation(libs.jxlayer)
compileOnly("org.jetbrains:annotations") compileOnly(libs.nullabilityAnnotations)
compileOnly("org.swinglabs:swingx") compileOnly(libs.swingx)
testImplementation("com.formdev:svgSalamander") testImplementation(libs.svgSalamander)
testImplementation("com.miglayout:miglayout-core") testImplementation(libs.bundles.test.miglayout)
testImplementation("com.miglayout:miglayout-swing") testImplementation(libs.swingx)
testImplementation("org.swinglabs:swingx") testImplementation(libs.test.rsyntaxtextarea)
testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation(libs.test.lGoodDatePicker)
testImplementation("com.fifesoft:rsyntaxtextarea") testImplementation(libs.test.junit.api)
testImplementation("com.github.lgooddatepicker:LGoodDatePicker") testRuntimeOnly(libs.test.junit.engine)
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
compileOnly(libs.autoservice.annotations)
annotationProcessor("com.google.auto.service:auto-service") annotationProcessor(libs.autoservice.processor)
compileOnly("com.google.auto.service:auto-service-annotations")
} }
tasks.test { tasks.test {
@ -44,6 +43,7 @@ fun Jar.includeLicenses() {
CrLfSpec(LineEndings.LF).run { CrLfSpec(LineEndings.LF).run {
into("META-INF") { into("META-INF") {
filteringCharset = "UTF-8" filteringCharset = "UTF-8"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
textFrom("$rootDir/licenses/DARCULA_LICENSE.txt") textFrom("$rootDir/licenses/DARCULA_LICENSE.txt")
textFrom("$rootDir/licenses/INTELLIJ_LICENSE.txt") textFrom("$rootDir/licenses/INTELLIJ_LICENSE.txt")
textFrom("$rootDir/licenses/INTELLIJ_NOTICE.txt") textFrom("$rootDir/licenses/INTELLIJ_NOTICE.txt")

3
core/src/test/java/test/AbstractImageTest.java

@ -30,7 +30,6 @@ import java.nio.file.Files;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import com.github.weisj.darklaf.util.ImageUtil; import com.github.weisj.darklaf.util.ImageUtil;
import com.github.weisj.darklaf.util.Scale;
import com.github.weisj.darklaf.util.graphics.ScaledImage; import com.github.weisj.darklaf.util.graphics.ScaledImage;
abstract class AbstractImageTest { abstract class AbstractImageTest {
@ -79,7 +78,7 @@ abstract class AbstractImageTest {
Robot robot = new Robot(); Robot robot = new Robot();
Point p = w.getLocationOnScreen(); Point p = w.getLocationOnScreen();
BufferedImage image = robot.createScreenCapture( 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); ImageIO.write(image, "png", file);
return image; return image;
} catch (IOException | AWTException e) { } catch (IOException | AWTException e) {

8
core/src/test/java/test/CustomTitleBarTest.java

@ -91,6 +91,7 @@ class CustomTitleBarTest extends AbstractImageTest {
}); });
} }
}); });
f.setAlwaysOnTop(true);
f.setVisible(true); f.setVisible(true);
frameModifier.accept(f); frameModifier.accept(f);
}); });
@ -104,6 +105,11 @@ class CustomTitleBarTest extends AbstractImageTest {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
} }
try {
new Robot().waitForIdle();
} catch (AWTException e) {
e.printStackTrace();
}
return frame; return frame;
} }
@ -201,7 +207,7 @@ class CustomTitleBarTest extends AbstractImageTest {
@Test @Test
@EnabledOnOs({OS.MAC, OS.WINDOWS}) @EnabledOnOs({OS.MAC, OS.WINDOWS})
void checkTitleBarHidden() { void checkTitleBarHidden() {
SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); TestUtils.runOnSwingThreadNotThrowing(() -> LafManager.install(new IntelliJTheme()));
UIManager.put("macos.coloredTitleBar", true); UIManager.put("macos.coloredTitleBar", true);
Assertions.assertTrue(LafManager.isDecorationsEnabled()); Assertions.assertTrue(LafManager.isDecorationsEnabled());
checkImage("title_bar_hidden_" + SystemInfo.getOsName(), checkImage("title_bar_hidden_" + SystemInfo.getOsName(),

4
core/src/test/java/test/NativeLibraryTest.java

@ -44,9 +44,9 @@ class NativeLibraryTest {
@EnabledOnOs(OS.WINDOWS) @EnabledOnOs(OS.WINDOWS)
void testWindowsLibraryLoading() { void testWindowsLibraryLoading() {
WindowsLibrary library = new TestWindowsLibrary(); 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"); "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"); "x86 library doesn't exist");
// Assertions.assertDoesNotThrow(library::updateLibrary); // Assertions.assertDoesNotThrow(library::updateLibrary);
// Assertions.assertTrue(library.isLoaded(), "Windows library isn't loaded"); // Assertions.assertTrue(library.isLoaded(), "Windows library isn't loaded");

47
dependencies-bom/build.gradle.kts

@ -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")
}
}

16
gradle.properties

@ -1,5 +1,6 @@
# suppress inspection "UnusedProperty" for whole file # suppress inspection "UnusedProperty" for whole file
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official kotlin.code.style = official
# See https://github.com/gradle/gradle/pull/11358 , https://issues.apache.org/jira/browse/INFRA-14923 # 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 darklaf.version = 2.6.0
# Plugins # 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 com.github.autostyle.version = 3.1
nokee.version = 0.4.0 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

42
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"]

BIN
gradle/wrapper/gradle-wrapper.jar vendored

Binary file not shown.

10
gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase = GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath = wrapper/dists distributionPath=wrapper/dists
distributionUrl = https\://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase = GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath = wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored

@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

21
gradlew.bat vendored

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 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_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,21 +64,6 @@ echo location of your Java installation.
goto fail 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 :execute
@rem Setup the command line @rem Setup the command line
@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @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 :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

33
macos/build.gradle.kts

@ -1,3 +1,5 @@
import org.gradle.util.VersionNumber
plugins { plugins {
java java
id("dev.nokee.jni-library") id("dev.nokee.jni-library")
@ -7,29 +9,32 @@ plugins {
} }
library { library {
val minOs = "10.10"
val frameworkVersion = "10.15"
dependencies { dependencies {
jvmImplementation(project(":darklaf-theme")) jvmImplementation(projects.darklafTheme)
jvmImplementation(project(":darklaf-native-utils")) jvmImplementation(projects.darklafNativeUtils)
jvmImplementation(project(":darklaf-utils")) jvmImplementation(projects.darklafUtils)
jvmImplementation(project(":darklaf-platform-base")) jvmImplementation(projects.darklafPlatformBase)
jvmImplementation(project(":darklaf-property-loader")) jvmImplementation(projects.darklafPropertyLoader)
nativeImplementation("dev.nokee.framework:JavaVM:[$frameworkVersion,)") nativeLibImplementation(libs.macos.appKit)
nativeImplementation("dev.nokee.framework:JavaVM:[$frameworkVersion,)") { nativeLibImplementation(libs.macos.cocoa)
capabilities { val xCodeVersion = getXCodeVersion()
requireCapability("JavaVM:JavaNativeFoundation:[$frameworkVersion,)") 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) targetMachines.addAll(machines.macOS.x86_64)
variants.configureEach { variants.configureEach {
resourcePath.set("com/github/weisj/darklaf/platform/${project.name}/${targetMachine.variantName}") resourcePath.set("com/github/weisj/darklaf/platform/${project.name}/${targetMachine.variantName}")
sharedLibrary { sharedLibrary {
val minOs = "10.10"
compileTasks.configureEach { compileTasks.configureEach {
compilerArgs.addAll("-mmacosx-version-min=$minOs") compilerArgs.addAll("-mmacosx-version-min=$minOs")
// Build type not modeled yet, assuming release // Build type not modeled yet, assuming release

1
native-utils/build.gradle.kts

@ -9,6 +9,7 @@ tasks.jar {
CrLfSpec(LineEndings.LF).run { CrLfSpec(LineEndings.LF).run {
into("META-INF") { into("META-INF") {
filteringCharset = "UTF-8" filteringCharset = "UTF-8"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
textFrom("$rootDir/licenses/NATIVEUTIL_LICENSE.txt") textFrom("$rootDir/licenses/NATIVEUTIL_LICENSE.txt")
} }
} }

8
property-loader/build.gradle.kts

@ -3,10 +3,10 @@ plugins {
} }
dependencies { dependencies {
api(project(":darklaf-utils")) api(projects.darklafUtils)
implementation("com.formdev:svgSalamander") implementation(libs.svgSalamander)
testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation(libs.test.junit.api)
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly(libs.test.junit.engine)
} }
tasks.test { tasks.test {

8
settings.gradle.kts

@ -1,8 +1,10 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
enableFeaturePreview("VERSION_CATALOGS")
pluginManagement { pluginManagement {
plugins { plugins {
fun String.v() = extra["$this.version"].toString() 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.autostyle")
idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins") idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins")
idv("com.github.vlsi.gradle-extensions", "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") idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins")
} }
} }
rootProject.name = "darklaf" rootProject.name = "darklaf"
include( include(
"dependencies-bom",
"annotations", "annotations",
"annotations-processor", "annotations-processor",
"native-utils", "native-utils",

12
theme/build.gradle.kts

@ -3,12 +3,12 @@ plugins {
} }
dependencies { dependencies {
implementation(project(":darklaf-property-loader")) implementation(projects.darklafPropertyLoader)
implementation(project(":darklaf-utils")) implementation(projects.darklafUtils)
compileOnly(project(":darklaf-annotations")) compileOnly(projects.darklafAnnotations)
annotationProcessor(project(":darklaf-annotations-processor")) annotationProcessor(projects.darklafAnnotationsProcessor)
annotationProcessor("com.google.auto.service:auto-service") compileOnly(libs.autoservice.annotations)
compileOnly("com.google.auto.service:auto-service-annotations") annotationProcessor(libs.autoservice.processor)
} }

27
windows/build.gradle.kts

@ -8,12 +8,12 @@ plugins {
library { library {
dependencies { dependencies {
jvmImplementation(project(":darklaf-native-utils")) jvmImplementation(projects.darklafNativeUtils)
jvmImplementation(project(":darklaf-utils")) jvmImplementation(projects.darklafUtils)
jvmImplementation(project(":darklaf-platform-base")) jvmImplementation(projects.darklafPlatformBase)
jvmImplementation(project(":darklaf-theme")) jvmImplementation(projects.darklafTheme)
jvmImplementation(project(":darklaf-property-loader")) jvmImplementation(projects.darklafPropertyLoader)
jvmImplementation("net.java.dev.jna:jna") jvmLibImplementation(libs.jna)
} }
targetMachines.addAll(machines.windows.x86, machines.windows.x86_64) targetMachines.addAll(machines.windows.x86, machines.windows.x86_64)
@ -23,17 +23,8 @@ library {
compileTasks.configureEach { compileTasks.configureEach {
compilerArgs.addAll(toolChain.map { compilerArgs.addAll(toolChain.map {
when (it) { when (it) {
is Gcc, is Clang -> listOf("--std=c++11", "-Wall", "-Wextra", "-pedantic", "-Werror") is Gcc, is Clang -> listOf("--std=c++17", "-Wall", "-Wextra", "-pedantic", "-O2")
is VisualCpp -> listOf("/EHsc", "/W4", "/permissive", "/WX") is VisualCpp -> listOf("/std:c++17", "/EHsc", "/W4", "/permissive", "/WX", "/02")
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")
else -> emptyList() else -> emptyList()
} }
}) })
@ -41,7 +32,7 @@ library {
linkTask.configure { linkTask.configure {
linkerArgs.addAll(toolChain.map { linkerArgs.addAll(toolChain.map {
when (it) { 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") is VisualCpp -> listOf("dwmapi.lib", "user32.lib", "Gdi32.lib", "Advapi32.lib", "Shell32.lib")
else -> emptyList() else -> emptyList()
} }

Loading…
Cancel
Save