mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 12:26:45 +00:00
update gradle wrapper to 8.5
This commit is contained in:
parent
b757c76028
commit
37af663511
11 changed files with 26 additions and 570 deletions
12
build.gradle
12
build.gradle
|
@ -2,8 +2,8 @@ import java.awt.GraphicsEnvironment
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'org-openjfx-javafxplugin'
|
|
||||||
id 'extra-java-module-info'
|
id 'extra-java-module-info'
|
||||||
|
id 'org.openjfx.javafxplugin' version '0.1.0'
|
||||||
id 'org.beryx.jlink' version '3.0.1'
|
id 'org.beryx.jlink' version '3.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,11 +134,6 @@ dependencies {
|
||||||
testImplementation('junit:junit:4.13.1')
|
testImplementation('junit:junit:4.13.1')
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
|
||||||
mainModule = 'com.sparrowwallet.sparrow'
|
|
||||||
mainClass = 'com.sparrowwallet.sparrow.SparrowWallet'
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.with {
|
options.with {
|
||||||
fork = true
|
fork = true
|
||||||
|
@ -160,7 +155,10 @@ test {
|
||||||
jvmArgs '--add-opens=java.base/java.io=com.google.gson'
|
jvmArgs '--add-opens=java.base/java.io=com.google.gson'
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
application {
|
||||||
|
mainModule = 'com.sparrowwallet.sparrow'
|
||||||
|
mainClass = 'com.sparrowwallet.sparrow.SparrowWallet'
|
||||||
|
|
||||||
applicationDefaultJvmArgs = ["-XX:+HeapDumpOnOutOfMemoryError",
|
applicationDefaultJvmArgs = ["-XX:+HeapDumpOnOutOfMemoryError",
|
||||||
"--add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
|
"--add-opens=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
|
||||||
"--add-opens=javafx.graphics/javafx.scene=org.controlsfx.controls",
|
"--add-opens=javafx.graphics/javafx.scene=org.controlsfx.controls",
|
||||||
|
|
|
@ -3,9 +3,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.ow2.asm:asm:8.0.1'
|
implementation 'org.ow2.asm:asm:9.6'
|
||||||
implementation 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
|
|
||||||
implementation 'org.javamodularity:moduleplugin:1.8.12'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -22,9 +20,5 @@ gradlePlugin {
|
||||||
id = "extra-java-module-info"
|
id = "extra-java-module-info"
|
||||||
implementationClass = "org.gradle.sample.transform.javamodules.ExtraModuleInfoPlugin"
|
implementationClass = "org.gradle.sample.transform.javamodules.ExtraModuleInfoPlugin"
|
||||||
}
|
}
|
||||||
register("org-openjfx-javafxplugin") {
|
|
||||||
id = "org-openjfx-javafxplugin"
|
|
||||||
implementationClass = "org.openjfx.gradle.JavaFXPlugin"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, 2020, Gluon
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.openjfx.gradle;
|
|
||||||
|
|
||||||
import org.gradle.api.GradleException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public enum JavaFXModule {
|
|
||||||
|
|
||||||
BASE,
|
|
||||||
GRAPHICS(BASE),
|
|
||||||
CONTROLS(BASE, GRAPHICS),
|
|
||||||
FXML(BASE, GRAPHICS),
|
|
||||||
MEDIA(BASE, GRAPHICS),
|
|
||||||
SWING(BASE, GRAPHICS),
|
|
||||||
WEB(BASE, CONTROLS, GRAPHICS, MEDIA);
|
|
||||||
|
|
||||||
static final String PREFIX_MODULE = "javafx.";
|
|
||||||
private static final String PREFIX_ARTIFACT = "javafx-";
|
|
||||||
|
|
||||||
private List<JavaFXModule> dependentModules;
|
|
||||||
|
|
||||||
JavaFXModule(JavaFXModule...dependentModules) {
|
|
||||||
this.dependentModules = List.of(dependentModules);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Optional<JavaFXModule> fromModuleName(String moduleName) {
|
|
||||||
return Stream.of(JavaFXModule.values())
|
|
||||||
.filter(javaFXModule -> moduleName.equals(javaFXModule.getModuleName()))
|
|
||||||
.findFirst();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getModuleName() {
|
|
||||||
return PREFIX_MODULE + name().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getModuleJarFileName() {
|
|
||||||
return getModuleName() + ".jar";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArtifactName() {
|
|
||||||
return PREFIX_ARTIFACT + name().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean compareJarFileName(JavaFXPlatform platform, String jarFileName) {
|
|
||||||
Pattern p = Pattern.compile(getArtifactName() + "-.+-" + platform.getClassifier() + "\\.jar");
|
|
||||||
return p.matcher(jarFileName).matches();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Set<JavaFXModule> getJavaFXModules(List<String> moduleNames) {
|
|
||||||
validateModules(moduleNames);
|
|
||||||
|
|
||||||
return moduleNames.stream()
|
|
||||||
.map(JavaFXModule::fromModuleName)
|
|
||||||
.flatMap(Optional::stream)
|
|
||||||
.flatMap(javaFXModule -> javaFXModule.getMavenDependencies().stream())
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void validateModules(List<String> moduleNames) {
|
|
||||||
var invalidModules = moduleNames.stream()
|
|
||||||
.filter(module -> JavaFXModule.fromModuleName(module).isEmpty())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (! invalidModules.isEmpty()) {
|
|
||||||
throw new GradleException("Found one or more invalid JavaFX module names: " + invalidModules);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JavaFXModule> getDependentModules() {
|
|
||||||
return dependentModules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JavaFXModule> getMavenDependencies() {
|
|
||||||
List<JavaFXModule> dependencies = new ArrayList<>(dependentModules);
|
|
||||||
dependencies.add(0, this);
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,164 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Gluon
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.openjfx.gradle;
|
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
|
||||||
import org.gradle.api.artifacts.repositories.FlatDirectoryArtifactRepository;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.openjfx.gradle.JavaFXModule.PREFIX_MODULE;
|
|
||||||
|
|
||||||
public class JavaFXOptions {
|
|
||||||
|
|
||||||
private static final String MAVEN_JAVAFX_ARTIFACT_GROUP_ID = "org.openjfx";
|
|
||||||
private static final String JAVAFX_SDK_LIB_FOLDER = "lib";
|
|
||||||
|
|
||||||
private final Project project;
|
|
||||||
private final JavaFXPlatform platform;
|
|
||||||
|
|
||||||
private String version = "16";
|
|
||||||
private String sdk;
|
|
||||||
private String configuration = "implementation";
|
|
||||||
private String lastUpdatedConfiguration;
|
|
||||||
private List<String> modules = new ArrayList<>();
|
|
||||||
private FlatDirectoryArtifactRepository customSDKArtifactRepository;
|
|
||||||
|
|
||||||
public JavaFXOptions(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
this.platform = JavaFXPlatform.detect(project);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JavaFXPlatform getPlatform() {
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVersion(String version) {
|
|
||||||
this.version = version;
|
|
||||||
updateJavaFXDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If set, the JavaFX modules will be taken from this local
|
|
||||||
* repository, and not from Maven Central
|
|
||||||
* @param sdk, the path to the local JavaFX SDK folder
|
|
||||||
*/
|
|
||||||
public void setSdk(String sdk) {
|
|
||||||
this.sdk = sdk;
|
|
||||||
updateJavaFXDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSdk() {
|
|
||||||
return sdk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set the configuration name for dependencies, e.g.
|
|
||||||
* 'implementation', 'compileOnly' etc.
|
|
||||||
* @param configuration The configuration name for dependencies
|
|
||||||
*/
|
|
||||||
public void setConfiguration(String configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
updateJavaFXDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConfiguration() {
|
|
||||||
return configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getModules() {
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setModules(List<String> modules) {
|
|
||||||
this.modules = modules;
|
|
||||||
updateJavaFXDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void modules(String...moduleNames) {
|
|
||||||
setModules(List.of(moduleNames));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateJavaFXDependencies() {
|
|
||||||
clearJavaFXDependencies();
|
|
||||||
|
|
||||||
String configuration = getConfiguration();
|
|
||||||
JavaFXModule.getJavaFXModules(this.modules).stream()
|
|
||||||
.sorted()
|
|
||||||
.forEach(javaFXModule -> {
|
|
||||||
if (customSDKArtifactRepository != null) {
|
|
||||||
project.getDependencies().add(configuration, Map.of("name", javaFXModule.getModuleName()));
|
|
||||||
} else {
|
|
||||||
project.getDependencies().add(configuration,
|
|
||||||
String.format("%s:%s:%s:%s", MAVEN_JAVAFX_ARTIFACT_GROUP_ID, javaFXModule.getArtifactName(),
|
|
||||||
getVersion(), getPlatform().getClassifier()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
lastUpdatedConfiguration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearJavaFXDependencies() {
|
|
||||||
if (customSDKArtifactRepository != null) {
|
|
||||||
project.getRepositories().remove(customSDKArtifactRepository);
|
|
||||||
customSDKArtifactRepository = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sdk != null && ! sdk.isEmpty()) {
|
|
||||||
Map<String, String> dirs = new HashMap<>();
|
|
||||||
dirs.put("name", "customSDKArtifactRepository");
|
|
||||||
if (sdk.endsWith(File.separator)) {
|
|
||||||
dirs.put("dirs", sdk + JAVAFX_SDK_LIB_FOLDER);
|
|
||||||
} else {
|
|
||||||
dirs.put("dirs", sdk + File.separator + JAVAFX_SDK_LIB_FOLDER);
|
|
||||||
}
|
|
||||||
customSDKArtifactRepository = project.getRepositories().flatDir(dirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastUpdatedConfiguration == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var configuration = project.getConfigurations().findByName(lastUpdatedConfiguration);
|
|
||||||
if (configuration != null) {
|
|
||||||
if (customSDKArtifactRepository != null) {
|
|
||||||
configuration.getDependencies()
|
|
||||||
.removeIf(dependency -> dependency.getName().startsWith(PREFIX_MODULE));
|
|
||||||
}
|
|
||||||
configuration.getDependencies()
|
|
||||||
.removeIf(dependency -> MAVEN_JAVAFX_ARTIFACT_GROUP_ID.equals(dependency.getGroup()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Gluon
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.openjfx.gradle;
|
|
||||||
|
|
||||||
import com.google.gradle.osdetector.OsDetector;
|
|
||||||
import org.gradle.api.GradleException;
|
|
||||||
import org.gradle.api.Project;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public enum JavaFXPlatform {
|
|
||||||
|
|
||||||
LINUX("linux", "linux-x86_64"),
|
|
||||||
LINUX_MONOCLE("linux-monocle", "linux-x86_64-monocle"),
|
|
||||||
LINUX_AARCH64("linux-aarch64", "linux-aarch_64"),
|
|
||||||
LINUX_AARCH64_MONOCLE("linux-aarch64-monocle", "linux-aarch_64-monocle"),
|
|
||||||
WINDOWS("win", "windows-x86_64"),
|
|
||||||
WINDOWS_MONOCLE("win-monocle", "windows-x86_64-monocle"),
|
|
||||||
OSX("mac", "osx-x86_64"),
|
|
||||||
OSX_MONOCLE("mac-monocle", "osx-x86_64-monocle"),
|
|
||||||
OSX_AARCH64("mac-aarch64", "osx-aarch_64"),
|
|
||||||
OSX_AARCH64_MONOCLE("mac-aarch64-monocle", "osx-aarch_64-monocle");
|
|
||||||
|
|
||||||
private final String classifier;
|
|
||||||
private final String osDetectorClassifier;
|
|
||||||
|
|
||||||
JavaFXPlatform( String classifier, String osDetectorClassifier ) {
|
|
||||||
this.classifier = classifier;
|
|
||||||
this.osDetectorClassifier = osDetectorClassifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassifier() {
|
|
||||||
return classifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JavaFXPlatform detect(Project project) {
|
|
||||||
|
|
||||||
String osClassifier = project.getExtensions().getByType(OsDetector.class).getClassifier();
|
|
||||||
|
|
||||||
if("true".equals(System.getProperty("java.awt.headless"))) {
|
|
||||||
osClassifier += "-monocle";
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( JavaFXPlatform platform: values()) {
|
|
||||||
if ( platform.osDetectorClassifier.equals(osClassifier)) {
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String supportedPlatforms = Arrays.stream(values())
|
|
||||||
.map(p->p.osDetectorClassifier)
|
|
||||||
.collect(Collectors.joining("', '", "'", "'"));
|
|
||||||
|
|
||||||
throw new GradleException(
|
|
||||||
String.format(
|
|
||||||
"Unsupported JavaFX platform found: '%s'! " +
|
|
||||||
"This plugin is designed to work on supported platforms only." +
|
|
||||||
"Current supported platforms are %s.", osClassifier, supportedPlatforms )
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Gluon
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.openjfx.gradle;
|
|
||||||
|
|
||||||
import com.google.gradle.osdetector.OsDetectorPlugin;
|
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
|
||||||
import org.javamodularity.moduleplugin.ModuleSystemPlugin;
|
|
||||||
import org.openjfx.gradle.tasks.ExecTask;
|
|
||||||
|
|
||||||
public class JavaFXPlugin implements Plugin<Project> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(Project project) {
|
|
||||||
project.getPlugins().apply(OsDetectorPlugin.class);
|
|
||||||
project.getPlugins().apply(ModuleSystemPlugin.class);
|
|
||||||
|
|
||||||
project.getExtensions().create("javafx", JavaFXOptions.class, project);
|
|
||||||
|
|
||||||
project.getTasks().create("configJavafxRun", ExecTask.class, project);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019, 2021, Gluon
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.openjfx.gradle.tasks;
|
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask;
|
|
||||||
import org.gradle.api.GradleException;
|
|
||||||
import org.gradle.api.Project;
|
|
||||||
import org.gradle.api.file.FileCollection;
|
|
||||||
import org.gradle.api.logging.Logger;
|
|
||||||
import org.gradle.api.logging.Logging;
|
|
||||||
import org.gradle.api.plugins.ApplicationPlugin;
|
|
||||||
import org.gradle.api.tasks.JavaExec;
|
|
||||||
import org.gradle.api.tasks.TaskAction;
|
|
||||||
import org.javamodularity.moduleplugin.extensions.RunModuleOptions;
|
|
||||||
import org.openjfx.gradle.JavaFXModule;
|
|
||||||
import org.openjfx.gradle.JavaFXOptions;
|
|
||||||
import org.openjfx.gradle.JavaFXPlatform;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
public class ExecTask extends DefaultTask {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = Logging.getLogger(ExecTask.class);
|
|
||||||
|
|
||||||
private final Project project;
|
|
||||||
private JavaExec execTask;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public ExecTask(Project project) {
|
|
||||||
this.project = project;
|
|
||||||
project.getPluginManager().withPlugin(ApplicationPlugin.APPLICATION_PLUGIN_NAME, e -> {
|
|
||||||
execTask = (JavaExec) project.getTasks().findByName(ApplicationPlugin.TASK_RUN_NAME);
|
|
||||||
if (execTask != null) {
|
|
||||||
execTask.dependsOn(this);
|
|
||||||
} else {
|
|
||||||
throw new GradleException("Run task not found.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
public void action() {
|
|
||||||
if (execTask != null) {
|
|
||||||
JavaFXOptions javaFXOptions = project.getExtensions().getByType(JavaFXOptions.class);
|
|
||||||
JavaFXModule.validateModules(javaFXOptions.getModules());
|
|
||||||
|
|
||||||
var definedJavaFXModuleNames = new TreeSet<>(javaFXOptions.getModules());
|
|
||||||
if (!definedJavaFXModuleNames.isEmpty()) {
|
|
||||||
RunModuleOptions moduleOptions = execTask.getExtensions().findByType(RunModuleOptions.class);
|
|
||||||
|
|
||||||
final FileCollection classpathWithoutJavaFXJars = execTask.getClasspath().filter(
|
|
||||||
jar -> Arrays.stream(JavaFXModule.values()).noneMatch(javaFXModule -> jar.getName().contains(javaFXModule.getArtifactName()))
|
|
||||||
);
|
|
||||||
final FileCollection javaFXPlatformJars = execTask.getClasspath().filter(jar -> isJavaFXJar(jar, javaFXOptions.getPlatform()));
|
|
||||||
|
|
||||||
if (moduleOptions != null) {
|
|
||||||
LOGGER.info("Modular JavaFX application found");
|
|
||||||
// Remove empty JavaFX jars from classpath
|
|
||||||
execTask.setClasspath(classpathWithoutJavaFXJars.plus(javaFXPlatformJars));
|
|
||||||
definedJavaFXModuleNames.forEach(javaFXModule -> moduleOptions.getAddModules().add(javaFXModule));
|
|
||||||
} else {
|
|
||||||
LOGGER.info("Non-modular JavaFX application found");
|
|
||||||
// Remove all JavaFX jars from classpath
|
|
||||||
execTask.setClasspath(classpathWithoutJavaFXJars);
|
|
||||||
|
|
||||||
var javaFXModuleJvmArgs = List.of("--module-path", javaFXPlatformJars.getAsPath());
|
|
||||||
|
|
||||||
var jvmArgs = new ArrayList<String>();
|
|
||||||
jvmArgs.add("--add-modules");
|
|
||||||
jvmArgs.add(String.join(",", definedJavaFXModuleNames));
|
|
||||||
|
|
||||||
List<String> execJvmArgs = execTask.getJvmArgs();
|
|
||||||
if (execJvmArgs != null) {
|
|
||||||
jvmArgs.addAll(execJvmArgs);
|
|
||||||
}
|
|
||||||
jvmArgs.addAll(javaFXModuleJvmArgs);
|
|
||||||
|
|
||||||
execTask.setJvmArgs(jvmArgs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new GradleException("Run task not found. Please, make sure the Application plugin is applied");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isJavaFXJar(File jar, JavaFXPlatform platform) {
|
|
||||||
return jar.isFile() &&
|
|
||||||
Arrays.stream(JavaFXModule.values()).anyMatch(javaFXModule ->
|
|
||||||
javaFXModule.compareJarFileName(platform, jar.getName()) ||
|
|
||||||
javaFXModule.getModuleJarFileName().equals(jar.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 389e89bac76ab8ddbe008c8cef2cdfe6b938715a
|
Subproject commit 4279884591d1d7e0f957c8834a7bc26b4b0b0d94
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,7 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
29
gradlew
vendored
29
gradlew
vendored
|
@ -83,10 +83,8 @@ done
|
||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
# 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"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -133,18 +131,21 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
|
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_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 -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|
Loading…
Reference in a new issue