mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-31 12:24:10 -08:00
Bind system properties to Maven properties.
Add heapSize property
This commit is contained in:
parent
fc799afcda
commit
7588962212
|
@ -165,6 +165,21 @@
|
||||||
<debugInformationGenerated>true</debugInformationGenerated>
|
<debugInformationGenerated>true</debugInformationGenerated>
|
||||||
<targetType>WEBASSEMBLY</targetType>
|
<targetType>WEBASSEMBLY</targetType>
|
||||||
<optimizationLevel>FULL</optimizationLevel>
|
<optimizationLevel>FULL</optimizationLevel>
|
||||||
|
<heapSize>8</heapSize>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>native-client</id>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<targetDirectory>${project.build.directory}/generated/c</targetDirectory>
|
||||||
|
<mainClass>org.teavm.samples.benchmark.teavm.Gtk3BenchmarkStarter</mainClass>
|
||||||
|
<debugInformationGenerated>true</debugInformationGenerated>
|
||||||
|
<targetType>C</targetType>
|
||||||
|
<optimizationLevel>FULL</optimizationLevel>
|
||||||
|
<heapSize>8</heapSize>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class TeaVMTool {
|
||||||
public void generate() throws TeaVMToolException {
|
public void generate() throws TeaVMToolException {
|
||||||
try {
|
try {
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
log.info("Building JavaScript file");
|
log.info("Running TeaVM");
|
||||||
TeaVMBuilder vmBuilder = new TeaVMBuilder(prepareTarget());
|
TeaVMBuilder vmBuilder = new TeaVMBuilder(prepareTarget());
|
||||||
if (incremental) {
|
if (incremental) {
|
||||||
cacheDirectory.mkdirs();
|
cacheDirectory.mkdirs();
|
||||||
|
|
|
@ -66,5 +66,7 @@ public interface BuildStrategy {
|
||||||
|
|
||||||
void setWasmVersion(WasmBinaryVersion wasmVersion);
|
void setWasmVersion(WasmBinaryVersion wasmVersion);
|
||||||
|
|
||||||
|
void setHeapSize(int heapSize);
|
||||||
|
|
||||||
BuildResult build() throws BuildException;
|
BuildResult build() throws BuildException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class InProcessBuildStrategy implements BuildStrategy {
|
||||||
private String[] transformers = new String[0];
|
private String[] transformers = new String[0];
|
||||||
private String[] classesToPreserve = new String[0];
|
private String[] classesToPreserve = new String[0];
|
||||||
private WasmBinaryVersion wasmVersion = WasmBinaryVersion.V_0x1;
|
private WasmBinaryVersion wasmVersion = WasmBinaryVersion.V_0x1;
|
||||||
|
private int heapSize = 32;
|
||||||
private final List<SourceFileProvider> sourceFileProviders = new ArrayList<>();
|
private final List<SourceFileProvider> sourceFileProviders = new ArrayList<>();
|
||||||
private TeaVMProgressListener progressListener;
|
private TeaVMProgressListener progressListener;
|
||||||
private Properties properties = new Properties();
|
private Properties properties = new Properties();
|
||||||
|
@ -172,6 +173,11 @@ public class InProcessBuildStrategy implements BuildStrategy {
|
||||||
this.wasmVersion = wasmVersion;
|
this.wasmVersion = wasmVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHeapSize(int heapSize) {
|
||||||
|
this.heapSize = heapSize;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuildResult build() throws BuildException {
|
public BuildResult build() throws BuildException {
|
||||||
TeaVMTool tool = new TeaVMTool();
|
TeaVMTool tool = new TeaVMTool();
|
||||||
|
@ -194,6 +200,7 @@ public class InProcessBuildStrategy implements BuildStrategy {
|
||||||
tool.getClassesToPreserve().addAll(Arrays.asList(classesToPreserve));
|
tool.getClassesToPreserve().addAll(Arrays.asList(classesToPreserve));
|
||||||
tool.setCacheDirectory(cacheDirectory != null ? new File(cacheDirectory) : null);
|
tool.setCacheDirectory(cacheDirectory != null ? new File(cacheDirectory) : null);
|
||||||
tool.setWasmVersion(wasmVersion);
|
tool.setWasmVersion(wasmVersion);
|
||||||
|
tool.setMinHeapSize(heapSize);
|
||||||
|
|
||||||
tool.getProperties().putAll(properties);
|
tool.getProperties().putAll(properties);
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,11 @@ public class RemoteBuildStrategy implements BuildStrategy {
|
||||||
request.wasmVersion = wasmVersion;
|
request.wasmVersion = wasmVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHeapSize(int heapSize) {
|
||||||
|
request.heapSize = heapSize;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuildResult build() throws BuildException {
|
public BuildResult build() throws BuildException {
|
||||||
RemoteBuildResponse response;
|
RemoteBuildResponse response;
|
||||||
|
|
|
@ -164,6 +164,7 @@ public class BuildDaemon extends UnicastRemoteObject implements RemoteBuildServi
|
||||||
tool.setOptimizationLevel(request.optimizationLevel);
|
tool.setOptimizationLevel(request.optimizationLevel);
|
||||||
tool.setMinifying(request.minifying);
|
tool.setMinifying(request.minifying);
|
||||||
tool.setWasmVersion(request.wasmVersion);
|
tool.setWasmVersion(request.wasmVersion);
|
||||||
|
tool.setMinHeapSize(request.heapSize);
|
||||||
|
|
||||||
for (String sourceDirectory : request.sourceDirectories) {
|
for (String sourceDirectory : request.sourceDirectories) {
|
||||||
tool.addSourceFileProvider(new DirectorySourceFileProvider(new File(sourceDirectory)));
|
tool.addSourceFileProvider(new DirectorySourceFileProvider(new File(sourceDirectory)));
|
||||||
|
|
|
@ -42,4 +42,5 @@ public class RemoteBuildRequest implements Serializable {
|
||||||
public Properties properties;
|
public Properties properties;
|
||||||
public TeaVMOptimizationLevel optimizationLevel;
|
public TeaVMOptimizationLevel optimizationLevel;
|
||||||
public WasmBinaryVersion wasmVersion;
|
public WasmBinaryVersion wasmVersion;
|
||||||
|
public int heapSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,22 +77,22 @@ public class TeaVMCompileMojo extends AbstractMojo {
|
||||||
@Parameter
|
@Parameter
|
||||||
private List<String> compileScopes;
|
private List<String> compileScopes;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.minifying", defaultValue = "true")
|
||||||
private boolean minifying = true;
|
private boolean minifying = true;
|
||||||
|
|
||||||
@Parameter
|
@Parameter
|
||||||
private Properties properties;
|
private Properties properties;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.debugInformationGenerated", defaultValue = "false")
|
||||||
private boolean debugInformationGenerated;
|
private boolean debugInformationGenerated;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.sourceMapsGenerated", defaultValue = "false")
|
||||||
private boolean sourceMapsGenerated;
|
private boolean sourceMapsGenerated;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.sourceFilesCopied", defaultValue = "false")
|
||||||
private boolean sourceFilesCopied;
|
private boolean sourceFilesCopied;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.incremental", defaultValue = "false")
|
||||||
private boolean incremental;
|
private boolean incremental;
|
||||||
|
|
||||||
@Parameter
|
@Parameter
|
||||||
|
@ -104,30 +104,33 @@ public class TeaVMCompileMojo extends AbstractMojo {
|
||||||
@Parameter(defaultValue = "${project.build.sourceDirectory}")
|
@Parameter(defaultValue = "${project.build.sourceDirectory}")
|
||||||
private File sourceDirectory;
|
private File sourceDirectory;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.targetFileName", defaultValue = "")
|
||||||
private String targetFileName = "";
|
private String targetFileName = "";
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.mainClass")
|
||||||
private String mainClass;
|
private String mainClass;
|
||||||
|
|
||||||
@Parameter
|
@Parameter
|
||||||
private String[] classesToPreserve;
|
private String[] classesToPreserve;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.stopOnErrors", defaultValue = "true")
|
||||||
private boolean stopOnErrors = true;
|
private boolean stopOnErrors = true;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.optimizationLevel", defaultValue = "SIMPLE")
|
||||||
private TeaVMOptimizationLevel optimizationLevel = TeaVMOptimizationLevel.SIMPLE;
|
private TeaVMOptimizationLevel optimizationLevel = TeaVMOptimizationLevel.SIMPLE;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.targetType", defaultValue = "JAVASCRIPT")
|
||||||
private TeaVMTargetType targetType = TeaVMTargetType.JAVASCRIPT;
|
private TeaVMTargetType targetType = TeaVMTargetType.JAVASCRIPT;
|
||||||
|
|
||||||
@Parameter(defaultValue = "${project.build.directory}/teavm-cache")
|
@Parameter(defaultValue = "${project.build.directory}/teavm-cache")
|
||||||
private File cacheDirectory;
|
private File cacheDirectory;
|
||||||
|
|
||||||
@Parameter
|
@Parameter(property = "teavm.wasmVersion", defaultValue = "V_0x1")
|
||||||
private WasmBinaryVersion wasmVersion = WasmBinaryVersion.V_0x1;
|
private WasmBinaryVersion wasmVersion = WasmBinaryVersion.V_0x1;
|
||||||
|
|
||||||
|
@Parameter(property = "teavm.heapSize", defaultValue = "32")
|
||||||
|
private int heapSize;
|
||||||
|
|
||||||
@Parameter(property = "teavm.outOfProcess", defaultValue = "false")
|
@Parameter(property = "teavm.outOfProcess", defaultValue = "false")
|
||||||
private boolean outOfProcess;
|
private boolean outOfProcess;
|
||||||
|
|
||||||
|
@ -154,6 +157,7 @@ public class TeaVMCompileMojo extends AbstractMojo {
|
||||||
builder.setDebugInformationGenerated(debugInformationGenerated);
|
builder.setDebugInformationGenerated(debugInformationGenerated);
|
||||||
builder.setSourceMapsFileGenerated(sourceMapsGenerated);
|
builder.setSourceMapsFileGenerated(sourceMapsGenerated);
|
||||||
builder.setSourceFilesCopied(sourceFilesCopied);
|
builder.setSourceFilesCopied(sourceFilesCopied);
|
||||||
|
builder.setHeapSize(heapSize * 1024 * 1024);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new MojoExecutionException("Unexpected error occurred", e);
|
throw new MojoExecutionException("Unexpected error occurred", e);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +165,7 @@ public class TeaVMCompileMojo extends AbstractMojo {
|
||||||
|
|
||||||
private List<String> prepareClassPath() {
|
private List<String> prepareClassPath() {
|
||||||
Log log = getLog();
|
Log log = getLog();
|
||||||
log.info("Preparing classpath for JavaScript generation");
|
log.info("Preparing classpath for TeaVM");
|
||||||
List<String> paths = new ArrayList<>();
|
List<String> paths = new ArrayList<>();
|
||||||
StringBuilder classpath = new StringBuilder();
|
StringBuilder classpath = new StringBuilder();
|
||||||
for (Artifact artifact : project.getArtifacts()) {
|
for (Artifact artifact : project.getArtifacts()) {
|
||||||
|
@ -180,7 +184,7 @@ public class TeaVMCompileMojo extends AbstractMojo {
|
||||||
}
|
}
|
||||||
classpath.append(classFiles.getPath());
|
classpath.append(classFiles.getPath());
|
||||||
paths.add(classFiles.getAbsolutePath());
|
paths.add(classFiles.getAbsolutePath());
|
||||||
log.info("Using the following classpath for JavaScript generation: " + classpath);
|
log.info("Using the following classpath for TeaVM: " + classpath);
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user