Skip to content

Commit

Permalink
Don't use symlink and update some files/projects
Browse files Browse the repository at this point in the history
IB-7781, Fixes #480

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Aug 6, 2023
1 parent ecdcd14 commit 308214c
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 95 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ jobs:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed
- name: Install dependencies
run: choco install doxygen.install swig -y > $null
- uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x86
- name: Build xsd
run: .\prepare_win_build_environment.ps1 -xsd
- name: Build
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md

This file was deleted.

176 changes: 111 additions & 65 deletions etc/Doxyfile.in

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions examples/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.cert.X509Certificate;
import java.sql.Timestamp;
import java.util.Objects;
Expand All @@ -45,16 +47,6 @@ public class MainActivity extends Activity {
System.loadLibrary("digidoc_java");
}

static private void saveToFile(InputStream in, String path) throws IOException {
try (FileOutputStream out = new FileOutputStream(path)) {
byte[] buffer = new byte[10240];
int count;
while ((count = in.read(buffer)) != -1) {
out.write(buffer, 0, count);
}
}
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -67,14 +59,14 @@ protected void onCreate(Bundle savedInstanceState) {
try (ZipInputStream zis = new ZipInputStream(getResources().openRawResource(R.raw.schema))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
saveToFile(zis, cache + "/" + ze.getName());
Files.copy(zis, Paths.get(cache, ze.getName()));
}
}
try (InputStream in = getResources().openRawResource(R.raw.test)) {
saveToFile(in, cache + "/test.bdoc");
Files.copy(in, Paths.get(cache, "test.bdoc"));
}
try (ByteArrayInputStream bin = new ByteArrayInputStream(new byte[] {})) {
saveToFile(bin, cache + "/EE_T.xml");
Files.copy(bin, Paths.get(cache, "EE_T.xml"));
}
} catch (IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -224,7 +216,7 @@ private void runTest(File path) {
}

try (FileInputStream in = new FileInputStream(cache + "/digidocpp.log")) {
saveToFile(in, Environment.getExternalStorageDirectory().getAbsolutePath() + "/digidocpp.log");
Files.copy(in, Paths.get(Environment.getExternalStorageDirectory().getAbsolutePath(), "digidocpp.log"));
}
try (FileOutputStream out = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/result.json")) {
out.write(r.toString().getBytes(StandardCharsets.UTF_8));
Expand All @@ -235,11 +227,11 @@ private void runTest(File path) {
findViewById(R.id.run).setEnabled(true);
}

private static void deleteRecursive(File fileOrDirectory) {
private static boolean deleteRecursive(File fileOrDirectory) {
if (fileOrDirectory.isDirectory())
for (File child : Objects.requireNonNull(fileOrDirectory.listFiles()))
deleteRecursive(child);
fileOrDirectory.delete();
return fileOrDirectory.delete();
}

static private abstract class URLTask extends AsyncTask<Void, Void, Exception> {
Expand Down Expand Up @@ -269,8 +261,8 @@ static private class DownloadTask extends URLTask {
DownloadTask(MainActivity activity) {
super(activity);
path = new File(activity.getCacheDir() + "/validate");
deleteRecursive(path);
path.mkdir();
if (deleteRecursive(path))
path.mkdir();
}

@Override
Expand All @@ -285,7 +277,7 @@ protected Exception doInBackground(Void... tmp) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
try {
saveToFile(zis, path + "/" + ze.getName());
Files.copy(zis, Paths.get(path.getPath(), ze.getName()));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.1.0'
}
}

Expand Down
5 changes: 4 additions & 1 deletion examples/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false
org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=true
android.nonFinalResIds=true
2 changes: 1 addition & 1 deletion examples/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ foreach(TSL_CERT ${TSL_CERTS})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.h
COMMAND $<TARGET_FILE:embedfile> ${TSL_CERT} ${BASE}_crt ${BASE}.h
COMMENT "Generating ${BASE}.h from ${TSL_CERT}"
)
)
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.h
COMMAND ln -sf ${TSL_CERT} ${BASE}.crt
COMMAND xxd -i ${BASE}.crt ${BASE}.h
COMMAND xxd -i ${TSL_CERT} ${BASE}.h
COMMAND sed -ie 's!unsigned char .*[][]!unsigned char ${BASE}_crt[]!' ${BASE}.h
COMMENT "Generating ${BASE}.h from ${TSL_CERT}"
)
)
endif()
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tslcerts.h "#include \"${BASE}.h\"\n")
endforeach()
Expand All @@ -105,7 +105,7 @@ set(COUNT 0)
foreach(TSL_CERT ${TSL_CERTS})
math(EXPR COUNT "${COUNT}+1")
set(BASE "tslcert${COUNT}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tslcerts.h "digidoc::X509Cert(${BASE}_crt, ${BASE}_crt_len, X509Cert::Pem),\n")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tslcerts.h "digidoc::X509Cert(${BASE}_crt, std::size(${BASE}_crt), X509Cert::Pem),\n")
endforeach()
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tslcerts.h "};")

Expand Down

0 comments on commit 308214c

Please sign in to comment.