You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by sh...@apache.org on 2022/11/11 05:18:15 UTC
[incubator-teaclave-java-tee-sdk] 35/48: [sdk] Add archetype for project based on JavaEnclave SDK
This is an automated email from the ASF dual-hosted git repository.
shaojunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-java-tee-sdk.git
commit c5696ebff94ead3bb5110085d039633963da1a6e
Author: jeffery.wsj <je...@alibaba-inc.com>
AuthorDate: Mon Jun 13 10:16:12 2022 +0800
[sdk] Add archetype for project based on JavaEnclave SDK
Summary: add archetype for project based on JavaEnclave SDK
Test Plan: all tests pass
Reviewers: lei.yul, cengfeng.lzy, sanhong.lsh
Issue: https://aone.alibaba-inc.com/task/42435188
CR: https://code.aone.alibaba-inc.com/java-tee/JavaEnclave/codereview/9056672
---
archetype/pom.xml | 27 +++
.../META-INF/maven/archetype-metadata.xml | 97 ++++++++++
.../resources/archetype-resources/common/pom.xml | 59 ++++++
.../resources/archetype-resources/enclave/pom.xml | 200 +++++++++++++++++++++
.../META-INF/native-image/jni-config.json | 2 +
.../META-INF/native-image/proxy-config.json | 2 +
.../META-INF/native-image/reflect-config.json | 2 +
.../META-INF/native-image/resource-config.json | 5 +
.../native-image/serialization-config.json | 2 +
.../src/main/resources/embedded_libos_enclave.json | 11 ++
.../enclave/src/main/resources/tee_sdk_svm.conf | 12 ++
.../resources/archetype-resources}/host/pom.xml | 56 +++---
.../src/main/resources/archetype-resources/pom.xml | 85 +++++++++
.../resources/projects/basic/archetype.properties | 5 +
.../src/test/resources/projects/basic/goal.txt | 0
samples/helloworld/common/pom.xml | 59 ++++++
.../alibaba/samples/helloworld/common/Service.java | 8 +
samples/helloworld/enclave/pom.xml | 200 +++++++++++++++++++++
.../samples/helloworld/enclave/ServiceImpl.java | 12 ++
.../META-INF/native-image/jni-config.json | 2 +
.../META-INF/native-image/proxy-config.json | 2 +
.../META-INF/native-image/reflect-config.json | 2 +
.../META-INF/native-image/resource-config.json | 5 +
.../native-image/serialization-config.json | 2 +
.../src/main/resources/embedded_libos_enclave.json | 11 ++
.../enclave/src/main/resources/tee_sdk_svm.conf | 12 ++
{test => samples/helloworld}/host/pom.xml | 56 +++---
.../com/alibaba/samples/helloworld/host/Main.java | 28 +++
samples/helloworld/pom.xml | 85 +++++++++
samples/helloworld/run.sh | 5 +
.../META-INF/native-image/jni-config.json | 2 +
.../META-INF/native-image/proxy-config.json | 2 +
.../META-INF/native-image/reflect-config.json | 2 +
.../META-INF/native-image/resource-config.json | 5 +
.../native-image/serialization-config.json | 2 +
test/host/pom.xml | 7 +
36 files changed, 1030 insertions(+), 44 deletions(-)
diff --git a/archetype/pom.xml b/archetype/pom.xml
new file mode 100644
index 0000000..8db96ac
--- /dev/null
+++ b/archetype/pom.xml
@@ -0,0 +1,27 @@
+<?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>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>javaenclave-archetype</artifactId>
+ <version>0.1.0</version>
+ <packaging>maven-archetype</packaging>
+ <name>JavaEnclave-Archetype</name>
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>3.0.1</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>3.0.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <url>http://maven.apache.org</url>
+</project>
\ No newline at end of file
diff --git a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..0cacd3d
--- /dev/null
+++ b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="points"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <fileSets>
+ <fileSet encoding="UTF-8">
+ <directory>.settings</directory>
+ <includes>
+ <include>**/*.prefs</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>.project</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <modules>
+ <module id="common" dir="common" name="common">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet encoding="UTF-8">
+ <directory>.settings</directory>
+ <includes>
+ <include>**/*.prefs</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>.classpath</include>
+ <include>.project</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ <module id="enclave" dir="enclave" name="enclave">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet encoding="UTF-8">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.json</include>
+ <include>**/*.conf</include>
+ </includes>
+ </fileSet>
+ <fileSet encoding="UTF-8">
+ <directory>.settings</directory>
+ <includes>
+ <include>**/*.prefs</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>.classpath</include>
+ <include>.project</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ <module id="host" dir="host" name="host">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" encoding="UTF-8">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet encoding="UTF-8">
+ <directory>.settings</directory>
+ <includes>
+ <include>**/*.prefs</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>.classpath</include>
+ <include>.project</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ </modules>
+</archetype-descriptor>
diff --git a/archetype/src/main/resources/archetype-resources/common/pom.xml b/archetype/src/main/resources/archetype-resources/common/pom.xml
new file mode 100644
index 0000000..cb01d3c
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/common/pom.xml
@@ -0,0 +1,59 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
+ <version>${version}</version>
+ </parent>
+ <artifactId>common</artifactId>
+ <packaging>jar</packaging>
+ <name>common</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service-annotations</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/archetype/src/main/resources/archetype-resources/enclave/pom.xml b/archetype/src/main/resources/archetype-resources/enclave/pom.xml
new file mode 100644
index 0000000..780d40f
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/pom.xml
@@ -0,0 +1,200 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
+ <version>${version}</version>
+ </parent>
+ <artifactId>enclave</artifactId>
+ <packaging>jar</packaging>
+ <name>enclave</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <svm.maven.version>0.9.13</svm.maven.version>
+ <com.alibaba.enclave.privatePem.path></com.alibaba.enclave.privatePem.path>
+ </properties>
+ <profiles>
+ <profile>
+ <id>native</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <version>${svm.maven.version}</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>test-native</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <buildArgs>
+ <buildArg>--no-fallback</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>test</phase>
+ </execution>
+ <execution>
+ <id>build-native</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <configuration>
+ <imageName>lib_mock_svm_load</imageName>
+ <buildArgs>
+ <buildArg>--shared</buildArg>
+ <buildArg>--no-fallback</buildArg>
+ <buildArg>-H:Path=svm-output</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>package</phase>
+ </execution>
+ <execution>
+ <id>build-native-tee</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <configuration>
+ <imageName>lib_tee_sdk_svm_load</imageName>
+ <buildArgs>
+ <buildArg>--shared</buildArg>
+ <buildArg>--no-fallback</buildArg>
+ <buildArg>-H:-AllowVMInternalThreads</buildArg>
+ <buildArg>-H:+RunInEnclave</buildArg>
+ <buildArg>-H:Path=svm-output</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <agent>
+ <enabled>true</enabled>
+ </agent>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <executions>
+ <execution>
+ <id>ApplicationNativeCompile</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bash</executable>
+ <arguments>
+ <argument>/opt/javaenclave/build_app/make.sh</argument>
+ <argument>${project.basedir}</argument>
+ <argument>${com.alibaba.enclave.platform}</argument>
+ <argument>${com.alibaba.enclave.privatePem.path}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.3.0</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>enclave</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${groupId}</groupId>
+ <artifactId>common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service-annotations</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit-pioneer</groupId>
+ <artifactId>junit-pioneer</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/jni-config.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/jni-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/jni-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/proxy-config.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/proxy-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/proxy-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/reflect-config.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/reflect-config.json
new file mode 100644
index 0000000..32960f8
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/reflect-config.json
@@ -0,0 +1,2 @@
+[
+]
\ No newline at end of file
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/resource-config.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/resource-config.json
new file mode 100644
index 0000000..791ea0f
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/resource-config.json
@@ -0,0 +1,5 @@
+{
+ "resources":{
+ "includes":[]},
+ "bundles":[]
+}
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/serialization-config.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/serialization-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/META-INF/native-image/serialization-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/embedded_libos_enclave.json b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/embedded_libos_enclave.json
new file mode 100644
index 0000000..add95b2
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/embedded_libos_enclave.json
@@ -0,0 +1,11 @@
+{
+ "debuggable": true,
+ "agent_http_handler_thread_pool_size": 6,
+ "enclave_startup_duration_ms": 60000,
+ "kernel_space_heap_size": "32MB",
+ "user_space_size": "1200MB",
+ "default_mmap_size": "800MB",
+ "max_num_of_threads": 48,
+ "log_level": "off",
+ "enclave_jvm_args": ["-XX:-UseCompressedOops", "-Xmx512m", "-Dos.name=Linux"]
+}
\ No newline at end of file
diff --git a/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/tee_sdk_svm.conf b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/tee_sdk_svm.conf
new file mode 100644
index 0000000..b52a2e9
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/enclave/src/main/resources/tee_sdk_svm.conf
@@ -0,0 +1,12 @@
+<!-- Please refer to User's Guide for the explanation of each field -->
+<EnclaveConfiguration>
+ <ProdID>0</ProdID>
+ <ISVSVN>0</ISVSVN>
+ <StackMaxSize>0x101000</StackMaxSize>
+ <HeapMaxSize>0x6000000</HeapMaxSize>
+ <TCSNum>10</TCSNum>
+ <TCSPolicy>1</TCSPolicy>
+ <DisableDebug>0</DisableDebug>
+ <MiscSelect>0</MiscSelect>
+ <MiscMask>0xFFFFFFFF</MiscMask>
+</EnclaveConfiguration>
\ No newline at end of file
diff --git a/test/host/pom.xml b/archetype/src/main/resources/archetype-resources/host/pom.xml
similarity index 69%
copy from test/host/pom.xml
copy to archetype/src/main/resources/archetype-resources/host/pom.xml
index 755b873..a3d5b76 100644
--- a/test/host/pom.xml
+++ b/archetype/src/main/resources/archetype-resources/host/pom.xml
@@ -1,17 +1,16 @@
<?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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
+ <groupId>${groupId}</groupId>
<parent>
- <groupId>com.alibaba.confidentialcomputing</groupId>
- <artifactId>test</artifactId>
- <version>0.1.0</version>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
+ <version>${version}</version>
</parent>
<artifactId>host</artifactId>
<packaging>jar</packaging>
- <name>Test-Host</name>
- <url></url>
+ <name>host</name>
+ <url>http://maven.apache.org</url>
<build>
<resources>
<resource>
@@ -22,13 +21,15 @@
<include>**/*.tgz</include>
</includes>
</resource>
+ <resource>
+ <directory>${project.basedir}/../enclave/src/main/resources</directory>
+ <includes>
+ <include>**/embedded_libos_enclave.json</include>
+ <include>**/tee_sdk_svm.conf</include>
+ </includes>
+ </resource>
</resources>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
@@ -50,6 +51,25 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.3.0</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -58,15 +78,7 @@
<artifactId>host</artifactId>
</dependency>
<dependency>
- <groupId>com.alibaba.confidentialcomputing</groupId>
- <artifactId>common</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
- <artifactId>enclave</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
+ <groupId>${groupId}</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
diff --git a/archetype/src/main/resources/archetype-resources/pom.xml b/archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..27b93c5
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,85 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <packaging>pom</packaging>
+ <version>${version}</version>
+ <name>${artifactId}</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <com.alibaba.enclave.platform>MOCK_IN_SVM:TEE_SDK:EMBEDDED_LIB_OS</com.alibaba.enclave.platform>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>common</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>enclave</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>host</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>${groupId}</groupId>
+ <artifactId>common</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${groupId}</groupId>
+ <artifactId>enclave</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${groupId}</groupId>
+ <artifactId>host</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.7.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-engine</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>5.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit-pioneer</groupId>
+ <artifactId>junit-pioneer</artifactId>
+ <version>1.5.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <modules>
+ <module>common</module>
+ <module>enclave</module>
+ <module>host</module>
+ </modules>
+</project>
\ No newline at end of file
diff --git a/archetype/src/test/resources/projects/basic/archetype.properties b/archetype/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..46d68c0
--- /dev/null
+++ b/archetype/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Mon Jun 28 12:07:27 CST 2021
+package=it.pkg
+groupId=archetype.it
+artifactId=basic
+version=0.1.0
diff --git a/archetype/src/test/resources/projects/basic/goal.txt b/archetype/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
diff --git a/samples/helloworld/common/pom.xml b/samples/helloworld/common/pom.xml
new file mode 100644
index 0000000..325070d
--- /dev/null
+++ b/samples/helloworld/common/pom.xml
@@ -0,0 +1,59 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <parent>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>helloworld</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>common</artifactId>
+ <packaging>jar</packaging>
+ <name>common</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service-annotations</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/samples/helloworld/common/src/main/java/com/alibaba/samples/helloworld/common/Service.java b/samples/helloworld/common/src/main/java/com/alibaba/samples/helloworld/common/Service.java
new file mode 100644
index 0000000..bbf0413
--- /dev/null
+++ b/samples/helloworld/common/src/main/java/com/alibaba/samples/helloworld/common/Service.java
@@ -0,0 +1,8 @@
+package com.alibaba.samples.helloworld.common;
+
+import com.alibaba.confidentialcomputing.common.annotations.EnclaveService;
+
+@EnclaveService
+public interface Service {
+ String sayHelloWorld();
+}
diff --git a/samples/helloworld/enclave/pom.xml b/samples/helloworld/enclave/pom.xml
new file mode 100644
index 0000000..7684ac3
--- /dev/null
+++ b/samples/helloworld/enclave/pom.xml
@@ -0,0 +1,200 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <parent>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>helloworld</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>enclave</artifactId>
+ <packaging>jar</packaging>
+ <name>enclave</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <svm.maven.version>0.9.13</svm.maven.version>
+ <com.alibaba.enclave.privatePem.path></com.alibaba.enclave.privatePem.path>
+ </properties>
+ <profiles>
+ <profile>
+ <id>native</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.graalvm.buildtools</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <version>${svm.maven.version}</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>test-native</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <buildArgs>
+ <buildArg>--no-fallback</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>test</phase>
+ </execution>
+ <execution>
+ <id>build-native</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <configuration>
+ <imageName>lib_mock_svm_load</imageName>
+ <buildArgs>
+ <buildArg>--shared</buildArg>
+ <buildArg>--no-fallback</buildArg>
+ <buildArg>-H:Path=svm-output</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>package</phase>
+ </execution>
+ <execution>
+ <id>build-native-tee</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <configuration>
+ <imageName>lib_tee_sdk_svm_load</imageName>
+ <buildArgs>
+ <buildArg>--shared</buildArg>
+ <buildArg>--no-fallback</buildArg>
+ <buildArg>-H:-AllowVMInternalThreads</buildArg>
+ <buildArg>-H:+RunInEnclave</buildArg>
+ <buildArg>-H:Path=svm-output</buildArg>
+ </buildArgs>
+ </configuration>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <agent>
+ <enabled>true</enabled>
+ </agent>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <executions>
+ <execution>
+ <id>ApplicationNativeCompile</id>
+ <phase>package</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bash</executable>
+ <arguments>
+ <argument>/opt/javaenclave/build_app/make.sh</argument>
+ <argument>${project.basedir}</argument>
+ <argument>${com.alibaba.enclave.platform}</argument>
+ <argument>${com.alibaba.enclave.privatePem.path}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.3.0</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>enclave</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service-annotations</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <version>1.0-rc6</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit-pioneer</groupId>
+ <artifactId>junit-pioneer</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/samples/helloworld/enclave/src/main/java/com/alibaba/samples/helloworld/enclave/ServiceImpl.java b/samples/helloworld/enclave/src/main/java/com/alibaba/samples/helloworld/enclave/ServiceImpl.java
new file mode 100644
index 0000000..282044c
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/java/com/alibaba/samples/helloworld/enclave/ServiceImpl.java
@@ -0,0 +1,12 @@
+package com.alibaba.samples.helloworld.enclave;
+
+import com.alibaba.samples.helloworld.common.Service;
+import com.google.auto.service.AutoService;
+
+@AutoService(Service.class)
+public class ServiceImpl implements Service {
+ @Override
+ public String sayHelloWorld() {
+ return "Hello World";
+ }
+}
diff --git a/samples/helloworld/enclave/src/main/resources/META-INF/native-image/jni-config.json b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/jni-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/jni-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/samples/helloworld/enclave/src/main/resources/META-INF/native-image/proxy-config.json b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/proxy-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/proxy-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/samples/helloworld/enclave/src/main/resources/META-INF/native-image/reflect-config.json b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/reflect-config.json
new file mode 100644
index 0000000..32960f8
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/reflect-config.json
@@ -0,0 +1,2 @@
+[
+]
\ No newline at end of file
diff --git a/samples/helloworld/enclave/src/main/resources/META-INF/native-image/resource-config.json b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/resource-config.json
new file mode 100644
index 0000000..791ea0f
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/resource-config.json
@@ -0,0 +1,5 @@
+{
+ "resources":{
+ "includes":[]},
+ "bundles":[]
+}
diff --git a/samples/helloworld/enclave/src/main/resources/META-INF/native-image/serialization-config.json b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/serialization-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/META-INF/native-image/serialization-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/samples/helloworld/enclave/src/main/resources/embedded_libos_enclave.json b/samples/helloworld/enclave/src/main/resources/embedded_libos_enclave.json
new file mode 100644
index 0000000..add95b2
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/embedded_libos_enclave.json
@@ -0,0 +1,11 @@
+{
+ "debuggable": true,
+ "agent_http_handler_thread_pool_size": 6,
+ "enclave_startup_duration_ms": 60000,
+ "kernel_space_heap_size": "32MB",
+ "user_space_size": "1200MB",
+ "default_mmap_size": "800MB",
+ "max_num_of_threads": 48,
+ "log_level": "off",
+ "enclave_jvm_args": ["-XX:-UseCompressedOops", "-Xmx512m", "-Dos.name=Linux"]
+}
\ No newline at end of file
diff --git a/samples/helloworld/enclave/src/main/resources/tee_sdk_svm.conf b/samples/helloworld/enclave/src/main/resources/tee_sdk_svm.conf
new file mode 100644
index 0000000..b52a2e9
--- /dev/null
+++ b/samples/helloworld/enclave/src/main/resources/tee_sdk_svm.conf
@@ -0,0 +1,12 @@
+<!-- Please refer to User's Guide for the explanation of each field -->
+<EnclaveConfiguration>
+ <ProdID>0</ProdID>
+ <ISVSVN>0</ISVSVN>
+ <StackMaxSize>0x101000</StackMaxSize>
+ <HeapMaxSize>0x6000000</HeapMaxSize>
+ <TCSNum>10</TCSNum>
+ <TCSPolicy>1</TCSPolicy>
+ <DisableDebug>0</DisableDebug>
+ <MiscSelect>0</MiscSelect>
+ <MiscMask>0xFFFFFFFF</MiscMask>
+</EnclaveConfiguration>
\ No newline at end of file
diff --git a/test/host/pom.xml b/samples/helloworld/host/pom.xml
similarity index 68%
copy from test/host/pom.xml
copy to samples/helloworld/host/pom.xml
index 755b873..04522ae 100644
--- a/test/host/pom.xml
+++ b/samples/helloworld/host/pom.xml
@@ -1,17 +1,16 @@
<?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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
+ <groupId>com.alibaba.samples.helloworld</groupId>
<parent>
- <groupId>com.alibaba.confidentialcomputing</groupId>
- <artifactId>test</artifactId>
- <version>0.1.0</version>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>helloworld</artifactId>
+ <version>1.0-SNAPSHOT</version>
</parent>
<artifactId>host</artifactId>
<packaging>jar</packaging>
- <name>Test-Host</name>
- <url></url>
+ <name>host</name>
+ <url>http://maven.apache.org</url>
<build>
<resources>
<resource>
@@ -22,13 +21,15 @@
<include>**/*.tgz</include>
</includes>
</resource>
+ <resource>
+ <directory>${project.basedir}/../enclave/src/main/resources</directory>
+ <includes>
+ <include>**/embedded_libos_enclave.json</include>
+ <include>**/tee_sdk_svm.conf</include>
+ </includes>
+ </resource>
</resources>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
@@ -50,6 +51,25 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.3.0</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -58,15 +78,7 @@
<artifactId>host</artifactId>
</dependency>
<dependency>
- <groupId>com.alibaba.confidentialcomputing</groupId>
- <artifactId>common</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
- <artifactId>enclave</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.confidentialcomputing.test</groupId>
+ <groupId>com.alibaba.samples.helloworld</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency>
diff --git a/samples/helloworld/host/src/main/java/com/alibaba/samples/helloworld/host/Main.java b/samples/helloworld/host/src/main/java/com/alibaba/samples/helloworld/host/Main.java
new file mode 100644
index 0000000..d531358
--- /dev/null
+++ b/samples/helloworld/host/src/main/java/com/alibaba/samples/helloworld/host/Main.java
@@ -0,0 +1,28 @@
+package com.alibaba.samples.helloworld.host;
+
+import com.alibaba.confidentialcomputing.host.Enclave;
+import com.alibaba.confidentialcomputing.host.EnclaveFactory;
+import com.alibaba.confidentialcomputing.host.EnclaveType;
+import com.alibaba.confidentialcomputing.host.exception.EnclaveCreatingException;
+import com.alibaba.confidentialcomputing.host.exception.EnclaveDestroyingException;
+import com.alibaba.confidentialcomputing.host.exception.ServicesLoadingException;
+import com.alibaba.samples.helloworld.common.Service;
+
+import java.util.Iterator;
+
+public class Main {
+ public static void main(String[] args) throws EnclaveCreatingException, ServicesLoadingException, EnclaveDestroyingException {
+ EnclaveType[] enclaveTypes = {
+ EnclaveType.MOCK_IN_JVM,
+ EnclaveType.MOCK_IN_SVM,
+ EnclaveType.TEE_SDK,
+ EnclaveType.EMBEDDED_LIB_OS};
+
+ for (EnclaveType enclaveType : enclaveTypes) {
+ Enclave enclave = EnclaveFactory.create(enclaveType);
+ Iterator<Service> services = enclave.load(Service.class);
+ System.out.println(services.next().sayHelloWorld());
+ enclave.destroy();
+ }
+ }
+}
diff --git a/samples/helloworld/pom.xml b/samples/helloworld/pom.xml
new file mode 100644
index 0000000..2d0cedb
--- /dev/null
+++ b/samples/helloworld/pom.xml
@@ -0,0 +1,85 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>helloworld</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>helloworld</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <com.alibaba.enclave.platform>MOCK_IN_SVM:TEE_SDK:EMBEDDED_LIB_OS</com.alibaba.enclave.platform>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>common</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>enclave</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.confidentialcomputing</groupId>
+ <artifactId>host</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>common</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>enclave</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.samples.helloworld</groupId>
+ <artifactId>host</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>5.7.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-engine</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>5.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit-pioneer</groupId>
+ <artifactId>junit-pioneer</artifactId>
+ <version>1.5.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <modules>
+ <module>common</module>
+ <module>enclave</module>
+ <module>host</module>
+ </modules>
+</project>
\ No newline at end of file
diff --git a/samples/helloworld/run.sh b/samples/helloworld/run.sh
new file mode 100755
index 0000000..dc29e4b
--- /dev/null
+++ b/samples/helloworld/run.sh
@@ -0,0 +1,5 @@
+#/bin/bash
+
+mvn --settings /root/tools/settings.xml -Pnative clean package
+
+java -cp host/target/host-1.0-SNAPSHOT-jar-with-dependencies.jar:enclave/target/enclave-1.0-SNAPSHOT-jar-with-dependencies.jar com.alibaba.samples.helloworld.host.Main
diff --git a/test/enclave/src/main/resources/META-INF/native-image/jni-config.json b/test/enclave/src/main/resources/META-INF/native-image/jni-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/test/enclave/src/main/resources/META-INF/native-image/jni-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/test/enclave/src/main/resources/META-INF/native-image/proxy-config.json b/test/enclave/src/main/resources/META-INF/native-image/proxy-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/test/enclave/src/main/resources/META-INF/native-image/proxy-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/test/enclave/src/main/resources/META-INF/native-image/reflect-config.json b/test/enclave/src/main/resources/META-INF/native-image/reflect-config.json
new file mode 100644
index 0000000..32960f8
--- /dev/null
+++ b/test/enclave/src/main/resources/META-INF/native-image/reflect-config.json
@@ -0,0 +1,2 @@
+[
+]
\ No newline at end of file
diff --git a/test/enclave/src/main/resources/META-INF/native-image/resource-config.json b/test/enclave/src/main/resources/META-INF/native-image/resource-config.json
new file mode 100644
index 0000000..791ea0f
--- /dev/null
+++ b/test/enclave/src/main/resources/META-INF/native-image/resource-config.json
@@ -0,0 +1,5 @@
+{
+ "resources":{
+ "includes":[]},
+ "bundles":[]
+}
diff --git a/test/enclave/src/main/resources/META-INF/native-image/serialization-config.json b/test/enclave/src/main/resources/META-INF/native-image/serialization-config.json
new file mode 100644
index 0000000..0d4f101
--- /dev/null
+++ b/test/enclave/src/main/resources/META-INF/native-image/serialization-config.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/test/host/pom.xml b/test/host/pom.xml
index 755b873..77bbc1c 100644
--- a/test/host/pom.xml
+++ b/test/host/pom.xml
@@ -22,6 +22,13 @@
<include>**/*.tgz</include>
</includes>
</resource>
+ <resource>
+ <directory>${project.basedir}/../enclave/src/main/resources</directory>
+ <includes>
+ <include>**/embedded_libos_enclave.json</include>
+ <include>**/tee_sdk_svm.conf</include>
+ </includes>
+ </resource>
</resources>
<plugins>
<plugin>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org