-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
151 lines (126 loc) · 4.28 KB
/
build.gradle
File metadata and controls
151 lines (126 loc) · 4.28 KB
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
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'signing'
id 'idea'
id 'checkstyle'
id("com.gradle.plugin-publish") version "2.1.0"
}
def releaseVersion = "0.0.1"
group = "io.github.git-commit-id"
project.gradle.taskGraph.whenReady {
if (gradle.taskGraph.hasTask(":publishAllPublicationsToLocalPluginRepositoryRepository")) {
version = "${releaseVersion}-alpha.local-test"
// Skip signing when we publish to local
tasks.withType(Sign) {
enabled = false
}
} else {
version = "${releaseVersion}"
}
}
repositories {
mavenCentral()
}
ext {
jdkCompileVersion = 11
}
dependencies {
implementation gradleApi()
implementation 'io.github.git-commit-id:git-commit-id-plugin-core:6.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:6.0.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:6.0.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation gradleTestKit()
testImplementation localGroovy()
}
tasks.withType(Test) {
useJUnitPlatform()
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
testLogging {
exceptionFormat = "full"
events "started", "skipped", "passed", "failed"
showStandardStreams = true
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
compileJava {
targetCompatibility = JavaVersion.toVersion("${jdkCompileVersion}")
}
java {
sourceCompatibility = JavaVersion.toVersion("${jdkCompileVersion}")
targetCompatibility = JavaVersion.toVersion("${jdkCompileVersion}")
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of("${jdkCompileVersion}"))
}
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
checkstyle {
toolVersion = '10.10.0'
configProperties = [
"samedir": "${rootProject.file('.github/.checkstyle')}",
"org.checkstyle.google.suppressionfilter.config": "${rootProject.file('.github/.checkstyle/checkstyle-suppressions.xml')}",
]
configFile = rootProject.file('.github/.checkstyle/google_checks_checkstyle_10.10.0.xml')
maxErrors = 0
maxWarnings = 0
showViolations = false
}
signing {
// By default the Signing Plugin uses a Java-based implementation of PGP for signing.
// This implementation cannot use the gpg-agent program for managing private keys, though.
// If you want to use the gpg-agent, you can change the signatory implementation used by the Signing Plugin:
useGpgCmd() // Without this method, gradle will not work with GnuPG keys.
}
publishing {
repositories {
maven {
// ./gradlew publishAllPublicationsToLocalPluginRepositoryRepository
name = "localPluginRepository"
url = "${project.gradle.gradleUserHomeDir}/.local-plugin-repository"
}
}
}
gradlePlugin {
website = "https://github.com/git-commit-id/${rootProject.name}"
vcsUrl = "https://github.com/git-commit-id/${rootProject.name}.git"
plugins {
gitCommitIdPlugin {
id = "${group}.${rootProject.name}"
displayName = "Git Commit ID Gradle Plugin"
description = "Capture comprehensive git repository metadata at build time -- commit ID, branch, tags, and more -- to embed in your artifacts for reproducibility and traceability."
tags.addAll("git", "version", "versioning", "commit", "build-info", "metadata", "reproducibility")
implementationClass = 'io.github.git.commit.id.gradle.plugin.GitCommitIdPlugin'
// https://github.com/gradle/gradle-plugin-compatibility-plugin/blob/main/README.md
// requires publishing plugin v2.1.0+
compatibility {
features {
// Declare the feature supported.
configurationCache = true
}
}
}
}
automatedPublishing = true
}