forked from RobertFischer/Gradle-License-Report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
109 lines (92 loc) · 2.44 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
buildscript {
repositories {
jcenter()
maven { url 'http://dl.bintray.com/smokejumperit/maven/' }
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.3'
classpath 'com.smokejumperit.gradle.license:Gradle-License-Report:[0,)'
}
}
apply plugin:'java'
apply plugin:'groovy'
apply plugin:'eclipse'
apply plugin:'osgi'
apply plugin:'maven-publish'
apply plugin:'bintray'
apply plugin:com.smokejumperit.gradle.report.DependencyLicensePlugin
group = "com.smokejumperit.gradle.license"
version = "0.0.2"
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
dependencies {
compile gradleApi()
compile 'org.codehaus.groovy:groovy:[2,3)'
compile 'org.apache.commons:commons-lang3:[3,4)'
compile 'commons-io:commons-io:[2,3)'
compile 'com.google.guava:guava:[14,)'
}
def binTrayKeyFile = new File(System.properties["user.home"], "bintray-api.key")
if(binTrayKeyFile.file) {
logger.info("Found Bintray key at: $binTrayKeyFile")
def project = project // needs to be localized for variable dereferencing to work
bintray {
user = "smokejumperit"
key = binTrayKeyFile.text.trim()
publications = ['mavenJava'] // see publications closure
pkg {
repo = "maven"
name = project.group
desc = "Gradle plugin for generating a report about the dependencies' licenses"
licenses = ["Unlicense"]
labels = [
"Groovy", "Gradle", "legal", "license", "reporting", "reports"
]
}
}
} else {
logger.info("Could NOT find Bintray key at: $binTrayKeyFile -- skipping Bintray upload configuration")
}
task('sourcesJar', type: Jar, dependsOn: classes) {
classifier = 'sources'
sourceSets.each { SourceSet ss ->
from ss.allSource
}
}
task('javadocJar', type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
}
}
}
tasks.bintrayUpload.dependsOn tasks.jar, tasks.sourcesJar, tasks.javadocJar
tasks.javadoc {
options.links(
"http://docs.oracle.com/javase/8/docs/api/",
"https://google-guice.googlecode.com/git/javadoc/"
)
options.linkSource true
}