forked from stempler/bnd-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
190 lines (159 loc) · 4.38 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5'
}
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
repositories {
jcenter()
}
group = 'org.standardout'
version = '1.8.0-SNAPSHOT'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
jar {
// include license into jar
into 'META-INF', {
from 'LICENSE'
}
}
dependencies {
compile gradleApi()
compile 'biz.aQute.bnd:biz.aQute.bndlib:3.5.0'
compile 'org.osgi:osgi.core:6.0.0'
compile 'commons-io:commons-io:2.4'
compile 'de.undercouch:gradle-download-task:3.1.1'
compile localGroovy()
}
task wrapper(type: Wrapper) {
gradleVersion = '4.6'
}
// package groovydoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'groovydoc') {
from groovydoc.destinationDir
classifier = 'javadoc'
}
// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
// define artifacts for upload
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
def configurePom(def pom) {
// ensure correct artifact ID
pom.artifactId = 'bnd-platform'
// pom file details
pom.project {
name 'bnd-platform'
packaging 'jar'
description 'Build OSGi bundles and Eclipse Update Sites from existing JARs, e.g. from Maven repositories (Plugin for Gradle)'
url 'https://github.com/stempler/bnd-platform'
scm {
url 'scm:git:https://github.com/stempler/bnd-platform.git'
connection 'scm:git:https://github.com/stempler/bnd-platform.git'
developerConnection 'scm:git:https://github.com/stempler/bnd-platform.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'stempler'
name 'Simon Templer'
email 'simon@templer.cc'
}
}
}
}
install {
repositories.mavenInstaller {
// ensure correct artifact ID when installing locally
configurePom(pom)
}
}
// sign all artifacts
signing {
required {
// NOTE: skipping does only work if no gradle properties specifying the key are present
gradle.taskGraph.hasTask('uploadArchives')
}
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
// sign artifacts before upload
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// upload to sonatype OSS (snapshot/release)
repository(url: this.version.endsWith('-SNAPSHOT') ?
'https://oss.sonatype.org/content/repositories/snapshots' :
'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: this.hasProperty('sonatypeUsername') ? sonatypeUsername : '',
password: this.hasProperty('sonatypePassword') ? sonatypePassword : '')
}
configurePom(pom)
}
}
}
// groovydoc task work-around
configurations {
jansi.extendsFrom(runtime)
}
groovydoc {
groovyClasspath = project.configurations.jansi
}
dependencies {
jansi 'org.fusesource.jansi:jansi:1.11'
}
// bintray
bintray { // task bintrayUpload
user = project.getProperty('bintrayUser')
key = project.getProperty('bintrayApiKey')
configurations = ['archives']
dryRun = false
publish = !project.version.endsWith('-SNAPSHOT')
pkg {
def githubUrl = 'https://github.com/stempler/bnd-platform'
repo = 'gradle-plugins'
name = 'bnd-platform'
desc = 'Build OSGi bundles and p2 repositories / Eclipse Update Sites from existing libraries and their dependencies, e.g. from Maven repositories. Useful for instance for creating a target platform for Eclipse/Equinox or Maven Tycho build from third party dependencies.'
websiteUrl = githubUrl
issueTrackerUrl = "$githubUrl/issues"
vcsUrl = "${githubUrl}.git"
licenses = ['Apache-2.0']
labels = ['gradle', 'bnd', 'osgi', 'p2', 'eclipse', 'tycho']
publicDownloadNumbers = true
// version descriptor
version {
name = project.version
attributes = ['gradle-plugin': "org.standardout.bnd-platform:${project.group}:bnd-platform"]
}
}
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId "${group}"
artifactId 'bnd-platform'
version "${version}"
}
}
}