flatpak / flatpak-builder-tools

Various helper tools for flatpak-builder
195 stars 107 forks source link

Maven/Gradle support #37

Closed hadess closed 4 months ago

hadess commented 5 years ago

This could be used to package Bisq and jadx.

yajo commented 3 years ago

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

mbooth101 commented 3 years ago

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.

hadess commented 2 years ago

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 commented 2 years ago

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

muelli commented 2 years ago

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

wvengen commented 8 months ago

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

hadess commented 5 months ago

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