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
- apply plugin : ' java'
9
-
10
- // The dependencies we'd like to pull from Eclipse's p2 repositories
11
- def eclipseDeps = [
12
- // The dependencies we actually use
13
- ' org.eclipse.jdt.core' ,
14
- ' org.eclipse.text' ,
15
-
16
- // Their transitives
17
- ' org.eclipse.core.contenttype' ,
18
- ' org.eclipse.core.jobs' ,
19
- ' org.eclipse.core.runtime' ,
20
- ' org.eclipse.core.resources' ,
21
- ' org.eclipse.equinox.common' ,
22
- ' org.eclipse.equinox.preferences' ,
23
- ' org.eclipse.osgi'
24
- ]
25
- // build a maven repo in our build folder containing these artifacts
26
- p2AsMaven {
27
- group ' p2' , {
28
- repoEclipse jdt_VER_ECLIPSE
29
- eclipseDeps. each { p2. addIU(it) }
30
- eclipseDeps. each { p2. addIU(it + ' .source' ) }
31
- }
32
- }
1
+ apply from : rootProject. file(' ../gradle/java-setup.gradle' )
2
+ apply from : rootProject. file(' ../gradle/java-publish.gradle' )
33
3
34
- configurations {
35
- embeddedJars // we will embed these into the binary artifact
36
- compile. extendsFrom(embeddedJars)
4
+ ext {
5
+ developers = [
6
+ fvgh : [
name :
' Frank Vennemeyer' ,
email :
' [email protected] ' ],
7
+ nedtwigg : [
name :
' Ned Twigg' ,
email :
' [email protected] ' ],
8
+ ]
37
9
}
38
10
39
11
dependencies {
40
- // add the eclipse jars to the embedded configuration
41
- eclipseDeps. each { embeddedJars " p2:${ it} :+" }
42
- }
43
-
44
- jar {
45
- // this embeds the eclipse jars into our "fat jar"
46
- from {
47
- configurations. embeddedJars. collect{ it. isDirectory() ? it : zipTree(it) }
12
+ compile " com.diffplug.spotless:spotless-eclipse-base:${ VER_SPOTLESS_ECLISPE_BASE} "
13
+ compile(" org.eclipse.jdt:org.eclipse.jdt.core:${ VER_ECLIPSE_JDT_CORE} " ) {
14
+ exclude group : ' org.eclipse.platform' , module : ' org.eclipse.ant.core'
15
+ exclude group : ' org.eclipse.platform' , module : ' org.eclipse.core.expressions'
16
+ exclude group : ' org.eclipse.platform' , module : ' org.eclipse.core.filesystem'
48
17
}
49
- // the eclipse jars are signed, and our fat jar breaks the signatures
50
- // so we've gotta be sure to filter out the signatures
51
- exclude ' META-INF/*.RSA'
52
- exclude ' META-INF/*.SF'
53
- }
54
-
55
- apply plugin : ' eclipse'
56
- eclipse {
57
- classpath {
58
- downloadSources true
59
- downloadJavadoc true
60
- }
61
- }
62
- // always create fresh projects
63
- tasks. eclipse. dependsOn(cleanEclipse)
64
-
65
- // /////////
66
- // MAVEN //
67
- // /////////
68
- apply plugin : ' maven-publish'
69
-
70
- task sourcesJar (type : Jar ) {
71
- classifier = ' sources'
72
- from sourceSets. main. allJava
73
- }
74
-
75
- task javadocJar (type : Jar , dependsOn : javadoc) {
76
- classifier = ' javadoc'
77
- from javadoc. destinationDir
78
- }
79
-
80
- // //////////////
81
- // PUBLISHING //
82
- // //////////////
83
- def isSnapshot = project. jdt_version. endsWith(' -SNAPSHOT' )
84
- // pulls the credentials from either the environment variable or gradle.properties
85
- def cred = {
86
- if (System . env[it] != null ) {
87
- return System . env[it]
88
- } else if (project. hasProperty(it)) {
89
- return project[it]
90
- } else {
91
- return ' unknown_' + it
92
- }
93
- }
94
-
95
- model {
96
- publishing {
97
- publications {
98
- mavenJava(MavenPublication ) {
99
- artifact jar
100
- artifact sourcesJar
101
- artifact javadocJar
102
-
103
- groupId project. jdt_group
104
- artifactId project. jdt_artifactId
105
- version project. jdt_version
106
-
107
- pom. withXml {
108
- // remove the p2 dependencies because they are embedded
109
- // also remove 'com.diffplug' dependencies so that we can use spotless on its dependencies
110
- asNode(). dependencies. ' *' . each() {
111
- if (it. groupId. text() == ' p2' ) {
112
- it. parent(). remove(it)
113
- }
114
- }
115
- // add MavenCentral requirements to the POM
116
- asNode(). children(). last() + {
117
- resolveStrategy = Closure . DELEGATE_FIRST
118
- name project. jdt_artifactId
119
- description project. jdt_description
120
- url " https://github.com/${ project.jdt_org} /${ project.name} "
121
- scm {
122
- url " https://github.com/${ project.jdt_org} /${ project.name} "
123
- connection " scm:git:git://github.com/${ project.jdt_org} /${ project.name} "
124
- developerConnection
" scm:git:ssh:[email protected] /${ project.jdt_org} /${ project.name} "
125
- }
126
- licenses {
127
- license {
128
- name ' Eclipse Public License - v 1.0'
129
- url ' https://www.eclipse.org/legal/epl-v10.html'
130
- distribution ' repo'
131
- }
132
- }
133
- developers {
134
- developer {
135
- id ' nedtwigg'
136
- name ' Ned Twigg'
137
-
138
- }
139
- }
140
- }
141
- }
142
- }
143
- }
144
- if (isSnapshot) {
145
- // upload snapshots to oss.sonatype.org
146
- repositories { maven {
147
- url = ' https://oss.sonatype.org/content/repositories/snapshots'
148
- credentials {
149
- username = cred(' nexus_user' )
150
- password = cred(' nexus_pass' )
151
- }
152
- } }
153
- }
154
- }
155
- }
156
-
157
- if (! isSnapshot) {
158
- // upload releases to bintray and then mavenCentral
159
- bintray {
160
- user = cred(' bintray_user' )
161
- key = cred(' bintray_pass' )
162
- publications = [' mavenJava' ]
163
- publish = true
164
- pkg {
165
- repo = ' opensource'
166
- name = project. jdt_artifactId
167
- userOrg = project. jdt_org
168
- version {
169
- name = project. jdt_version
170
- mavenCentralSync {
171
- user = cred(' nexus_user' )
172
- password = cred(' nexus_pass' )
173
- }
174
- }
175
- }
176
- }
177
-
178
- publish. dependsOn(bintrayUpload)
179
- bintrayUpload. dependsOn([' generatePomFileForMavenJavaPublication' , jar, sourcesJar, javadocJar])
180
- }
18
+ }
0 commit comments