forked from brailleapps/braille-utils.api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
126 lines (109 loc) · 3.28 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
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "signing"
//custom plugins
apply plugin: "org.dm.bundle"
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
javadoc {
options.encoding = 'UTF-8'
options.links('http://docs.oracle.com/javase/7/docs/api/');
}
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
def repoRevision = System.getenv("REPO_REVISION")!=null?System.getenv("REPO_REVISION"):repositoryRevision
group = "org.daisy.braille"
sourceSets {
main { java { srcDir 'src' } resources { srcDir 'src' } }
test { java { srcDir 'test' } resources { srcDir 'test' } }
}
repositories {
mavenCentral()
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
configurations {
provided
compile { extendsFrom provided }
}
dependencies {
provided group: "biz.aQute.bnd", name: "annotation", version: "2.3.0"
testCompile group: 'junit', name: 'junit', version: '4.7'
}
buildscript {
repositories { mavenCentral() }
dependencies { classpath group: "org.dm.gradle", name: "gradle-bundle-plugin", version: "0.6.4" }
}
task updateBndVersion() << {
String contents = file('bnd.bnd').getText('UTF-8')
file('bnd.bnd').write(contents.replaceAll('Bundle-Version: [\\d\\.A-Za-z\\-]+', "Bundle-Version: $version"), 'UTF-8')
}
bundle {
instructions << [
"-include": file('bnd.bnd'),
'Built-By': System.getProperty("user.name"),
'Built-On': new Date().format('yyyy-MM-dd'),
'Implementation-Title': "$releaseName",
'Repository-Revision': "$repoRevision",
'Repository-URL': "$repositoryURL"
]
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
//Only upload if a git hash is supplied. On Travis only upload snapshots.
enabled = repoRevision.size()==40 && (System.getenv("TRAVIS_BUILD_ID")==null || version.endsWith("SNAPSHOT"))
repositories {
mavenDeployer {
if (isReleaseVersion) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'braille-utils.api'
packaging 'jar'
description 'Braille Utils API'
url 'https://github.com/brailleapps/braille-utils.api/'
scm {
connection 'scm:git:https://github.com/brailleapps/braille-utils.api.git'
developerConnection 'scm:git:https://github.com/brailleapps/braille-utils.api.git'
url "$repositoryURL"
}
licenses {
license {
name 'LGPL'
url 'http://www.gnu.org/licenses/lgpl.html'
}
}
developers {
developer {
id 'joel'
name 'Joel Håkansson'
}
}
}
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
}