Skip to content

Commit 306a061

Browse files
committed
Somewhat hacky fix to still build other optimization levels
1 parent c6665d5 commit 306a061

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/Closure.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public boolean compile(
177177

178178
final InProcessJsCompRunner jscompRunner;
179179
synchronized (GLOBAL_CLOSURE_ARGS_LOCK) {
180-
jscompRunner = new InProcessJsCompRunner(log, jscompArgs.toArray(new String[0]), jsCompiler, exportTestFunctions, checkAssertions);
180+
jscompRunner = new InProcessJsCompRunner(log, jscompArgs.toArray(new String[0]), jsCompiler, exportTestFunctions, checkAssertions, compilationLevel);
181181
}
182182
jscompArgs.forEach(log::debug);
183183
if (!jscompRunner.shouldRunCompiler()) {
@@ -197,11 +197,13 @@ static class InProcessJsCompRunner extends CommandLineRunner {
197197
private final boolean exportTestFunctions;
198198
private final boolean checkAssertions;
199199
private final Compiler compiler;
200+
private final CompilationLevel compilationLevel;
200201
private Integer exitCode;
201202

202-
InProcessJsCompRunner(BuildLog log, String[] args, Compiler compiler, boolean exportTestFunctions, boolean checkAssertions) {
203+
InProcessJsCompRunner(BuildLog log, String[] args, Compiler compiler, boolean exportTestFunctions, boolean checkAssertions, CompilationLevel compilationLevel) {
203204
super(args);
204205
this.compiler = compiler;
206+
this.compilationLevel = compilationLevel;
205207
this.compiler.setErrorManager(new SortingErrorManager(Collections.singleton(new LoggingErrorReportGenerator(compiler, log))));
206208
this.exportTestFunctions = exportTestFunctions;
207209
this.checkAssertions = checkAssertions;
@@ -232,7 +234,9 @@ protected CompilerOptions createOptions() {
232234
@Override
233235
protected void setRunOptions(CompilerOptions options) throws IOException {
234236
super.setRunOptions(options);
235-
this.compiler.setPassConfig(new ServiceLoadingPassConfig(options));
237+
if (compilationLevel == CompilationLevel.ADVANCED_OPTIMIZATIONS) {
238+
this.compiler.setPassConfig(new ServiceLoadingPassConfig(options));
239+
}
236240
}
237241
}
238242

j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/closure/ServiceLoadingPassConfig.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ public ServiceLoadingPassConfig(CompilerOptions options) {
2323
@Override
2424
protected PassListBuilder getOptimizations() {
2525
PassListBuilder optimizations = super.getOptimizations();
26-
// optimizations.addAfter(convertServiceLoaderProperties, PassNames.PARSE_INPUTS);
27-
// optimizations.addAfter(convertServiceLoaderProperties, PassNames.NORMALIZE);
2826
optimizations.addBefore(convertServiceLoaderProperties, PassNames.AFTER_EARLY_OPTIMIZATION_LOOP);
2927
optimizations.addBefore(convertServiceLoaderProperties, PassNames.AFTER_MAIN_OPTIMIZATIONS);
30-
// optimizations.addAfter(convertServiceLoaderProperties, PassNames.PEEPHOLE_OPTIMIZATIONS);
3128
return optimizations;
3229
}
3330
}

0 commit comments

Comments
 (0)