From f2bdee4337d37a58e4ede5c37894f1d905abf6f1 Mon Sep 17 00:00:00 2001 From: Alexander Krimm Date: Thu, 22 Jun 2023 23:00:09 +0200 Subject: [PATCH 1/3] scenebuilder: 15.0.1 -> 19.0.0 Bump scenebuilder to 19.0.0 as the latest release 20.0.0 depends on jdk20, which is not packaged in nixpkgs yet. Since version 15 the build system for scenebuilder was switched from gradle to maven. Additionally this commit switches to using a jre which bundles openjfx. This used to be the default but was changed in ce6bc62, which prevented scenebuilder from starting. --- .../tools/scenebuilder/default.nix | 114 +++++------------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 33 insertions(+), 85 deletions(-) diff --git a/pkgs/development/tools/scenebuilder/default.nix b/pkgs/development/tools/scenebuilder/default.nix index 56ddc9af95b2..d191ff934a99 100644 --- a/pkgs/development/tools/scenebuilder/default.nix +++ b/pkgs/development/tools/scenebuilder/default.nix @@ -1,69 +1,46 @@ -{ lib, stdenv, fetchFromGitHub, jdk11, gradle_6, makeDesktopItem, copyDesktopItems, perl, writeText, runtimeShell, makeWrapper, glib, wrapGAppsHook }: -let - gradle = gradle_6; - +{ lib, stdenv, fetchFromGitHub, jre, maven, makeDesktopItem, copyDesktopItems, perl, writeText, runtimeShell, makeWrapper, glib, wrapGAppsHook }: +maven.buildMavenPackage rec { pname = "scenebuilder"; - version = "15.0.1"; + version = "19.0.0"; # 20.0.0 already available but needs java20 which is not available in nixpkgs yet src = fetchFromGitHub { owner = "gluonhq"; repo = pname; rev = version; - sha256 = "0dqlpfgr9qpmk62zsnhzw4q6n0swjqy00294q0kb4djp3jn47iz4"; + hash = "sha256-No0yMAVmM5T++h74ZZIufaHmJBOzYhI0EtfOEGWGzis="; }; - deps = stdenv.mkDerivation { - name = "${pname}-deps"; - inherit src; + inherit jre; - nativeBuildInputs = [ jdk11 perl gradle ]; + buildDate = "2022-10-07T00:00:00+01:00"; # v20.0.0 release date + mvnParameters = "-Dmaven.test.skip -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; + mvnHash = "sha256-G4WjQVRawNITSGh/e+fb6fVe80WSd0swT3uPIQOlif4="; - buildPhase = '' - export GRADLE_USER_HOME=$(mktemp -d); - gradle --no-daemon build -x test - ''; + nativeBuildInputs = [ copyDesktopItems maven makeWrapper glib wrapGAppsHook ]; - # Mavenize dependency paths - # e.g. org.codehaus.groovy/groovy/2.4.0/{hash}/groovy-2.4.0.jar -> org/codehaus/groovy/groovy/2.4.0/groovy-2.4.0.jar - installPhase = '' - find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \ - | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \ - | sh - ''; + dontWrapGApps = true; # prevent double wrapping - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "01dkayad68g3zpzdnjwrc0h6s7s6n619y5b576snc35l8g2r5sgd"; - }; + installPhase = '' + runHook preInstall - # Point to our local deps repo - gradleInit = writeText "init.gradle" '' - settingsEvaluated { settings -> - settings.pluginManagement { - repositories { - clear() - maven { url '${deps}' } - } - } - } - logger.lifecycle 'Replacing Maven repositories with ${deps}...' - gradle.projectsLoaded { - rootProject.allprojects { - buildscript { - repositories { - clear() - maven { url '${deps}' } - } - } - repositories { - clear() - maven { url '${deps}' } - } - } - } + 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 + + runHook postInstall ''; - desktopItem = makeDesktopItem { + postFixup = '' + makeWrapper ${jre}/bin/java $out/bin/${pname} \ + --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" \ + "''${gappsWrapperArgs[@]}" + ''; + + desktopItems = [ (makeDesktopItem { name = "scenebuilder"; exec = "scenebuilder"; icon = "scenebuilder"; @@ -71,39 +48,7 @@ let desktopName = "Scene Builder"; mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ]; categories = [ "Development" ]; - }; - -in stdenv.mkDerivation rec { - inherit pname src version; - - nativeBuildInputs = [ jdk11 gradle makeWrapper glib wrapGAppsHook ]; - - dontWrapGApps = true; # prevent double wrapping - - buildPhase = '' - runHook preBuild - - export GRADLE_USER_HOME=$(mktemp -d) - gradle -PVERSION=${version} --offline --no-daemon --info --init-script ${gradleInit} build -x test - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin $out/share/{${pname},icons/hicolor/128x128/apps} - cp app/build/libs/SceneBuilder-${version}-all.jar $out/share/${pname}/${pname}.jar - cp app/build/resources/main/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png - - runHook postInstall - ''; - - postFixup = '' - makeWrapper ${jdk11}/bin/java $out/bin/${pname} --add-flags "-jar $out/share/${pname}/${pname}.jar" "''${gappsWrapperArgs[@]}" - ''; - - desktopItems = [ desktopItem ]; + }) ]; meta = with lib; { broken = stdenv.isDarwin; @@ -118,3 +63,4 @@ in stdenv.mkDerivation rec { platforms = platforms.all; }; } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 288098666707..ecff14adfb66 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19859,7 +19859,9 @@ with pkgs; schemaspy = callPackage ../development/tools/database/schemaspy { }; - scenebuilder = callPackage ../development/tools/scenebuilder { }; + scenebuilder = callPackage ../development/tools/scenebuilder { + jre = jre.override { enableJavaFX = true; }; + }; scenic-view = callPackage ../development/tools/scenic-view { jdk = jdk11; }; From d02a90fd173f4076412432fd3ef8fadacd7b1945 Mon Sep 17 00:00:00 2001 From: Alexander Krimm Date: Thu, 22 Jun 2023 23:22:16 +0200 Subject: [PATCH 2/3] scenic-view: use a jdk with bundled openjfx This used to be the default but got changed in #206643 / ce6bc62 to reduce the closure of non javafx java apps. Additionally 1caf19b removed webkit support which is also required for scenic-view and therefore explicitly enabled. --- pkgs/top-level/all-packages.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ecff14adfb66..1eb95527316c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19863,7 +19863,12 @@ with pkgs; jre = jre.override { enableJavaFX = true; }; }; - scenic-view = callPackage ../development/tools/scenic-view { jdk = jdk11; }; + scenic-view = callPackage ../development/tools/scenic-view { + jdk = jdk.override { + enableJavaFX = true; + openjfx = openjfx.override { withWebKit = true; }; + }; + }; shncpd = callPackage ../tools/networking/shncpd { }; From b881156cec7b253079f23d182ae5c01c217f302b Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 5 Aug 2023 19:12:48 +0200 Subject: [PATCH 3/3] scenebuilder: 19.0.0 -> 20.0.0 --- .../tools/scenebuilder/default.nix | 31 +++++++++++++------ .../development/tools/scenic-view/default.nix | 7 ++++- pkgs/top-level/all-packages.nix | 11 ++----- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/pkgs/development/tools/scenebuilder/default.nix b/pkgs/development/tools/scenebuilder/default.nix index d191ff934a99..f7ed72be94ae 100644 --- a/pkgs/development/tools/scenebuilder/default.nix +++ b/pkgs/development/tools/scenebuilder/default.nix @@ -1,22 +1,35 @@ -{ lib, stdenv, fetchFromGitHub, jre, maven, makeDesktopItem, copyDesktopItems, perl, writeText, runtimeShell, makeWrapper, glib, wrapGAppsHook }: -maven.buildMavenPackage rec { +{ lib, stdenv, fetchFromGitHub, openjdk20, maven, makeDesktopItem, copyDesktopItems, makeWrapper, glib, wrapGAppsHook }: + +let + jdk = openjdk20.override (lib.optionalAttrs stdenv.isLinux { + 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 = "19.0.0"; # 20.0.0 already available but needs java20 which is not available in nixpkgs yet + version = "20.0.0"; src = fetchFromGitHub { owner = "gluonhq"; repo = pname; rev = version; - hash = "sha256-No0yMAVmM5T++h74ZZIufaHmJBOzYhI0EtfOEGWGzis="; + hash = "sha256-Og+dzkJ6+YH0fD4HJw8gUKGgvQuNw17BxgzZMP/bEA0="; }; - inherit jre; - buildDate = "2022-10-07T00:00:00+01:00"; # v20.0.0 release date mvnParameters = "-Dmaven.test.skip -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; - mvnHash = "sha256-G4WjQVRawNITSGh/e+fb6fVe80WSd0swT3uPIQOlif4="; + mvnHash = selectSystem { + x86_64-linux = "sha256-3SFCQ+hyQPtAEx1jSbe/Qtq4dYkfVvU/Kmekzv53o3U="; + aarch64-linux = "sha256-AZ1NXzSRyT77W+EjLIb7eWxf7Ztu6XuKjSImRg1lNcw="; + }; - nativeBuildInputs = [ copyDesktopItems maven makeWrapper glib wrapGAppsHook ]; + nativeBuildInputs = [ copyDesktopItems makeWrapper glib wrapGAppsHook ]; dontWrapGApps = true; # prevent double wrapping @@ -32,7 +45,7 @@ maven.buildMavenPackage rec { ''; postFixup = '' - makeWrapper ${jre}/bin/java $out/bin/${pname} \ + makeWrapper ${jdk}/bin/java $out/bin/${pname} \ --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" \ diff --git a/pkgs/development/tools/scenic-view/default.nix b/pkgs/development/tools/scenic-view/default.nix index 172fbc80804d..3d0c69d66cf7 100644 --- a/pkgs/development/tools/scenic-view/default.nix +++ b/pkgs/development/tools/scenic-view/default.nix @@ -1,5 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, jdk, gradle_7, makeDesktopItem, copyDesktopItems, perl, writeText, runtimeShell, makeWrapper }: +{ lib, stdenv, fetchFromGitHub, openjdk, openjfx, gradle_7, makeDesktopItem, perl, writeText, makeWrapper }: let + jdk = openjdk.override (lib.optionalAttrs stdenv.isLinux { + enableJavaFX = true; + openjfx = openjfx.override { withWebKit = true; }; + }); + pname = "scenic-view"; version = "11.0.2"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1eb95527316c..901c6c8611e9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19859,16 +19859,9 @@ with pkgs; schemaspy = callPackage ../development/tools/database/schemaspy { }; - scenebuilder = callPackage ../development/tools/scenebuilder { - jre = jre.override { enableJavaFX = true; }; - }; + scenebuilder = callPackage ../development/tools/scenebuilder { }; - scenic-view = callPackage ../development/tools/scenic-view { - jdk = jdk.override { - enableJavaFX = true; - openjfx = openjfx.override { withWebKit = true; }; - }; - }; + scenic-view = callPackage ../development/tools/scenic-view { }; shncpd = callPackage ../tools/networking/shncpd { };