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