First working version of JPS plugin

This commit is contained in:
Alexey Andreev 2016-02-18 01:17:37 +03:00
parent 863a4b76ff
commit 1ee07e89bc
14 changed files with 98 additions and 116 deletions

View File

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="teavm-all">
<CLASSES>
<root url="jar://$PROJECT_DIR$/tools/idea/jps-plugin/lib/teavm-all.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/core/src/main/java" />
<root url="file://$PROJECT_DIR$/tools/core/src/main/java" />
</SOURCES>
</library>
</component>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="teavm-core-1.0.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/teavm/teavm-core/1.0.0-SNAPSHOT/teavm-core-1.0.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="teavm-tooling-1.0.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/teavm/teavm-tooling/1.0.0-SNAPSHOT/teavm-tooling-1.0.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,7 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="install-artifacts-for-idea" type="CompoundRunConfigurationType" factoryName="Compound Run Configuration">
<toRun type="MavenRunConfiguration" name="install-core-artifact" />
<toRun type="MavenRunConfiguration" name="install-tooling-artifact" />
<method />
</configuration>
</component>

View File

@ -1,27 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="install-core-artifact" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="install" />
</list>
</option>
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$/core" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method />
</configuration>
</component>

View File

@ -1,27 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="install-tooling-artifact" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="install" />
</list>
</option>
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$/tools/core" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method />
</configuration>
</component>

View File

@ -72,33 +72,6 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
<artifactSet>
<includes>
<include>org.ow2.asm:asm-debug-all</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.objectweb.asm</pattern>
<shadedPattern>org.teavm.asm</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-bundle-plugin</artifactId>

1
tools/idea/jps-plugin/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lib/

View File

@ -0,0 +1,65 @@
<!--
~ Copyright 2016 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.teavm</groupId>
<artifactId>teavm</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>
<packaging>pom</packaging>
<artifactId>teavm-jps-repack</artifactId>
<dependencies>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-tooling</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>lib/teavm-all.jar</outputFile>
<relocations>
<relocation>
<pattern>org.objectweb.asm</pattern>
<shadedPattern>org.teavm.asm</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -83,6 +83,7 @@ public class TeaVMBuilder extends ModuleLevelBuilder {
tool.setSourceMapsFileGenerated(true); tool.setSourceMapsFileGenerated(true);
tool.setTargetDirectory(new File(config.getTargetDirectory())); tool.setTargetDirectory(new File(config.getTargetDirectory()));
tool.setClassLoader(buildClassLoader(module)); tool.setClassLoader(buildClassLoader(module));
tool.setMinifying(false);
try { try {
tool.generate(); tool.generate();

View File

@ -15,8 +15,11 @@
*/ */
package org.teavm.idea.jps; package org.teavm.idea.jps;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.BuilderService; import org.jetbrains.jps.incremental.BuilderService;
@ -27,6 +30,17 @@ public class TeaVMBuilderService extends BuilderService {
@NotNull @NotNull
@Override @Override
public List<? extends ModuleLevelBuilder> createModuleLevelBuilders() { public List<? extends ModuleLevelBuilder> createModuleLevelBuilders() {
try {
Enumeration<URL> resources = TeaVMBuilderService.class.getClassLoader().getResources(
"org/objectweb/asm/ClassVisitor.class");
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
System.out.println(url);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
System.out.println();
return Arrays.asList(new TeaVMBuilder()); return Arrays.asList(new TeaVMBuilder());
} }

View File

@ -11,9 +11,7 @@
</content> </content>
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-144.3600.7" jdkType="IDEA JDK" /> <orderEntry type="jdk" jdkName="IntelliJ IDEA IU-144.3600.7" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="teavm-tooling-1.0.0-SNAPSHOT" level="project" /> <orderEntry type="library" name="Maven: org.ow2.asm:asm-debug-all:5.0.4" level="project" />
<orderEntry type="library" exported="" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.6.2" level="project" /> <orderEntry type="library" name="teavm-all" level="project" />
<orderEntry type="library" exported="" name="Maven: com.carrotsearch:hppc:0.6.1" level="project" />
<orderEntry type="library" exported="" name="Maven: commons-io:commons-io:2.4" level="project" />
</component> </component>
</module> </module>

View File

@ -21,7 +21,7 @@
<moduleConfigurable instance="org.teavm.idea.ui.TeaVMConfigurable"/> <moduleConfigurable instance="org.teavm.idea.ui.TeaVMConfigurable"/>
<moduleService serviceInterface="org.teavm.idea.TeaVMConfigurationStorage" <moduleService serviceInterface="org.teavm.idea.TeaVMConfigurationStorage"
serviceImplementation="org.teavm.idea.TeaVMConfigurationStorage"/> serviceImplementation="org.teavm.idea.TeaVMConfigurationStorage"/>
<compileServer.plugin classpath="jps-plugin/teavm-jps-plugin.jar"/> <compileServer.plugin classpath="jps/teavm-jps-plugin.jar;teavm-all.jar"/>
</extensions> </extensions>
<module-components> <module-components>

View File

@ -12,10 +12,7 @@
</content> </content>
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-144.3600.7" jdkType="IDEA JDK" /> <orderEntry type="jdk" jdkName="IntelliJ IDEA IU-144.3600.7" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="teavm-jps-plugin" exported="" /> <orderEntry type="module" module-name="teavm-jps-plugin" />
<orderEntry type="library" exported="" name="teavm-tooling-1.0.0-SNAPSHOT" level="project" /> <orderEntry type="library" name="teavm-all" level="project" />
<orderEntry type="library" exported="" name="Maven: com.carrotsearch:hppc:0.6.1" level="project" />
<orderEntry type="library" exported="" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.6.2" level="project" />
<orderEntry type="library" exported="" name="Maven: commons-io:commons-io:2.4" level="project" />
</component> </component>
</module> </module>