scenebuilder: 20.0.0 -> 21.0.1, make deterministic

This commit is contained in:
TomaSajt 2024-02-08 22:43:30 +01:00
parent ab279344c5
commit 971f75d50d
No known key found for this signature in database
GPG key ID: F011163C050122A1
3 changed files with 151 additions and 39 deletions

View file

@ -1,59 +1,82 @@
{ lib, stdenv, fetchFromGitHub, openjdk20, maven, makeDesktopItem, copyDesktopItems, makeWrapper, glib, wrapGAppsHook }: { lib
, jdk21
, maven
, fetchFromGitHub
, makeDesktopItem
, copyDesktopItems
, glib
, makeWrapper
, wrapGAppsHook
}:
let let
jdk = openjdk20.override (lib.optionalAttrs stdenv.isLinux { jdk = jdk21.override {
enableJavaFX = true; enableJavaFX = true;
}); };
maven' = maven.override { maven' = maven.override {
inherit jdk; inherit jdk;
}; };
selectSystem = attrs:
attrs.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in in
maven'.buildMavenPackage rec { maven'.buildMavenPackage rec {
pname = "scenebuilder"; pname = "scenebuilder";
version = "20.0.0"; version = "21.0.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "gluonhq"; owner = "gluonhq";
repo = pname; repo = "scenebuilder";
rev = version; 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 patches = [
mvnParameters = "-Dmaven.test.skip -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; # makes the mvnHash platform-independent
mvnHash = selectSystem { ./pom-remove-javafx.patch
x86_64-linux = "sha256-QwxA3lKVkRG5CV2GIwfVFPOj112pHr7bDlZJD6KwrHc=";
aarch64-linux = "sha256-cO5nHSvv2saBuAjq47A+GW9vFWEM+ysXyZgI0Oe/F70=";
};
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 dontWrapGApps = true; # prevent double wrapping
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin $out/share/java $out/share/{${pname},icons/hicolor/128x128/apps} install -Dm644 app/target/lib/scenebuilder-${version}-SNAPSHOT-all.jar $out/share/scenebuilder/scenebuilder.jar
cp app/target/lib/scenebuilder-${version}-SNAPSHOT-all.jar $out/share/java/${pname}.jar install -Dm644 app/src/main/resources/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png
cp app/src/main/resources/com/oracle/javafx/scenebuilder/app/SB_Logo.png $out/share/icons/hicolor/128x128/apps/scenebuilder.png
runHook postInstall runHook postInstall
''; '';
postFixup = '' 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-modules javafx.web,javafx.fxml,javafx.swing,javafx.media" \
--add-flags "--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED" \ --add-flags "--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED" \
--add-flags "-cp $out/share/java/${pname}.jar" \ --add-flags "-jar $out/share/scenebuilder/scenebuilder.jar" \
--add-flags "com.oracle.javafx.scenebuilder.app.SceneBuilderApp" \
"''${gappsWrapperArgs[@]}" "''${gappsWrapperArgs[@]}"
''; '';
desktopItems = [ (makeDesktopItem { desktopItems = [
(makeDesktopItem {
name = "scenebuilder"; name = "scenebuilder";
exec = "scenebuilder"; exec = "scenebuilder";
icon = "scenebuilder"; icon = "scenebuilder";
@ -61,20 +84,21 @@ maven'.buildMavenPackage rec {
desktopName = "Scene Builder"; desktopName = "Scene Builder";
mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ]; mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ];
categories = [ "Development" ]; categories = [ "Development" ];
}) ]; })
];
meta = with lib; { 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."; description = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces.";
mainProgram = "scenebuilder";
homepage = "https://gluonhq.com/products/scene-builder/"; homepage = "https://gluonhq.com/products/scene-builder/";
license = licenses.bsd3;
mainProgram = "scenebuilder";
maintainers = with maintainers; [ wirew0rm ];
platforms = jdk.meta.platforms;
sourceProvenance = with sourceTypes; [ sourceProvenance = with sourceTypes; [
fromSource fromSource
binaryBytecode # deps binaryBytecode # deps
]; ];
license = licenses.bsd3;
maintainers = with maintainers; [ wirew0rm ];
platforms = platforms.all;
}; };
} }

View file

@ -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 @@
</plugins>
</pluginManagement>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>3.3.0</version>
+ <executions>
+ <execution>
+ <id>require-all-plugin-versions-to-be-set</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requirePluginVersions />
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.3.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>3.1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>4.0.0-M13</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>3.1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.2.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.3.0</version>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>

View file

@ -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 @@
</parent>
<dependencies>
- <!-- JavaFX -->
- <dependency>
- <groupId>org.openjfx</groupId>
- <artifactId>javafx-fxml</artifactId>
- <version>${javafx.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openjfx</groupId>
- <artifactId>javafx-web</artifactId>
- <version>${javafx.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openjfx</groupId>
- <artifactId>javafx-swing</artifactId>
- <version>${javafx.version}</version>
- </dependency>
-
<!-- Eclipse Aether -->
<dependency>
<groupId>org.eclipse.aether</groupId>