-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathbuild.gradle
126 lines (109 loc) · 3.72 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
plugins {
id "java-library"
id "org.sonarqube" version "2.7"
id 'maven-publish'
id 'signing'
id "biz.aQute.bnd.builder" version "5.1.1"
}
group = findProperty("project.group") ?: "com.intuit.commons"
version = findProperty("project.version") ?: "${new Date().format('yyyy_MMdd_HHmmss')}-SNAPSHOT"
def PUBLISH_URI = findProperty("PUBLISH_URL") ?: "https://oss.sonatype.org/content/repositories/snapshots"
def PUBLISH_USER = findProperty("ossrhUsername") ?: null
def PUBLISH_PASSWORD = findProperty("ossrhPassword") ?: null
repositories {
mavenLocal()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
mavenCentral()
}
dependencies {
testImplementation 'org.codehaus.groovy:groovy-all:2.3.7'
testImplementation 'org.jmockit:jmockit:1.20'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.slf4j:slf4j-simple:1.7.13'
}
sonarqube {
properties {
property "sonar.host.url", System.getenv("SONARQUBE_SERVER_URL")
property "sonar.login", System.getenv("SONARQUBE_USERNAME")
property "sonar.password", System.getenv("SONARQUBE_PASSWORD")
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'Traverser'
description = 'Java library to traverse objects graph'
url = 'https://github.com/intuit/Traverser'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'gkesler'
name = 'Greg Kesler'
email = '[email protected]'
}
developer {
id = 'amatiushkin'
name = 'Alex Matiushkin'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/intuit/Traverser.git'
developerConnection = 'scm:git:https://github.com/intuit/Traverser.git'
url = 'https://github.com/intuit/Traverser'
}
}
}
}
repositories {
maven {
url(uri(PUBLISH_URI))
credentials {
username = PUBLISH_USER
password = PUBLISH_PASSWORD
}
}
}
}
/**
*
* Generate manifest file for all components jars
*/
jar {
manifest {
def nameParts = project.version.toString().tokenize(".")
// manifest
attributes(["Extension-Name" : project.name,
"Specification-Version": nameParts[0],
"Implementation-Version": project.version,
"Sealed": true,
"Created-By": System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')',
"Built-With": "gradle-${project.getGradle().getGradleVersion()}, groovy-${GroovySystem.getVersion()}",
"Built-On": "${InetAddress.localHost.hostName}/${InetAddress.localHost.hostAddress}"])
}
}
signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { PUBLISH_USER != null && PUBLISH_PASSWORD != null }
}