Skip to content

flathub/com.remnantsoftheprecursors.ROTP

Repository files navigation

Generating maven-dependencies.yaml

Here's a very messy and ineffective way to generate the maven-dependencies.yaml file, at least until proper maven support is added:

Temporarily enable network access at build time by adding the following key under build-options: in the manifest file (es.estoes.wallpaperDownloader.yaml):

      build-args:
        - --share=network

Now, delete the following line from the manifest file, found under the sources: key:

      - maven-dependencies.yaml

Now, invoke flatpak-builder:

flatpak-builder --build-only --force-clean --keep-build-dirs --install-deps-from=flathub builddir/ com.remnantsoftheprecursors.ROTP.yaml

Then, run these commands to finally generate the maven-dependencies.yaml file:

MAVEN_REPO="$PWD/.flatpak-builder/build/rotp/.m2/repository"
find $MAVEN_REPO \( -iname '*.jar' -o -iname '*.pom' \) -printf '%P\n' | sort -V | xargs -rI '{}' bash -c "echo -e \"- type: file\n  dest: .m2/repository/\$(dirname {})\n  url: https://repo.maven.apache.org/maven2/{}\n  sha256: \$(sha256sum \"$MAVEN_REPO/{}\" | cut -c 1-64)\"" > maven-dependencies.yaml

To test if this generated file actually works, first revert the changes you did to the manifest file in the previous steps.

Then, invoke flatpak-builder with the --sandbox option:

flatpak-builder --force-clean --sandbox builddir/ com.remnantsoftheprecursors.ROTP.yaml

If the file was generated correctly, the build will succeed.