Move emulator-base native code into its own non-Gradle directory.
[SquirrelJME.git] / emulators / emulator-base / build.gradle
blobfbbc9df899b5a1198321bd5ab8d38e7bd2be239c
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().getParent()
39                 .resolve("emulator-base-native"),
40         System.mapLibraryName("emulator-base"),
41         ["libEmulatorBase"])
43 Provider<MimeDecodeResourcesTask> mimeDecode =tasks.register(
44         "mimeDecode", MimeDecodeResourcesTask.class,
45         "main",
46         tasks.named("processResources").get(),
47         tasks.named("clean").get())
49 processResources.dependsOn(mimeDecode)
50 processResources.dependsOn(libNativeEmulatorBase)
52 jar.dependsOn(mimeDecode)
54 compileJava.dependsOn(libNativeEmulatorBase)
56 mimeDecode.get().dependsOn(libNativeEmulatorBase)
58 // We need the native library in the JAR before we can properly use it
59 // But we can compile the Java code just fine without it
60 jar {
61         dependsOn libNativeEmulatorBase
63         from libNativeEmulatorBase.get().cmakeOutFile.toFile()
64         into "/"
67 java {
68         // Use a fixed version of the JVM
69         compileJava
70         {
71                 sourceCompatibility = JavaVersion.VERSION_1_8
72                 targetCompatibility = JavaVersion.VERSION_1_8
73                 
74                 // Use the default bootstrap classpath
75                 options.bootstrapClasspath = null
76         }
78         // Maximize debugging
79         compileJava.options.debug = true
80         compileJava.options.debugOptions.setDebugLevel("source,lines,vars")
82         // Copy settings
83         compileTestJava.options.debug = compileJava.options.debug
84         compileTestJava.options.debugOptions = compileJava.options.debugOptions
85         
86         javadoc.options.tags = [ "squirreljme.property",
87                 "squirreljme.env",
88                 "squirreljme.error",
89                 "squirreljme.syscallparam",
90                 "squirreljme.syscallreturn",
91                 "squirreljme.tsiparam",
92                 "squirreljme.configtype",
93                 "squirreljme.uiwidgetparam" ]