mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-29 04:57:48 +01:00
JNI hello world
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
<modules>
|
||||
<module>server</module>
|
||||
<module>kleppmanntree</module>
|
||||
<module>supportlib</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
@@ -27,6 +28,7 @@
|
||||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.version>3.11.3</quarkus.platform.version>
|
||||
<surefire-plugin.version>3.2.5</surefire-plugin.version>
|
||||
<dhfs.native-libs-dir>${project.parent.build.outputDirectory}/native</dhfs.native-libs-dir>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -89,6 +91,9 @@
|
||||
<systemPropertyVariables>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
<com.usatiuk.dhfs.supportlib.native-path>
|
||||
${dhfs.native-libs-dir}
|
||||
</com.usatiuk.dhfs.supportlib.native-path>
|
||||
</systemPropertyVariables>
|
||||
<argLine>
|
||||
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
|
||||
@@ -115,6 +120,7 @@
|
||||
</native.image.path>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<buildDirectory>${project.build.directory}</buildDirectory>
|
||||
<nativeLibsDirectory>${dhfs.native-libs-dir}</nativeLibsDirectory>
|
||||
<junit.jupiter.execution.parallel.enabled>
|
||||
true
|
||||
</junit.jupiter.execution.parallel.enabled>
|
||||
|
||||
@@ -127,5 +127,10 @@
|
||||
<artifactId>kleppmanntree</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.usatiuk.dhfs</groupId>
|
||||
<artifactId>supportlib</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.usatiuk.dhfs.files.service.DhfsFileService;
|
||||
import com.usatiuk.dhfs.files.service.DirectoryNotEmptyException;
|
||||
import com.usatiuk.dhfs.files.service.GetattrRes;
|
||||
import com.usatiuk.dhfs.objects.repository.persistence.ObjectPersistentStore;
|
||||
import com.usatiuk.dhfs.supportlib.DhfsSupport;
|
||||
import com.usatiuk.kleppmanntree.AlreadyExistsException;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.StatusRuntimeException;
|
||||
@@ -54,6 +55,7 @@ public class DhfsFuse extends FuseStubFS {
|
||||
DhfsFileService fileService;
|
||||
|
||||
void init(@Observes @Priority(100000) StartupEvent event) {
|
||||
DhfsSupport.hello();
|
||||
if (!enabled) return;
|
||||
Paths.get(root).toFile().mkdirs();
|
||||
Log.info("Mounting with root " + root);
|
||||
@@ -142,6 +144,9 @@ public class DhfsFuse extends FuseStubFS {
|
||||
} catch (Exception e) {
|
||||
Log.error("When getattr " + path, e);
|
||||
return -ErrorCodes.EIO();
|
||||
} catch (Throwable e) {
|
||||
Log.error("When getattr " + path, e);
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ public class DhfsFuseIT {
|
||||
@BeforeEach
|
||||
void setup(TestInfo testInfo) throws IOException, InterruptedException, TimeoutException {
|
||||
String buildPath = System.getProperty("buildDirectory");
|
||||
System.out.println("Build path: " + buildPath);
|
||||
String nativeLibsDirectory = System.getProperty("nativeLibsDirectory");
|
||||
Log.info("Build path: " + buildPath);
|
||||
Log.info("Native libs path: " + nativeLibsDirectory);
|
||||
|
||||
Network network = Network.newNetwork();
|
||||
var image = new ImageFromDockerfile()
|
||||
@@ -44,6 +46,7 @@ public class DhfsFuseIT {
|
||||
.from("azul/zulu-openjdk-debian:21-jre-latest")
|
||||
.run("apt update && apt install -y libfuse2 curl")
|
||||
.copy("/app", "/app")
|
||||
.copy("/libs", "/libs")
|
||||
.cmd("java", "-ea", "-Xmx128M", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
|
||||
"-Ddhfs.objects.peerdiscovery.interval=100",
|
||||
@@ -54,11 +57,13 @@ public class DhfsFuseIT {
|
||||
"-Ddhfs.objects.sync.timeout=20",
|
||||
"-Ddhfs.objects.sync.ping.timeout=20",
|
||||
"-Ddhfs.objects.reconnect_interval=1s",
|
||||
"-Dcom.usatiuk.dhfs.supportlib.native-path=/libs",
|
||||
"-Dquarkus.log.category.\"com.usatiuk\".level=TRACE",
|
||||
"-Dquarkus.log.category.\"com.usatiuk.dhfs\".level=TRACE",
|
||||
"-jar", "/app/quarkus-run.jar")
|
||||
.build())
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"));
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"))
|
||||
.withFileFromPath("/libs", Paths.get(nativeLibsDirectory));
|
||||
container1 = new GenericContainer<>(image)
|
||||
.withPrivilegedMode(true)
|
||||
.withCreateContainerCmdModifier(cmd -> Objects.requireNonNull(cmd.getHostConfig()).withDevices(Device.parse("/dev/fuse")))
|
||||
|
||||
@@ -38,7 +38,9 @@ public class DhfsFusex3IT {
|
||||
@BeforeEach
|
||||
void setup(TestInfo testInfo) throws IOException, InterruptedException, TimeoutException {
|
||||
String buildPath = System.getProperty("buildDirectory");
|
||||
System.out.println("Build path: " + buildPath);
|
||||
String nativeLibsDirectory = System.getProperty("nativeLibsDirectory");
|
||||
Log.info("Build path: " + buildPath);
|
||||
Log.info("Native libs path: " + nativeLibsDirectory);
|
||||
|
||||
// TODO: Dedup
|
||||
Network network = Network.newNetwork();
|
||||
@@ -48,6 +50,7 @@ public class DhfsFusex3IT {
|
||||
.from("azul/zulu-openjdk-debian:21-jre-latest")
|
||||
.run("apt update && apt install -y libfuse2 curl gcc")
|
||||
.copy("/app", "/app")
|
||||
.copy("/libs", "/libs")
|
||||
.cmd("java", "-ea", "-Xmx128M", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
|
||||
"-Ddhfs.objects.peerdiscovery.interval=100",
|
||||
@@ -58,11 +61,13 @@ public class DhfsFusex3IT {
|
||||
"-Ddhfs.objects.sync.timeout=10",
|
||||
"-Ddhfs.objects.sync.ping.timeout=5",
|
||||
"-Ddhfs.objects.reconnect_interval=1s",
|
||||
"-Dcom.usatiuk.dhfs.supportlib.native-path=/libs",
|
||||
"-Dquarkus.log.category.\"com.usatiuk\".level=TRACE",
|
||||
"-Dquarkus.log.category.\"com.usatiuk.dhfs\".level=TRACE",
|
||||
"-jar", "/app/quarkus-run.jar")
|
||||
.build())
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"));
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"))
|
||||
.withFileFromPath("/libs", Paths.get(nativeLibsDirectory));
|
||||
container1 = new GenericContainer<>(image)
|
||||
.withPrivilegedMode(true)
|
||||
.withCreateContainerCmdModifier(cmd -> Objects.requireNonNull(cmd.getHostConfig()).withDevices(Device.parse("/dev/fuse")))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.usatiuk.dhfs.integration;
|
||||
|
||||
import com.github.dockerjava.api.model.Device;
|
||||
import io.quarkus.logging.Log;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
@@ -32,7 +33,9 @@ public class ResyncIT {
|
||||
@BeforeEach
|
||||
void setup(TestInfo testInfo) throws IOException, InterruptedException, TimeoutException {
|
||||
String buildPath = System.getProperty("buildDirectory");
|
||||
System.out.println("Build path: " + buildPath);
|
||||
String nativeLibsDirectory = System.getProperty("nativeLibsDirectory");
|
||||
Log.info("Build path: " + buildPath);
|
||||
Log.info("Native libs path: " + nativeLibsDirectory);
|
||||
|
||||
Network network = Network.newNetwork();
|
||||
var image = new ImageFromDockerfile()
|
||||
@@ -41,6 +44,7 @@ public class ResyncIT {
|
||||
.from("azul/zulu-openjdk-debian:21-jre-latest")
|
||||
.run("apt update && apt install -y libfuse2 curl")
|
||||
.copy("/app", "/app")
|
||||
.copy("/libs", "/libs")
|
||||
.cmd("java", "-ea", "-Xmx128M", "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
|
||||
"-Ddhfs.objects.peerdiscovery.interval=100",
|
||||
@@ -51,10 +55,12 @@ public class ResyncIT {
|
||||
"-Ddhfs.objects.sync.timeout=20",
|
||||
"-Ddhfs.objects.sync.ping.timeout=20",
|
||||
"-Ddhfs.objects.reconnect_interval=1s",
|
||||
"-Dcom.usatiuk.dhfs.supportlib.native-path=/libs",
|
||||
"-Dquarkus.log.category.\"com.usatiuk.dhfs\".level=TRACE",
|
||||
"-jar", "/app/quarkus-run.jar")
|
||||
.build())
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"));
|
||||
.withFileFromPath("/app", Paths.get(buildPath, "quarkus-app"))
|
||||
.withFileFromPath("/libs", Paths.get(nativeLibsDirectory));
|
||||
container1 = new GenericContainer<>(image)
|
||||
.withPrivilegedMode(true)
|
||||
.withCreateContainerCmdModifier(cmd -> Objects.requireNonNull(cmd.getHostConfig()).withDevices(Device.parse("/dev/fuse")))
|
||||
|
||||
@@ -5,3 +5,4 @@ dhfs.objects.ref_verification=true
|
||||
dhfs.objects.deletion.delay=0
|
||||
quarkus.log.category."com.usatiuk.dhfs".level=TRACE
|
||||
quarkus.log.category."com.usatiuk.dhfs".min-level=TRACE
|
||||
quarkus.class-loading.parent-first-artifacts=com.usatiuk.dhfs:supportlib
|
||||
|
||||
109
dhfs-parent/supportlib/pom.xml
Normal file
109
dhfs-parent/supportlib/pom.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.usatiuk.dhfs</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>supportlib</artifactId>
|
||||
|
||||
<properties>
|
||||
<cmake.download>false</cmake.download>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<version>3.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>CMake Configure</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>
|
||||
${project.parent.basedir}/../libdhfs_support/builder/cross-build.sh
|
||||
</executable>
|
||||
<arguments>
|
||||
<argument>configure</argument>
|
||||
<argument>${project.build.outputDirectory}/native-build</argument>
|
||||
<argument>${dhfs.native-libs-dir}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>CMake Build</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>
|
||||
${project.parent.basedir}/../libdhfs_support/builder/cross-build.sh
|
||||
</executable>
|
||||
<arguments>
|
||||
<argument>build</argument>
|
||||
<argument>${project.build.outputDirectory}/native-build</argument>
|
||||
<argument>${dhfs.native-libs-dir}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.googlecode.cmake-maven-project</groupId>
|
||||
<artifactId>cmake-maven-plugin</artifactId>
|
||||
<version>3.30.2-b1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>cmake-generate</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourcePath>
|
||||
${project.parent.basedir}/../libdhfs_support
|
||||
</sourcePath>
|
||||
<targetPath>
|
||||
${project.build.outputDirectory}/native-build-local
|
||||
</targetPath>
|
||||
<options>
|
||||
-DDHFS_LIB_INSTALL=${dhfs.native-libs-dir}
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>cmake-compile</id>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
install
|
||||
</target>
|
||||
<projectDirectory>
|
||||
${project.build.outputDirectory}/native-build-local
|
||||
</projectDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.usatiuk.dhfs.supportlib;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class DhfsSupport {
|
||||
static private final String LibName = "libdhfs_support";
|
||||
|
||||
static private Path getLibPath() {
|
||||
return Path.of(System.getProperty("com.usatiuk.dhfs.supportlib.native-path"))
|
||||
.resolve(SysUtils.getLibPlatform() + "-" + SysUtils.getLibArch()).resolve(LibName + "." + SysUtils.getLibExtension());
|
||||
}
|
||||
|
||||
static {
|
||||
System.load(getLibPath().toAbsolutePath().toString());
|
||||
}
|
||||
|
||||
public static void hello() {
|
||||
DhfsSupportNative.hello();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.usatiuk.dhfs.supportlib;
|
||||
|
||||
|
||||
class DhfsSupportNative {
|
||||
|
||||
public static native void hello();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.usatiuk.dhfs.supportlib;
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
class SysUtils {
|
||||
static String getLibPlatform() {
|
||||
if (SystemUtils.IS_OS_MAC) {
|
||||
return "Darwin";
|
||||
} else if (SystemUtils.IS_OS_LINUX) {
|
||||
return "Linux";
|
||||
} else {
|
||||
throw new IllegalStateException("Unsupported OS: " + SystemUtils.OS_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
static String getLibExtension() {
|
||||
if (SystemUtils.IS_OS_MAC) {
|
||||
return "dylib";
|
||||
} else if (SystemUtils.IS_OS_LINUX) {
|
||||
return "so";
|
||||
} else {
|
||||
throw new IllegalStateException("Unsupported OS: " + SystemUtils.OS_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
static String getLibArch() {
|
||||
if (SystemUtils.IS_OS_MAC) {
|
||||
return switch (SystemUtils.OS_ARCH) {
|
||||
case "aarch64" -> "arm64";
|
||||
default -> throw new IllegalStateException("Unsupported architecture: " + SystemUtils.OS_ARCH);
|
||||
};
|
||||
} else if (SystemUtils.IS_OS_LINUX) {
|
||||
return switch (SystemUtils.OS_ARCH) {
|
||||
case "aarch64" -> "aarch64";
|
||||
default -> throw new IllegalStateException("Unsupported architecture: " + SystemUtils.OS_ARCH);
|
||||
};
|
||||
} else {
|
||||
throw new IllegalStateException("Unsupported OS: " + SystemUtils.OS_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
83
libdhfs_support/.gitignore
vendored
Normal file
83
libdhfs_support/.gitignore
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
.DS_Store
|
||||
/toolchain
|
||||
/cmake-build-debug
|
||||
/sysroot
|
||||
/mvn-build
|
||||
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
8
libdhfs_support/.idea/.gitignore
generated
vendored
Normal file
8
libdhfs_support/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
88
libdhfs_support/.idea/editor.xml
generated
Normal file
88
libdhfs_support/.idea/editor.xml
generated
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BackendCodeEditorSettings">
|
||||
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="None" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="8" type="long" />
|
||||
</component>
|
||||
</project>
|
||||
6
libdhfs_support/.idea/git_toolbox_blame.xml
generated
Normal file
6
libdhfs_support/.idea/git_toolbox_blame.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxBlameSettings">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
2
libdhfs_support/.idea/libdhfs_support.iml
generated
Normal file
2
libdhfs_support/.idea/libdhfs_support.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
12
libdhfs_support/.idea/misc.xml
generated
Normal file
12
libdhfs_support/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakePythonSetting">
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="CidrRootsConfiguration">
|
||||
<excludeRoots>
|
||||
<file path="$PROJECT_DIR$/mvn-build" />
|
||||
</excludeRoots>
|
||||
</component>
|
||||
</project>
|
||||
8
libdhfs_support/.idea/modules.xml
generated
Normal file
8
libdhfs_support/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/libdhfs_support.iml" filepath="$PROJECT_DIR$/.idea/libdhfs_support.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
libdhfs_support/.idea/vcs.xml
generated
Normal file
6
libdhfs_support/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
16
libdhfs_support/CMakeLists.txt
Normal file
16
libdhfs_support/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(libdhfs_support CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
find_package(JNI REQUIRED COMPONENTS JVM)
|
||||
find_package(Java REQUIRED)
|
||||
include(UseJava)
|
||||
|
||||
add_jar(DhfsSupportNative
|
||||
"${PROJECT_SOURCE_DIR}/../dhfs-parent/supportlib/src/main/java/com/usatiuk/dhfs/supportlib/DhfsSupportNative.java"
|
||||
GENERATE_NATIVE_HEADERS DhfsSupportNative-native)
|
||||
|
||||
add_library(dhfs_support SHARED DhfsSupportNative.cpp)
|
||||
target_link_libraries(dhfs_support PRIVATE DhfsSupportNative-native)
|
||||
install(TARGETS dhfs_support LIBRARY DESTINATION "${DHFS_LIB_INSTALL}/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
9
libdhfs_support/DhfsSupportNative.cpp
Normal file
9
libdhfs_support/DhfsSupportNative.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "com_usatiuk_dhfs_supportlib_DhfsSupportNative.h"
|
||||
|
||||
extern "C" {
|
||||
void Java_com_usatiuk_dhfs_supportlib_DhfsSupportNative_hello(JNIEnv* env, jclass klass) {
|
||||
printf("Hello, World!\n");
|
||||
}
|
||||
}
|
||||
3
libdhfs_support/builder/Dockerfile
Normal file
3
libdhfs_support/builder/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM rockylinux:8
|
||||
|
||||
RUN dnf install -y java-21-openjdk-headless java-21-openjdk-devel cmake gcc gcc-c++
|
||||
51
libdhfs_support/builder/cross-build.sh
Executable file
51
libdhfs_support/builder/cross-build.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$(uname)" == "*Linux*" ]]
|
||||
then
|
||||
echo "Already on linux"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
if [[ -z "${INSIDE_DOCKER_ALREADY}" ]]; then
|
||||
exec "$SCRIPT_DIR"/docker-launch.sh "$@"
|
||||
fi
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo "Not enough arguments supplied: (build/configure) (build dir) (output dir)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_DIR="$SCRIPT_DIR/.."
|
||||
|
||||
CONFIGURE_DIR="$2"
|
||||
INSTALL_DIR="$3"
|
||||
|
||||
function configure() {
|
||||
cmake -B"$CONFIGURE_DIR" -S"$PROJECT_DIR" -DDHFS_LIB_INSTALL="$INSTALL_DIR"
|
||||
}
|
||||
|
||||
function build() {
|
||||
cmake --build "$CONFIGURE_DIR" --target install
|
||||
}
|
||||
|
||||
mkdir -p "$2"
|
||||
mkdir -p "$3"
|
||||
|
||||
case "$1" in
|
||||
"configure")
|
||||
configure
|
||||
;;
|
||||
"build")
|
||||
build
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
13
libdhfs_support/builder/docker-launch.sh
Executable file
13
libdhfs_support/builder/docker-launch.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
export SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
DOCKER_IMG_FILE=$(mktemp)
|
||||
docker build --iidfile "$DOCKER_IMG_FILE" .
|
||||
|
||||
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
|
||||
docker run --rm -v "$ROOT_DIR:$ROOT_DIR" -e INSIDE_DOCKER_ALREADY=TRUE "$(cat "$DOCKER_IMG_FILE")" \
|
||||
"$SCRIPT_DIR/cross-build.sh" "$@"
|
||||
Reference in New Issue
Block a user