-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better split and structure the annotation processing stuff
- Loading branch information
Showing
34 changed files
with
372 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...tion-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../chicory/function/annotations/Buffer.java → ...hicory/hostmodule/annotations/Buffer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...chicory/function/annotations/CString.java → ...icory/hostmodule/annotations/CString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cory/function/annotations/HostModule.java → ...ry/hostmodule/annotations/HostModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cory/function/annotations/WasmExport.java → ...ry/hostmodule/annotations/WasmExport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?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.dylibso.chicory</groupId> | ||
<artifactId>host-module-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>host-module-it</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Chicory - Host Module - IT</name> | ||
<description>Integration tests for the Chicory annotations</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>host-module-processor</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<configuration> | ||
<ignoredUnusedDeclaredDependencies combine.children="append"> | ||
<dependency>com.dylibso.chicory:host-module-processor</dependency> | ||
</ignoredUnusedDeclaredDependencies> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven-failsafe-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<itDir>${project.basedir}</itDir> | ||
<chicoryVersion>${project.version}</chicoryVersion> | ||
</systemPropertyVariables> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-invoker-plugin</artifactId> | ||
<version>${maven-invoker-plugin.version}</version> | ||
<configuration> | ||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> | ||
<cloneClean>true</cloneClean> | ||
<settingsFile>src/it/settings.xml</settingsFile> | ||
<postBuildHookScript>verify</postBuildHookScript> | ||
<addTestClassPath>true</addTestClassPath> | ||
<skipInvocation>${skipTests}</skipInvocation> | ||
<streamLogs>true</streamLogs> | ||
<invokerPropertiesFile>invoker.properties</invokerPropertiesFile> | ||
<scriptVariables> | ||
<version>${project.version}</version> | ||
<artifactId>${project.artifactId}</artifactId> | ||
<groupId>${project.groupId}</groupId> | ||
</scriptVariables> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>integration-tests</id> | ||
<goals> | ||
<goal>install</goal> | ||
<goal>run</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>templating-maven-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<id>filtering-java-templates</id> | ||
<goals> | ||
<goal>filter-sources</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<settings> | ||
<profiles> | ||
<profile> | ||
<id>it-repo</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<repositories> | ||
<repository> | ||
<id>local.central</id> | ||
<url>@localRepositoryUrl@</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>local.central</id> | ||
<url>@localRepositoryUrl@</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
</profiles> | ||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.goals=test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.dylibso.chicory</groupId> | ||
|
||
<artifactId>with-imports-chicory-it</artifactId> | ||
<version>0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<maven.compiler.release>@maven.compiler.release@</maven.compiler.release> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>host-module-annotations</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>runtime</artifactId> | ||
<version>@project.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>host-module-processor</artifactId> | ||
<version>@project.version@</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>wasm-corpus</artifactId> | ||
<version>@project.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>@junit.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>@junit.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>@maven-compiler-plugin.version@</version> | ||
<configuration> | ||
<release>${maven.compiler.release}</release> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>com.dylibso.chicory</groupId> | ||
<artifactId>host-module-processor</artifactId> | ||
<version>@project.version@</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
58 changes: 58 additions & 0 deletions
58
host-module/it/src/it/with-imports/src/test/java/chicory/test/WithImportsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package chicory.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.dylibso.chicory.hostmodule.annotations.HostModule; | ||
import com.dylibso.chicory.hostmodule.annotations.WasmExport; | ||
import com.dylibso.chicory.runtime.ExternalValues; | ||
import com.dylibso.chicory.runtime.Instance; | ||
import com.dylibso.chicory.wasm.Parser; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class WithImportsTest { | ||
public final AtomicInteger count = new AtomicInteger(); | ||
|
||
@HostModule("console") | ||
class TestModule { | ||
private static final String EXPECTED = "Hello, World!"; | ||
private final Instance instance; | ||
|
||
public TestModule() { | ||
instance = | ||
Instance.builder( | ||
Parser.parse( | ||
WithImportsTest.class.getResourceAsStream( | ||
"/compiled/host-function.wat.wasm"))) | ||
.withExternalValues( | ||
new ExternalValues( | ||
TestModule_ModuleFactory.toHostFunctions(this))) | ||
.build(); | ||
} | ||
|
||
public void logIt() { | ||
instance.export("logIt").apply(); | ||
} | ||
|
||
@WasmExport | ||
public void log(int len, int offset) { | ||
var message = instance.memory().readString(offset, len); | ||
|
||
if (EXPECTED.equals(message)) { | ||
count.incrementAndGet(); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
public void withImportsModule() { | ||
// Arrange | ||
var withImportsModule = new TestModule(); | ||
|
||
// Act | ||
withImportsModule.logIt(); | ||
|
||
// Assert | ||
assertEquals(10, count.get()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?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.dylibso.chicory</groupId> | ||
<artifactId>chicory</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>host-module-parent</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Chicory - Host Module - Parent</name> | ||
<description>Parent module for the Host Module machinery</description> | ||
|
||
<modules> | ||
<module>annotations</module> | ||
<module>it</module> | ||
<module>processor</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.