-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle
136 lines (113 loc) · 3.45 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
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
group = 'me.sgeb.gradle'
version = '1.1.0-SNAPSHOT'
sourceCompatibility = 1.5
targetCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
compile gradleApi()
compile localGroovy()
testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
}
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Native Artifacts Plugin',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
}
}
ext.pomConfiguration = {
project {
name 'Gradle Native Artifacts Plugin'
description 'A gradle plugin to package C/C++ native executables and ' +
'libraries into artifacts publishable to Ivy or Maven, with ' +
'support for transitive dependencies.'
url 'https://github.com/sgeb/gradle-native-artifacts-plugin'
inceptionYear '2014'
scm {
url 'https://github.com/sgeb/gradle-native-artifacts-plugin'
connection 'scm:git:https://github.com/sgeb/gradle-native-artifacts-plugin.git'
developerConnection 'scm:git:https://github.com/sgeb/gradle-native-artifacts-plugin.git'
}
licenses {
license {
name 'The MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
distribution 'repo'
}
}
developers {
developer {
id 'sgeb'
name 'Serge Gebhardt'
}
}
}
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
classifier = 'javadoc'
from groovydoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives groovydocJar
archives sourcesJar
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") ||
gradle.taskGraph.hasTask("install") }
sign configurations.archives
}
// GRADLE-1285 - workaround to get <packaging>jar</packaging>
// into the pom file
def pomPackagingElement = { root ->
def children = root.asNode().children()
def versionIndex = children.indexOf(children.find {it.name().localPart == 'version'})
children.add(versionIndex + 1, new Node(null, 'packaging', 'jar'))
}
install {
repositories {
mavenInstaller {
beforeDeployment { mavenDeployment ->
signing.signPom(mavenDeployment)
}
pom(pomConfiguration)
pom.withXml pomPackagingElement
}
}
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { mavenDeployment ->
signing.signPom(mavenDeployment)
}
repository(url: "file://$rootDir/../maven_repo")
pom(pomConfiguration)
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
tasks['uploadArchives'].mustRunAfter tasks.withType(Test)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(':uploadArchives'))
{
if (!taskGraph.hasTask(':test'))
{
throw new StopExecutionException('Test task must be run for releases that ' +
'will be uploaded.')
}
}
}