From a74a42b010f40b0801142f2cb58ca1118d87e848 Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 4 Sep 2025 23:20:21 +0000 Subject: [PATCH] More cleanup --- .../io/xpipe/app/comp/base/IntroComp.java | 21 ++-- .../main/java/io/xpipe/app/core/AppLogs.java | 2 +- .../io/xpipe/app/issue/ErrorDetailsComp.java | 2 +- .../io/xpipe/app/issue/EventHandlerImpl.java | 2 +- .../io/xpipe/app/issue/LogErrorHandler.java | 2 +- .../xpipe/app/update/AppDistributionType.java | 2 +- .../java/io/xpipe/app/util}/Deobfuscator.java | 9 +- build.gradle | 113 ++++++++++-------- 8 files changed, 86 insertions(+), 67 deletions(-) rename {core/src/main/java/io/xpipe/core => app/src/main/java/io/xpipe/app/util}/Deobfuscator.java (85%) diff --git a/app/src/main/java/io/xpipe/app/comp/base/IntroComp.java b/app/src/main/java/io/xpipe/app/comp/base/IntroComp.java index 2a7479a79..c303d2627 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/IntroComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/IntroComp.java @@ -57,19 +57,18 @@ public class IntroComp extends SimpleComp { var hbox = new HBox(img, text); hbox.setSpacing(55); hbox.setAlignment(Pos.CENTER); - - var button = new ButtonComp( - AppI18n.observable(translationsKey + "Button"), - buttonGraphic != null ? buttonGraphic.createGraphicNode() : null, - buttonAction); - if (buttonDefault) { - button.styleClass(Styles.ACCENT); - } - var buttonPane = new StackPane(button.createRegion()); - buttonPane.setAlignment(Pos.CENTER); - var v = new VBox(hbox); + if (buttonAction != null) { + var button = new ButtonComp( + AppI18n.observable(translationsKey + "Button"), + buttonGraphic != null ? buttonGraphic.createGraphicNode() : null, + buttonAction); + if (buttonDefault) { + button.styleClass(Styles.ACCENT); + } + var buttonPane = new StackPane(button.createRegion()); + buttonPane.setAlignment(Pos.CENTER); v.getChildren().add(buttonPane); } diff --git a/app/src/main/java/io/xpipe/app/core/AppLogs.java b/app/src/main/java/io/xpipe/app/core/AppLogs.java index 016913088..91c1dd460 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLogs.java +++ b/app/src/main/java/io/xpipe/app/core/AppLogs.java @@ -2,7 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; -import io.xpipe.core.Deobfuscator; +import io.xpipe.app.util.Deobfuscator; import lombok.Getter; import org.apache.commons.io.FileUtils; diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java b/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java index 3acd5abb4..a536c4bfb 100644 --- a/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java +++ b/app/src/main/java/io/xpipe/app/issue/ErrorDetailsComp.java @@ -3,7 +3,7 @@ package io.xpipe.app.issue; import io.xpipe.app.comp.Comp; import io.xpipe.app.comp.SimpleComp; import io.xpipe.app.core.AppFontSizes; -import io.xpipe.core.Deobfuscator; +import io.xpipe.app.util.Deobfuscator; import javafx.geometry.Insets; import javafx.scene.control.TextArea; diff --git a/app/src/main/java/io/xpipe/app/issue/EventHandlerImpl.java b/app/src/main/java/io/xpipe/app/issue/EventHandlerImpl.java index 2b3d874e6..c3bf356c3 100644 --- a/app/src/main/java/io/xpipe/app/issue/EventHandlerImpl.java +++ b/app/src/main/java/io/xpipe/app/issue/EventHandlerImpl.java @@ -3,7 +3,7 @@ package io.xpipe.app.issue; import io.xpipe.app.core.AppLogs; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.core.Deobfuscator; +import io.xpipe.app.util.Deobfuscator; import java.nio.file.Path; diff --git a/app/src/main/java/io/xpipe/app/issue/LogErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/LogErrorHandler.java index f332114e0..2916946a1 100644 --- a/app/src/main/java/io/xpipe/app/issue/LogErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/LogErrorHandler.java @@ -1,7 +1,7 @@ package io.xpipe.app.issue; import io.xpipe.app.core.AppLogs; -import io.xpipe.core.Deobfuscator; +import io.xpipe.app.util.Deobfuscator; public class LogErrorHandler implements ErrorHandler { diff --git a/app/src/main/java/io/xpipe/app/update/AppDistributionType.java b/app/src/main/java/io/xpipe/app/update/AppDistributionType.java index 28a7afaee..85780a5ff 100644 --- a/app/src/main/java/io/xpipe/app/update/AppDistributionType.java +++ b/app/src/main/java/io/xpipe/app/update/AppDistributionType.java @@ -197,7 +197,7 @@ public enum AppDistributionType implements Translatable { if (OsType.getLocal() == OsType.LINUX) { if (base.startsWith("/opt")) { - var aptOut = LocalExec.readStdoutIfPossible("apt", "show", "xpipe"); + var aptOut = LocalExec.readStdoutIfPossible("apt", "show", AppNames.ofCurrent().getKebapName()); if (aptOut.isPresent()) { var fromRepo = aptOut.get().lines().anyMatch(s -> { return s.contains("APT-Sources") && s.contains("apt.xpipe.io"); diff --git a/core/src/main/java/io/xpipe/core/Deobfuscator.java b/app/src/main/java/io/xpipe/app/util/Deobfuscator.java similarity index 85% rename from core/src/main/java/io/xpipe/core/Deobfuscator.java rename to app/src/main/java/io/xpipe/app/util/Deobfuscator.java index 2f8b63351..5ec569d32 100644 --- a/core/src/main/java/io/xpipe/core/Deobfuscator.java +++ b/app/src/main/java/io/xpipe/app/util/Deobfuscator.java @@ -1,4 +1,7 @@ -package io.xpipe.core; +package io.xpipe.app.util; + +import io.xpipe.app.core.AppNames; +import io.xpipe.core.OsType; import java.io.PrintWriter; import java.io.StringWriter; @@ -19,11 +22,11 @@ public class Deobfuscator { return stackTrace; } - var file = Files.createTempFile("xpipe-stacktrace", null); + var file = Files.createTempFile(AppNames.ofCurrent().getKebapName() + "-stacktrace", null); Files.writeString(file, stackTrace); var proc = new ProcessBuilder( "retrace." + (OsType.getLocal() == OsType.WINDOWS ? "bat" : "sh"), - System.getenv("XPIPE_MAPPING"), + System.getenv(AppNames.ofMain().getUppercaseName() + "_MAPPING"), file.toString()) .redirectErrorStream(true); var active = proc.start(); diff --git a/build.gradle b/build.gradle index 07fa52138..708ed527c 100644 --- a/build.gradle +++ b/build.gradle @@ -41,8 +41,8 @@ subprojects {subproject -> } } -def user = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME') -def pass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD') +def sonatypeUser = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME') +def sonatypePass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD') tasks.withType(GenerateModuleMetadata).configureEach { enabled = false @@ -53,8 +53,8 @@ nexusPublishing { sonatype { nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/')) snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')) - username = user - password = pass + username = sonatypeUser + password = sonatypePass } } useStaging = true @@ -98,17 +98,17 @@ def getPlatformName() { def getJvmArgs() { def os = DefaultNativePlatform.currentOperatingSystem def jvmRunArgs = [ - "-Dio.xpipe.app.arch=$arch", + "-D" + propertyName("arch") + "=" + arch, "-Dfile.encoding=UTF-8", "-Dvisualvm.display.name=$productName", - "-Djavafx.preloader=io.xpipe.app.core.AppPreloader", + "-Djavafx.preloader=" + packageName("core.AppPreloader"), "-Djdk.virtualThreadScheduler.parallelism=8" ] // Virtual threads cause crashes on Windows ARM if (os.isWindows() && arch == "arm64") { jvmRunArgs += [ - "-Dio.xpipe.app.useVirtualThreads=false" + "-D" + propertyName("useVirtualThreads") + "=false" ] } @@ -121,23 +121,23 @@ def getJvmArgs() { ] // Module access fixes + def appPackage = packageName(null) jvmRunArgs += [ - "--add-opens", "java.base/java.lang=io.xpipe.app", - "--add-opens", "net.synedra.validatorfx/net.synedra.validatorfx=io.xpipe.app", - "--add-opens", "java.base/java.nio.file=io.xpipe.app", - "--add-opens", "java.base/java.lang=io.xpipe.app", - "--add-exports", "javafx.graphics/com.sun.javafx.tk=io.xpipe.app", + "--add-opens", "java.base/java.lang=$appPackage", + "--add-opens", "net.synedra.validatorfx/net.synedra.validatorfx=$appPackage", + "--add-opens", "java.base/java.nio.file=$appPackage", + "--add-exports", "javafx.graphics/com.sun.javafx.tk=$appPackage", "--add-exports", "jdk.zipfs/jdk.nio.zipfs=io.xpipe.modulefs", - "--add-opens", "javafx.graphics/com.sun.glass.ui=io.xpipe.app", - "--add-opens", "javafx.graphics/javafx.stage=io.xpipe.app", - "--add-opens", "javafx.graphics/com.sun.javafx.tk=io.xpipe.app", - "--add-opens", "javafx.graphics/com.sun.javafx.tk.quantum=io.xpipe.app" + "--add-opens", "javafx.graphics/com.sun.glass.ui=$appPackage", + "--add-opens", "javafx.graphics/javafx.stage=$appPackage", + "--add-opens", "javafx.graphics/com.sun.javafx.tk=$appPackage", + "--add-opens", "javafx.graphics/com.sun.javafx.tk.quantum=$appPackage" ] if (fullVersion) { jvmRunArgs += [ - "--add-opens", "java.base/java.io=io.xpipe.ext.proc", - "--add-opens", "org.apache.commons.io/org.apache.commons.io.input=io.xpipe.ext.proc", + "--add-opens", "java.base/java.io=" + packageName("ext.proc", null), + "--add-opens", "org.apache.commons.io/org.apache.commons.io.input=" + packageName("ext.proc", null), ] } @@ -163,61 +163,82 @@ def getJvmArgs() { jvmRunArgs += ["-Dapple.awt.application.appearance=system"] } + if (os == org.gradle.internal.os.OperatingSystem.LINUX) { + jvmRunArgs.addAll("--add-opens", "java.desktop/sun.awt.X11=" + packageName(null)) + } + return jvmRunArgs } project.ext { - ci = System.getenv('CI') != null - os = org.gradle.internal.os.OperatingSystem.current() - allExtensions = Stream.concat(Stream.of(project(':base')), Arrays.stream(file("$rootDir/ext").list()) - .filter(s -> file("$rootDir/ext/$s/build.gradle").exists()) - .filter(s -> s != 'base') - .map(l -> project(":$l"))).toList() - fullVersion = file("$rootDir/private_files.txt").exists() - arch = getArchName() - privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : [] + // Release pipeline config isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE')) isStage = System.getenv('STAGE') != null && Boolean.parseBoolean(System.getenv('STAGE')) - rawVersion = file('version').text.strip() - versionString = rawVersion + (isFullRelease || isStage ? '' : '-SNAPSHOT') - versionReleaseNumber = rawVersion.split('-').length == 2 ? Integer.parseInt(rawVersion.split('-')[1]) : 1 - canonicalVersionString = rawVersion.split('-').length == 2 ? rawVersion.split('-')[0] : rawVersion - buildId = UUID.nameUUIDFromBytes(versionString.getBytes()) + ci = System.getenv('CI') != null obfuscate = true - changelog = file("dist/changelog/${canonicalVersionString}.md").exists() ? file("dist/changelog/${canonicalVersionString}.md").text.strip() + '\n' : "" + bundleCds = ci && fullVersion + + // Names productName = isStage ? 'XPipe PTB' : 'XPipe' kebapProductName = isStage ? 'xpipe-ptb' : 'xpipe' flatcaseProductName = isStage ? 'xpipeptb' : 'xpipe' snakeProductName = isStage ? 'xpipe_ptb' : 'xpipe' + artifactBaseName = "xpipe" + + // Info publisher = 'XPipe UG (haftungsbeschränkt)' shortDescription = isStage ? 'XPipe PTB (Public Test Build)' : 'Your entire server infrastructure at your fingertips' longDescription = 'XPipe is a new type of shell connection hub and remote file manager that allows you to access your entire server infrastructure from your local machine. It works on top of your installed command-line programs that you normally use to connect and does not require any setup on your remote systems.' website = 'https://xpipe.io' sourceWebsite = isStage ? 'https://github.com/xpipe-io/xpipe-ptb' : 'https://github.com/xpipe-io/xpipe' authors = 'Christopher Schnick' - devJavafxVersion = '26-ea+3' - platformName = getPlatformName() - jvmRunArgs = getJvmArgs() - useBundledJavaFx = fullVersion - useBundledJna = fullVersion - announce = System.getenv('SKIP_ANNOUNCEMENT') == null || !Boolean.parseBoolean(System.getenv('SKIP_ANNOUNCEMENT')) + + // Version info + rawVersion = file('version').text.strip() + versionString = rawVersion + (isFullRelease || isStage ? '' : '-SNAPSHOT') + versionReleaseNumber = rawVersion.split('-').length == 2 ? Integer.parseInt(rawVersion.split('-')[1]) : 1 + canonicalVersionString = rawVersion.split('-').length == 2 ? rawVersion.split('-')[0] : rawVersion + buildId = UUID.nameUUIDFromBytes(versionString.getBytes()) + windowsSchemaCanonicalVersion = getWindowsSchemaCanonicalVersion() + + // Changelog info + changelog = file("dist/changelog/${canonicalVersionString}.md").exists() ? file("dist/changelog/${canonicalVersionString}.md").text.strip() + '\n' : "" changelogFile = file("$rootDir/dist/changelog/${versionString}.md").exists() ? file("$rootDir/dist/changelog/${versionString}.md") : file("$rootDir/dist/changelog/${canonicalVersionString}.md") incrementalChangelogFile = file("$rootDir/dist/changelog/${canonicalVersionString}_incremental.md") + announce = System.getenv('SKIP_ANNOUNCEMENT') == null || !Boolean.parseBoolean(System.getenv('SKIP_ANNOUNCEMENT')) + + // Signing config signingKeyId = project.hasProperty('signingKeyId') ? project.property("signingKeyId") : (System.getenv('GPG_KEY_ID') != null ? System.getenv('GPG_KEY_ID') : "") signingKey = project.hasProperty('signingKeyFile') ? file(project.property("signingKeyFile")).text : (System.getenv('GPG_KEY') != null ? System.getenv('GPG_KEY') : "") signingPassword = project.hasProperty('signingKeyPassword') ? project.property("signingKeyPassword") : (System.getenv('GPG_KEY_PASSWORD') != null ? System.getenv('GPG_KEY_PASSWORD') : "") - deeplApiKey = findProperty('DEEPL_API_KEY') != null ? findProperty('DEEPL_API_KEY') : "" + // Extension config + allExtensions = Stream.concat(Stream.of(project(':base')), Arrays.stream(file("$rootDir/ext").list()) + .filter(s -> file("$rootDir/ext/$s/build.gradle").exists()) + .filter(s -> s != 'base') + .map(l -> project(":$l"))).toList() + fullVersion = file("$rootDir/private_files.txt").exists() + privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : [] + + // Build config + os = org.gradle.internal.os.OperatingSystem.current() + groupName = 'io.xpipe' + arch = getArchName() + jvmRunArgs = getJvmArgs() + useBundledJna = fullVersion + + // JavaFX config + devJavafxVersion = '26-ea+3' + platformName = getPlatformName() + useBundledJavaFx = fullVersion bundledJdkJavaFx = ModuleFinder.ofSystem().find("javafx.base").isPresent() - // Define a custom JavaFX SDK location // customJavaFxPath = null - bundleCds = ci && fullVersion - windowsSchemaCanonicalVersion = getWindowsSchemaCanonicalVersion() - groupName = 'io.xpipe' + // Other + deeplApiKey = findProperty('DEEPL_API_KEY') != null ? findProperty('DEEPL_API_KEY') : "" } def propertyName(String s) { @@ -245,10 +266,6 @@ def getWindowsSchemaCanonicalVersion() { return v + "." + last } -if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.LINUX) { - jvmRunArgs.addAll("--add-opens", "java.desktop/sun.awt.X11=io.xpipe.app") -} - if (isFullRelease && rawVersion.contains("-")) { throw new IllegalArgumentException("Releases must have canonical versions") }