ProtonVPN / android-app

Official ProtonVPN Android app
https://protonvpn.com/download-android
GNU General Public License v3.0
2.04k stars 278 forks source link

F-Droid can't build #98

Closed licaon-kter closed 1 year ago

licaon-kter commented 1 year ago

ERROR: Found Android AAR library at app/libs/tunnel-release.aar ref: https://gitlab.com/fdroid/fdroiddata/-/jobs/3108039077#L92

But, if I remove the file it fails later

...
> Task :app:optimizeProdReleaseResources

> Task :app:kaptProdReleaseKotlin
Note: [1] Wrote GeneratedAppGlideModule with: []
/home/vagrant/build/ch.protonvpn.android/app/build/tmp/kapt3/stubs/prodRelease/com/protonvpn/android/vpn/wireguard/WireguardWrapperService.java:7: error: [Hilt]
public final class WireguardWrapperService {
             ^
  @AndroidEntryPoint base class must extend ComponentActivity, (support) Fragment, View, Service, or BroadcastReceiver.
  [Hilt] Processing did not complete. See error above for details.

> Task :app:kaptProdReleaseKotlin FAILED

> Task :openvpn:buildCMakeRelWithDebInfo
C/C++: ninja: Entering directory `/home/vagrant/build/ch.protonvpn.android/openvpn/.cxx/RelWithDebInfo/5w6n5m4f/x86'
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/crypto/threads_pthread.c:220:16: warning: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Watomic-alignment]
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/crypto/threads_pthread.c:245:9: warning: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Watomic-alignment]
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openvpn/src/openvpn/init.c:2434:64: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openvpn/src/openvpn/error.h:152:67: note: expanded from macro 'msg'
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/ovpnutil/rsapss.cpp:110:7: warning: 'PKCS1_MGF1' is deprecated [-Wdeprecated-declarations]
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/rsa.h:389:1: note: 'PKCS1_MGF1' has been explicitly marked deprecated here
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
C/C++: ninja: Entering directory `/home/vagrant/build/ch.protonvpn.android/openvpn/.cxx/RelWithDebInfo/5w6n5m4f/x86_64'
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/ovpnutil/rsapss.cpp:110:7: warning: 'PKCS1_MGF1' is deprecated [-Wdeprecated-declarations]
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/rsa.h:389:1: note: 'PKCS1_MGF1' has been explicitly marked deprecated here
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
C/C++: /home/vagrant/build/ch.protonvpn.android/openvpn/src/main/cpp/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptProdReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

...as expected since the recipe does not build Wireguard too?

mateusz-markowicz commented 1 year ago

Hey, thanks, f-droid is always trying to build from the tip of the master or is there a way to define a revision for f-droid to build from? 4.3.42.0 won't build for f-droid because of this embedded wireguard library, we published it to maven and next release should build fine (it'll happen next week). I guess we can skip this and wait for next release.

proletarius101 commented 1 year ago

the tip of the master

No. From your tags.

If you don't want us to fetch the latest version from your git tags, you can create a, e.g. public JSON file, to specify the version that we should fetch from.

licaon-kter commented 1 year ago

@proletarius101 that's not the issue

@mateusz-markowicz then don't Tag incomplete versions: https://github.com/ProtonVPN/android-app/blob/4.3.42.0/app/build.gradle#L713

eg. you can mark these "not for update" tags with -beta suffix so we can regex avoid them in autoupdate

licaon-kter commented 1 year ago

@proletarius101 also, they already have a separate file: https://github.com/ProtonVPN/android-app/blob/master/metadata/version_fdroid.txt that we use: https://gitlab.com/fdroid/fdroiddata/-/blob/6af4805d5b66c0b33383dc03631dc2a64a182d7b/metadata/ch.protonvpn.android.yml#L1352 for this exact purpose

mateusz-markowicz commented 1 year ago

@proletarius101 https://github.com/ProtonVPN/android-app/blob/master/metadata/version_fdroid.txt we actually put the last buildable f-droid version here in the metadata, versionName=4.2.93.2 actually corresponds to 4.2.93.2 tag.

@licaon-kter we tag each our public release and it is complete (4.3.42.0 is the current production version in google play and other stores) it's just not f-droid compliant - we normally avoid that but in exceptional cases we won't be f-droid ready.

mateusz-markowicz commented 1 year ago

@licaon-kter version_fdroid.txt was updated to last f-droid buildable version (4.2.93.2), but as I understand f-droid tried to build 4.3.42.0 (our latest tag) which isn't f-droid compliant.

licaon-kter commented 1 year ago

Ok, there's a misunderstanding here.

version_fdroid.txt can be used to complement Tags, not to "redirect the robot to another tag and convince it to pickup that other tags commit hash and build that"

mateusz-markowicz commented 1 year ago

understood, what you think should be the best solution? -beta added to our tags is not great for us as 4.3.42.0 is actually not a beta

licaon-kter commented 1 year ago

When you Tag it points to a commit, auto update picks up THAT commit.

The .txt file was used, yes, but to set versionCode and versionName, to those strings. When the APK is done if those won't match the set ones it will fail anyway.

licaon-kter commented 1 year ago

https://f-droid.org/docs/Build_Metadata_Reference/#UpdateCheckMode

Optionally append a regex pattern at the end - separated with a space - to only check the tags matching said pattern. Useful when apps tag non-release versions such as X.X-alpha, so you can filter them out with something like .*[0-9]$ which requires tag names to end with a digit.

So we set that, you tag all non-fdroid-ready tags (only tags not versionName) to 4.3.42.0-beta or 4.3.42.0-notfdroid or 4.3.42.0-whatever and they won't be picked up.

Don't forget to update version_fdroid.txt anyway

proletarius101 commented 1 year ago

seems the .aar is no longer there

gabsoftware commented 1 year ago

Is that why we don't have Stealth on F-Droid version?

mateusz-markowicz commented 1 year ago

4.3.49.0 with Stealth should build on f-droid, is there still a problem @licaon-kter ?

licaon-kter commented 1 year ago

https://monitor.f-droid.org/builds/log/ch.protonvpn.android/104034900#site-footer we're tackling issues as they popup on the new buildserver with Debian Bullseye.

mateusz-markowicz commented 1 year ago

I see 4.3.49.0 is now published on f-droid. Thanks @licaon-kter

licaon-kter commented 1 year ago

Thanks to @proletarius101 actually :)