1 import java.nio.file.Files
2 import java.nio.file.StandardOpenOption
5 apply plugin: 'eclipse'
6 apply plugin: 'cc.squirreljme.plugin.general'
8 group = "cc.squirreljme"
9 description = "SquirrelJME is a Java ME 8 Virtual Machine for embedded " +
10 "and Internet of Things devices. It has the ultimate goal of being " +
11 "99.9% compatible with the Java ME standard."
12 version = squirreljmeVersion
14 // IntelliJ Configuration (because the root project is a bit different)
19 // Use the proper name for this module
22 // Exclude these directories so IntelliJ does not pick these up
23 // in inspections and builds
24 excludeDirs += file(".circleci")
25 excludeDirs += file(".fossil-settings")
26 excludeDirs += file(".github")
27 excludeDirs += file(".idea")
28 excludeDirs += file(".vscode")
29 excludeDirs += file(".settings")
30 excludeDirs += file("config")
31 excludeDirs += file("gradle")
32 excludeDirs += file("utils-dev")
35 excludeDirs += file(".flatpak-builder")
36 excludeDirs += file("build-dir")
38 // These are auto-generated by Fossil and should be ignored
39 excludeDirs += file("manifest")
40 excludeDirs += file("manifest.uuid")
42 // Emulator Base Native Code
43 excludeDirs += file("emulators/emulator-base-native/cmake-build-debug")
44 excludeDirs += file("emulators/emulator-base-native/cmake-build-release")
45 excludeDirs += file("emulators/emulator-base-native/cmake-build-relwithdebinfo")
48 excludeDirs += file("nanocoat/build")
49 excludeDirs += file("nanocoat/cmake-build-debug")
50 excludeDirs += file("nanocoat/cmake-build-release")
51 excludeDirs += file("nanocoat/cmake-build-relwithdebinfo")
53 // IntelliJ's own dependency matrix output (in "out")
54 project.allprojects.each() { Project subProj ->
55 excludeDirs += subProj.projectDir.toPath().resolve("out").toFile()
58 excludeDirs += subProj.projectDir.toPath().resolve(".settings").toFile()
59 excludeDirs += subProj.projectDir.toPath().resolve("bin").toFile()
65 apply plugin: 'eclipse'
73 plugins.withType(JavaPlugin) {
74 def settingsDir = projectDir.toPath().resolve(".settings")
75 def buildShipPrefs = settingsDir.resolve("org.eclipse.buildship.core.prefs")
76 def pathToRoot = projectDir.toPath().relativize(rootDir.toPath())
79 task cleanEclipseFixBuild {
81 description "Cleans up after build fixes."
84 // Just delete the buildship preferences
85 Files.deleteIfExists(buildShipPrefs)
90 task eclipseFixBuild {
92 description "Fixes Eclipse build due to missing expected files."
94 // If clean and such is ran, this must always be followed by it
95 // since we could accidentally destroy it
96 mustRunAfter cleanEclipseFixBuild, cleanEclipseJdt
99 // Setup settings directory first
100 Files.createDirectories(settingsDir)
102 // Write missing Eclipse file
106 "connection.project.dir=" + pathToRoot,
107 "eclipse.preferences.version=1"),
108 StandardOpenOption.CREATE,
109 StandardOpenOption.WRITE,
110 StandardOpenOption.TRUNCATE_EXISTING)
114 // Fix for cyclic dependencies
116 // We are a Java 8 project
117 sourceCompatibility = 1.8
118 targetCompatibility = 1.8
120 // Fix for Eclipse and VSCode breaking on "circular" dependencies
121 file.withProperties { properties ->
122 properties["org.eclipse.jdt.core.builder.invalidClasspath"] = "warning"
123 properties["org.eclipse.jdt.core.circularClasspath"] = "warning"
124 properties["org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource"] = "warning"
128 eclipseJdt.finalizedBy(eclipseFixBuild)
129 cleanEclipseJdt.finalizedBy(cleanEclipseFixBuild)
133 // Generic root clean task, does nothing by default and just depends on
135 tasks.register('clean') {