This repository has been archived by the owner on Jan 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
99 lines (84 loc) · 2.38 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
plugins {
id "java"
id "groovy"
id "maven-publish"
id "maven"
id "eclipse"
id "idea"
id "com.gradle.plugin-publish" version "0.9.3"
id "com.palantir.flexversion" version "0.9.2"
}
project.ext."gradle.publish.key" = System.env.GRADLE_PUBLISH_KEY
project.ext."gradle.publish.secret" = System.env.GRADLE_PUBLISH_SECRET
repositories {
mavenCentral()
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'org.eclipse.jgit:org.eclipse.jgit.java7:3.4.1.201406201815-r'
testCompile 'junit:junit:4.11'
}
flexversion {
useTags = true
}
group "com.palantir"
version flexVersion()
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier "sources"
}
publishing {
publications {
ivy(MavenPublication) {
from components.java
artifact(sourceJar) {
classifier "sources"
}
}
}
repositories {
maven {
url "$buildDir/localpublish/"
}
}
}
task zipPublish (type: Zip) {
from ("${buildDir}/localpublish") {
include '**/*'
exclude '**/maven-metadata.xml*'
}
appendix = "release"
destinationDir = file("${project.buildDir}/artifacts")
}
publish << {
file("${project.buildDir}/artifacts").mkdirs()
tasks.zipPublish.execute()
}
test {
workingDir = file("${project.buildDir}/testing")
environment "buildRef", "fancybranchname"
environment "buildRef_CLEAN", "fancybranchname"
environment "GIT_BRANCH_FOR_TESTING", "refs/heads/feature/checkbox"
environment "GIT_BRANCH_FOR_TESTING_CLEAN", "feature/checkbox"
environment "git.branch", "gerrit/release/1.5"
environment "git.branch_CLEAN", "release/1.5"
}.doFirst {
workingDir.deleteDir()
workingDir.mkdirs()
}
pluginBundle {
website = "https://github.com/palantir/gradle-flexversion"
vcsUrl = "https://github.com/palantir/gradle-flexversion"
description = "Gradle FlexVersion is a plugin to calculate the flex version of a repo. A flex version is constructed from a domain, the number of commits in HEAD's history, and a git hash. A domain can be a branch name, a user-defined value, or unspecified. If the HEAD commit has a tag, the tag will be the version #."
tags = ['git', 'version']
plugins {
flexVersionPlugin {
id = 'com.palantir.flexversion'
displayName = "Palantir Gradle Flex Version"
}
}
}
publishPlugins.onlyIf {
System.getenv('TRAVIS_TAG') && project.version.toString() ==~ /\d+\.\d+\.\d+/
}