Skip to content

Commit cc7fb9a

Browse files
ci: Depend on versioned wasm (#253)
* ci: Depend on versioned wasm * fix: Remove wasm from checked code * feat: Clean removes the wasm * refactor: Use relative path
1 parent 313a06f commit cc7fb9a

5 files changed

Lines changed: 52 additions & 3 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/target/
77
*/target/
88
*.iml
9-
**dependency-reduced-pom.xml
9+
**dependency-reduced-pom.xml
10+
openfeature-provider-local/src/main/resources/wasm/confidence_resolver.wasm

‎openfeature-provider-local/pom.xml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<!-- Prevents the compiler version from resetting locally in Intellij -->
1919
<maven.compiler.source>17</maven.compiler.source>
2020
<maven.compiler.target>17</maven.compiler.target>
21+
<!-- WASM file version. When updated, make sure to mvn clean to force a new download -->
22+
<confidence.resolver.wasm.version>v0.2.0</confidence.resolver.wasm.version>
2123
</properties>
2224

2325

@@ -153,6 +155,50 @@
153155
</dependencies>
154156

155157
<build>
158+
<plugins>
159+
<!-- Plugin to clean WASM file during clean phase -->
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-clean-plugin</artifactId>
163+
<version>3.3.2</version>
164+
<configuration>
165+
<filesets>
166+
<fileset>
167+
<directory>src/main/resources/wasm</directory>
168+
<includes>
169+
<include>confidence_resolver.wasm</include>
170+
</includes>
171+
</fileset>
172+
</filesets>
173+
</configuration>
174+
</plugin>
175+
176+
<!-- Plugin to download WASM file during generate-resources phase -->
177+
<plugin>
178+
<groupId>org.apache.maven.plugins</groupId>
179+
<artifactId>maven-antrun-plugin</artifactId>
180+
<version>3.1.0</version>
181+
<executions>
182+
<execution>
183+
<id>download-wasm</id>
184+
<phase>generate-resources</phase>
185+
<goals>
186+
<goal>run</goal>
187+
</goals>
188+
<configuration>
189+
<target>
190+
<mkdir dir="src/main/resources/wasm"/>
191+
<get src="https://github.com/spotify/confidence-resolver-rust/releases/download/confidence_resolver-${confidence.resolver.wasm.version}/confidence_resolver.wasm"
192+
dest="src/main/resources/wasm/confidence_resolver.wasm"
193+
skipexisting="true"
194+
verbose="true"/>
195+
</target>
196+
</configuration>
197+
</execution>
198+
</executions>
199+
</plugin>
200+
</plugins>
201+
156202
<resources>
157203
<resource>
158204
<directory>src/main/resources</directory>

‎openfeature-provider-local/src/main/java/com/spotify/confidence/WasmResolveApi.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class WasmResolveApi {
5353
public WasmResolveApi(FlagLogger flagLogger) {
5454
this.flagLogger = flagLogger;
5555
try (InputStream wasmStream =
56-
getClass().getClassLoader().getResourceAsStream("wasm/rust_guest.wasm")) {
56+
getClass().getClassLoader().getResourceAsStream("wasm/confidence_resolver.wasm")) {
5757
if (wasmStream == null) {
58-
throw new RuntimeException("Could not find rust_guest.wasm in resources");
58+
throw new RuntimeException("Could not find confidence_resolver.wasm in resources");
5959
}
6060
final WasmModule module = Parser.parse(wasmStream);
6161
instance =
Binary file not shown.

‎pom.xml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@
493493
</ignoredClassPatterns>
494494
</configuration>
495495
</plugin>
496+
496497
</plugins>
497498
</build>
499+
498500
</project>

0 commit comments

Comments
 (0)