mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Moves JCL report generator into separate package. Adds hack that allows
to obtain JavaCompiler (but yet it won't compile).
This commit is contained in:
parent
4cc484729f
commit
e35f9b54b5
|
@ -71,7 +71,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.teavm.classlib.impl.JCLComparisonBuilder</mainClass>
|
||||
<mainClass>org.teavm.classlib.impl.report.JCLComparisonBuilder</mainClass>
|
||||
<arguments>
|
||||
<argument>java.lang</argument>
|
||||
<argument>java.lang.annotation</argument>
|
||||
|
|
|
@ -38,5 +38,7 @@ public class JCLPlugin implements TeaVMPlugin {
|
|||
"loadServices", ValueType.object("java.lang.Class"),
|
||||
ValueType.arrayOf(ValueType.object("java.lang.Object"))));
|
||||
host.add(loadServicesMethod, serviceLoaderSupp);
|
||||
JavacSupport javacSupport = new JavacSupport();
|
||||
host.add(javacSupport);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2014 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
|
||||
import org.teavm.model.*;
|
||||
import org.teavm.model.instructions.ConstructInstruction;
|
||||
import org.teavm.model.instructions.ExitInstruction;
|
||||
import org.teavm.model.instructions.InvocationType;
|
||||
import org.teavm.model.instructions.InvokeInstruction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public class JavacSupport implements ClassHolderTransformer {
|
||||
@Override
|
||||
public void transformClass(ClassHolder cls, ClassReaderSource innerSource) {
|
||||
if (cls.getName().equals("javax.tools.ToolProvider")) {
|
||||
MethodHolder method = cls.getMethod(new MethodDescriptor("getSystemJavaCompiler",
|
||||
ValueType.object("javax.tools.JavaCompiler")));
|
||||
Program program = new Program();
|
||||
BasicBlock block = program.createBasicBlock();
|
||||
program.createVariable();
|
||||
Variable var = program.createVariable();
|
||||
ConstructInstruction construct = new ConstructInstruction();
|
||||
construct.setReceiver(var);
|
||||
construct.setType("com.sun.tools.javac.api.JavacTool");
|
||||
block.getInstructions().add(construct);
|
||||
InvokeInstruction init = new InvokeInstruction();
|
||||
init.setInstance(var);
|
||||
init.setType(InvocationType.SPECIAL);
|
||||
init.setMethod(new MethodReference("com.sun.tools.javac.api.JavacTool", "<init>", ValueType.VOID));
|
||||
block.getInstructions().add(init);
|
||||
ExitInstruction exit = new ExitInstruction();
|
||||
exit.setValueToReturn(var);
|
||||
block.getInstructions().add(exit);
|
||||
method.setProgram(program);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
import java.util.Map;
|
||||
import org.objectweb.asm.*;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.impl;
|
||||
package org.teavm.classlib.impl.report;
|
||||
|
||||
/**
|
||||
*
|
|
@ -291,7 +291,13 @@ public class DependencyChecker implements DependencyInfo {
|
|||
missingMethods.putIfAbsent(methodRef, stack);
|
||||
}
|
||||
if (method != null) {
|
||||
initClass(methodRef.getClassName(), stack);
|
||||
final DependencyStack callerStack = stack;
|
||||
executor.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
initClass(dep.getReference().getClassName(), callerStack);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return dep;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user