Skip to content

Use odrcode v5 #380

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

Merged
merged 18 commits into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .github/workflows/android_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ env.ndk_version }}"

- name: conan remote
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
run: |
conan remote remove "*"
conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
conan remote add conancenter https://center2.conan.io
- name: conan profile
run: conan profile detect

Expand Down
10 changes: 9 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ tasks.register('conanProfile', Copy) {
["armv8", "armv7", "x86", "x86_64"].each { architecture ->
tasks.named("conanInstall-" + architecture) {
profile.set('build/conanprofile.txt')
deployer.set('conandeployer.py')
deployerFolder.set(outputDirectory.get().asFile.toString() + "/assets/core")
dependsOn(tasks.named('conanProfile'))
conanExecutable.set('conan')
}
}

Expand Down Expand Up @@ -121,6 +124,11 @@ android {
}
}
namespace 'at.tomtasche.reader'
compileSdk 35
buildToolsVersion '34.0.0'

// TODO can and should this be architecture dependent?
sourceSets.main.assets.srcDirs += "build/conan/armv8/assets"
}

dependencies {
Expand All @@ -140,9 +148,9 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.webkit:webkit:1.11.0'

implementation 'app.opendocument:pdf2htmlex-android:0.18.26'
implementation 'app.opendocument:wvware-android:1.2.11'
implementation 'com.github.huzongyao:AndroidMagic:v1.1.2'
implementation 'com.viliussutkus89:assetextractor-android:1.3.3'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'androidx.test:rules:1.6.1'
Expand Down
54 changes: 54 additions & 0 deletions app/conandeployer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import shutil


def deploy(graph, output_folder: str, **kwargs):
conanfile = graph.root.conanfile
conanfile.output.info(f"Custom deployer to {output_folder}")

symlinks = conanfile.conf.get("tools.deployer:symlinks", check_type=bool, default=True)
arch = conanfile.settings.get_safe("arch")

conanfile.output.info(f"Symlinks: {symlinks}")
conanfile.output.info(f"Arch: {arch}")

deps = {dep.ref.name: dep for dep in conanfile.dependencies.values()}

print(f"Dependencies: {list(deps.keys())}")

copytree_kwargs = {"symlinks": symlinks, "dirs_exist_ok": True}

if "odrcore" in deps:
dep = deps["odrcore"]
conanfile.output.info(f"Deploying odrcore to {output_folder}")
shutil.copytree(
f"{dep.package_folder}/share",
f"{output_folder}/odrcore",
**copytree_kwargs,
)

if "pdf2htmlex" in deps:
dep = deps["pdf2htmlex"]
conanfile.output.info(f"Deploying pdf2htmlex to {output_folder}")
shutil.copytree(
f"{dep.package_folder}/share/pdf2htmlEX",
f"{output_folder}/pdf2htmlex",
**copytree_kwargs,
)

if "poppler-data" in deps:
dep = deps["poppler-data"]
conanfile.output.info(f"Deploying poppler-data to {output_folder}")
shutil.copytree(
f"{dep.package_folder}/share/poppler",
f"{output_folder}/poppler",
**copytree_kwargs,
)

if "fontconfig" in deps:
dep = deps["fontconfig"]
conanfile.output.info(f"Deploying fontconfig to {output_folder}")
shutil.copytree(
f"{dep.package_folder}/res/share",
f"{output_folder}/fontconfig",
**copytree_kwargs,
)
7 changes: 6 additions & 1 deletion app/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[requires]
odrcore/4.1.1@
odrcore/5.0.0-pre12

[generators]
CMakeToolchain
CMakeDeps

[options]
odrcore/*:shared=True
odrcore/*:with_pdf2htmlEX=True
odrcore/*:with_wvWare=False
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private static void copy(InputStream src, File dst) throws IOException {
@Test
public void test() {
CoreWrapper core = new CoreWrapper();
core.initialize();

File cacheDir = InstrumentationRegistry.getInstrumentation().getTargetContext().getCacheDir();
File htmlFile = new File(cacheDir, "html");
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
android:label="@string/app_title"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/MainTheme"
android:networkSecurityConfig="@xml/network_security_config"
tools:replace="android:label">

<!-- https://stackoverflow.com/a/78086604/198996 -->
Expand Down
Loading
Loading