Build Flatpak from Java application - java

I'm currently working on DXVKoTool, a Compose application built with Kotlin.
As I want it to be easily available on the Steam Deck, I try to build a Flatpak off it.
Basically what I wanted to do is packaging it (with jpackage) and use the built binaries when building the Flatpak.
My building process would look like this:
./gradlew packageAppImage
flatpak-builder build/release/main/flatpak dev.datlag.DXVKoTool.yml --force-clean
The packageAppImage command produces an output like this:
{project-dir}
|-build
|-release
|-main
|-app
|-DXVKoTool
|-bin
| |-DXVKoTool {executable}
|-lib
|-{resources, binaries, etc.}
However building the Flatpak is somehow driving me crazy and I'm not sure what's wrong.
My flatpak build YAML file:
app-id: dev.datlag.DXVKoTool
runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: DXVKoTool
modules:
- name: dxvkotool
buildsystem: simple
build-commands:
- mkdir -p /app/lib/
- install -Dm755 ./build/release/main/app/DXVKoTool/bin/DXVKoTool /app/bin/DXVKKoTool
- cp -R ./build/release/main/app/DXVKoTool/lib/* /app/lib/
sources:
- type: file
path: ./build/release/main/app/DXVKoTool/bin/DXVKoTool
- type: dir
path: ./build/release/main/app/DXVKoTool/lib/
When I run the flatpak-builder command, it's stopping with the following error:
Emptying app dir 'build/release/main/flatpak'
Downloading sources
Starting build of dev.datlag.DXVKoTool
Cache hit for openjdk, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module git in /home/jeff/Projects/Multiplatform/DXVKoTool/.flatpak-builder/build/git-1
========================================================================
Running: mkdir -p /app/lib/
Running: install -Dm755 ./build/release/main/app/DXVKoTool/bin/DXVKoTool /app/bin/DXVKoTool
install: cannot stat './build/release/main/app/DXVKoTool/bin/DXVKoTool': No such file or directory
When I change the config to the following:
app-id: dev.datlag.DXVKoTool
runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: DXVKoTool
modules:
- name: dxvkotool
buildsystem: simple
build-commands:
- mkdir -p /app/lib/
- install -Dm755 DXVKoTool /app/bin/DXVKoTool
- cp -R lib/* /app/lib/
sources:
- type: file
path: ./build/release/main/app/DXVKoTool/bin/DXVKoTool
- type: dir
path: ./build/release/main/app/DXVKoTool/
The building works but after installing the outcome it doesn't start with this error:
bwrap: execvp DXVKoTool: No such file or directory
Would be nice if someone can help me building the Flatpak.

Related

Debug OpenJDK14 using CLion: failed to load the CMake project

I download the source code of OpenJDK14 and put them in \home\yuanfang\jdk14 and after running bash configure --disable-warnings-as-errors and make images, I build OpenJDK14 successfully, The newly built JDK is in home\yuanfang\jdk14\build\linux-x86_64-server-release\jdk. By the way, I am using Ubuntu 20.04 LTS.
Then I want to debug OpenJDK14 using CLion IDE. I was using CLion 2020.2 and I take the following steps:
After open CLion I choose Create New CMake Project from Sources and choose the directory of \home\yuanfang\jdk14, which is the root directory of the jdk project.
I alter the Run/Debug Configurations to make it look like this:
CLion create a CMakeLists.txt automatically but the file doesn't work, so after googling I find find the correct CMakeLists.txt here at https://github.com/ojdkbuild/ojdkbuild/blob/master/src/java-14-openjdk/CMakeLists.txt. I then rewrite the old CMakeLists.txt using the correct one.
I download the whole repository(that is, github.com/ojdkbuild/ojdkbuild), unzip it and put it into \home\yuanfang\jdk14.
It looks like as follow, the ojdkbuild-master is the newly added folder.
I reload the CMake project, but some CMake error occurs(as follow), why can't CLion find those files? javaI googled but can't find any effective solution. Is there anything I can do or refer to? Thanks in advance.
CMake Error at CMakeLists.txt:19 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/ojdkbuild_common.cmake
CMake Error at CMakeLists.txt:21 (include):
include could not find load file:
/home/yuanfang/jdk14/../../resources/cmake/version.cmake
CMake Error at CMakeLists.txt:93 (add_subdirectory):
add_subdirectory given source
"/home/yuanfang/jdk14/../../deps/rhino/scripting_tasks" which is not an
existing directory.
CMake Error at CMakeLists.txt:98 (ojdkbuild_add_subdirectory):
Unknown CMake command "ojdkbuild_add_subdirectory".
-- Configuring incomplete, errors occurred!
See also "/home/yuanfang/jdk14/cmake-build-debug/CMakeFiles/CMakeOutput.log".
Cannot get compiler information:
Compiler exited with error code 1: /usr/bin/cc -xobjective-c -I/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles......./loading/LibraryLoader/jar_src -g -fpch-preprocess -v -dD -E
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
COLLECT_GCC_OPTIONS='-I' '/home/yuanfang/jdk14/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles' '-I' '......'-g' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-mtune=generic' '-march=x86-64'
cc1obj -E -quiet -v #/tmp/cci3XM6r -imultiarch x86_64-linux-gnu -D ___CIDR_DEFINITIONS_END /tmp/compiler-file5929385022787926768 -mtune=generic -march=x86-64 -fpch-preprocess -g -fworking-directory -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -dD
cc: fatal error: cannot execute 'cc1obj': execvp: No such file or directory
compilation terminated.
[Failed to reload]
step: check out this projecdt :https://github.com/ojdkbuild/ojdkbuild.git
step: put the source code of OpenJDK14 in ojdkbuild/src/
step: copy reousrces directory and CMakelists.txt to OpenJDK14
step: recomile openjdk and import project to CLin

Concourse CI + MVN

I am trying to create a pipeline using Concourse CI using Maven. The pipeline should:
Get the code from git.
Build and run test using maven.
the project generates html report in target folder
above steps are executing properly. The question how to access the output i.e target folder generated by the maven project.
I am not able to access the generated folder and copy to the required folder for later usage.
File pipeline.yml:
resources:
- name: branch-master
type: git
source:
uri: {{git-url}}
branch: master
jobs:
- name: MavenJob
serial: true
plan:
- get: branch-master
trigger: true
- task: mvn-test
privileged: true
file: branch-dev/AppDemo/test.yml
File test.yml:
platform: linux
image_resource:
type: docker-image
source:
repository: maven
tag: latest
inputs:
- name: branch-master
outputs:
- name: mvn-output
run:
path: "mvn"
args: ["-f", "branch-master/AppDemo/pom.xml", "test"]
Please some body help me.
Thanks in advance.
For sake of simplicity and unambiguity I renamed your git repo to project. Let's assume it contains concourse's yamls. And there is a directory AppDemo with java-maven app
project/pipeline.yml:
resources:
- name: project
type: git
source:
uri: {{git-url}}
branch: master
jobs:
- name: MavenJob
serial: true
plan:
- get: project
trigger: true
- task: mvn-test
privileged: true
file: project/test.yml
the job above should locate and trigger the test.yml task
project/test.yml:
platform: linux
image_resource:
type: docker-image
source:
repository: maven # let's hope bin/bash is available there. if no, use sh
tag: latest
inputs:
- name: project # project is your git-repo. all paths are relative to it's location
outputs:
- name: mvn-output
run:
path: /bin/bash
args:
- project/test-script.sh:
project/test-script.sh:
_ROOT=$(pwd)
echo "starting test-script from directory: $ROOT"
cd _ROOT/AppDemo
mvn test
if you want to pass outputs of maven job somewhere further, then you should just copy all those files into mvn-output directory later in the script.
I would also recommend using this bash-script as wrapper rather than raw "maven call" - it's more convenient for debugging the whole process as you can, e.g. echo'ing paths.
in case of any error, if container still alive, try hijacking into it to see what has actually happened there and where files are located:
fly -t <target> hijack -u <url-of-failed-job-from-your-browser>
hope this helps

Action failed: gradle dependencies CircleCi

I have integrated CircleCI to run Espresso test on my app. I have taken the following circle.yml file from another online github repo and changed the android build tools and android version to 25. However when I run the build on the circleCI server, I get the following error. I have granted the execution permission in yml file.
My app Repo structure is
Action failed: gradle dependencies
export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi
bash: line 2: ./gradlew: Permission denied
export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi
returned exit code 126
Action failed: gradle dependencies
circle.yml:
general:
artifacts:
- /home/ubuntu/MyRideApp/app/build/outputs/apk/
machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
ADB_INSTALL_TIMEOUT: 240
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx3072M -XX:+HeapDumpOnOutOfMemoryError"'
dependencies:
pre:
- chmod +x gradlew
- touch app/google-services.json
- echo y | android update sdk --no-ui --all --filter "tools,android-25,build-tools-25.0.2,platform-tools,extra-android-m2repository,extra-android-support,extra-google-m2repository,extra-google-google_play_services"
cache_directories:
- /usr/local/android-sdk-linux/tools
- /usr/local/android-sdk-linux/build-tools/25.0.2
override:
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
# Comment the test stuff out (or remove it) if you don't need it.
test:
pre:
- emulator -avd circleci-android23 -no-audio -no-window:
background: true
parallel: true
- circle-android wait-for-boot
# unlock emulator
- sleep 30
- adb shell input keyevent 82
override:
# - ./gradlew clean assemble
# This will run the tests:
- ./gradlew assemble connectedDebugAndroidTest -PdisablePreDex --console=plain --info
post:
- cp -r app/build/outputs $CIRCLE_ARTIFACTS
- cp -r app/build/outputs/androidTest-results/connected/ $CIRCLE_TEST_REPORTS
gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
/gradle/wrapper does contain gradle-wrapper.jar
A solution is on the circleCI forum.
You have to add execution right like the following : chmod +x gradlew
It works for me.
Here is an example of my circleci.yml :
machine:
java:
version: oraclejdk8
dependencies:
override:
- chmod +x gradlew
- ./gradlew dependencies
test:
override:
- chmod +x grailsw
- ./grailsw test-app --non-interactive
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/target/test-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

spring boot with bluemix error: None of the buildpacks detected a compatible application

Steps:
create new project with start.spring.io
run it localy - works
run gradle task jar
push jar to bluemix cf push demoWar.jar
Downloaded app package (20.1M) Staging... None of the buildpacks
detected a compatible application Exit status 222 Staging failed:
Exited with status 222 Destroying container
FAILED Error restarting application: NoAppDetectedError
TIP: Buildpacks are detected when the "cf push" is executed from
within the dire ctory that contains the app source code.
Try two things:
1. Use the -p command to target your deployable artifact. This would look something like cf p APP_NAME -p PATH_TO_YOUR_WAR. I usually chain my build and deploy commands so: mvn clean package && cf p APP_NAME -p PATH_TO_YOUR_WAR.
If this doesn't work then you can specify a build pack. So cf p APP_NAME -p PATH_TO_YOUR_WAR -b SOME_BUILDPACK. You can see the available build packs by calling cf buildpacks.
Hope this helps.
When deploying first time your app on cloud foundry then following command will not work
cf push TestService
you need to use following command
cf push -p TestService-0.0.1-SNAPSHOT.jar testService
Useful link :
https://discuss.pivotal.io/hc/en-us/articles/226273647-Troubleshooting-error-None-of-the-buildpacks-detected-a-compatible-application-exit-status-222-
https://docs.cloudfoundry.org/buildpacks/detection.html
Else add manifest.yml on root
applications:
- name: Demo
memory: 2G
disk_quota: 2G
instances: 1
path: target/demo-local-0.0.1-SNAPSHOT.jar
env:
SPRING_PROFILES_ACTIVE : "dev"
routes:
- route: demo.app.dev.vk.vaquar.khan.com
after that go to path and run cf push < JAR_NAME>

Using Gitlab pages to publish jar file

I am using gitlab.io. I have a Java project which builds using Maven.
I have setup the following yml file to do the builds:
image: maven:3-jdk-7
build:
script:
- "mvn install -B"
- mkdir .public
- cp -r ./gl_pages/* .public
- mv ./target/MyProg_installer-0.0.1-SNAPSHOT.jar .public/Prog_Latest.jar
- mv .public public
artifacts:
paths:
- public
only:
- master
If I go to the following URL's I can see index.html without a problem.
https://<<MYUSER>>.gitlab.io/<<MY_PROJECT>/
https://<<MYUSER>>.gitlab.io/<<MY_PROJECT>/index.html
I expected
https://<<MYUSER>>.gitlab.io/<<MY_PROJECT>/Prog_Latest.jar
to enable me to download the jar file, but this url simply returns a 404.
I have downloaded the zip of the artifacts from the build and this works without an issue.
Am I doing something wrong?

Categories

Resources