-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
136 lines (113 loc) · 3.93 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import java.nio.file.Files
import java.nio.file.StandardOpenOption
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'cc.squirreljme.plugin.general'
group = "cc.squirreljme"
description = "SquirrelJME is a Java ME 8 Virtual Machine for embedded " +
"and Internet of Things devices. It has the ultimate goal of being " +
"99.9% compatible with the Java ME standard."
version = squirreljmeVersion
// IntelliJ Configuration (because the root project is a bit different)
idea
{
module
{
// Use the proper name for this module
name = "SquirrelJME"
// Exclude these directories so IntelliJ does not pick these up
// in inspections and builds
excludeDirs += file(".circleci")
excludeDirs += file(".fossil-settings")
excludeDirs += file(".github")
excludeDirs += file(".idea")
excludeDirs += file(".vscode")
excludeDirs += file(".settings")
excludeDirs += file("config")
excludeDirs += file("gradle")
excludeDirs += file("utils-dev")
// Flatpak
excludeDirs += file(".flatpak-builder")
excludeDirs += file("build-dir")
// These are auto-generated by Fossil and should be ignored
excludeDirs += file("manifest")
excludeDirs += file("manifest.uuid")
// Emulator Base Native Code
excludeDirs += file("emulators/emulator-base-native/cmake-build-debug")
excludeDirs += file("emulators/emulator-base-native/cmake-build-release")
excludeDirs += file("emulators/emulator-base-native/cmake-build-relwithdebinfo")
// NanoCoat files
excludeDirs += file("nanocoat/build")
excludeDirs += file("nanocoat/cmake-build-debug")
excludeDirs += file("nanocoat/cmake-build-release")
excludeDirs += file("nanocoat/cmake-build-relwithdebinfo")
// IntelliJ's own dependency matrix output (in "out")
project.allprojects.each() { Project subProj ->
excludeDirs += subProj.projectDir.toPath().resolve("out").toFile()
// Eclipse Junk
excludeDirs += subProj.projectDir.toPath().resolve(".settings").toFile()
excludeDirs += subProj.projectDir.toPath().resolve("bin").toFile()
}
}
}
allprojects {
apply plugin: 'eclipse'
repositories
{
mavenCentral()
}
// Eclipse IDE
plugins.withType(JavaPlugin) {
def settingsDir = projectDir.toPath().resolve(".settings")
def buildShipPrefs = settingsDir.resolve("org.eclipse.buildship.core.prefs")
def pathToRoot = projectDir.toPath().relativize(rootDir.toPath())
// Clean fix
task cleanEclipseFixBuild {
group "squirreljme"
description "Cleans up after build fixes."
doFirst {
// Just delete the buildship preferences
Files.deleteIfExists(buildShipPrefs)
}
}
// Fix build
task eclipseFixBuild {
group "squirreljme"
description "Fixes Eclipse build due to missing expected files."
// If clean and such is ran, this must always be followed by it
// since we could accidentally destroy it
mustRunAfter cleanEclipseFixBuild, cleanEclipseJdt
doFirst {
// Setup settings directory first
Files.createDirectories(settingsDir)
// Write missing Eclipse file
Files.write(
buildShipPrefs,
Arrays.asList(
"connection.project.dir=" + pathToRoot,
"eclipse.preferences.version=1"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)
}
}
// Fix for cyclic dependencies
eclipse.jdt {
// We are a Java 8 project
sourceCompatibility = 1.8
targetCompatibility = 1.8
// Fix for Eclipse and VSCode breaking on "circular" dependencies
file.withProperties { properties ->
properties["org.eclipse.jdt.core.builder.invalidClasspath"] = "warning"
properties["org.eclipse.jdt.core.circularClasspath"] = "warning"
properties["org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource"] = "warning"
}
}
eclipseJdt.finalizedBy(eclipseFixBuild)
cleanEclipseJdt.finalizedBy(cleanEclipseFixBuild)
}
}
// Generic root clean task, does nothing by default and just depends on
// others
tasks.register('clean') {
}