Merge pull request #287319 from TomaSajt/scenebuilder

scenebuilder: 20.0.0 -> 21.0.1, make deterministic
This commit is contained in:
Peder Bergebakken Sundt 2024-04-22 23:29:16 +02:00 committed by GitHub
commit 48633752f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
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 {
desktopItems = [
(makeDesktopItem {
name = "scenebuilder";
exec = "scenebuilder";
icon = "scenebuilder";
@ -61,20 +84,21 @@ maven'.buildMavenPackage rec {
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
];
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>