Cherry pick changes from wip-scritchui which should be mainline.
[SquirrelJME.git] / emulators / emulator-base / build.gradle
blobce4bea8a1cf4f2c0bce91754c1eed68f993dbda9
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")
34 // Native emulator support library
35 Provider<CMakeBuildTask> libNativeEmulatorBase = tasks.register(
36         "libNativeEmulatorBase",
37         CMakeBuildTask.class,
38         project.getProjectDir().toPath().resolve("src").resolve("main"),
39         System.mapLibraryName("emulator-base"),
40         "libEmulatorBase")
42 Provider<MimeDecodeResourcesTask> mimeDecode =tasks.register(
43         "mimeDecode", MimeDecodeResourcesTask.class,
44         "main",
45         tasks.named("processResources").get(),
46         tasks.named("clean").get())
48 processResources.dependsOn(mimeDecode)
49 processResources.dependsOn(libNativeEmulatorBase)
51 jar.dependsOn(mimeDecode)
53 compileJava.dependsOn(libNativeEmulatorBase)
55 mimeDecode.get().dependsOn(libNativeEmulatorBase)
57 // We need the native library in the JAR before we can properly use it
58 // But we can compile the Java code just fine without it
59 jar {
60         dependsOn libNativeEmulatorBase
62         from libNativeEmulatorBase.get().cmakeOutFile.toFile()
63         into "/"
66 java {
67         // Use a fixed version of the JVM
68         compileJava
69         {
70                 sourceCompatibility = JavaVersion.VERSION_1_8
71                 targetCompatibility = JavaVersion.VERSION_1_8
72                 
73                 // Use the default bootstrap classpath
74                 options.bootstrapClasspath = null
75         }
77         // Maximize debugging
78         compileJava.options.debug = true
79         compileJava.options.debugOptions.setDebugLevel("source,lines,vars")
81         // Copy settings
82         compileTestJava.options.debug = compileJava.options.debug
83         compileTestJava.options.debugOptions = compileJava.options.debugOptions
84         
85         javadoc.options.tags = [ "squirreljme.property",
86                 "squirreljme.env",
87                 "squirreljme.error",
88                 "squirreljme.syscallparam",
89                 "squirreljme.syscallreturn",
90                 "squirreljme.tsiparam",
91                 "squirreljme.configtype",
92                 "squirreljme.uiwidgetparam" ]