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. 21
      gradlew.bat
  20. 31
      macos/build.gradle.kts
  21. 1
      native-utils/build.gradle.kts
  22. 8
      property-loader/build.gradle.kts
  23. 8
      settings.gradle.kts
  24. 12
      theme/build.gradle.kts
  25. 27
      windows/build.gradle.kts

4
.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

2
.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 }}"

2
.gitignore vendored

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

2
annotations-processor/build.gradle.kts

@ -3,5 +3,5 @@ plugins {
}
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
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<UsePrebuiltBinariesWhenUnbuildablePlugin> {
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<JavaLibraryPlugin> {
dependencies {
"api"(platform(project(":darklaf-dependencies-bom")))
"annotationProcessor"(platform(project(":darklaf-dependencies-bom")))
}
}
if (!enableGradleMetadata) {
tasks.withType<GenerateModuleMetadata> {
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<PublishingExtension> {
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
}

2
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<Json>
val runs = this["workflow_runs"] as? List<Json> ?: return null
val candidates = runs.asSequence().filter {
val completed = "completed" == it["status"]
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.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<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
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"

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.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<Project> {
@ -20,34 +19,17 @@ class UberJniJarPlugin : Plugin<Project> {
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<JniLibrary>.withTarget(target: TargetMachine): Provider<JniLibrary> {
return filter { it.targetMachine == target }.map {
check(it.size == 1)
it.first()
}
}
private fun JarBinary.asZipTree(project: Project): Provider<FileTree> =
jarTask.map { project.zipTree(it.archiveFile) }
}

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 {
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")

3
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) {

8
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(),

4
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");

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
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

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
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

21
gradlew.bat vendored

@ -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

31
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,)") {
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 {
requireCapability("JavaVM:JavaNativeFoundation:[$frameworkVersion,)")
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

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

8
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 {

8
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",

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

27
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()
}

Loading…
Cancel
Save