Skip to content

Commit 93d322e

Browse files
committed
use embedding.util.VirtualFileSystem in maven archetype
1 parent 5b8c939 commit 93d322e

File tree

3 files changed

+13
-640
lines changed

3 files changed

+13
-640
lines changed

graalpython/graalpy-archetype-polyglot-app/src/main/resources/archetype-resources/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
<artifactId>python-launcher</artifactId>
3838
<version>${symbol_dollar}{graalpy.version}</version>
3939
</dependency>
40+
41+
<dependency>
42+
<groupId>org.graalvm.python</groupId>
43+
<artifactId>python-embedding</artifactId>
44+
<version>${symbol_dollar}{graalpy.version}</version>
45+
</dependency>
4046
</dependencies>
4147

4248
<build>

graalpython/graalpy-archetype-polyglot-app/src/main/resources/archetype-resources/src/main/java/GraalPy.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.graalvm.polyglot.Value;
5252
import org.graalvm.polyglot.io.IOAccess;
5353
import java.io.IOException;
54+
import org.graalvm.python.embedding.utils.VirtualFileSystem;
5455

5556
public class GraalPy {
5657
private static final String VENV_PREFIX = "/vfs/venv";
@@ -60,7 +61,12 @@ public class GraalPy {
6061
private static final String PYTHON = "python";
6162

6263
public static Context getContext() {
63-
VirtualFileSystem vfs = new VirtualFileSystem();
64+
VirtualFileSystem vfs = VirtualFileSystem.newBuilder()
65+
.extractFilter(p -> {
66+
String s = p.toString();
67+
return s.endsWith(".ttf");
68+
})
69+
.build();
6470
Context context = Context.newBuilder()
6571
// set true to allow experimental options
6672
.allowExperimentalOptions(false)

0 commit comments

Comments
 (0)