forked from hierynomus/license-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
170 lines (145 loc) · 4.5 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
170
defaultTasks 'build'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'license'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'optional-base'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5'
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.+'
}
}
group = 'nl.javadude.gradle.plugins'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories { jcenter() }
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
configurations.compile.transitive = false
dependencies {
compile "org.codehaus.plexus:plexus-utils:2.0.5"
compile "com.mycila.xmltool:xmltool:3.3"
// Using compile instead of groovy, so that it goes into the pom
compile ('com.mycila.maven-license-plugin:maven-license-plugin:1.10.b1') {
exclude group: 'org.apache.maven', module: 'maven-plugin-api'
exclude group: 'org.apache.maven', module: 'maven-project'
}
compile 'com.android.tools.build:gradle:1.0.+', optional
compile gradleApi()
testCompile 'junit:junit:4.11'
testCompile 'com.google.guava:guava:17.0'
testCompile('org.spockframework:spock-core:0.7-groovy-2.0') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
}
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
license {
ignoreFailures true
}
test {
afterSuite { descriptor, result ->
def indicator = "\u001B[32m✓\u001b[0m"
if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
}
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
}
}
def pomConfig = {
name project.name
description project.project_description
url project.project_url
inceptionYear '2011'
scm { url project.project_scm }
licenses {
license([:]) {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'hierynomus'
name 'Jeroen van Erp'
url 'http://www.javadude.nl/'
email '[email protected]'
roles { role 'Developer' }
}
}
contributors {
contributor {
name 'Tim Harsch'
email '[email protected]'
}
contributor {
name 'Justin Ryan'
email '[email protected]'
}
}
}
publishing {
publications {
mavenCustom(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().children().last() + pomConfig
}
}
}
}
// Both 'bintrayUsername' and 'bintrayApiKey' must defined in the ~/.gradle/gradle.properties
if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = 'invalid'
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = 'invalid'
bintray {
user = project.bintrayUsername
key = project.bintrayApiKey
publications = ['mavenCustom']
pkg {
repo = project.project_bintray_repo
name = project.name
desc = project.project_description
licenses = ['Apache-2.0']
labels = ['gradle', 'plugin', 'license']
websiteUrl = project.project_url
issueTrackerUrl = project.project_issues_url
vcsUrl = project.project_scm
publicDownloadNumbers = true
version {
vcsTag = project.version
attributes = [
'gradle-plugin': ['com.github.hierynomus.license', project.group, project.name].join(':')
]
}
}
}
if (!System.env.containsKey("JENKINS_URL")) {
def javaVersion = System.properties['java.version']
if (JavaVersion.toVersion(javaVersion) != project.targetCompatibility) {
// throw new GradleException("Expected Java version ${project.targetCompatibility} but running with $javaVersion")
}
}