-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
136 lines (113 loc) · 3.72 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
125
126
127
128
129
130
131
132
133
134
135
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'signing'
id 'idea'
id 'checkstyle'
id("com.gradle.plugin-publish") version "1.2.2"
}
group = "io.github.git-commit-id"
project.gradle.taskGraph.whenReady {
if (gradle.taskGraph.hasTask(":publishAllPublicationsToLocalPluginRepositoryRepository")) {
version = "0.0.1-alpha"
// Skip signing when we publish to local
tasks.withType(Sign) {
enabled = false
}
} else {
version = "0.0.1-beta"
}
}
repositories {
mavenCentral()
}
ext {
jdkCompileVersion = 11
}
dependencies {
implementation gradleApi()
implementation 'io.github.git-commit-id:git-commit-id-plugin-core:6.0.0-rc.9'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0'
testImplementation gradleTestKit()
testImplementation localGroovy()
}
tasks.withType(Test) {
useJUnitPlatform()
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 = "Plugin to make basic git repository information available in the gradle world."
description = "A plugin that helps you to extract valuable information from your git repository that can be included in your final artifact for reproducability."
tags.addAll("git", "gradle-plugin", "versioning")
implementationClass = 'io.github.git.commit.id.gradle.plugin.GitCommitIdPlugin'
}
}
automatedPublishing = true
}