Adds initial interface for platform resource generation

This commit is contained in:
konsoletyper 2014-05-29 21:17:57 +04:00
parent 2e5cdc109b
commit 43aebc4174
11 changed files with 118 additions and 0 deletions

View File

@ -76,6 +76,7 @@
<module>teavm-dom</module> <module>teavm-dom</module>
<module>teavm-jso</module> <module>teavm-jso</module>
<module>teavm-html4j</module> <module>teavm-html4j</module>
<module>teavm-platform</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>

4
teavm-platform/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/target
/.settings
/.project
/.classpath

19
teavm-platform/pom.xml Normal file
View File

@ -0,0 +1,19 @@
<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>0.2-SNAPSHOT</version>
</parent>
<artifactId>teavm-platform</artifactId>
<dependencies>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package org.teavm.platform.metadata;
import org.teavm.model.MethodReference;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public interface MetadataGenerator {
Object generateMetadata(MetadataGeneratorContext context, MethodReference method);
}

View File

@ -0,0 +1,13 @@
package org.teavm.platform.metadata;
import org.teavm.model.ListableClassReaderSource;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public interface MetadataGeneratorContext {
ListableClassReaderSource getClassSource();
<T> T createResource(Class<T> resourceType);
}

View File

@ -0,0 +1,16 @@
package org.teavm.platform.metadata;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MetadataProvider {
Class<? extends MetadataGenerator> value();
}

View File

@ -0,0 +1,15 @@
package org.teavm.platform.metadata;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Resource {
}

View File

@ -0,0 +1,13 @@
package org.teavm.platform.metadata;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public interface ResourceArray<T> {
int size();
T get(int i);
void add(T elem);
}

View File

@ -0,0 +1,11 @@
package org.teavm.platform.metadata;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public interface ResourceMap<T> {
T get(String key);
void put(String key, T value);
}

View File

@ -0,0 +1,14 @@
package org.teavm.platform.plugin;
import org.teavm.vm.spi.TeaVMHost;
import org.teavm.vm.spi.TeaVMPlugin;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public class PlatformPlugin implements TeaVMPlugin {
@Override
public void install(TeaVMHost host) {
}
}

View File

@ -0,0 +1 @@
org.teavm.platform.plugin.PlatformPlugin