Reimplement descriptor parsing.
[SquirrelJME.git] / emulators / emulator-base / build.gradle
blob965253a01f3208665d5d15ba36b725270d65ad41
1 import cc.squirreljme.plugin.general.cmake.CMakeBuildTask
2 import cc.squirreljme.plugin.tasks.MimeDecodeResourcesTask
4 import java.nio.file.Files
5 import java.nio.file.Paths
6 import java.nio.file.StandardOpenOption
7 import java.util.concurrent.TimeUnit
8 import java.util.regex.Pattern
10 plugins
12         id "java-library"
15 description = "This library provides the base support for testing and " +
16         "running SquirrelJME on a Java SE host, which is normally not " +
17         "capable of doing as such."
19 // Due to the combination of C++ and Java these dependencies have to be very
20 // specific in that they only refer to the Java or C++ portion. So
21 // "implementation" and "compile" cannot be used because the C++ library will
22 // try to use them during compilation.
23 dependencies
25         api project(":modules:cldc-compact")
26         api project(":modules:common-vm")
27         api project(":modules:io")
28         api project(":modules:tac")
29         api project(":modules:zip")
30         api project(":modules:debug-jdwp")
31         api project(":modules:debug-jdwp-vm-host")
32         api project(":modules:scritch-ui")
35 // Native emulator support library
36 Provider<CMakeBuildTask> libNativeEmulatorBase = tasks.register(
37         "libNativeEmulatorBase",
38         CMakeBuildTask.class,
39         project.getProjectDir().toPath().getParent()
40                 .resolve("emulator-base-native"),
41         System.mapLibraryName("emulator-base"),
42         ["libEmulatorBase"])
44 // ScritchUI native implementations
45 Provider<CMakeBuildTask> libsNativeNanoCoat = tasks.register(
46         "libsNativeNanoCoat",
47         CMakeBuildTask.class,
48         rootProject.getProjectDir().toPath().resolve("nanocoat"),
49         "libsquirreljme-scritchui.zip",
50         ["ScritchUICollectZip", "BaseStatic"])
52 // The base library needs to exist first
53 libNativeEmulatorBase.get().dependsOn(libsNativeNanoCoat)
55 // Decoding of mime resources
56 Provider<MimeDecodeResourcesTask> mimeDecode = tasks.register(
57         "mimeDecode", MimeDecodeResourcesTask.class,
58         "main",
59         tasks.named("processResources").get(),
60         tasks.named("clean").get())
62 processResources.dependsOn(mimeDecode)
63 processResources.dependsOn(libNativeEmulatorBase)
64 processResources.dependsOn(libsNativeNanoCoat)
66 compileJava.dependsOn(libNativeEmulatorBase)
67 compileJava.dependsOn(libsNativeNanoCoat)
69 mimeDecode.get().dependsOn(libNativeEmulatorBase)
70 mimeDecode.get().dependsOn(libsNativeNanoCoat)
72 // We need the native library in the JAR before we can properly use it
73 // But we can compile the Java code just fine without it
74 jar {
75         dependsOn mimeDecode, libNativeEmulatorBase, libsNativeNanoCoat
77         from libNativeEmulatorBase.get().cmakeOutFile.toFile()
78         from project.provider({ ->
79                 zipTree(libsNativeNanoCoat.get().cmakeOutFile.toFile())
80                         .getElements() })
81         into "/"
84 java {
85         // Use a fixed version of the JVM
86         compileJava
87         {
88                 sourceCompatibility = JavaVersion.VERSION_1_8
89                 targetCompatibility = JavaVersion.VERSION_1_8
90                 
91                 // Use the default bootstrap classpath
92                 options.bootstrapClasspath = null
93         }
95         // Maximize debugging
96         compileJava.options.debug = true
97         compileJava.options.debugOptions.setDebugLevel("source,lines,vars")
99         // Copy settings
100         compileTestJava.options.debug = compileJava.options.debug
101         compileTestJava.options.debugOptions = compileJava.options.debugOptions
102         
103         javadoc.options.tags = [ "squirreljme.property",
104                 "squirreljme.env",
105                 "squirreljme.error",
106                 "squirreljme.syscallparam",
107                 "squirreljme.syscallreturn",
108                 "squirreljme.tsiparam",
109                 "squirreljme.configtype",
110                 "squirreljme.uiwidgetparam" ]