forked from cloudfoundry/cf-java-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
120 lines (104 loc) · 4.09 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
import org.gradle.api.artifacts.maven.MavenDeployment
/*
* Copyright 2012 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile gradleApi()
compile 'org.cloudfoundry:cloudfoundry-client-lib:1.1.1'
compile 'org.codehaus.groovy:groovy:2.3.6'
testCompile 'junit:junit:4.8.2'
}
group = 'org.cloudfoundry'
version = '1.1.2.BUILD-SNAPSHOT'
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
if (project.hasProperty('performRelease')) {
signing {
sign configurations.archives
}
}
def credentials = [ : ]
if (project.hasProperty('deployUser') && project.hasProperty('deployPassword')) {
credentials << [userName: deployUser, password: deployPassword]
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(id:'sonatype-nexus-staging',url: uri('https://oss.sonatype.org/service/local/staging/deploy/maven2'), authentication: credentials)
snapshotRepository(id:'sonatype-nexus-snapshots', url: uri('https://oss.sonatype.org/content/repositories/snapshots'), authentication: credentials)
pom.project {
name 'Cloud Foundry Gradle Plugin'
parent {
groupId 'org.sonatype.oss'
artifactId 'oss-parent'
version '7'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm(
url:'[email protected]:cloudfoundry/cf-java-client.git',
connection:'scm:git:[email protected]:cloudfoundry/cf-java-client.git',
developerConnection:'scm:git:[email protected]:cloudfoundry/cf-java-client.git')
developers {
developer(id:'melix', name:'Cédric Champeau')
developer(id:'scottfrederick', name:'Scott Frederick')
}
description('A Gradle plugin that makes it easy to deploy Gradle-based applications to Cloud Foundry instances.')
url('https://github.com/cloudfoundry/cf-java-client/cloudfoundry-gradle-plugin')
}
// courtesy of http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parse(new ByteArrayInputStream(xml.toString().bytes))
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
}
}
}