forked from javamuc/gradle-semantic-build-versioning
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
124 lines (102 loc) · 4.89 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
import net.vivin.gradle.versioning.tasks.TagTask
plugins {
id 'com.gradle.plugin-publish' version '0.14.0'
id 'io.alcide.gradle-semantic-build-versioning' apply false
id 'groovy'
id 'maven-publish'
id 'jacoco'
id 'java-gradle-plugin'
}
group 'io.alcide'
tasks.withType(TagTask) {
it.dependsOn publishPlugins
}
publishPlugins.dependsOn build
repositories {
jcenter()
}
sourceCompatibility = 1.8
project.ext.'gradle.publish.key' = System.env.PUBLISH_KEY
project.ext.'gradle.publish.secret' = System.env.PUBLISH_SECRET
sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDir 'src/main/java'
task createPluginClasspathFile {
inputs.files sourceSets.main.runtimeClasspath
outputs.dir "$temporaryDir"
doLast {
file("$temporaryDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n")
}
}
configurations {
jacocoRuntime
}
task createJacocoAgentClasspathFile {
inputs.files configurations.jacocoRuntime
outputs.dir "$temporaryDir"
doLast {
def jacocoAgentClasspathFile = file("$temporaryDir/jacoco-agent-classpath.txt")
jacocoAgentClasspathFile.text = """|${configurations.jacocoRuntime.asPath}
|${test.jacoco.destinationFile.absolutePath}""".stripMargin()
}
}
dependencies {
compile 'org.eclipse.jgit:org.eclipse.jgit:5.11.0.202103091610-r'
testCompile 'org.eclipse.jgit:org.eclipse.jgit.junit:5.11.0.202103091610-r'
testCompile 'org.jmockit:jmockit:1.49'
testCompile('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testRuntime 'cglib:cglib-nodep:3.3.0'
testRuntime 'org.objenesis:objenesis:3.2'
jacocoRuntime "org.jacoco:org.jacoco.agent:$jacoco.toolVersion:runtime"
testRuntime files(createPluginClasspathFile)
testRuntime files(createJacocoAgentClasspathFile)
}
jacocoTestReport {
reports {
xml.enabled true
}
}
// this is useful for better coverage values
// it should not be used for a final production build
if(project.hasProperty('disableGroovyOptimizations')) {
compileGroovy {
inputs.property 'disableGroovyOptimizations', project.hasProperty('disableGroovyOptimizations')
groovyOptions.optimizationOptions.all = false
}
}
test {
if(System.env.CIRCLECI) {
maxHeapSize = '1G'
}
environment 'message', 'test env'
environment 'emptyMessage', ''
jacoco.includes = ['net.vivin.gradle.versioning.*']
finalizedBy jacocoTestReport
doFirst {
delete jacoco.destinationFile
}
}
gradlePlugin {
plugins {
semanticBuildVersioningPlugin {
id = 'io.alcide.gradle-semantic-build-versioning'
implementationClass = 'net.vivin.gradle.versioning.SemanticBuildVersioningPlugin'
}
}
}
pluginBundle {
website = 'https://github.com/alcideio/gradle-semantic-build-versioning'
vcsUrl = 'https://github.com/alcideio/gradle-semantic-build-versioning'
description = 'This is a Gradle settings-plugin that provides support for semantic versioning of builds. It is quite easy to use and extremely configurable. The plugin allows you to bump the major, minor, patch or pre-release version based on the latest version, which is identified from a git tag. It also allows you to bump pre-release versions based on a scheme that you define. The version can be bumped by using version-component-specific project properties or can be bumped automatically based on the contents of a commit message. If no manual bumping is done via commit message or project property, the plugin will increment the version-component with the lowest precedence; this is usually the patch version, but can be the pre-release version if the latest version is a pre-release one. The plugin does its best to ensure that you do not accidentally violate semver rules while generating your versions; in cases where this might happen the plugin forces you to be explicit about violating these rules. As this is a settings plugin, it is applied to settings.gradle and version calculation is therefore performed right at the start of the build, before any projects are configured. This means that the project version is immediately available (almost as if it were set explicitly - which it effectively is), and will never change during the build (barring some other, external task that attempts to modify the version during the build). While the build is running, tagging or changing the project properties will not influence the version that was calculated at the start of the build.'
tags = ['versioning', 'semantic-versioning', 'git', 'build-versioning', 'auto-versioning', 'version']
plugins {
semanticBuildVersioningPlugin {
id = 'io.alcide.gradle-semantic-build-versioning'
displayName = 'Gradle Semantic Build Versioning Plugin'
}
}
}
wrapper {
gradleVersion = '6.8.3'
}