Skip to content
Open
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
7 changes: 2 additions & 5 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ jobs:
- name: conan profile
run: conan profile detect

- name: checkout core
run: git submodule update --init --depth 1 OpenDocument.core

- name: checkout conan-index
run: cd OpenDocument.core; git submodule update --init --depth 1 conan-odr-index
run: git submodule update --init --depth 1 conan-odr-index

- name: export conan-odr-index
run: python OpenDocument.core/conan-odr-index/scripts/conan_export_all_packages.py
run: python conan-odr-index/scripts/conan_export_all_packages.py

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "OpenDocument.core"]
path = OpenDocument.core
url = https://github.com/opendocument-app/OpenDocument.core
[submodule "conan-odr-index"]
path = conan-odr-index
url = https://github.com/opendocument-app/conan-odr-index.git
1 change: 0 additions & 1 deletion OpenDocument.core
Submodule OpenDocument.core deleted from 7862af
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ Please help to translate on the https://crowdin.com/project/opendocument
- install conan using pip in a venv
- `conan profile detect --force`
- make sure `conan` is in your $PATH or replace conan-call in `app/build.gradle`
- `git submodule update --init --depth 1 OpenDocument.core`
- `cd OpenDocument.core; git submodule update --init --depth 1 conan-odr-index`
- `python OpenDocument.core/conan-odr-index/scripts/conan_export_all_packages.py`
- `git submodule update --init --depth 1 conan-odr-index`
- `python conan-odr-index/scripts/conan_export_all_packages.py`
27 changes: 0 additions & 27 deletions app/conandeployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@ def deploy(graph, output_folder: str, **kwargs):
**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,
)

if "libmagic" in deps:
dep = deps["libmagic"]
conanfile.output.info(f"Deploying libmagic to {output_folder}")
Expand Down
7 changes: 4 additions & 3 deletions app/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[requires]
odrcore/5.2.0
odrcore/5.4.0

[generators]
CMakeToolchain
CMakeDeps

[options]
odrcore/*:shared=False
odrcore/*:with_pdf2htmlEX=True
odrcore/*:with_wvWare=True
odrcore/*:with_pdf2htmlEX=False
odrcore/*:with_wvWare=False
odrcore/*:bundle_assets=False
12 changes: 2 additions & 10 deletions app/src/main/cpp/core_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace {

protected:
void log_impl(Time time, odr::LogLevel level, const std::string &message,
const std::source_location &location) override {
const std::source_location &location) const override {
__android_log_print(to_android_log_level(level), "smn", "%s", message.c_str());
}

Expand All @@ -85,16 +85,10 @@ Java_at_tomtasche_reader_background_CoreWrapper_setGlobalParams(JNIEnv *env, jcl
jclass paramsClass = env->GetObjectClass(params);

std::string odrCoreDataPath = getStringField(env, paramsClass, params, "coreDataPath");
std::string fontconfigDataPath = getStringField(env, paramsClass, params, "fontconfigDataPath");
std::string popplerDataPath = getStringField(env, paramsClass, params, "popplerDataPath");
std::string pdf2htmlexDataPath = getStringField(env, paramsClass, params, "pdf2htmlexDataPath");
std::string libmagicDatabasePath = getStringField(env, paramsClass, params, "libmagicDatabasePath");
std::string customTmpfilePath = getStringField(env, paramsClass, params, "customTmpfilePath");

odr::GlobalParams::set_odr_core_data_path(odrCoreDataPath);
odr::GlobalParams::set_fontconfig_data_path(fontconfigDataPath);
odr::GlobalParams::set_poppler_data_path(popplerDataPath);
odr::GlobalParams::set_pdf2htmlex_data_path(pdf2htmlexDataPath);
odr::GlobalParams::set_libmagic_database_path(libmagicDatabasePath);

tmpfile_hack::set_tmpfile_directory(customTmpfilePath);
Expand Down Expand Up @@ -252,9 +246,7 @@ Java_at_tomtasche_reader_background_CoreWrapper_hostFileNative(JNIEnv *env, jcla

try {
odr::DecodePreference decodePreference;
decodePreference.engine_priority = {odr::DecoderEngine::poppler,
odr::DecoderEngine::wvware,
odr::DecoderEngine::odr};
decodePreference.engine_priority = {odr::DecoderEngine::odr};
odr::DecodedFile file = odr::open(inputPathCpp, decodePreference, *logger);

if (file.password_encrypted()) {
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ public class CoreWrapper {

public static class GlobalParams {
public String coreDataPath;
public String fontconfigDataPath;
public String popplerDataPath;
public String pdf2htmlexDataPath;
public String libmagicDatabasePath;

public String customTmpfilePath;
Expand All @@ -28,24 +25,15 @@ public static class GlobalParams {
public static void initialize(Context context) {
File assetsDirectory = new File(context.getFilesDir(), "assets");
File odrCoreDataDirectory = new File(assetsDirectory, "odrcore");
File fontconfigDataDirectory = new File(assetsDirectory, "fontconfig");
File popplerDataDirectory = new File(assetsDirectory, "poppler");
File pdf2htmlexDataDirectory = new File(assetsDirectory, "pdf2htmlex");
File libmagicDataDirectory = new File(assetsDirectory, "libmagic");

AssetExtractor ae = new AssetExtractor(context.getAssets());
ae.setOverwrite();
ae.extract(assetsDirectory, "core/odrcore");
ae.extract(assetsDirectory, "core/fontconfig");
ae.extract(assetsDirectory, "core/poppler");
ae.extract(assetsDirectory, "core/pdf2htmlex");
ae.extract(assetsDirectory, "core/libmagic");

CoreWrapper.GlobalParams globalParams = new CoreWrapper.GlobalParams();
globalParams.coreDataPath = odrCoreDataDirectory.getAbsolutePath();
globalParams.fontconfigDataPath = fontconfigDataDirectory.getAbsolutePath();
globalParams.popplerDataPath = popplerDataDirectory.getAbsolutePath();
globalParams.pdf2htmlexDataPath = pdf2htmlexDataDirectory.getAbsolutePath();
globalParams.libmagicDatabasePath = new File(libmagicDataDirectory, "magic.mgc").getAbsolutePath();
globalParams.customTmpfilePath = context.getCacheDir().getAbsolutePath();
CoreWrapper.setGlobalParams(globalParams);
Expand Down
1 change: 1 addition & 0 deletions conan-odr-index
Submodule conan-odr-index added at 5d1cae
Loading