diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b350f1f..b3a39d6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,4 +14,4 @@ I know some features are large in scope, just break down what you can where poss ## License -BentoFX is licensed under the MIT License. Anything you contribute will thus also be under the MIT license. \ No newline at end of file +BentoFX is licensed under the MIT License. Anything you contribute will thus also be under the MIT license. diff --git a/README.md b/README.md index 6317c9ee..b473230c 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ A docking system for JavaFX. Requirements: -- JavaFX 19+ -- Java 17+ +- JavaFX 21+ +- Java 21+ Gradle syntax: diff --git a/build-logic/build.gradle b/build-logic/build.gradle new file mode 100644 index 00000000..86ad2f6d --- /dev/null +++ b/build-logic/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'groovy-gradle-plugin' +} + +description = + 'Used to apply plugins to projects and to configure dependencies and tasks. Runs during project ' + + 'configuration, after settings.' + +dependencies { + implementation gradleApi() + implementation localGroovy() + + implementation libs.benmanes.versions.gradlePlugin.dependency + implementation libs.javafx.gradlePlugin.dependency + implementation libs.jreleaser.gradlePlugin.dependency +} diff --git a/build-logic/gradle.properties b/build-logic/gradle.properties new file mode 100644 index 00000000..70cfb330 --- /dev/null +++ b/build-logic/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.caching=true +org.gradle.jvmargs=-Xmx2500m -Dfile.encoding=UTF-8 diff --git a/build-logic/settings.gradle b/build-logic/settings.gradle new file mode 100644 index 00000000..93765196 --- /dev/null +++ b/build-logic/settings.gradle @@ -0,0 +1,20 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + } +} + +dependencyResolutionManagement { + repositories { + gradlePluginPortal() + mavenCentral() + } + versionCatalogs { + libs { + from(files('../gradle/libs.versions.toml')) + } + } +} + +rootProject.name = 'build-logic' diff --git a/build-logic/src/main/groovy/bento.project.build-lifecycle.gradle b/build-logic/src/main/groovy/bento.project.build-lifecycle.gradle new file mode 100644 index 00000000..184960cf --- /dev/null +++ b/build-logic/src/main/groovy/bento.project.build-lifecycle.gradle @@ -0,0 +1,6 @@ +import static software.coley.gradle.lifecycle.BuildLifecycle.ALL_CLASSES_TASK_NAME + +tasks.register(ALL_CLASSES_TASK_NAME) { + description = 'Compiles all main and test code for all applicable subprojects and test suites.' + group = LifecycleBasePlugin.BUILD_GROUP +} diff --git a/build-logic/src/main/groovy/bento.project.project-convention.gradle b/build-logic/src/main/groovy/bento.project.project-convention.gradle new file mode 100644 index 00000000..92c30680 --- /dev/null +++ b/build-logic/src/main/groovy/bento.project.project-convention.gradle @@ -0,0 +1,120 @@ +import org.gradle.api.plugins.jvm.JvmTestSuite +import org.gradlex.jvm.dependency.conflict.detection.rules.CapabilityDefinition.* +import software.coley.gradle.artifacts.TestFxAlignmentRule +import software.coley.gradle.task.extensions.BentoConventionExtension + +import static software.coley.gradle.lifecycle.BuildLifecycle.ALL_CLASSES_TASK_NAME + +plugins { + id 'java-library' + id 'com.github.ben-manes.versions' + id 'bento.project.build-lifecycle' + id 'bento.test.unit-test-suite' +} + +def versionCatalog = versionCatalogs.named('libs') + +group = 'software.coley.bento-fx' +version = versionCatalog.findVersion("bentofx").get().requiredVersion + +def normalizedProjectName = providers.provider { + project.path.substring(1).replace(':', '.') +} + +extensions.create('bentoConvention', BentoConventionExtension, normalizedProjectName) + +// Get the Java JDK version specified in libs.versions.toml and accommodate all +// the different ways Gradle and its plugins take the Java version... +def jdkVersion = versionCatalog.findVersion("java-jdk").get().requiredVersion +def javaLanguageVersion = JavaLanguageVersion.of(jdkVersion) +def javaMajorVersionAsInt = javaLanguageVersion.asInt() + +dependencies { + + components.all(TestFxAlignmentRule) + + api platform(project(':platform')) +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(javaMajorVersionAsInt) + } + + withSourcesJar() + withJavadocJar() +} + +javadoc { + options { + addStringOption('Xdoclint:none', '-quiet') + } +} + +testing { + suites { + configureEach { suite -> + if (suite instanceof JvmTestSuite) { + + def junitVersion = + versionCatalog.findVersion('junit').get().requiredVersion + + useJUnitJupiter(junitVersion) + + targets.configureEach { + testTask.configure { + it.filter { + includeTestsMatching '*Test' + includeTestsMatching '*Test\$*' + failOnNoDiscoveredTests = false + } + + // Set system properties for the test JVM(s) + systemProperty 'project.name', rootProject.name + // Turns out we really DO need a graphics environment + // to initialize the JavaFx platform used by some + // JUnit tests. Therefore, we can NOT run JUnit + // tests headless. + systemProperty 'java.awt.headless', 'false' + } + } + } + } + } +} + +tasks.named(ALL_CLASSES_TASK_NAME) { + dependsOn(tasks.named('classes')) +} + +tasks.withType(JavaCompile).configureEach { + it.options.with { + encoding = 'UTF-8' + release = javaMajorVersionAsInt + fork = true + forkOptions.memoryMaximumSize = '1g' + options.compilerArgs << '-parameters' + } +} + +tasks.withType(Jar).configureEach { + archiveBaseName = normalizedProjectName + + from(project.isolated.rootProject.projectDirectory) { + include 'LICENSE' + into 'META-INF' + rename { 'LICENSE.txt' } + } +} + +tasks.withType(JavaExec).configureEach { + javaLauncher = javaToolchains.launcherFor { + languageVersion = javaLanguageVersion + } +} + +tasks.withType(Test).configureEach { + javaLauncher = javaToolchains.launcherFor { + languageVersion = javaLanguageVersion + } +} diff --git a/build-logic/src/main/groovy/bento.release.publish-convention.gradle b/build-logic/src/main/groovy/bento.release.publish-convention.gradle new file mode 100644 index 00000000..6226e0af --- /dev/null +++ b/build-logic/src/main/groovy/bento.release.publish-convention.gradle @@ -0,0 +1,51 @@ +plugins { + id 'java' + id 'bento.project.project-convention' + id 'maven-publish' +} + +def bentoConvention = extensions.getByName('bentoConvention') + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = bentoConvention.normalizedProjectName.get() + + from components['java'] + + pom { + url.set( 'https://github.com/Col-E/BentoFX') + inceptionYear.set( '2025') + + licenses { + license { + name.set( 'MIT') + url.set( 'https://spdx.org/licenses/MIT.html') + } + } + developers { + developer { + id = 'Col-E' + name = 'Matt Coley' + } + developer { + id.set( 'philliplbryant') + name.set( 'Phil Bryant') + } + } + scm { + connection.set( 'scm:git:https://github.com/Col-E/BentoFX.git') + developerConnection.set( 'scm:git:ssh://github.com/Col-E/BentoFX.git') + url.set( 'https://github.com/Col-E/BentoFX') + } + } + } + } + + repositories { + mavenLocal() + maven { + url = uri(layout.buildDirectory.dir( 'staging-deploy')) + } + } +} diff --git a/build-logic/src/main/groovy/bento.test.unit-test-suite.gradle b/build-logic/src/main/groovy/bento.test.unit-test-suite.gradle new file mode 100644 index 00000000..9c0538ed --- /dev/null +++ b/build-logic/src/main/groovy/bento.test.unit-test-suite.gradle @@ -0,0 +1,14 @@ +import static software.coley.gradle.lifecycle.BuildLifecycle.ALL_CLASSES_TASK_NAME + +plugins { + id 'bento.project.build-lifecycle' + id 'jvm-test-suite' +} + +tasks.named(ALL_CLASSES_TASK_NAME) { + dependsOn tasks.named('testClasses') +} + +tasks.named('check') { + dependsOn(tasks.named('test')) +} diff --git a/build-logic/src/main/groovy/software/coley/gradle/artifacts/TestFxAlignmentRule.groovy b/build-logic/src/main/groovy/software/coley/gradle/artifacts/TestFxAlignmentRule.groovy new file mode 100644 index 00000000..a5b59acb --- /dev/null +++ b/build-logic/src/main/groovy/software/coley/gradle/artifacts/TestFxAlignmentRule.groovy @@ -0,0 +1,14 @@ +package software.coley.gradle.artifacts + +import org.gradle.api.artifacts.ComponentMetadataContext +import org.gradle.api.artifacts.ComponentMetadataRule + +abstract class TestFxAlignmentRule implements ComponentMetadataRule { + @Override + void execute(ComponentMetadataContext ctx) { + def id = ctx.details.id + if (id.group == 'org.testfx' && id.name != 'openjfx-monocle') { + ctx.details.belongsTo("org.testfx:testfx-virtual-bom:${id.version}") + } + } +} diff --git a/build-logic/src/main/groovy/software/coley/gradle/lifecycle/BuildLifecycle.groovy b/build-logic/src/main/groovy/software/coley/gradle/lifecycle/BuildLifecycle.groovy new file mode 100644 index 00000000..d6632540 --- /dev/null +++ b/build-logic/src/main/groovy/software/coley/gradle/lifecycle/BuildLifecycle.groovy @@ -0,0 +1,11 @@ +package software.coley.gradle.lifecycle + +final class BuildLifecycle { + public static final String ALL_CLASSES_TASK_NAME = 'allClasses' + + private BuildLifecycle() { + throw new UnsupportedOperationException( + 'Utility classes should not be instantiated.' + ) + } +} diff --git a/build-logic/src/main/groovy/software/coley/gradle/task/extensions/BentoConventionExtension.groovy b/build-logic/src/main/groovy/software/coley/gradle/task/extensions/BentoConventionExtension.groovy new file mode 100644 index 00000000..4e8280a5 --- /dev/null +++ b/build-logic/src/main/groovy/software/coley/gradle/task/extensions/BentoConventionExtension.groovy @@ -0,0 +1,26 @@ +package software.coley.gradle.task.extensions + +import org.gradle.api.provider.Provider + +import javax.inject.Inject + +/** + * Extension class for sharing lazily calculated values among precompiled + * convention script plugins. + */ +abstract class BentoConventionExtension { + /** + * The fully qualified project name, normalized as a valid for use as an + * artifact ID, JAR file name, etc. + */ + final Provider normalizedProjectName + + /** + * @param normalizedProjectName The fully qualified project name, + * normalized as a valid for use as an artifact ID, JAR file name, etc. + */ + @Inject + BentoConventionExtension(final Provider normalizedProjectName) { + this.normalizedProjectName = normalizedProjectName + } +} diff --git a/build.gradle b/build.gradle index 71726665..cad99916 100644 --- a/build.gradle +++ b/build.gradle @@ -1,123 +1,10 @@ -plugins { - id 'java' - alias(libs.plugins.javafx) apply false - alias(libs.plugins.jreleaser) - alias(libs.plugins.benmanes.versions) apply false - alias(libs.plugins.buildconfig) apply false -} - -ext.pluginId = { provider -> provider.get().pluginId } - -allprojects { - group = 'software.coley.bento-fx' - version = '0.16.0' -} - -subprojects { sub -> - apply plugin: 'java' - apply plugin: 'maven-publish' - apply plugin: pluginId(libs.plugins.javafx) - apply plugin: pluginId(libs.plugins.benmanes.versions) - - repositories { - mavenLocal() - mavenCentral() - } - - dependencies { - // Shared annotations for all modules - compileOnly(libs.bundles.annotations) - testCompileOnly(libs.bundles.annotations) - - // Test dependencies - testImplementation(libs.bundles.test.libraries) - testRuntimeOnly(libs.bundles.test.runtime) - } - - javafx { - version = '21.0.9' - modules = ['javafx.controls'] - - // We don't want to include a specific version of JavaFX as a transitive dependency for users of the library - configurations = ['compileOnly', 'testImplementation'] - } - - java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } - - withJavadocJar() - withSourcesJar() - } - - tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-parameters' - } - - tasks.named('jar') { - from(rootProject.layout.projectDirectory) { - include 'LICENSE' - into 'META-INF' - rename { 'LICENSE.txt' } - } - } - - javadoc { - options { - addStringOption('Xdoclint:none', '-quiet') - } - } - - test { - useJUnitPlatform() +import static org.gradle.api.tasks.wrapper.Wrapper.DistributionType.BIN - // Not all subprojects have tests, so don't fail the build if no tests are found. - failOnNoDiscoveredTests = false - } - - publishing { - publications { - mavenJava(MavenPublication) { - groupId = sub.group - artifactId = sub.name - version = sub.version - - from sub.components.java - - pom { - name = sub.name - description = 'A docking system for JavaFX.' - url = 'https://github.com/Col-E/BentoFX' - inceptionYear = '2025' - licenses { - license { - name = 'MIT' - url = 'https://spdx.org/licenses/MIT.html' - } - } - developers { - developer { - id = 'Col-E' - name = 'Matt Coley' - } - } - scm { - connection = 'scm:git:https://github.com/Col-E/BentoFX.git' - developerConnection = 'scm:git:ssh://github.com/Col-E/BentoFX.git' - url = 'https://github.com/Col-E/BentoFX' - } - } - } - } - repositories { - mavenLocal() - maven { - // All modules will publish to the same staging directory. - url = rootProject.layout.projectDirectory.dir("build/staging-deploy") - } - } - } +plugins { + // Apply the base plugin to add `clean` to the root project. + id 'base' + alias libs.plugins.jreleaser + alias libs.plugins.benmanes.versions } jreleaser { @@ -154,3 +41,19 @@ jreleaser { } } } + +// Using this task to upgrade Gradle keeps the gradle-wrapper.properties, +// distribution JAR, and wrapper scripts (./gradle and ./gradlew.bat) in sync. +tasks.named("wrapper", Wrapper).configure { + def versionCatalog = versionCatalogs.named('libs') + + // The Gradle version and checksum are specified in libs.versions.toml + gradleVersion = + versionCatalog.findVersion("gradle").get().requiredVersion + distributionSha256Sum = + versionCatalog.findVersion("gradle-checksum").get().requiredVersion + + // Use `ALL` instead of `BIN` to provide support for developers using the Gradle scripts. + distributionType = BIN + networkTimeout = 60000 +} diff --git a/core/build.gradle b/core/build.gradle index 97398c18..c633b34f 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,5 +1,24 @@ plugins { + id 'bento.project.project-convention' + id 'bento.release.publish-convention' alias(libs.plugins.buildconfig) + alias(libs.plugins.javafx) +} + +description = 'A docking system for JavaFX' + +javafx { + def versionCatalog = versionCatalogs.named('libs') + version = versionCatalog.findVersion("javafx") + modules = ['javafx.controls'] + + // We don't want to include a specific version of JavaFX as a transitive + // dependency for users of the library. + configurations = ['compileOnlyApi'] +} + +dependencies { + compileOnly libs.jspecify } buildConfig { @@ -8,4 +27,4 @@ buildConfig { packageName("software.coley.bentofx") buildConfigField(String, "VERSION", provider { "${project.version}" }) buildConfigField(String, "BUILD_DATE", provider { "${new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")}" }) -} \ No newline at end of file +} diff --git a/demos/basic/build.gradle b/demos/basic/build.gradle index 11129953..b58711a4 100644 --- a/demos/basic/build.gradle +++ b/demos/basic/build.gradle @@ -1,3 +1,26 @@ +plugins { + id 'application' + id 'bento.project.project-convention' + alias(libs.plugins.javafx) +} + +description = 'BentoFX Basic Demo' + application { + applicationName = description ?: name + mainModule = 'bento.fx.demo.basic' mainClass = 'demo.Runner' -} \ No newline at end of file + applicationDefaultJvmArgs = ["-Xms256m", "-Xmx1024m"] +} + +javafx { + def versionCatalog = versionCatalogs.named('libs') + version = versionCatalog.findVersion("javafx") + modules = ['javafx.base', 'javafx.controls', 'javafx.graphics'] +} + +dependencies { + implementation projects.core + + compileOnly libs.jspecify +} diff --git a/demos/basic/src/main/java/module-info.java b/demos/basic/src/main/java/module-info.java new file mode 100644 index 00000000..64ff8ac2 --- /dev/null +++ b/demos/basic/src/main/java/module-info.java @@ -0,0 +1,21 @@ +import org.jspecify.annotations.NullMarked; + +/** + * This module is a basic JavaFX application demonstrating use of the + * BentoFX docking framework. + * + * @author Phil Bryant + */ +@NullMarked +module bento.fx.demo.basic { + + requires bento.fx; + + requires javafx.controls; + + requires static org.jspecify; + + // This must be exported for the JavaFX launcher to access the + // application classes in them. + exports demo; +} diff --git a/demos/build.gradle b/demos/build.gradle deleted file mode 100644 index 6765801d..00000000 --- a/demos/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -subprojects { - apply plugin: 'application' - - // Just support running the demos, don't create distributions for them - tasks.named('startScripts') { enabled = false } - tasks.named('distTar') { enabled = false } - tasks.named('distZip') { enabled = false } - - // Override top-level 'compileOnly', 'testImplementation' configurations - // to facilitate running via :run task - javafx { - configurations = [ 'implementation' ] - } - - dependencies { - implementation projects.core - } -} - -allprojects { - // Don't use configuration cache for the demo run tasks - tasks.withType(JavaExec).configureEach { - notCompatibleWithConfigurationCache("Demo run tasks do not need configuration cache") - } - - // Don't publish the demos, they are just for testing and examples. They aren't meant to be consumed as a library. - tasks.withType(PublishToMavenRepository).configureEach { enabled = false } - tasks.withType(PublishToMavenLocal).configureEach { enabled = false } - tasks.withType(Javadoc).configureEach { enabled = false } - tasks.withType(Jar).configureEach { - if (name.contains('sources') || name.contains('javadoc')) { - enabled = false - } - } - tasks.named('generateMetadataFileForMavenJavaPublication') { enabled = false } - tasks.named('publish') { enabled = false } - tasks.named('jar') { enabled = false } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 86de0448..96a63d40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,12 @@ org.gradle.caching=true org.gradle.configuration-cache=true org.gradle.configuration-cache.parallel=true - -org.gradle.parallel=true \ No newline at end of file +# Performance optimization for multi-project builds - only configures the root +# project and the specific subprojects required for the requested task. +org.gradle.configureondemand=true +org.gradle.parallel=true +# Explicitly enable filesystem watching so Gradle doesn't go through its +# default of trying to evaluate whether it can be enabled automatically, which +# can be slow: +# https://github.com/gradle/gradle/issues/17955. +org.gradle.vfs.watch=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 154d87d8..014dad7d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,28 +1,49 @@ [versions] +# noinspection UnusedVersionCatalogEntry +bentofx = "0.16.0" +# noinspection UnusedVersionCatalogEntry +gradle = "9.4.1" +# noinspection UnusedVersionCatalogEntry +gradle-checksum = "2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb" +# noinspection UnusedVersionCatalogEntry +java-jdk = "21" + # Libraries -assertj = "3.27.3" -junit = "5.13.4" -junit-launch = "1.13.4" +assertj = "3.27.7" +javafx = "21.0.9" +jspecify = "1.0.0" +junit = "6.0.3" testfx = "4.0.18" +testfx-monocle = "21.0.2" + # Plugins benmanes-versions = "0.52.0" buildconfig = "6.0.9" javafx-plugin = "0.1.0" -jreleaser = "1.22.0" -jspecify = "1.0.0" +jreleaser = "1.24.0" [libraries] assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } -junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } -junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } -junit-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-launch" } +benmanes-versions-gradlePlugin-dependency = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "benmanes-versions" } +javafx-base = { module = "org.openjfx:javafx-base", version.ref = "javafx" } +javafx-controls = { module = "org.openjfx:javafx-controls", version.ref = "javafx" } +javafx-gradlePlugin-dependency = { module = "org.openjfx.javafxplugin:org.openjfx.javafxplugin.gradle.plugin", version.ref = "javafx-plugin" } +javafx-graphics = { module = "org.openjfx:javafx-graphics", version.ref = "javafx" } +jreleaser-gradlePlugin-dependency = { module = "org.jreleaser:org.jreleaser.gradle.plugin", version.ref = "jreleaser" } jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" } +junit-api = { module = "org.junit.jupiter:junit-jupiter-api" } +junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } +junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine" } +junit-launcher = { module = "org.junit.platform:junit-platform-launcher" } +junit-params = { module = "org.junit.jupiter:junit-jupiter-params" } testfx = { module = "org.testfx:testfx-junit5", version.ref = "testfx" } +testfx-core = { module = "org.testfx:testfx-core", version.ref = "testfx" } +testfx-monocle = { module = "org.testfx:openjfx-monocle", version.ref = "testfx-monocle" } [bundles] annotations = ["jspecify"] -test-libraries = ["assertj", "junit-api", "junit-params", "testfx"] +javafx = [ "javafx-base", "javafx-controls", "javafx-graphics", ] +test-libraries = ["assertj", "junit-api", "junit-params", "testfx", "testfx-core","testfx-monocle"] test-runtime = ["junit-engine", "junit-launcher"] [plugins] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..d997cfc6 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 2dd6f86d..d9eff5bb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,8 +1,8 @@ -# Sat Jan 18 02:53:32 EST 2025 -# https://gradle.org/release-checksums/ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip +networkTimeout=60000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..739907df 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,22 +132,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -165,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..c4bdd3ab 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,32 +59,33 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -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 %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/platform/build.gradle b/platform/build.gradle new file mode 100644 index 00000000..a5d2d583 --- /dev/null +++ b/platform/build.gradle @@ -0,0 +1,30 @@ +plugins { + id 'java-platform' +} + +javaPlatform { + allowDependencies() +} + +// See also Gradle Version Catalog at '\gradle\libs.versions.toml'. +dependencies { + /* + * BOMs + * + * Ordering matters! Declaring a BOM before subsequent platform declarations + * will cause third-party dependencies declared in the BOM to be overridden + * by those platform declarations. + */ + api platform(libs.junit.bom.get()) + + constraints { + api libs.bundles.javafx + api libs.bundles.test.libraries + api libs.bundles.annotations + api libs.bundles.test.runtime + + api libs.junit.api + api libs.junit.engine + api libs.junit.params + } +} diff --git a/settings.gradle b/settings.gradle index ae10ced4..46ea6050 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,27 @@ +pluginManagement { + includeBuild 'build-logic' + + repositories { + gradlePluginPortal() + mavenCentral() + } +} + +dependencyResolutionManagement { + includeBuild 'build-logic' + + repositories { + mavenLocal() + mavenCentral() + } +} + rootProject.name = 'bento-fx' enableFeaturePreview('STABLE_CONFIGURATION_CACHE') enableFeaturePreview('TYPESAFE_PROJECT_ACCESSORS') +include 'platform' + include 'core' -include 'demos' -include 'demos:basic' \ No newline at end of file +include 'demos:basic'