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
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.
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",
39 project.getProjectDir().toPath().getParent()
40 .resolve("emulator-base-native"),
41 System.mapLibraryName("emulator-base"),
44 // ScritchUI native implementations
45 Provider<CMakeBuildTask> libsNativeNanoCoat = tasks.register(
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,
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
75 dependsOn mimeDecode, libNativeEmulatorBase, libsNativeNanoCoat
77 from libNativeEmulatorBase.get().cmakeOutFile.toFile()
78 from project.provider({ ->
79 zipTree(libsNativeNanoCoat.get().cmakeOutFile.toFile())
85 // Use a fixed version of the JVM
88 sourceCompatibility = JavaVersion.VERSION_1_8
89 targetCompatibility = JavaVersion.VERSION_1_8
91 // Use the default bootstrap classpath
92 options.bootstrapClasspath = null
96 compileJava.options.debug = true
97 compileJava.options.debugOptions.setDebugLevel("source,lines,vars")
100 compileTestJava.options.debug = compileJava.options.debug
101 compileTestJava.options.debugOptions = compileJava.options.debugOptions
103 javadoc.options.tags = [ "squirreljme.property",
106 "squirreljme.syscallparam",
107 "squirreljme.syscallreturn",
108 "squirreljme.tsiparam",
109 "squirreljme.configtype",
110 "squirreljme.uiwidgetparam" ]