From 971f75d50dae1698a0ee74a42519c337a2e495e8 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Thu, 8 Feb 2024 22:43:30 +0100 Subject: [PATCH] scenebuilder: 20.0.0 -> 21.0.1, make deterministic --- .../tools/scenebuilder/default.nix | 102 +++++++++++------- .../fix-default-maven-plugin-versions.patch | 60 +++++++++++ .../scenebuilder/pom-remove-javafx.patch | 28 +++++ 3 files changed, 151 insertions(+), 39 deletions(-) create mode 100644 pkgs/development/tools/scenebuilder/fix-default-maven-plugin-versions.patch create mode 100644 pkgs/development/tools/scenebuilder/pom-remove-javafx.patch diff --git a/pkgs/development/tools/scenebuilder/default.nix b/pkgs/development/tools/scenebuilder/default.nix index e10ebf1e5519..6e0b80497f4b 100644 --- a/pkgs/development/tools/scenebuilder/default.nix +++ b/pkgs/development/tools/scenebuilder/default.nix @@ -1,80 +1,104 @@ -{ lib, stdenv, fetchFromGitHub, openjdk20, maven, makeDesktopItem, copyDesktopItems, makeWrapper, glib, wrapGAppsHook }: +{ lib +, jdk21 +, maven +, fetchFromGitHub +, makeDesktopItem +, copyDesktopItems +, glib +, makeWrapper +, wrapGAppsHook +}: let - jdk = openjdk20.override (lib.optionalAttrs stdenv.isLinux { + jdk = jdk21.override { enableJavaFX = true; - }); + }; maven' = maven.override { inherit jdk; }; - selectSystem = attrs: - attrs.${stdenv.hostPlatform.system} - or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); in maven'.buildMavenPackage rec { pname = "scenebuilder"; - version = "20.0.0"; + version = "21.0.1"; src = fetchFromGitHub { owner = "gluonhq"; - repo = pname; + repo = "scenebuilder"; rev = version; - hash = "sha256-Og+dzkJ6+YH0fD4HJw8gUKGgvQuNw17BxgzZMP/bEA0="; + hash = "sha256-YEcW1yQK6RKDqSstsrpdOqMt972ZagenGDxcJ/gP+SA="; }; - buildDate = "2022-10-07T00:00:00+01:00"; # v20.0.0 release date - mvnParameters = "-Dmaven.test.skip -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; - mvnHash = selectSystem { - x86_64-linux = "sha256-QwxA3lKVkRG5CV2GIwfVFPOj112pHr7bDlZJD6KwrHc="; - aarch64-linux = "sha256-cO5nHSvv2saBuAjq47A+GW9vFWEM+ysXyZgI0Oe/F70="; - }; + patches = [ + # makes the mvnHash platform-independent + ./pom-remove-javafx.patch - nativeBuildInputs = [ copyDesktopItems makeWrapper glib wrapGAppsHook ]; + # makes sure that maven upgrades don't change the mvnHash + ./fix-default-maven-plugin-versions.patch + ]; + + postPatch = '' + # set the build timestamp to $SOURCE_DATE_EPOCH + substituteInPlace app/pom.xml \ + --replace-fail "\''${maven.build.timestamp}" "$(date -d "@$SOURCE_DATE_EPOCH" '+%Y-%m-%d %H:%M:%S')" + ''; + + mvnParameters = toString [ + "-Dmaven.test.skip" + "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z" + ]; + + mvnHash = "sha256-fS7dS2Q4ORThLBwDOzJJnRboNNRmhp0RG6Dae9fl+pw="; + + nativeBuildInputs = [ + copyDesktopItems + glib + makeWrapper + wrapGAppsHook + ]; dontWrapGApps = true; # prevent double wrapping installPhase = '' runHook preInstall - mkdir -p $out/bin $out/share/java $out/share/{${pname},icons/hicolor/128x128/apps} - cp app/target/lib/scenebuilder-${version}-SNAPSHOT-all.jar $out/share/java/${pname}.jar - - cp app/src/main/resources/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png + install -Dm644 app/target/lib/scenebuilder-${version}-SNAPSHOT-all.jar $out/share/scenebuilder/scenebuilder.jar + install -Dm644 app/src/main/resources/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png runHook postInstall ''; postFixup = '' - makeWrapper ${jdk}/bin/java $out/bin/${pname} \ + makeWrapper ${jdk}/bin/java $out/bin/scenebuilder \ --add-flags "--add-modules javafx.web,javafx.fxml,javafx.swing,javafx.media" \ --add-flags "--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED" \ - --add-flags "-cp $out/share/java/${pname}.jar" \ - --add-flags "com.oracle.javafx.scenebuilder.app.SceneBuilderApp" \ + --add-flags "-jar $out/share/scenebuilder/scenebuilder.jar" \ "''${gappsWrapperArgs[@]}" - ''; + ''; - desktopItems = [ (makeDesktopItem { - name = "scenebuilder"; - exec = "scenebuilder"; - icon = "scenebuilder"; - comment = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces."; - desktopName = "Scene Builder"; - mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ]; - categories = [ "Development" ]; - }) ]; + desktopItems = [ + (makeDesktopItem { + name = "scenebuilder"; + exec = "scenebuilder"; + icon = "scenebuilder"; + comment = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces."; + desktopName = "Scene Builder"; + mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ]; + categories = [ "Development" ]; + }) + ]; meta = with lib; { - broken = stdenv.isDarwin; + changelog = "https://github.com/gluonhq/scenebuilder/releases/tag/${src.rev}"; description = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces."; - mainProgram = "scenebuilder"; homepage = "https://gluonhq.com/products/scene-builder/"; + license = licenses.bsd3; + mainProgram = "scenebuilder"; + maintainers = with maintainers; [ wirew0rm ]; + platforms = jdk.meta.platforms; sourceProvenance = with sourceTypes; [ fromSource - binaryBytecode # deps + binaryBytecode # deps ]; - license = licenses.bsd3; - maintainers = with maintainers; [ wirew0rm ]; - platforms = platforms.all; }; } diff --git a/pkgs/development/tools/scenebuilder/fix-default-maven-plugin-versions.patch b/pkgs/development/tools/scenebuilder/fix-default-maven-plugin-versions.patch new file mode 100644 index 000000000000..be5e590694a0 --- /dev/null +++ b/pkgs/development/tools/scenebuilder/fix-default-maven-plugin-versions.patch @@ -0,0 +1,60 @@ +diff --git a/pom.xml b/pom.xml +index 193f7ca..45faa1a 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -137,6 +137,55 @@ + + + ++ ++ org.apache.maven.plugins ++ maven-enforcer-plugin ++ 3.3.0 ++ ++ ++ require-all-plugin-versions-to-be-set ++ validate ++ ++ enforce ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ org.apache.maven.plugins ++ maven-clean-plugin ++ 3.3.2 ++ ++ ++ org.apache.maven.plugins ++ maven-install-plugin ++ 3.1.1 ++ ++ ++ org.apache.maven.plugins ++ maven-site-plugin ++ 4.0.0-M13 ++ ++ ++ org.apache.maven.plugins ++ maven-deploy-plugin ++ 3.1.1 ++ ++ ++ org.apache.maven.plugins ++ maven-surefire-plugin ++ 3.2.5 ++ ++ ++ org.apache.maven.plugins ++ maven-jar-plugin ++ 3.3.0 ++ + + org.codehaus.mojo + build-helper-maven-plugin diff --git a/pkgs/development/tools/scenebuilder/pom-remove-javafx.patch b/pkgs/development/tools/scenebuilder/pom-remove-javafx.patch new file mode 100644 index 000000000000..6c9c9784d037 --- /dev/null +++ b/pkgs/development/tools/scenebuilder/pom-remove-javafx.patch @@ -0,0 +1,28 @@ +diff --git a/kit/pom.xml b/kit/pom.xml +index 644d36c..e4d91fb 100644 +--- a/kit/pom.xml ++++ b/kit/pom.xml +@@ -11,23 +11,6 @@ + + + +- +- +- org.openjfx +- javafx-fxml +- ${javafx.version} +- +- +- org.openjfx +- javafx-web +- ${javafx.version} +- +- +- org.openjfx +- javafx-swing +- ${javafx.version} +- +- + + + org.eclipse.aether