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; };