flatpak-builder-tools icon indicating copy to clipboard operation
flatpak-builder-tools copied to clipboard

Maven/Gradle support

Open hadess opened this issue 7 years ago • 6 comments

This could be used to package Bisq and jadx.

hadess avatar Dec 06 '18 10:12 hadess

Would help kmcaster too. See https://github.com/flathub/flathub/pull/2165#issuecomment-803082132.

yajo avatar Mar 19 '21 19:03 yajo

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.

mbooth101 avatar Sep 02 '21 09:09 mbooth101

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.

hadess avatar May 09 '22 17:05 hadess

This script looks easy enough to modify for our needs: https://github.com/flatpak/flatpak-builder-tools/blob/master/dotnet/flatpak-dotnet-generator.py

hadess avatar May 09 '22 17:05 hadess

this seems to be tackled here: https://github.com/flatpak/flatpak-builder-tools/pull/276

muelli avatar Jul 12 '22 13:07 muelli

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).

wvengen avatar Jan 26 '24 22:01 wvengen

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/\-?=%.]+')

hadess avatar May 21 '24 07:05 hadess