Skip to content

Commit 70494bc

Browse files
authored
Use odrcode v5 (#380)
1 parent fc1b249 commit 70494bc

File tree

18 files changed

+534
-308
lines changed

18 files changed

+534
-308
lines changed

.github/workflows/android_main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ jobs:
4242
run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ env.ndk_version }}"
4343

4444
- name: conan remote
45-
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
45+
run: |
46+
conan remote remove "*"
47+
conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
48+
conan remote add conancenter https://center2.conan.io
4649
- name: conan profile
4750
run: conan profile detect
4851

app/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ tasks.register('conanProfile', Copy) {
2020
["armv8", "armv7", "x86", "x86_64"].each { architecture ->
2121
tasks.named("conanInstall-" + architecture) {
2222
profile.set('build/conanprofile.txt')
23+
deployer.set('conandeployer.py')
24+
deployerFolder.set(outputDirectory.get().asFile.toString() + "/assets/core")
2325
dependsOn(tasks.named('conanProfile'))
26+
conanExecutable.set('conan')
2427
}
2528
}
2629

@@ -121,6 +124,11 @@ android {
121124
}
122125
}
123126
namespace 'at.tomtasche.reader'
127+
compileSdk 35
128+
buildToolsVersion '34.0.0'
129+
130+
// TODO can and should this be architecture dependent?
131+
sourceSets.main.assets.srcDirs += "build/conan/armv8/assets"
124132
}
125133

126134
dependencies {
@@ -140,9 +148,9 @@ dependencies {
140148
implementation 'com.google.android.material:material:1.12.0'
141149
implementation 'androidx.webkit:webkit:1.11.0'
142150

143-
implementation 'app.opendocument:pdf2htmlex-android:0.18.26'
144151
implementation 'app.opendocument:wvware-android:1.2.11'
145152
implementation 'com.github.huzongyao:AndroidMagic:v1.1.2'
153+
implementation 'com.viliussutkus89:assetextractor-android:1.3.3'
146154

147155
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
148156
androidTestImplementation 'androidx.test:rules:1.6.1'

app/conandeployer.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import shutil
2+
3+
4+
def deploy(graph, output_folder: str, **kwargs):
5+
conanfile = graph.root.conanfile
6+
conanfile.output.info(f"Custom deployer to {output_folder}")
7+
8+
symlinks = conanfile.conf.get("tools.deployer:symlinks", check_type=bool, default=True)
9+
arch = conanfile.settings.get_safe("arch")
10+
11+
conanfile.output.info(f"Symlinks: {symlinks}")
12+
conanfile.output.info(f"Arch: {arch}")
13+
14+
deps = {dep.ref.name: dep for dep in conanfile.dependencies.values()}
15+
16+
print(f"Dependencies: {list(deps.keys())}")
17+
18+
copytree_kwargs = {"symlinks": symlinks, "dirs_exist_ok": True}
19+
20+
if "odrcore" in deps:
21+
dep = deps["odrcore"]
22+
conanfile.output.info(f"Deploying odrcore to {output_folder}")
23+
shutil.copytree(
24+
f"{dep.package_folder}/share",
25+
f"{output_folder}/odrcore",
26+
**copytree_kwargs,
27+
)
28+
29+
if "pdf2htmlex" in deps:
30+
dep = deps["pdf2htmlex"]
31+
conanfile.output.info(f"Deploying pdf2htmlex to {output_folder}")
32+
shutil.copytree(
33+
f"{dep.package_folder}/share/pdf2htmlEX",
34+
f"{output_folder}/pdf2htmlex",
35+
**copytree_kwargs,
36+
)
37+
38+
if "poppler-data" in deps:
39+
dep = deps["poppler-data"]
40+
conanfile.output.info(f"Deploying poppler-data to {output_folder}")
41+
shutil.copytree(
42+
f"{dep.package_folder}/share/poppler",
43+
f"{output_folder}/poppler",
44+
**copytree_kwargs,
45+
)
46+
47+
if "fontconfig" in deps:
48+
dep = deps["fontconfig"]
49+
conanfile.output.info(f"Deploying fontconfig to {output_folder}")
50+
shutil.copytree(
51+
f"{dep.package_folder}/res/share",
52+
f"{output_folder}/fontconfig",
53+
**copytree_kwargs,
54+
)

app/conanfile.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[requires]
2-
odrcore/4.1.1@
2+
odrcore/5.0.0-pre12
33

44
[generators]
55
CMakeToolchain
66
CMakeDeps
7+
8+
[options]
9+
odrcore/*:shared=True
10+
odrcore/*:with_pdf2htmlEX=True
11+
odrcore/*:with_wvWare=False

app/src/androidTest/java/at/tomtasche/reader/test/CoreTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ private static void copy(InputStream src, File dst) throws IOException {
5959
@Test
6060
public void test() {
6161
CoreWrapper core = new CoreWrapper();
62-
core.initialize();
6362

6463
File cacheDir = InstrumentationRegistry.getInstrumentation().getTargetContext().getCacheDir();
6564
File htmlFile = new File(cacheDir, "html");

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
android:label="@string/app_title"
5050
android:roundIcon="@mipmap/ic_launcher_round"
5151
android:theme="@style/MainTheme"
52+
android:networkSecurityConfig="@xml/network_security_config"
5253
tools:replace="android:label">
5354

5455
<!-- https://stackoverflow.com/a/78086604/198996 -->

0 commit comments

Comments
 (0)