-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
155 lines (142 loc) · 4.13 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
buildscript {
repositories {
// make it easy to test a snapshot version of goomph
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
// grab dependencies from the gradle plugin portal
maven { url 'https://plugins.gradle.org/m2/' }
}
// make sure we don't cache stale snapshot versions
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
// a bunch of eclipse stuff
classpath "com.diffplug.gradle:goomph:${VER_GOOMPH}"
// creates a targetplatform
classpath "org.standardout:bnd-platform:${VER_BND_PLATFORM}"
// apply spotless
classpath "com.diffplug.spotless:spotless-plugin-gradle:${VER_SPOTLESS}"
}
}
///////////
// MAVEN //
///////////
repositories {
mavenCentral()
}
apply from: rootProject.file('gradle/spotless/spotless.gradle')
subprojects {
apply from: rootProject.file('gradle/spotless/spotless.gradle')
repositories {
mavenCentral()
// SNAPSHOT versions are free to rely on other SNAPSHOT libraries
if (project.version.endsWith('SNAPSHOT')) {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
// local eclipse maven (created by Goomph)
maven {
url rootProject.file('target.p2/build/p2asmaven/maven')
metadataSources {
mavenPom()
artifact()
}
}
}
}
/////////////
// PLUGINS //
/////////////
// tasks to clean and jar all of the plugins
Closure IS_PLUGIN = { it.name.startsWith('com.diffplug') }
configure(subprojects.findAll(IS_PLUGIN)) {
// we need the maven repo from p2
evaluationDependsOn(':target.p2')
def PROJECT_NAME = it.name
//////////
// JAVA //
//////////
apply plugin: 'java'
sourceSets {
main { java {
srcDir 'src'
} }
test { java {
srcDir 'test'
} }
}
sourceCompatibility = VER_JAVA
targetCompatibility = VER_JAVA
// add SWT and the appropriate platform-native SWT for building and testing
dependencies {
implementation "eclipse-deps:org.eclipse.swt:+"
implementation "eclipse-deps:org.eclipse.swt.${com.diffplug.common.swt.os.SwtPlatform.getNative()}:+"
}
//////////
// OSGI //
//////////
// create the manifest
apply plugin: 'com.diffplug.osgi.bndmanifest'
osgiBndManifest {
copyTo 'META-INF/MANIFEST.MF'
}
// configure the OSGi bundle
jar.manifest.attributes(
'-exportcontents': 'com.diffplug.*',
'-removeheaders': 'Bnd-LastModified,Bundle-Name,Created-By,Tool,Private-Package,Require-Capability',
'Import-Package': '!javax.annotation.*,*',
'Bundle-SymbolicName': project.name,
'Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8',
'Require-Capability': 'osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"',
'Bundle-Vendor': 'DiffPlug',
'Bundle-License': "http://www.apache.org/licenses/LICENSE-2.0"
)
//////////////////////
// ECLIPSE PROJECTS //
//////////////////////
apply plugin: 'eclipse'
// remove the build folder
apply plugin: 'com.diffplug.eclipse.excludebuildfolder'
// improve the project deps
apply plugin: 'com.diffplug.eclipse.projectdeps'
// handle build.properties correctly
apply plugin: 'com.diffplug.eclipse.buildproperties'
eclipse {
project {
natures 'org.eclipse.pde.PluginNature'
natures 'org.eclipse.jdt.core.javanature'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'org.eclipse.pde.ManifestBuilder'
buildCommand 'org.eclipse.pde.SchemaBuilder'
}
classpath {
downloadSources true
downloadJavadoc true
}
jdt {
sourceCompatibility VER_JAVA
targetCompatibility VER_JAVA
}
}
// always create "fresh" projects
tasks.eclipse.dependsOn(cleanEclipse)
}
/////////////////////////////////////////////////////////
// Root eclipse project for tinkering with build files //
/////////////////////////////////////////////////////////
apply plugin: 'com.diffplug.eclipse.resourcefilters'
eclipseResourceFilters {
exclude().folders().name('com.diffplug.*')
}
/////////////////////////////
// Setup a headless launch //
/////////////////////////////
apply plugin: 'com.diffplug.osgi.equinoxlaunch'
equinoxLaunch {
codegenSetup {
source.addProject(project(':com.diffplug.rcpdemo'))
source.addMaven('com.google.guava:guava:17.0')
source.addMaven('com.google.guava:guava:18.0')
}
}