Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
1.2k stars 40 forks source link

F-Droid can't build / missing native issue #1026

Closed licaon-kter closed 10 months ago

licaon-kter commented 10 months ago

Updated recipe to use Java 17 but this happened: https://gitlab.com/fdroid/fdroiddata/-/jobs/5475535486#L3951

/LE: fyi https://gitlab.com/fdroid/fdroiddata/-/commit/8a34540e89d84da94dc4a90f546ca858857deb3f

Catfriend1 commented 10 months ago

Thanks for letting me know. So the change to Java17 came via Fdroid env?

BUILD FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:mergeReleaseJniLibFolders' (type 'MergeSourceSetFolders').
  - Gradle detected a problem with the following location: '/builds/fdroid/fdroiddata/build/com.github.catfriend1.syncthingandroid/app/src/main/jniLibs'.

    Reason: Task ':app:mergeReleaseJniLibFolders' uses this output of task ':syncthing:buildNative' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':syncthing:buildNative' as an input of ':app:mergeReleaseJniLibFolders'.
      2. Declare an explicit dependency on ':syncthing:buildNative' from ':app:mergeReleaseJniLibFolders' using Task#dependsOn.
      3. Declare an explicit dependency on ':syncthing:buildNative' from ':app:mergeReleaseJniLibFolders' using Task#mustRunAfter.

    Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/8.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 58s
18 actionable tasks: 18 executed
==== detail end ====
2023-11-07 08:56:48,476 DEBUG: Error encountered, stopping by user request.
Uploading artifacts for failed job
00
licaon-kter commented 10 months ago

You want Java 17: https://github.com/Catfriend1/syncthing-android/blob/main/gradle/wrapper/gradle-wrapper.properties#L4 as Gradle 8 needs 17 ;)

Catfriend1 commented 10 months ago

Do I have to set this in my files or fdroiddata?

licaon-kter commented 10 months ago

Set what?

Are we lost in translation?

After you upgraded to Gradle 8, you app needs Java 17, if you use AS I guess that happens behind your back, for F-Droid we added 4 lines in the recipe.

Now, about the error?

Catfriend1 commented 10 months ago

After you upgraded to Gradle 8, you app needs Java 17, if you use AS I guess that happens behind your back

Correct. I remember that I needed to uninstall jdk 11 from my computer. Pointed my JavaHome env var to Android Studio's jbr java dir.

Catfriend1 commented 10 months ago

we added 4 lines in the recipe.

Okay, I checked that and it seems fine. Thanks.

https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.github.catfriend1.syncthingandroid.yml#L1976

Catfriend1 commented 10 months ago

So according to the error message above, it seems I have a dependency problem/step order problem in my build.gradle . Will check during my next dev session how to fix this. I'm just wondering why my Windows based build worked fine with gradle 8 and the existing build.gradle. maybe some weird gradle specific stuff that came with upgrading gradle (...)

licaon-kter commented 10 months ago

Maybe try to clean up your local gradle/whatever cache and retry to build?

Catfriend1 commented 10 months ago

@licaon-kter Why is it calling gradlew with both "buildNative assembleRelease" according to the log ( ref https://gitlab.com/fdroid/fdroiddata/-/jobs/5475535486#L619 ) ?

image

buildNative is configured as a single and first step in fdroiddata yml...

image https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.github.catfriend1.syncthingandroid.yml#L1987

Catfriend1 commented 10 months ago

@licaon-kter Could you please retry to build from this tag: https://github.com/Catfriend1/syncthing-android-fdroid/tree/v1.26.0.2

Catfriend1 commented 10 months ago

The command gradlew :syncthing:buildNative assembleDebug now succeeds on my Windows machine.

licaon-kter commented 10 months ago

https://gitlab.com/fdroid/fdroiddata/-/commit/dc1d75ade2d12d76ed673dfe8a60b34d8dae4868 thanks

Catfriend1 commented 10 months ago

Thank you too :-)

Catfriend1 commented 10 months ago

@licaon-kter

In https://monitor.f-droid.org/builds/log/com.github.catfriend1.syncthingandroid/1260002#site-footer I am missing the "buildNative" step. I think this is a non functioning APK without the Syncthing Binary that has been built? But why?

Ah okay now I see in the above linked commit buildNative was removed. That should be the culprit. I suggest we put it back and rebuild before users get affected?

licaon-kter commented 10 months ago

I've removed it: https://gitlab.com/fdroid/fdroiddata/-/commit/dc1d75ade2d12d76ed673dfe8a60b34d8dae4868

Because when you said:

Why is it calling gradlew with both "buildNative assembleRelease" according to the log ( ref https://gitlab.com/fdroid/fdroiddata/-/jobs/5475535486#L619 ) ?

I understood it as "this is wrong"

Then, reading https://github.com/Catfriend1/syncthing-android/blob/3b78c7263df2c33a8bf70fd01bd8c27819ad5492/app%2Fbuild.gradle it looked (in my un-dev eyes) like you are going to call this from gradle so the extra .yml step was unnecessary.

Also, the build succeeded, which is rather baffling to me... it should fail if its deps are not there as needed. :(

licaon-kter commented 10 months ago

The apk was built, and we are in the sweetspot of the cycle where we can still remove the faulty APK, so we did. :)

I'll amend the recipe asap.

Catfriend1 commented 10 months ago

@licaon-kter Thank you. So this was just a misunderstanding and now solved. I must admit I got used to the two step build process as it always had been from the beginning, so doing buildNative first and then then the main app build 🙂. I also wonder , because gradle wanted the dependency defined but now does not fire the task when it never ran before. 🤷‍♂️

licaon-kter commented 10 months ago

re-added via https://gitlab.com/fdroid/fdroiddata/-/commit/e30a9c339e5d47f9aca6a8e8f4ef6cc16678c8bc

But please add a fail mode for this during build

licaon-kter commented 10 months ago

hmm we're back at square 1: https://gitlab.com/fdroid/fdroiddata/-/jobs/5525083301#L3743

I'll try something else locally, brb

Catfriend1 commented 10 months ago

Hmm, I could reproduce the problem on windows before I fixed it. Interesting, that it now returned with the preassemble in place. 🤷‍♂️

licaon-kter commented 10 months ago

It's running now with this change that I've done to your upstream: https://gitlab.com/fdroid/fdroiddata/-/commit/4cea94a0b8251d914ba0152a1812729d5064b057#bdbd642de47f8b99c9954756fdff27dc60ec9b7f_2052_2057

Catfriend1 commented 10 months ago

Can we try this for the fork, please? Do I also need to adjust something on my github repo?

licaon-kter commented 10 months ago

Was waiting for the build locally, the APK has the libs/.so hence: https://gitlab.com/fdroid/fdroiddata/-/commit/578fee5d169ed569b7d07e30ed853d94b576d420 :tada:

Thanks and sorry for the mixup

Catfriend1 commented 10 months ago

Thanks, all good!

Catfriend1 commented 9 months ago

Just for information: Building with Android Studio automatically fires the "buildNative" task when I click on the button to "assembleDebug".

image

licaon-kter commented 9 months ago

We're not building Debug, try assembleRelease too...