Closed hadess closed 4 months ago
Would help kmcaster too. See https://github.com/flathub/flathub/pull/2165#issuecomment-803082132.
I maintain the java extensions and have been thinking about it.
Current status: Apache Ant, Apache Maven, and Gradle are available for use in the openjdk extensions, but building stuff from source is quite complex due to the offline nature of flathub builds.
I have been working on some tooling to help, and will keep this ticket updated.
I don't know anything about building Java apps, or Gradle, but I think that something like this could work.
Run this from the app's git repo:
flatpak run --command=bash --share=network --filesystem=`pwd` -d org.freedesktop.Sdk//21.08 ./script.sh
With script.sh
being:
source /usr/lib/sdk/openjdk11/enable.sh
rm -rf gradle-cache
mkdir -p dependencies/flatRepo/
# Install some ghidra specific files, should probably be installed by hand/outside this script
wget https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip
unzip -j dex-tools-2.0.zip "*.jar" -d dependencies/flatRepo/
wget -P dependencies/flatRepo/ https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar
# Launch gradle build with `--info` to log all the http(s) URLs
gradle -g gradle-cache/ --info --console plain buildGhidra | grep http > gradle-log.txt
# And parse gradle-log.txt to output a nice json file...
The parsing could also be done outside the sandbox, probably in Python.
This script looks easy enough to modify for our needs: https://github.com/flatpak/flatpak-builder-tools/blob/master/dotnet/flatpak-dotnet-generator.py
this seems to be tackled here: https://github.com/flatpak/flatpak-builder-tools/pull/276
For Maven, https://github.com/flatpak/flatpak-builder/issues/58#issuecomment-781508777 is probably useful to know about (and used by some existing apps on Flathub).
Latest push(es) fixed warnings related to the regex syntax:
/home/hadess/Projects/Flathub/org.ghidra_sre.Ghidra/_deps_build/./flatpak-gradle-generator.py:83: SyntaxWarning: invalid escape sequence '\/'
r = re.compile('https:\/\/[\w/\-?=%.]+\.[\w/\-?=%.]+')
This could be used to package Bisq and jadx.