Closed licaon-kter closed 4 months ago
https://gitlab.com/fdroid/fdroiddata/-/merge_requests/15059 might solve it now, thanks to @linsui but in the long run this needs to be tackled here too
Hey @licaon-kter ! Thanks for moving things forward with F-Droid! Our conan setup on Android is a bit brittle at the moment. I am trying to move things towards conan v2 right now with https://github.com/opendocument-app/OpenDocument.droid/pull/345. This requires to move https://github.com/opendocument-app/OpenDocument.core to conan v2 as well with I am working on right now https://github.com/opendocument-app/OpenDocument.core/pull/354.
This is the recipe I am following https://docs.conan.io/2/examples/cross_build/android/android_studio.html#examples-cross-build-android-studio which seems much more stable than what was suggested for conan v1 so I hope this will also solve the problems you are facing right now.
Should be good now?
Thanks for your FOSS work by the way @licaon-kter!
@TomTasche will you open a MR to update?
You mean on F-Droid? How do I do that / what needs to be done exactly? I thought this is automated in some way.
just like https://gitlab.com/fdroid/fdroiddata/-/merge_requests/15059/diffs
I thought this is automated in some way.
sometimes it can be, but there you see AutoUpdateMode: None
so currently it isn't
looking at https://github.com/opendocument-app/OpenDocument.droid/blob/v3.28/app/src/main/AndroidManifest.xml#L5-L6 I guess it might be feasible, will try asap
updated recipe, but:
...
arch=armv7
arch_build=x86_64
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=c++_shared
compiler.version=12
os=Android
os.api_level=23
os_build=Linux
&:build_type=RelWithDebInfo
odrcore/*:build_type=RelWithDebInfo
[options]
[build_requires]
[env]
[conf]
tools.android:ndk_path=/opt/android-sdk/ndk/26.3.11579264
tools.build:skip_test=True
odrcore/4.1.0: Not found in local cache, looking in remotes...
odrcore/4.1.0: Trying with 'conancenter'...
ERROR: Unable to find 'odrcore/4.1.0' in remotes
you need to add our conan remote like we do it in our CI https://github.com/opendocument-app/OpenDocument.droid/blob/5796674f30d14f2d3b5ebf1ade8977662a58310a/.github/workflows/android_main.yml#L51-L52
what does that contain?
why was that not needed in the previous version?
What do you mean? Looking at your original post you have
- conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan,
which is the same thing but with conan 1 instead of conan 2 which is what we use now
ignore my post here, or that version for now
previous version build recipe is: https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/at.tomtasche.reader.yml#L258-L294
and I don't see the remote thing
what does that contain?
?
how can I see the url contents? are those binaries? source code?
Does conan export . odrcore/VERSION@
still work? We use that to build the core locally.
It is the same as it was with this here https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/at.tomtasche.reader.yml#L255
It adds our conan remote which contains the recipe for https://github.com/opendocument-app/OpenDocument.core and potential other dependencies in the future.
It is up to you if you want to use the remote or not. If you don't use it you have to export the odrcore
package with the correct version yourself like you did here https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/at.tomtasche.reader.yml#L291-293
let me retry, the log is https://gitlab.com/fdroid/fdroiddata/-/merge_requests/15059#note_1992311087 and this fails in gradle clean
after prebuild:
where the export part is LATER in build:
I'll try to export in prebuild:
and see if that does it
@andiwand what's the new export command for conan2?
I have an example here https://github.com/opendocument-app/OpenDocument.core/blob/de96f913cedd19fe968e6b2c99e4e3c3593302b4/.github/workflows/build_test.yml#L254-L255
conan export . --name odrcore --version 4.1.0
Can you update it in https://github.com/opendocument-app/OpenDocument.core?tab=readme-ov-file#local-build?
Some issues that I see:
gradle clean
should not build anything, why does it do that?remember when I asked
what does that contain?
well.. this is why I asked because it appears it contains binary deps... which are a blocker
/LE: reopen this issue
Well it contains what a conan remote contains. Your question is way too generic to give you a definite answer.
gradle clean
.--build
option.Again you were already using a conan remote. I have a hard time understanding the confusion here. You can look up everything you asked here on the conan docs.
That is a conan issue. You can overrule that if you need to or use a system cmake.
how?
What you call random binaries I call stuff we don't have to compile thousands of times in our CI.
same here, I can install several versions of cmake, including 3.30.0, but your build system ignores the local installed one and pull 3.30.0 from conancenter anyway
Again you were already using a conan remote.
if we missed them then and notice random binaries being downloaded now, against the F-Droid policy, we need to remove those actions, and remove faulty past versions as needed
You can look up everything you asked here on the conan docs.
right, but that takes time for those that don't use it daily
anyway, this recipe:
- versionName: '3.28'
versionCode: 181
commit: 5796674f30d14f2d3b5ebf1ade8977662a58310a
subdir: app
sudo:
- apt-get update
- apt-get install -y cmake make ninja-build pipx
- PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install conan
gradle:
- pro
srclibs:
- OpenDocument.core@v4.1.0
prebuild:
- export coreVersion=$(sed -n -E 's/odrcore\/([0-9.]+)@/\1/p' conanfile.txt)
- git -C $$OpenDocument.core$$ checkout -f v$coreVersion
- conan export $$OpenDocument.core$$ --name odrcore --version $coreVersion
- conan profile detect
- sed -i -e '/gms/d' -e '/firebase/d' -e 's/build=missing/build=*/' {.,..}/build.gradle
- sed -i -e '/com.google.android.play/d' -e '/ump/d' -e '/pro"/d' build.gradle
- sed -i -e '/INTERNET/d' -e '/^ <meta-data/,+5d' -e '/property/,+4d'
src/main/AndroidManifest.xml
- cd src/main/java/at/tomtasche/reader
- sed -i -e '/gms/d' -e '/play.core/d' -e '/firebase/d' -e '/void initializeProprietaryLibraries/,/^ }/d'
-e '/initializeProprietaryLibraries/d' -e 's/billingManager.hasPurchased()/true/'
ui/activity/*.java background/FileLoader.java background/LoaderService.java
- sed -i -e '/private Uri doFirebaseConvert/,/^ }/d' -e 's/viewerUri = doFirebaseConvert(options)/return/'
-e '/gms/d' -e '/firebase/Id' -e '/Storage/d' -e '/auth /d' -e '/storage /d'
background/OnlineLoader.java
- sed -i -e '/getBooleanConfig("show_in_app_rating/,/});/d' -e '/void offerUpload/,/^ }/d'
-e '/offerUpload/d' -e '/void requestInAppRating/,/^ }/d' -e '/requestInAppRating/d'
ui/activity/DocumentFragment.java
- sed -i -e 's/configManager.getBooleanConfig(".*")/null/' background/OdfLoader.java
- for class in AdManager AnalyticsManager BillingManager ConfigManager CrashManager
HelpManager; do echo "package at.tomtasche.reader.nonfree; public class ${class}
{}" > nonfree/${class}.java; sed -i -e "/${class}\./Id" background/*.java
ui/*/*.java ui/*.java; done
ndk: 26.3.11579264
will build
cmake/3.30.0 (1 of 10)
gtest/1.14.0 (2 of 10)
miniz/3.0.2 (3 of 10)
nlohmann_json/3.11.3 (4 of 10)
pugixml/1.14 (5 of 10)
uchardet/0.0.7 (6 of 10)
utfcpp/4.0.4 (7 of 10)
vincentlaucsb-csv-parser/2.1.3 (8 of 10)
cryptopp/8.8.0 (9 of 10)
odrcore/4.1.0 (10 of 10)
as expected, which is nice :tada:
it will build them 8 (!!) times each... but yeah...
here's the full log: at.tomtasche.reader_181.log.gz
while I understand it will be built once in prebuild, maybe you can find a way for us to not build it 7 more times later? :smile:
gradle clean
invokes task conanInstall
. It's not that gradle's clean task specifically invokes it, it's just that the conanInstall
task is involved on each gradle invocation. I'll find the correct Android Gradle Plugin task, on which should we attach the conanInstall task dependency.
@licaon-kter , I do believe you could ask conan to build everything from source if you change --build=missing into --build="*" in conan install
invocation. Additional line of sed in prebuild is reasonable, right?
@licaon-kter , also, it's not our build system that ignores your preinstalled system cmake, it's conan. We didn't ask it to do it this way, it's the default way.
Please read under "anyway, this recipe:" too :)
sorry, misread that somehow
...and create an actual flavor that's FOSS, so there's no need for this huge recipe
this recipe falls with
then again, surely I'm missing some steps :smile: