Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI build with core #337

Merged
merged 35 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
91412c4
fix ci build with core
andiwand Apr 20, 2024
a1771a1
fix checkout; rm afterwards
andiwand Apr 20, 2024
4b3511c
bump java version
andiwand Apr 20, 2024
da64946
fix build and test
andiwand Apr 20, 2024
0589a30
fixfix
andiwand Apr 20, 2024
4b35a3a
fix build
andiwand Apr 20, 2024
1217a6a
fix build?
andiwand Apr 20, 2024
e7ecd2c
runs locally
andiwand Apr 21, 2024
26ca5c6
fix linux build?
andiwand Apr 21, 2024
adb6c58
fix build; try disable package test build
andiwand Apr 21, 2024
62f7730
try disable package test build
andiwand Apr 21, 2024
87be0dd
use core version 4
andiwand Apr 21, 2024
508adf3
revert to v3
andiwand Apr 21, 2024
65e0a74
fix CoreWrapper
andiwand Apr 21, 2024
5f6eb3c
try force build machine libcxx
andiwand Apr 21, 2024
3b86a1c
try again
andiwand Apr 21, 2024
74f7d3f
try again
andiwand Apr 21, 2024
cf7ec09
try again
andiwand Apr 21, 2024
0956504
try again
andiwand Apr 21, 2024
87fb654
try again
andiwand Apr 21, 2024
74b3b1a
try again
andiwand Apr 21, 2024
56fa0b3
try again
andiwand Apr 21, 2024
2a00300
build missing
andiwand Apr 21, 2024
a181720
try again
andiwand Apr 21, 2024
a223ce6
try again
andiwand Apr 21, 2024
b070abe
try again
andiwand Apr 21, 2024
1bbea67
try again
andiwand Apr 21, 2024
f920cc4
try again
andiwand Apr 21, 2024
f183eda
try again
andiwand Apr 21, 2024
2b5542a
try again
andiwand Apr 21, 2024
e7ebeda
drop 19
andiwand Apr 21, 2024
77a191d
improve conan setup documentation
TomTasche Apr 26, 2024
3795a27
Merge branch 'master' into fix-ci-conan-core
andiwand Apr 27, 2024
deddc05
use new shiny artifactory instance
andiwand Apr 27, 2024
9891604
Merge branch 'fix-ci-conan-core' of github.com:opendocument-app/OpenD…
andiwand Apr 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 71 additions & 28 deletions .github/workflows/android_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,39 +27,58 @@ 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: 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: python -m pip install --upgrade pip conan==1.*

- run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace

- uses: actions/upload-artifact@v3
- name: checkout odr.core
uses: actions/checkout@v3
with:
repository: opendocument-app/OpenDocument.core
ref: v3.0.0
path: OpenDocument.core
- name: conan export odr.core
run: conan export OpenDocument.core odrcore/3.0.0@
- name: remove odr.core
run: rm -rf OpenDocument.core

- 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

- name: gradle
run: ./gradlew assembleDebug lintProDebug lintLiteDebug --stacktrace

- 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:
Expand Down Expand Up @@ -81,28 +108,43 @@ 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
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
- name: install conan
run: pip3 install --upgrade conan==1.*

- name: checkout odr.core
uses: actions/checkout@v3
with:
repository: opendocument-app/OpenDocument.core
ref: v3.0.0
path: OpenDocument.core
- name: conan export odr.core
run: conan export OpenDocument.core odrcore/3.0.0@
- name: remove odr.core
run: rm -rf OpenDocument.core

- 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
Expand Down Expand Up @@ -152,7 +194,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 }}
Expand Down
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,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)
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/cpp/CoreWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "CoreWrapper.h"
#include <string>
#include <optional>

#include <odr/document.hpp>
#include <odr/document_cursor.hpp>
#include <odr/document_element.hpp>
#include <odr/file.hpp>
#include <odr/html.hpp>
#include <odr/open_document_reader.hpp>
#include <odr/exceptions.hpp>

#include <android/log.h>

#include <string>
#include <optional>

std::optional<odr::Html> html;

JNIEXPORT jobject JNICALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void loadSync(Options options) {
File cacheDirectory = AndroidFileCache.getCacheDirectory(cacheFile);

pdf2htmlEX pdfConverter = new pdf2htmlEX(context).setInputPDF(cacheFile);
pdfConverter.setOutline(false).setBackgroundFormat("jpg").setDRM(false);
pdfConverter.setDRM(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomTasche @ViliusSutkus89 do you know what should be done here? It complained about the functions being not existent and I just removed the calls for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I remember correctly that disables the overview of pages on the left side, so it was quite important for us! can you remember why it was removed? @ViliusSutkus89

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it was just replaced with a different method?

What confused me is why does this break now? Are we not pinning the version correctly of this library?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the outline is now visible (black bar on the left in screenshot), which is not what we want. we can't release like that 😞 help @ViliusSutkus89
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, is this problem still relevant? I've tried running current main version and outline isn't there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't try and just made it compile. Did you try @TomTasche ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, all good!

pdfConverter.setProcessAnnotation(true);
if (options.password != null) {
pdfConverter.setOwnerPassword(options.password).setUserPassword(options.password);
Expand Down
1 change: 0 additions & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ odrcore/3.0.0@
cmake
cmake_paths
cmake_find_package

6 changes: 0 additions & 6 deletions conanprofile.txt

This file was deleted.

11 changes: 11 additions & 0 deletions conanprofile_build.txt
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions conanprofile_host.txt
Original file line number Diff line number Diff line change
@@ -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
Loading