processing: Move to gradle-based build (#466611)
This commit is contained in:
Generated
+1178
File diff suppressed because it is too large
Load Diff
@@ -1,80 +0,0 @@
|
||||
diff --git a/app/build.xml b/app/build.xml
|
||||
index 37aa13d03..a495b4f7e 100644
|
||||
--- a/app/build.xml
|
||||
+++ b/app/build.xml
|
||||
@@ -162,6 +162,7 @@
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../core/library/core.jar;
|
||||
+ utils/library/utils.jar;
|
||||
lib/ant.jar;
|
||||
lib/ant-launcher.jar;
|
||||
lib/flatlaf.jar;
|
||||
diff --git a/app/utils/build.xml b/app/utils/build.xml
|
||||
new file mode 100644
|
||||
index 000000000..5a4b72e32
|
||||
--- /dev/null
|
||||
+++ b/app/utils/build.xml
|
||||
@@ -0,0 +1,22 @@
|
||||
+<?xml version="1.0"?>
|
||||
+<project name="Processing Utils Library" default="build">
|
||||
+ <target name="compile" description="Compile sources">
|
||||
+ <mkdir dir="bin" />
|
||||
+ <javac source="17"
|
||||
+ target="17"
|
||||
+ srcdir="src" destdir="bin"
|
||||
+ encoding="UTF-8"
|
||||
+ includeAntRuntime="false"
|
||||
+ nowarn="true">
|
||||
+ </javac>
|
||||
+ </target>
|
||||
+
|
||||
+ <target name="build" depends="compile" description="Build utils library">
|
||||
+ <jar basedir="bin" destfile="library/utils.jar" />
|
||||
+ </target>
|
||||
+
|
||||
+ <target name="clean" description="Clean the build directories">
|
||||
+ <delete dir="bin" />
|
||||
+ <delete file="library/utils.jar" />
|
||||
+ </target>
|
||||
+</project>
|
||||
diff --git a/build/build.xml b/build/build.xml
|
||||
index f1247b511..2f1f22128 100644
|
||||
--- a/build/build.xml
|
||||
+++ b/build/build.xml
|
||||
@@ -191,6 +191,7 @@
|
||||
<!-- also need to copy these to the bundleapp task for macos -->
|
||||
<fileset dir=".." id="runtime.jars">
|
||||
<include name="app/pde.jar" />
|
||||
+ <include name="app/utils/library/utils.jar" />
|
||||
<include name="app/lib/jna.jar" />
|
||||
<include name="app/lib/jna-platform.jar" />
|
||||
<include name="app/lib/ant.jar" />
|
||||
@@ -294,6 +295,7 @@
|
||||
|
||||
<target name="subprojects-clean">
|
||||
<subant buildpath="../core" target="clean"/>
|
||||
+ <subant buildpath="../app/utils" target="clean"/>
|
||||
<subant buildpath="../app" target="clean"/>
|
||||
<subant buildpath="../java/libraries/dxf" target="clean"/>
|
||||
<subant buildpath="../java/libraries/io" target="clean"/>
|
||||
@@ -315,6 +317,7 @@
|
||||
|
||||
<target name="subprojects-build">
|
||||
<subant buildpath="../core" target="build"/>
|
||||
+ <subant buildpath="../app/utils" target="build"/>
|
||||
<subant buildpath="../app" target="build"/>
|
||||
<subant buildpath="../java/libraries/dxf" target="build"/>
|
||||
<subant buildpath="../java/libraries/net" target="build"/>
|
||||
diff --git a/java/build.xml b/java/build.xml
|
||||
index ca2e32f4f..5aeae7ac8 100644
|
||||
--- a/java/build.xml
|
||||
+++ b/java/build.xml
|
||||
@@ -97,6 +97,7 @@
|
||||
<pathelement location="../app/lib/apple.jar" />
|
||||
<pathelement location="../app/lib/jna.jar" />
|
||||
<pathelement location="../app/lib/jna-platform.jar" />
|
||||
+ <pathelement location="../app/utils/library/utils.jar" />
|
||||
|
||||
<pathelement location="mode/antlr-4.7.2-complete.jar" />
|
||||
<pathelement location="mode/classpath-explorer-1.0.jar" />
|
||||
@@ -0,0 +1,24 @@
|
||||
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
|
||||
index 88a0b63..a0f50bc 100644
|
||||
--- a/app/build.gradle.kts
|
||||
+++ b/app/build.gradle.kts
|
||||
@@ -341,6 +341,7 @@ tasks.register<Copy>("includeJdk") {
|
||||
from(Jvm.current().javaHome.absolutePath)
|
||||
destinationDir = composeResources("jdk").get().asFile
|
||||
|
||||
+ dirPermissions { unix("rwx------") };
|
||||
fileTree(destinationDir).files.forEach { file ->
|
||||
file.setWritable(true, false)
|
||||
file.setReadable(true, false)
|
||||
diff --git a/java/build.gradle.kts b/java/build.gradle.kts
|
||||
index fc7151189..6dd8409fa 100644
|
||||
--- a/java/build.gradle.kts
|
||||
+++ b/java/build.gradle.kts
|
||||
@@ -80,6 +80,7 @@ legacyLibraries.forEach { library ->
|
||||
include("*.properties")
|
||||
include("library/**/*")
|
||||
include("examples/**/*")
|
||||
+ dirPermissions { unix("rwx------") };
|
||||
into( javaMode("/libraries/$library"))
|
||||
}
|
||||
bundle.configure {
|
||||
@@ -3,19 +3,20 @@
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchurl,
|
||||
ant,
|
||||
unzip,
|
||||
makeWrapper,
|
||||
gradle_8,
|
||||
jdk17,
|
||||
jogl,
|
||||
rsync,
|
||||
ffmpeg,
|
||||
batik,
|
||||
stripJavaArchivesHook,
|
||||
wrapGAppsHook3,
|
||||
libGL,
|
||||
}:
|
||||
let
|
||||
# Force use of JDK 17, see https://github.com/processing/processing4/issues/1043
|
||||
gradle = gradle_8.override { java = jdk17; };
|
||||
jdk = jdk17;
|
||||
buildNumber = "1310";
|
||||
vaqua = fetchurl {
|
||||
@@ -53,12 +54,6 @@ let
|
||||
url = "mirror://maven/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar";
|
||||
sha256 = "sha256-N4U04znm5tULFzb7Ort28cFdG+P0wTzsbVNkEuI9pgM=";
|
||||
};
|
||||
|
||||
arch =
|
||||
{
|
||||
x86_64 = "amd64";
|
||||
}
|
||||
.${stdenv.hostPlatform.parsed.cpu.name} or stdenv.hostPlatform.parsed.cpu.name;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "processing";
|
||||
@@ -71,10 +66,16 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-u2wQl/VGCNJPd+k3DX2eW7gkA/RARMTSNGcoQuS/Oh8=";
|
||||
};
|
||||
|
||||
patches = [ ./fix-ant-build.patch ];
|
||||
patches = [
|
||||
# Compose Multiplatform generates its createDistributable target too late, and we don't need it anyway
|
||||
./skip-distributable.patch
|
||||
|
||||
# dirPermissions: Without this, some gradle tasks (e.g. includeJdk) fail to copy contents of read-only subfolders within the nix store
|
||||
./fix-permissions.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
ant
|
||||
gradle
|
||||
unzip
|
||||
makeWrapper
|
||||
stripJavaArchivesHook
|
||||
@@ -83,21 +84,27 @@ stdenv.mkDerivation rec {
|
||||
buildInputs = [
|
||||
jdk
|
||||
jogl
|
||||
ant
|
||||
rsync
|
||||
ffmpeg
|
||||
batik
|
||||
];
|
||||
|
||||
dontWrapGApps = true;
|
||||
mitmCache = gradle.fetchDeps {
|
||||
inherit pname;
|
||||
data = ./deps.json;
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
gradleFlags = [ "-Dfile.encoding=utf-8" ];
|
||||
|
||||
gradleBuildTask = "createDistributable";
|
||||
gradleUpdateTask = "createDistributable";
|
||||
enableParallelUpdating = false;
|
||||
|
||||
# Need to run the entire createDistributable task, otherwise the buildPhase fails at the compose checkRuntime step
|
||||
gradleUpdateScript = ''
|
||||
runHook preBuild
|
||||
runHook preGradleUpdate
|
||||
|
||||
echo "tarring jdk"
|
||||
tar --checkpoint=10000 -czf build/linux/jdk-17.0.8-${arch}.tgz ${jdk}
|
||||
mkdir -p app/lib core/library
|
||||
cp ${ant.home}/lib/{ant.jar,ant-launcher.jar} app/lib/
|
||||
ln -s ${jogl}/share/java/* core/library/
|
||||
ln -s ${vaqua} app/lib/VAqua9.jar
|
||||
ln -s ${flatlaf} app/lib/flatlaf.jar
|
||||
@@ -107,13 +114,41 @@ stdenv.mkDerivation rec {
|
||||
unzip -qo ${jna} -d app/lib/
|
||||
mv app/lib/{jna-5.10.0/dist/jna.jar,}
|
||||
mv app/lib/{jna-5.10.0/dist/jna-platform.jar,}
|
||||
|
||||
ln -sf ${batik}/* java/libraries/svg/library/
|
||||
cp java/libraries/svg/library/share/java/batik-all-${batik.version}.jar java/libraries/svg/library/batik.jar
|
||||
echo "tarring ffmpeg"
|
||||
tar --checkpoint=10000 -czf build/shared/tools/MovieMaker/ffmpeg-5.0.1.gz ${ffmpeg}
|
||||
cd build
|
||||
ant build
|
||||
cd ..
|
||||
|
||||
gradle createDistributable
|
||||
|
||||
runHook postGradleUpdate
|
||||
'';
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace app/build.gradle.kts \
|
||||
--replace-fail "https://github.com/processing/processing-examples/archive/refs/heads/main.zip" "https://github.com/processing/processing-examples/archive/b10c9e9a05a0d6c20d233ca7f30d315b5047720e.zip" \
|
||||
--replace-fail "https://github.com/processing/processing-website/archive/refs/heads/main.zip" "https://github.com/processing/processing-website/archive/f11676d1b7464291a23ae834f2ef6ab00baaed8e.zip"
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p app/lib core/library
|
||||
ln -s ${jogl}/share/java/* core/library/
|
||||
ln -s ${vaqua} app/lib/VAqua9.jar
|
||||
ln -s ${flatlaf} app/lib/flatlaf.jar
|
||||
ln -s ${lsp4j} java/mode/org.eclipse.lsp4j.jar
|
||||
ln -s ${lsp4j-jsonrpc} java/mode/org.eclipse.lsp4j.jsonrpc.jar
|
||||
ln -s ${gson} java/mode/gson.jar
|
||||
unzip -qo ${jna} -d app/lib/
|
||||
mv app/lib/{jna-5.10.0/dist/jna.jar,}
|
||||
mv app/lib/{jna-5.10.0/dist/jna-platform.jar,}
|
||||
|
||||
ln -sf ${batik}/* java/libraries/svg/library/
|
||||
cp java/libraries/svg/library/share/java/batik-all-${batik.version}.jar java/libraries/svg/library/batik.jar
|
||||
|
||||
gradle assemble
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
@@ -121,24 +156,28 @@ stdenv.mkDerivation rec {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share/
|
||||
gradle createDistributable
|
||||
|
||||
mkdir -p $out/lib
|
||||
cp -dpr app/build/compose/binaries/main/app/Processing/lib/* $out/lib/
|
||||
cp -dpr app/build/compose/binaries/main/app/Processing/bin $out/unwrapped
|
||||
|
||||
mkdir -p $out/share/applications/
|
||||
cp -dp build/linux/${pname}.desktop $out/share/applications/
|
||||
cp -dpr build/linux/work $out/share/${pname}
|
||||
rmdir $out/share/${pname}/java
|
||||
ln -s ${jdk} $out/share/${pname}/java
|
||||
|
||||
rm -r $out/lib/app/resources/jdk
|
||||
ln -s ${jdk}/lib/openjdk $out/lib/app/resources/jdk
|
||||
|
||||
makeWrapper $out/unwrapped/Processing $out/bin/Processing \
|
||||
''${gappsWrapperArgs[@]} \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \
|
||||
--prefix _JAVA_OPTIONS " " "-Dawt.useSystemAAFontSettings=gasp"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
makeWrapper $out/share/${pname}/processing $out/bin/processing \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \
|
||||
--prefix _JAVA_OPTIONS " " "-Dawt.useSystemAAFontSettings=gasp"
|
||||
makeWrapper $out/share/${pname}/processing-java $out/bin/processing-java \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \
|
||||
--prefix _JAVA_OPTIONS " " "-Dawt.useSystemAAFontSettings=gasp"
|
||||
postFixup = ''
|
||||
ln -s $out/bin/Processing $out/bin/processing
|
||||
'';
|
||||
|
||||
meta = {
|
||||
@@ -148,7 +187,12 @@ stdenv.mkDerivation rec {
|
||||
gpl2Only
|
||||
lgpl21Only
|
||||
];
|
||||
mainProgram = "Processing";
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = with lib.maintainers; [ evan-goode ];
|
||||
sourceProvenance = with lib.sourceTypes; [
|
||||
fromSource
|
||||
binaryBytecode
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
|
||||
index 0d3fcbd..88a0b63 100644
|
||||
--- a/app/build.gradle.kts
|
||||
+++ b/app/build.gradle.kts
|
||||
@@ -280,16 +280,7 @@ tasks.register<Exec>("packageSnap"){
|
||||
commandLine("snapcraft")
|
||||
}
|
||||
tasks.register<Zip>("zipDistributable"){
|
||||
- dependsOn("createDistributable", "setExecutablePermissions")
|
||||
group = "compose desktop"
|
||||
-
|
||||
- val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
|
||||
- val dir = distributable.destinationDir.get()
|
||||
- val packageName = distributable.packageName.get()
|
||||
-
|
||||
- from(dir){ eachFile{ permissions{ unix("755") } } }
|
||||
- archiveBaseName.set(packageName)
|
||||
- destinationDirectory.set(dir.file("../").asFile)
|
||||
}
|
||||
|
||||
afterEvaluate{
|
||||
Reference in New Issue
Block a user