-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
142 lines (122 loc) · 4.57 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
['groovy', 'maven', 'signing', 'io.codearte.nexus-staging'].each {
apply plugin: it
}
defaultTasks 'clean', 'jar', 'copyDocs'
group = 'com.ibm.urbancode.plugins'
archivesBaseName = 'groovy-plugin-utils'
// Use -Psnapshot=false to produce new releases
version = '1.3' + ((hasProperty('snapshot') && snapshot == 'false') ? '' : '-SNAPSHOT')
jar.archiveName "${archivesBaseName}-${version}.jar"
def username = hasProperty('ossrhUsername') ? ossrhUsername : ''
def password = hasProperty('ossrhPassword') ? ossrhPassword : ''
repositories {
mavenCentral()
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.7'
implementation 'com.google.code.gson:gson:2.8.9'
}
/*
* Uploading artifacts requires properties be defined in $GRADLE_USER_HOME/gradle.properties. $GRADLE_USER_HOME defaults to $USER_HOME/.gradle
* ossrhUsername=your-jira-id
* ossrhPassword=your-jira-password
* See: http://central.sonatype.org/pages/gradle.html
* Then follow: http://central.sonatype.org/pages/releasing-the-deployment.html
*/
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: username, password: password)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: username, password: password)
}
pom.project {
name "${group}:${archivesBaseName}"
description 'A set of utility scripts that can be used in community plugins on GitHub.'
url 'https://github.com/IBM-UrbanCode/groovy-plugin-utils'
licenses {
license {
name 'Eclipse Public License, Version 1.0'
url 'https://www.eclipse.org/legal/epl-v10.html'
}
}
developers {
developer {
name 'Nicholas Mathison'
email '[email protected]'
organization 'IBM'
organizationUrl 'http://www.ibm.com'
}
}
scm {
connection 'scm:git:https://github.com/IBM-UrbanCode/groovy-plugin-utils.git'
developerConnection 'scm:git:https://github.com/IBM-UrbanCode/groovy-plugin-utils.git'
url 'https://github.com/IBM-UrbanCode/groovy-plugin-utils'
}
}
}
}
}
// Creates a ${archivesBaseName}-${version}-sources.jar file that contains all Groovy and Java source files
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.groovy
}
// Creates a ${archivesBaseName}-${version}-javadoc.jar file that contains JavaDoc for all source files
task groovyDocJar(type: Jar) {
classifier = 'javadoc'
from groovydoc
}
// Copy the source into the build jar directory
jar {
dependsOn 'copyGroovy'
}
// Change the Groovy Compile output directory to not combine in final Jar build folder
compileGroovy {
destinationDir = file('build/tmp/groovyClasses')
}
task copyGroovy(type:Copy) {
from sourceSets.main.groovy
into 'build/classes/main'
}
artifacts {
archives jar, sourcesJar, groovyDocJar
}
/**
* Signing requires that the following properties be defined in $GRADLE_USER_HOME/gradle.properties. $GRADLE_USER_HOME defaults to $USER_HOME/.gradle
* signing.keyId=YourKeyId
* signing.password=YourPublicKeyPassword
* signing.secretKeyRingFile=PathToYourKeyRingFile
* See http://www.gradle.org/docs/current/userguide/signing_plugin.html
*/
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task copyDocs(type: Copy) {
from groovydoc
into('docs')
}
/**
* Deploy to Sonatype Nexus
* Run: gradle closeAndPromoteRepository
* See: https://github.com/Codearte/gradle-nexus-staging-plugin/
* ossrhUsername and ossrhPassword are taken from gradle.properties
*/
// Add the gradle nexus staging plugin
// See: https://github.com/Codearte/gradle-nexus-staging-plugin/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
}
}
// Configure the nexus staging plugin
nexusStaging {
packageGroup = "com.ibm.urbancode.plugins" //optional if packageGroup == project.getGroup()
}