Skip to content
Open
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
21 changes: 17 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ dependencies {
testImplementation(libs.junitJupiterParams)

testRuntimeOnly("org.junit.platform:junit-platform-launcher")

}

tasks.test {
Expand Down Expand Up @@ -451,9 +451,18 @@ tasks.register<Copy>("includeJdk") {
from(jdkHome)
destinationDir = composeResources("jdk").get().asFile

fileTree(destinationDir).files.forEach { file ->
file.setWritable(true, false)
file.setReadable(true, false)
doLast {
val sourceJdkHome = jdkHome.get()
fileTree(destinationDir).files.forEach { file ->
// Copy preserves the source exec bit, but some environments strip it.
// Re-apply exec on files that should be executable.
val sourceFile = File(sourceJdkHome, file.relativeTo(destinationDir).path)
if (sourceFile.canExecute()) {
file.setExecutable(true, false)
}
file.setWritable(true, false)
file.setReadable(true, false)
}
}
}
tasks.register<Copy>("includeSharedAssets"){
Expand Down Expand Up @@ -648,6 +657,10 @@ tasks.register("setExecutablePermissions") {
include("**/resources/**/*.dylib")
include("**/resources/**/*.so")
include("**/resources/**/*.exe")
// Also cover the IDE runtime (jspawnhelper, jexec, bin/*) — same issue
// https://github.com/processing/processing4/issues/1537
include("**/runtime/**/bin/**")
include("**/runtime/**/lib/**")
}.forEach { file ->
if (file.isFile) {
file.setExecutable(true, false)
Expand Down
12 changes: 11 additions & 1 deletion app/src/processing/app/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static public File getContentFile(String name) {
}

static public File getJavaHome() {
// Get the build in JDK location from the Jetpack Compose resources
// Get the built-in JDK location from the Jetpack Compose resources
var resourcesDir = System.getProperty("compose.application.resources.dir");
if(resourcesDir != null) {
var jdkFolder = new File(resourcesDir,"jdk");
Expand All @@ -381,6 +381,16 @@ static public File getJavaHome() {
}

// If the JDK is set in the environment, use that.
// if not, fall back to the java.home system property.
for (String envKey : new String[] { "JAVA_HOME", "JDK_HOME" }) {
String envPath = System.getenv(envKey);
if (envPath != null && !envPath.isEmpty()) {
File envHome = new File(envPath);
if (new File(envHome, "bin/java" + (Platform.isWindows() ? ".exe" : "")).canExecute()) {
return envHome;
}
}
}
var home = System.getProperty("java.home");
if(home != null){
return new File(home);
Expand Down
Loading