Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ I know some features are large in scope, just break down what you can where poss

## License

Comment thread
Col-E marked this conversation as resolved.
BentoFX is licensed under the MIT License. Anything you contribute will thus also be under the MIT license.
BentoFX is licensed under the MIT License. Anything you contribute will thus also be under the MIT license.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ A docking system for JavaFX.

Requirements:

Comment thread
Col-E marked this conversation as resolved.
- JavaFX 19+
- Java 17+
- JavaFX 21+
- Java 21+

Gradle syntax:

Expand Down
16 changes: 16 additions & 0 deletions build-logic/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions build-logic/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2500m -Dfile.encoding=UTF-8
20 changes: 20 additions & 0 deletions build-logic/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

dependencyResolutionManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
versionCatalogs {
libs {
from(files('../gradle/libs.versions.toml'))
}
}
}

rootProject.name = 'build-logic'
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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
}
120 changes: 120 additions & 0 deletions build-logic/src/main/groovy/bento.project.project-convention.gradle
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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)
}
Comment thread
Col-E marked this conversation as resolved.

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
}
}
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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'
}
Comment thread
Col-E marked this conversation as resolved.
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'))
}
}
Comment thread
Col-E marked this conversation as resolved.
}
14 changes: 14 additions & 0 deletions build-logic/src/main/groovy/bento.test.unit-test-suite.gradle
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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'))
}
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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}")
}
}
}
Comment thread
Col-E marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -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.'
)
}
}
Original file line number Diff line number Diff line change
@@ -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<String> 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<String> normalizedProjectName) {
this.normalizedProjectName = normalizedProjectName
}
}
Loading
Loading