opendocument-app / OpenDocument.droid

It's Android's first OpenOffice Document Reader!
https://opendocument.app/
Other
243 stars 35 forks source link

F-Droid - update recipe #346

Open licaon-kter opened 1 month ago

licaon-kter commented 1 month ago

...and create an actual flavor that's FOSS, so there's no need for this huge recipe

  - versionName: '3.24'
    versionCode: 177
    commit: f33ded86b3bb0bd4e62c9aead37063a087180043
    subdir: app
    sudo:
      - apt-get update
      - apt-get install -y cmake ninja-build pipx
    output: apk.apk
    prebuild:
      - pipx install conan==1.*
      - export PATH="${HOME}/.local/bin:$PATH"
      - sed -i -e '/com.google/d' ../build.gradle
      - sed -i -e '/com.google.firebase/d' -e '/firebaseCrashlytics/d' -e '/com.google.android.play/d'
        -e '/com.android.billingclient/d' -e '/com.google.gms/d' -e '/pro"/d' -e '/com.google.android.gms/d'
        build.gradle
      - sed -i -e '/INTERNET/d' -e '/BILLING/d' -e '/^        <meta-data/,+5d' src/main/AndroidManifest.xml
      - cd src/main/java/at/tomtasche/reader
      - sed -i -e '/com.google.firebase/d' background/FileLoader.java
      - sed -i -e '/gms/d' -e '/play.core/d' -e '/firebase/d' ui/activity/*.java
      - sed -i -e '/private Uri doFirebaseConvert/,/^    }/d' -e 's/viewerUri = doFirebaseConvert(options)/return/'
        -e '/com.google/d' -e '/Firebase/d' -e '/Storage/d' -e '/auth /d' -e '/storage
        /d' background/OnlineLoader.java
      - sed -i -e '/void initializeProprietaryLibraries/,/^    }/d' -e '/initializeProprietaryLibraries/d'
        -e '/void buyAdRemoval/,/^    }/d' -e '/buyAdRemoval/d' -e 's/billingManager.hasPurchased()/true/'
        -e 's/billingManager.isEnabled()/false/' -e '/addOnPreDrawListener/,/});/d'
        ui/activity/MainActivity.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
      - echo "[settings]" >> conanprofile_build.txt
      - echo "compiler=clang" >> conanprofile_build.txt
      - echo "compiler.libcxx=libstdc++11" >> conanprofile_build.txt
      - conan config set general.revisions_enabled=1
      - conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan,
      - cd ..
      - gradle clean
    build:
      - export PATH="${HOME}/.local/bin:$PATH"
      - cd ..
      - gradle assembleProRelease
    ndk: 25.2.9519653

this recipe falls with

> Task :app:configureCMakeRelWithDebInfo[arm64-v8a]
C/C++: WARN: *** Conan 1 is legacy and on a deprecation path ***
C/C++: WARN: *** Please upgrade to Conan 2 ***
C/C++: cmake/3.29.3: ERROR: Package 'ada521499582ffec91aef450980290fff1f6c275' build failed
C/C++: cmake/3.29.3: WARN: Build folder /home/vagrant/.conan/data/cmake/3.29.3/_/_/build/ada521499582ffec91aef450980290fff1f6c275
C/C++: ERROR: cmake/3.29.3: Error in build() method, line 30
C/C++:  get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][arch],
C/C++:  KeyError: 'Android'
C/C++: CMake Error at app/conan.cmake:633 (message):
C/C++:   Conan install failed='1'
C/C++: Call Stack (most recent call first):
C/C++:   CMakeLists.txt:29 (conan_cmake_install)

> Task :app:configureCMakeRelWithDebInfo[arm64-v8a] FAILED

FAILURE: Build failed with an exception.

* What went wrong:
> IDLE
> [CXX1429] error when building with cmake using /home/vagrant/build/at.tomtasche.reader/CMakeLists.txt: -- The CXX compiler identification is Clang 14.0.7
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
  -- Conan: checking conan executable
  -- Conan: Found program /home/vagrant/.local/bin/conan
  -- Conan: Version found Conan version 1.64.1
  -- Conan executing: /home/vagrant/.local/bin/conan install /home/vagrant/build/at.tomtasche.reader --build missing --env CONAN_CMAKE_TOOLCHAIN_FILE=/home/vagrant/build/at.tomtasche.reader/app/.cxx/RelWithDebInfo/1n412d41/arm64-v8a/toolchain.cmake --profile /home/vagrant/build/at.tomtasche.reader/conanprofile.txt --settings arch=armv8 --settings build_type=RelWithDebInfo --settings compiler=clang --settings compiler.version=14 --settings compiler.libcxx=libc++
  Auto detecting your dev setup to initialize the default profile (/home/vagrant/.conan/profiles/default)
  CC and CXX: None, /opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ 
  Found clang 14.0
  clang>=8, using the major as version
  Default settings
        os=Linux
        os_build=Linux
        arch=x86_64
        arch_build=x86_64
        compiler=clang
        compiler.version=14
        compiler.libcxx=libstdc++
        build_type=Release
  *** You can change them in /home/vagrant/.conan/profiles/default ***
  *** Or override with -s compiler='other' -s ...s***

  Configuration:
  [settings]
  arch=armv8
  arch_build=x86_64
  build_type=RelWithDebInfo
  compiler=clang
  compiler.l
  miniz/3.0.2: Not found in local cache, looking in remotes...
  miniz/3.0.2: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  miniz/3.0.2: Downloaded recipe revision 6e39a83b94a8951a57a0e29969960170
  nlohmann_json/3.11.3: Not found in local cache, looking in remotes...
  nlohmann_json/3.11.3: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  nlohmann_json/3.11.3: Downloaded recipe revision 45828be26eb619a2e04ca517bb7b828d
  vincentlaucsb-csv-parser/2.1.3: Not found in local cache, looking in remotes...
  vincentlaucsb-csv-parser/2.1.3: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  vincentlaucsb-csv-parser/2.1.3: Downloaded recipe revision 7d96da1144496d8aefbc76dda620e9e7
  uchardet/0.0.7: Not found in local cache, looking in remotes...
  uchardet/0.0.7: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  uchardet/0.0.7: Downloaded recipe revision 540e0bb16506f0b42bfbffbebddfd63a
  cmake/3.29.3: Not found in local cache, looking in remotes...
  cmake/3.29.3: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  cmake/3.29.3: Downloaded recipe revision 292a699b66d006bf4c6648608fa7c9e4
  gtest/1.14.0: Not found in local cache, looking in remotes...
  gtest/1.14.0: Trying with 'conancenter'...
  Downloading conanmanifest.txt
  Downloading conanfile.py
  Downloading conan_export.tgz
  Cross-build from 'Linux:x86_64' to 'Android:armv8'
  Installing (downloading, building) binaries...
  nlohmann_json/3.11.3: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'conancenter' 
  Downloading conanmanifest.txt
  Downloading conaninfo.txt
  Downloading conan_package.tgz
  nlohmann_json/3.11.3: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
  nlohmann_json/3.11.3: Downloaded package revision 570207c0cf4a2d9790a6f36ab5e3f077
  vincentlaucsb-csv-parser/2.1.3: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'conancenter' 
  Downloading conanmanifest.txt
  Downloading conaninfo.txt
  Downloading conan_package.tgz
  vincentlaucsb-csv-parser/2.1.3: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
  vincentlaucsb-csv-parser/2.1.3: Downloaded package revision 741758e6bbb087d16ad3a0685a31f4f0
  cmake/3.29.3: Configuring sources in /home/vagrant/.conan/data/cmake/3.29.3/_/_/source
  cmake/3.29.3: Copying sources to build folder
  cmake/3.29.3: Building your package in /home/vagrant/.conan/data/cmake/3.29.3/_/_/build/ada521499582ffec91aef450980290fff1f6c275
  cmake/3.29.3: Generator txt created conanbuildinfo.txt
  cmake/3.29.3: Aggregating env generators
  cmake/3.29.3: Calling build()
  cmake/3.29.3: 
  -- Configuring incomplete, errors occurred!
  See also "/home/vagrant/build/at.tomtasche.reader/app/.cxx/RelWithDebInfo/1n412d41/arm64-v8a/CMakeFiles/CMakeOutput.log".

  C++ build system [configure] failed while executing:
      /usr/bin/cmake \
        -H/home/vagrant/build/at.tomtasche.reader \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=21 \
        -DANDROID_PLATFORM=android-21 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/opt/android-sdk/ndk/25.2.9519653 \
        -DCMAKE_ANDROID_NDK=/opt/android-sdk/ndk/25.2.9519653 \
        -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/vagrant/build/at.tomtasche.reader/app/build/intermediates/cxx/RelWithDebInfo/1n412d41/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/home/vagrant/build/at.tomtasche.reader/app/build/intermediates/cxx/RelWithDebInfo/1n412d41/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -B/home/vagrant/build/at.tomtasche.reader/app/.cxx/RelWithDebInfo/1n412d41/arm64-v8a \
        -GNinja \
        -DANDROID_STL=c++_shared
    from /home/vagrant/build/at.tomtasche.reader/app
  WARN: *** Conan 1 is legacy and on a deprecation path ***
  WARN: *** Please upgrade to Conan 2 ***
  cmake/3.29.3: ERROR: Package 'ada521499582ffec91aef450980290fff1f6c275' build failed
  cmake/3.29.3: WARN: Build folder /home/vagrant/.conan/data/cmake/3.29.3/_/_/build/ada521499582ffec91aef450980290fff1f6c275
  ERROR: cmake/3.29.3: Error in build() method, line 30
        get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][arch],
        KeyError: 'Android'
  CMake Error at app/conan.cmake:633 (message):
    Conan install failed='1'
  Call Stack (most recent call first):
    CMakeLists.txt:29 (conan_cmake_install)

then again, surely I'm missing some steps :smile:

licaon-kter commented 1 month 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

andiwand commented 1 month ago

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.