diff --git a/pom.xml b/pom.xml index cb91e354c..c144930dc 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,7 @@ teavm-dom teavm-jso teavm-html4j + teavm-platform diff --git a/teavm-platform/.gitignore b/teavm-platform/.gitignore new file mode 100644 index 000000000..bb138cf03 --- /dev/null +++ b/teavm-platform/.gitignore @@ -0,0 +1,4 @@ +/target +/.settings +/.project +/.classpath diff --git a/teavm-platform/pom.xml b/teavm-platform/pom.xml new file mode 100644 index 000000000..f35121baa --- /dev/null +++ b/teavm-platform/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + + + org.teavm + teavm + 0.2-SNAPSHOT + + teavm-platform + + + + org.teavm + teavm-core + ${project.version} + + + \ No newline at end of file diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGenerator.java new file mode 100644 index 000000000..bf7302399 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGenerator.java @@ -0,0 +1,11 @@ +package org.teavm.platform.metadata; + +import org.teavm.model.MethodReference; + +/** + * + * @author Alexey Andreev + */ +public interface MetadataGenerator { + Object generateMetadata(MetadataGeneratorContext context, MethodReference method); +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGeneratorContext.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGeneratorContext.java new file mode 100644 index 000000000..c172938d9 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataGeneratorContext.java @@ -0,0 +1,13 @@ +package org.teavm.platform.metadata; + +import org.teavm.model.ListableClassReaderSource; + +/** + * + * @author Alexey Andreev + */ +public interface MetadataGeneratorContext { + ListableClassReaderSource getClassSource(); + + T createResource(Class resourceType); +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataProvider.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataProvider.java new file mode 100644 index 000000000..aed053db3 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/MetadataProvider.java @@ -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 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface MetadataProvider { + Class value(); +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/Resource.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/Resource.java new file mode 100644 index 000000000..64755a4d6 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/Resource.java @@ -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 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Resource { +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceArray.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceArray.java new file mode 100644 index 000000000..43bd6a7d0 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceArray.java @@ -0,0 +1,13 @@ +package org.teavm.platform.metadata; + +/** + * + * @author Alexey Andreev + */ +public interface ResourceArray { + int size(); + + T get(int i); + + void add(T elem); +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceMap.java b/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceMap.java new file mode 100644 index 000000000..eddd2e28c --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/metadata/ResourceMap.java @@ -0,0 +1,11 @@ +package org.teavm.platform.metadata; + +/** + * + * @author Alexey Andreev + */ +public interface ResourceMap { + T get(String key); + + void put(String key, T value); +} diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java new file mode 100644 index 000000000..09f41abc6 --- /dev/null +++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/PlatformPlugin.java @@ -0,0 +1,14 @@ +package org.teavm.platform.plugin; + +import org.teavm.vm.spi.TeaVMHost; +import org.teavm.vm.spi.TeaVMPlugin; + +/** + * + * @author Alexey Andreev + */ +public class PlatformPlugin implements TeaVMPlugin { + @Override + public void install(TeaVMHost host) { + } +} diff --git a/teavm-platform/src/main/resources/META-INF/services/org.teavm.vm.spi.TeaVMPlugin b/teavm-platform/src/main/resources/META-INF/services/org.teavm.vm.spi.TeaVMPlugin new file mode 100644 index 000000000..03f8f7273 --- /dev/null +++ b/teavm-platform/src/main/resources/META-INF/services/org.teavm.vm.spi.TeaVMPlugin @@ -0,0 +1 @@ +org.teavm.platform.plugin.PlatformPlugin \ No newline at end of file