diff --git a/.github/workflows/android_main.yml b/.github/workflows/android_main.yml index 265edf780c48..7b3b567423ed 100644 --- a/.github/workflows/android_main.yml +++ b/.github/workflows/android_main.yml @@ -2,15 +2,23 @@ name: OpenDocument-Reader-Android on: workflow_dispatch: - pull_request: + push: paths-ignore: - '**.md' - push: + - '.github/**' + - '!.github/workflows/android_main.yml' + branches: + - main + pull_request: paths-ignore: - '**.md' - '.github/**' - '!.github/workflows/android_main.yml' +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-20.04 @@ -19,39 +27,52 @@ jobs: - name: checkout uses: actions/checkout@v3 - - name: ninja + - name: install ninja run: sudo apt-get install -y ninja-build - - name: java + - name: setup java uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - - name: set up python 3.8 + - name: setup python 3.8 uses: actions/setup-python@v4 with: python-version: 3.8 - name: install pip and conan - run: python -m pip install --upgrade pip conan - - name: conan revisions + run: python -m pip install --upgrade pip conan==1.* + + - name: conan config run: conan config set general.revisions_enabled=1 - name: conan repo - run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan + run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan + + - name: tweak conan profile for build machine + run: | + echo "" >> conanprofile_build.txt + echo "[settings]" >> conanprofile_build.txt + echo "compiler=clang" >> conanprofile_build.txt + echo "compiler.libcxx=libstdc++11" >> conanprofile_build.txt + echo "" >> conanprofile_build.txt - - run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace + - name: gradle + run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace - - uses: actions/upload-artifact@v3 + - name: upload apks + uses: actions/upload-artifact@v3 with: name: APKs path: app/build/outputs/apk/**/*.apk if-no-files-found: error - - uses: actions/upload-artifact@v3 + - name: upload lint results + uses: actions/upload-artifact@v3 with: name: lint-report path: app/build/reports/lint-results-*.html if-no-files-found: error + test: runs-on: macos-11 strategy: @@ -59,9 +80,6 @@ jobs: # Make sure the matrix here and in cache_AVD_images.yml is the same matrix: include: - # Oldest version we support - - arch: x86 - api-level: 19 # Oldest x86_64 - arch: x86_64 api-level: 21 @@ -81,28 +99,37 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - - name: brew + - name: install brew run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null - name: fix ninja install run: rm '/usr/local/bin/2to3' - - name: ninja + - name: install ninja run: brew install ninja # https://stackoverflow.com/a/57758679/198996 - - name: bundler + - name: install bundler run: gem install bundler:1.17.3 - - name: fastlane + - name: install fastlane run: bundle install - - name: pip + - name: install pip run: python3 -m ensurepip - - name: conan - run: pip3 install conan - - name: conan revisions + - name: install conan + run: pip3 install --upgrade conan==1.* + + - name: conan config run: conan config set general.revisions_enabled=1 - name: conan repo - run: conan remote add odr https://odr.jfrog.io/artifactory/api/conan/odr-conan + run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan + + - name: tweak conan profile for build machine + run: | + echo "" >> conanprofile_build.txt + echo "[settings]" >> conanprofile_build.txt + echo "compiler=clang" >> conanprofile_build.txt + echo "compiler.libcxx=libc++" >> conanprofile_build.txt + echo "" >> conanprofile_build.txt - name: Android Virtual Device (AVD) cache uses: actions/cache@v3 @@ -152,7 +179,8 @@ jobs: test ! -f sorry_but_tests_are_failing - - uses: actions/upload-artifact@v3 + - name: upload test results + uses: actions/upload-artifact@v3 if: always() with: name: testResults-${{ matrix.api-level }}-${{ matrix.arch }} diff --git a/CMakeLists.txt b/CMakeLists.txt index a7b5fcb113ee..95525b70f043 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,10 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -# make sure "which conan" points to a version of 1.x +# create virtual environment in project root and "pip install conan==1.*" +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/bin") +# or make sure "which conan" points to a version of 1.x + # TODO: call FIND_PROGRAM(conan) here manually so the location is cached for later # TODO: use proper virtual environment @@ -23,14 +26,17 @@ string(REPLACE "armeabi-v7a" "armv7" ARCH "${ARCH}") string(REPLACE "arm64-v8a" "armv8" ARCH "${ARCH}") include(${CMAKE_CURRENT_LIST_DIR}/app/conan.cmake) -conan_cmake_autodetect(settings ARCH ${ARCH}) +conan_cmake_autodetect(settings_host ARCH ${ARCH}) # inspired from here https://docs.conan.io/en/latest/integrations/cross_platform/android.html configure_file(app/toolchain.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake @ONLY) conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_CURRENT_LIST_DIR} BUILD missing - SETTINGS ${settings} - PROFILE ${CMAKE_CURRENT_LIST_DIR}/conanprofile.txt - ENV CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake) + SETTINGS_HOST ${settings_host} compiler.libcxx=c++_shared + PROFILE_BUILD ${CMAKE_CURRENT_LIST_DIR}/conanprofile_build.txt + PROFILE_HOST ${CMAKE_CURRENT_LIST_DIR}/conanprofile_host.txt + ENV_HOST + CONAN_CMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake + ANDROID_NDK_ROOT=${CMAKE_ANDROID_NDK}) include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake) find_package(odr REQUIRED) diff --git a/README.md b/README.md index 91bb0f0875e8..73f0b23ba3e1 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,7 @@ Feel free to use it in your own project too, but please don't forget to tell us height="80">](https://play.google.com/store/apps/details?id=at.tomtasche.reader) More information at http://reader.tomtasche.at/ and in the app itself. + +## Setup + +- `conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan` \ No newline at end of file diff --git a/app/src/main/cpp/CoreWrapper.cpp b/app/src/main/cpp/CoreWrapper.cpp index c9224a7e3aca..9a5aba3d3b70 100644 --- a/app/src/main/cpp/CoreWrapper.cpp +++ b/app/src/main/cpp/CoreWrapper.cpp @@ -1,15 +1,16 @@ #include "CoreWrapper.h" -#include -#include + #include -#include -#include #include #include #include #include + #include +#include +#include + std::optional html; JNIEXPORT jobject JNICALL diff --git a/conanfile.txt b/conanfile.txt index dde444cbcfed..a62701ffc648 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -5,4 +5,3 @@ odrcore/3.0.0@ cmake cmake_paths cmake_find_package - diff --git a/conanprofile.txt b/conanprofile.txt deleted file mode 100644 index e1162eecfb2f..000000000000 --- a/conanprofile.txt +++ /dev/null @@ -1,6 +0,0 @@ -include(default) - -[settings] -os=Android -os.api_level=19 -build_type=Release diff --git a/conanprofile_build.txt b/conanprofile_build.txt new file mode 100644 index 000000000000..b0b4359ab469 --- /dev/null +++ b/conanprofile_build.txt @@ -0,0 +1,11 @@ +include(default) + +[settings] +build_type=Release + +[env] +CONAN_RUN_TESTS=False +CONAN_CMAKE_GENERATOR=Ninja + +[conf] +tools.build:skip_test=True diff --git a/conanprofile_host.txt b/conanprofile_host.txt new file mode 100644 index 000000000000..a3ab8ff0c37e --- /dev/null +++ b/conanprofile_host.txt @@ -0,0 +1,16 @@ +include(default) + +[settings] +os=Android +os.api_level=19 +compiler=clang +compiler.libcxx=c++_shared +build_type=Release + +[env] +CONAN_RUN_TESTS=False +CONAN_CMAKE_GENERATOR=Ninja + +[conf] +tools.android:ndk_path=$ENV{ANDROID_NDK_ROOT} +tools.build:skip_test=True