-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.gradle
executable file
·117 lines (95 loc) · 3.16 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
import java.text.SimpleDateFormat
plugins {
id 'groovy'
id 'maven'
id "com.gradle.plugin-publish" version "0.9.7"
}
sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
if (!hasProperty('mainClass')) {
ext.mainClass = ''
}
group = 'de.fuerstenau'
version = '1.1.8'
repositories {
mavenCentral()
}
configurations {
provided
compile.extendsFrom provided
}
task createClasspathManifest {
def outputDir = file("${buildDir}/${name}")
inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
doLast {
outputDir.mkdirs()
file("${outputDir}/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join ("\n")
}
}
dependencies {
provided gradleApi()
testCompile group: 'junit', name: 'junit', version: '4.10'
testCompile ('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude module : 'groovy-all'
}
testCompile gradleTestKit()
testRuntime files(createClasspathManifest)
}
jar {
dependsOn configurations.runtime
from {
(configurations.runtime - configurations.provided).collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
task copyBintrayTemplate (type: Copy) {
from "${projectDir}/templates"
into "${project.buildDir}"
include 'bintray.json.template'
rename { file -> 'bintray.json' }
expand (version: version, releasedate: releaseDate (), mavenRepositoryPath: mavenRepositoryPath ())
}
task copyPOMTemplate (type: Copy) {
from "${projectDir}/templates"
into "${buildDir}/libs"
include 'pom.xml.template'
rename { file -> "${project.name}-${project.version}.pom" }
expand (version: version)
}
assemble.dependsOn copyBintrayTemplate
assemble.dependsOn copyPOMTemplate
pluginBundle {
// These settings are set for the whole plugin bundle
website = 'https://github.com/mfuerstenau/gradle-buildconfig-plugin'
vcsUrl = 'https://github.com/mfuerstenau/gradle-buildconfig-plugin'
plugins {
// another plugin
buildConfigPlugin {
id = 'de.fuerstenau.buildconfig'
displayName = 'Build config plugin for Gradle Java and Groovy projects'
description = 'A build config is a generated class holding constants set by the build script. It can be accessed within the Java or Groovy application, thus providing a way to transport information about version, project name or debug flags or a lot more info that otherwise will not be available or has to to be transported via complicated workarounds.'
tags = ['java', 'buildconfig', 'static', 'version', 'generated', 'sourceset', 'groovy', 'constants']
version = project.version
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
test {
testLogging {
events "failed"
exceptionFormat "full"
showStandardStreams = true
}
}
def mavenRepositoryPath ()
{
"gradle/plugin/de/fuerstenau/BuildConfigPlugin/${version}/"
}
def releaseDate ()
{
new SimpleDateFormat("yyyy-MM-dd").format (new Date())
}