Cherry pick changes from wip-scritchui which should be mainline.
[SquirrelJME.git] / emulators / nanocoat-vm / build.gradle
blob341170c2a7932dfe8192dde36053d3c5d9e881b0
1 import cc.squirreljme.plugin.general.cmake.CMakeBuildTask
3 import java.nio.file.Files
5 plugins
7         id "java-library"
10 description = "This is able to use the NanoCoat shared library to run the " +
11         "code within the emulator."
13 dependencies
15         api project(":emulators:emulator-base")
16         
17         api project(":modules:cldc-compact")
18         api project(":modules:common-vm")
19         api project(":modules:meep-swm")
20         api project(":modules:tool-classfile")
21         api project(":modules:debug-jdwp")
22         api project(":modules:debug-jdwp-vm-host")
23         api project(":tools:squirreljme-debugger")
26 Provider<CMakeBuildTask> libNativeNanoCoat = tasks.register(
27         "libNativeNanoCoat",
28         CMakeBuildTask.class,
29         gradle.rootProject.projectDir.toPath().resolve("nanocoat"),
30         System.mapLibraryName("emulator-nanocoat"),
31         "libEmulator")
33 libNativeNanoCoat.configure { taskIsh ->
34         // Get source root for extra dependency checking
35         java.nio.file.Path cmakeRoot = taskIsh.cmakeSource
36         
37         // Where is the CMake root? It depends on it
38         taskIsh.inputs.files(
39                 cmakeRoot.resolve("CMakeLists.txt"),
40                 cmakeRoot.resolve("squirreljme-version"),
41                 cmakeRoot.resolve("frontend").resolve("CMakeLists.txt"))
42         taskIsh.inputs.dir(cmakeRoot.resolve("cmake"))
43         taskIsh.inputs.dir(cmakeRoot.resolve("include"))
44         taskIsh.inputs.dir(cmakeRoot.resolve("src"))
45         taskIsh.inputs.dir(cmakeRoot.resolve("frontend").resolve("emulator"))
48 // We need to include the native library here so NanoCoat actually works
49 jar {
50         // Requires the NanoCoat library
51         dependsOn libNativeNanoCoat
52         
53         // Include library into the root
54         from libNativeNanoCoat.get().cmakeOutFile.toFile()
55         into "/"
58 // JAR resources
59 processResources {
60         // We need to embed the shared library here
61         dependsOn libNativeNanoCoat
64 java {
65         // Use a fixed version of the JVM
66         compileJava
67         {
68                 sourceCompatibility = JavaVersion.VERSION_1_8
69                 targetCompatibility = JavaVersion.VERSION_1_8
70                 
71                 // Use the default bootstrap classpath
72                 options.bootstrapClasspath = null
73         }
75         // Maximize debugging
76         compileJava.options.debug = true
77         compileJava.options.debugOptions.setDebugLevel("source,lines,vars")
79         // Copy settings
80         compileTestJava.options.debug = compileJava.options.debug
81         compileTestJava.options.debugOptions = compileJava.options.debugOptions
82         
83         javadoc.options.tags = [ "squirreljme.property",
84                 "squirreljme.env",
85                 "squirreljme.error",
86                 "squirreljme.syscallparam",
87                 "squirreljme.syscallreturn",
88                 "squirreljme.tsiparam",
89                 "squirreljme.configtype",
90                 "squirreljme.uiwidgetparam" ]