-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
134 lines (114 loc) · 3.1 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://repo.springsource.org/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.4'
}
}
subprojects {
if(path != ':doc/guide') {
apply plugin: 'java'
apply plugin: 'groovy'
}
apply plugin: 'propdeps'
// IDE support
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
repositories {
mavenLocal()
mavenCentral()
}
group = 'org.shamdata'
version = '0.4-SNAPSHOT'
ext {
isSnapshot = version.endsWith("-SNAPSHOT")
publishedModules = [':sham-core']
}
if (path in publishedModules) {
apply plugin: "base"
apply plugin: "maven"
apply plugin: "signing"
signing {
sign configurations.archives
required { !isSnapshot && gradle.taskGraph.hasTask(uploadArchives) }
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
apply from: "$rootDir/gradle/pom.gradle"
uploadArchives { task ->
repositories.mavenDeployer {
if(!isSnapshot) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
uniqueVersion = false
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(task)) {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeOssUsername, password: sonatypeOssPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: sonatypeOssUsername, password: sonatypeOssPassword)
}
}
}
}
}
task uploadSnapshots << {
if(!isSnapshot) {
println "Not uploading snapshot as not a snapshot version"
}
}
if(isSnapshot) {
uploadSnapshots.dependsOn(uploadArchives)
}
}
}
task dist(type: Zip, dependsOn: [':sham-core:javadoc', ':sham-core:jar', 'doc/guide:compileManual']) {
def coreProject = project(':sham-core')
def docProject = project(':doc/guide')
archiveName = "$buildDir/sham-${coreProject.version}.zip"
def archiveBaseDir = "sham-${coreProject.version}"
from(projectDir) {
include "LICENSE"
into archiveBaseDir
}
from(new File(projectDir, 'doc/dist')) {
include "README.TXT"
into archiveBaseDir
}
from(new File(coreProject.buildDir, 'libs')) {
include "sham-core-${coreProject.version}.jar"
into archiveBaseDir
}
from(new File(coreProject.projectDir, 'src/main')) {
include '**/*'
into "$archiveBaseDir/src"
}
from(new File(coreProject.buildDir, 'docs/javadoc')) {
include '**/*'
into "$archiveBaseDir/doc/api"
}
from(new File(docProject.buildDir, "manual-compiled")) {
include '**/*'
into "$archiveBaseDir/doc/guide"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}