forked from erma/erma
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
169 lines (148 loc) · 4.16 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
/*
* ERMA Gradle build file.
*
* To execute build:
* $ ./gradlew
*
* If executing via a pre-installed version of gradle or your IDE, make sure to export GRADLE_OPTS
* as defined in this project's gradlew script.
*/
import org.gradle.plugins.signing.Sign
dependsOnChildren()
allprojects {
apply plugin: 'java'
}
task projectDist() << {
}
task dist(dependsOn: [projectDist]) << {
File distFolder = new File(buildDir.getCanonicalPath() + File.separator + 'dist')
distFolder.mkdirs()
for (project in subprojects) {
for (archiveTask in project.tasks.withType(Jar)) {
copy {
from archiveTask.archivePath
into distFolder
}
}
for (signTask in project.tasks.withType(Sign)) {
copy {
from signTask.signatureFiles
into distFolder
}
}
}
}
subprojects { subproject ->
apply plugin: 'signing'
apply plugin: 'maven'
apply plugin: 'project-reports'
signing {
sign configurations.archives
}
defaultTasks 'assemble'
buildscript {
// using a variable to make wiki look cleaner
def githubBase = 'https://github.com/valkolovos/gradle_cobertura/raw/master/ivy'
apply from: "${githubBase}/gradle_cobertura/gradle_cobertura/1.0-rc4/coberturainit.gradle"
}
sourceSets {
main {
java { srcDir 'src/java' }
}
test {
java { srcDir 'test/src/java' }
resources { srcDir 'test/src/java' }
}
}
repositories {
mavenCentral()
}
def pomConfig = {
name project.projectName
description project.description
packaging 'jar'
url 'https://github.com/erma/erma'
inceptionYear '2008'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection 'scm:git:git@github.com:erma/erma.git'
developerConnection 'scm:git:git@github.com:erma/erma.git'
url 'git@github.com:erma/erma.git'
}
developers {
developer {
id 'ConnorWGarvey'
name 'Connor Garvey'
email 'connorwgarvey@gmail.com'
url 'http://www.connorgarvey.com'
organization 'Orbitz Worldwide, LLC'
organizationUrl 'http://www.orbitz.com'
roles {
role 'developer'
}
timezone '-6'
}
}
parent {
groupId 'org.sonatype.oss'
artifactId 'oss-parent'
version '7'
}
}
subproject.basePomConfig = pomConfig
configure(install.repositories.mavenInstaller) {
pom.project pomConfig
}
uploadArchives {
if (project.hasProperty('sonatypeUserName') && project.hasProperty('sonatypePassword')) {
dependsOn << [ signArchives ]
repositories.mavenDeployer {
beforeDeployment { deployment ->
signPom(deployment)
for (signTask in project.tasks.withType(Sign)) {
for (signature in signTask.signatures) {
deployment.addArtifact(signature)
}
}
}
name = 'Maven Central Deployer'
configuration = configurations.archives
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)
}
// repository(url: "file://localhost/tmp/myRepo/")
pom.project pomConfig
}
}
}
// erma/abc sub-project generates jar with basename "abc"
def shortProjectName = project.name.split('/')[-1]
jar.baseName = shortProjectName
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
baseName = shortProjectName
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
basename = shortProjectName
}
task projectDist(dependsOn: [build, signArchives]) << {
}
artifacts {
archives jar, sourceJar, javadocJar
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-4'
}
}