1
- plugins {
2
- // bintray uploading
3
- id ' com.jfrog.bintray' version ' 1.3.1'
4
- // p2 dependencies
5
- id ' com.diffplug.gradle.p2.asmaven' version ' 3.9.0'
6
- }
7
-
8
- repositories {
9
- mavenCentral()
10
- maven { url ' https://plugins.gradle.org/m2/' }
11
- }
12
-
13
- apply plugin : ' java'
14
- sourceCompatibility = VER_JAVA
15
- targetCompatibility = VER_JAVA
16
-
17
- import java.io.File
18
-
19
- // The dependencies to pull from CDT's p2 repositories
20
- def eclipseCdtDeps = [
21
- ' org.eclipse.cdt.core' :' +' , // CodeFormatter and related
22
- ]
23
-
24
- // The dependencies to pull from Eclipse's p2 repositories
25
- def eclipseDeps = [
26
- ' org.eclipse.core.jobs' :' +' , // Required by CDT ParserUtil
27
- ' org.eclipse.core.resources' :' +' ,
28
- ' org.eclipse.core.runtime' :' +' , // Provides central logging and plugin interface
29
- ' org.eclipse.equinox.common' :' +' , // Provides runtime status used during exception reporting
30
- ' org.eclipse.jface' :' +' , // PreferenceStore for creating preferences from properties
31
- ' org.eclipse.text' :' +' , // Provides Document data structure for formatter
32
- ' org.eclipse.osgi' :' +' , // CCorePlugin requires OSGI bundle interfaces (but not effectively used)
33
- ' org.eclipse.osgi.services' :' +' ,
34
- ]
1
+ ext {
2
+ developers = [
3
+ fvgh : [ name : ' Frank Vennemeyer' , email : ' frankgh@zoho.com' ],
4
+ ]
35
5
6
+ p2Repository = " http://download.eclipse.org/tools/cdt/releases/${ VER_ECLIPSE_CDT} "
7
+
8
+ p2Dependencies = [
9
+ ' org.eclipse.cdt.core' :' +' , // CodeFormatter and related
10
+ ]
36
11
37
- // build a maven repo in our build folder containing these artifacts
38
- p2AsMaven {
39
- group ' p2' , {
40
- repoEclipse cdt_VER_ECLIPSE
41
- eclipseDeps. keySet. each { p2. addIU(it) }
42
- eclipseDeps. keySet. each { p2. addIU(it + ' .source' ) }
43
- repo " http://download.eclipse.org/tools/cdt/releases/${ cdt_VER_ECLIPSE_CDT} "
44
- eclipseCdtDeps. keySet. each { p2. addIU(it) }
45
- eclipseCdtDeps. keySet. each { p2. addIU(it + ' .source' ) }
46
- }
47
12
}
48
13
49
- configurations
50
- {
51
- embeddedJars // JARs (Eclipse and WTP) the fat-jar is based uppon
52
- embeddedSource // Source for Eclipse JARS (GrEclipse provides no source packages)
53
- compile. extendsFrom(embeddedJars)
54
- }
14
+ apply from : rootProject. file(' ../gradle/p2-fat-jar-setup.gradle' )
15
+ apply from : rootProject. file(' ../gradle/java-publish.gradle' )
16
+
55
17
56
18
dependencies {
57
- // Add the Eclipse and Eclipse-WTP jars to the embedded configuration.
58
- eclipseDeps. each { groupArtifact , version ->
59
- embeddedJars " p2:${ groupArtifact} :${ version} "
60
- embeddedSource " p2:${ groupArtifact} :${ version} :sources"
61
- }
62
- eclipseCdtDeps. each { groupArtifact , version ->
63
- embeddedJars " p2:${ groupArtifact} :${ version} "
64
- embeddedSource " p2:${ groupArtifact} :${ version} :sources"
19
+ compile " com.diffplug.spotless:spotless-eclipse-base:${ VER_SPOTLESS_ECLISPE_BASE} "
20
+ // Provides text partitioners for formatters
21
+ compile (" org.eclipse.platform:org.eclipse.jface.text:${ VER_ECLISPE_JFACE} " ) {
22
+ exclude group : ' org.eclipse.platform' , module : ' org.eclipse.swt'
65
23
}
66
-
67
- testCompile " junit:junit:${ cdt_VER_JUNIT} "
68
24
}
69
25
70
- jar {
71
- // this embeds the eclipse jars into our "fat jar"
72
- from {
73
- configurations. embeddedJars. collect{ it. isDirectory() ? it : zipTree(it) }
74
- }
75
- // the eclipse jars are signed, and our fat jar breaks the signatures
76
- // so we've got to be sure to filter out the signatures
77
- exclude ' META-INF/*.RSA'
78
- exclude ' META-INF/*.SF'
79
- }
80
26
81
27
// ////////
82
28
// Test //
@@ -85,133 +31,3 @@ sourceSets {
85
31
// Use JAR file with all resources for Eclipse-XML integration-tests
86
32
test. runtimeClasspath = jar. outputs. files + sourceSets. test. output + sourceSets. test. compileClasspath
87
33
}
88
-
89
- // ///////
90
- // IDE //
91
- // ///////
92
-
93
- apply plugin : ' eclipse'
94
-
95
- eclipse {
96
- classpath {
97
- downloadSources true
98
- downloadJavadoc true
99
- }
100
- }
101
-
102
- // always create fresh projects
103
- tasks. eclipse. dependsOn(cleanEclipse)
104
-
105
- // //////////////
106
- // Publishing //
107
- // //////////////
108
- apply plugin : ' maven-publish'
109
-
110
- task sourcesJar (type : Jar ) {
111
- classifier = ' sources'
112
- from sourceSets. main. allJava
113
- }
114
-
115
- task javadocJar (type : Jar , dependsOn : javadoc) {
116
- classifier = ' javadoc'
117
- from javadoc. destinationDir
118
- }
119
-
120
- def isSnapshot = cdt_version. endsWith(' -SNAPSHOT' )
121
- // pulls the credentials from either the environment variable or gradle.properties
122
- def cred = {
123
- if (System . env[it] != null ) {
124
- return System . env[it]
125
- } else if (project. hasProperty(it)) {
126
- return project[it]
127
- } else {
128
- return ' unknown_' + it
129
- }
130
- }
131
-
132
- model {
133
- publishing {
134
- publications {
135
- mavenJava(MavenPublication ) {
136
-
137
- groupId project. cdt_group
138
- artifactId project. cdt_artifactId
139
- version project. cdt_version
140
- from components. java
141
-
142
- pom. withXml {
143
-
144
- // add MavenCentral requirements to the POM
145
- asNode(). children(). last() + {
146
- resolveStrategy = Closure . DELEGATE_FIRST
147
- name project. cdt_artifactId
148
- description project. cdt_description
149
- url " https://github.com/${ project.cdt_org} /${ project.name} "
150
- scm {
151
- url " https://github.com/${ project.cdt_org} /${ project.name} "
152
- connection " scm:git:git://github.com/${ project.cdt_org} /${ project.name} "
153
- developerConnection " scm:git:ssh:git@github.com/${ project.cdt_org} /${ project.name} "
154
- }
155
- licenses {
156
- license {
157
- name ' Eclipse Public License - v 1.0'
158
- url ' https://www.eclipse.org/legal/epl-v10.html'
159
- distribution ' repo'
160
- }
161
- }
162
- developers {
163
- developer {
164
- id ' fvgh'
165
- name ' Frank Vennemeyer'
166
- email ' frankgh@zoho.com'
167
- }
168
- }
169
- }
170
- }
171
- }
172
- }
173
- if (isSnapshot) {
174
- // upload snapshots to oss.sonatype.org
175
- repositories {
176
- maven {
177
- url = ' https://oss.sonatype.org/content/repositories/snapshots'
178
- credentials {
179
- username = cred(' nexus_user' )
180
- password = cred(' nexus_pass' )
181
- }
182
- } }
183
- }
184
- }
185
- }
186
-
187
- if (! isSnapshot) {
188
- // upload releases to bintray and then mavenCentral
189
- bintray {
190
- user = cred(' bintray_user' )
191
- key = cred(' bintray_pass' )
192
- publications = [
193
- ' mavenJava'
194
- ]
195
- publish = true
196
- pkg {
197
- repo = ' opensource'
198
- name = project. cdt_artifactId
199
- userOrg = project. cdt_org
200
- version {
201
- name = project. cdt_version
202
- mavenCentralSync {
203
- user = cred(' nexus_user' )
204
- password = cred(' nexus_pass' )
205
- }
206
- }
207
- }
208
- }
209
-
210
- publish. dependsOn(bintrayUpload)
211
- bintrayUpload. dependsOn([
212
- ' generatePomFileForMavenJavaPublication' ,
213
- jar,
214
- sourcesJar,
215
- javadocJar
216
- ])
217
- }
0 commit comments