forked from square/javapoet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
146 lines (128 loc) · 4.17 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
136
137
138
139
140
141
142
143
144
145
146
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "net.ltgt.errorprone" version "3.1.0"
id "checkstyle"
}
group v_groupId
version v_version
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// RUNTIME **************************
// TESTS **************************
// JUnit 4
testImplementation "junit:junit:$junitVersion"
testImplementation "com.google.testing.compile:compile-testing:$compileTestingVersion"
testImplementation "com.google.truth:truth:$compileTestingVersion"
testImplementation "com.google.jimfs:jimfs:1.2"
testImplementation "org.mockito:mockito-core:4.11.0"
testImplementation "org.eclipse.jdt.core.compiler:ecj:4.6.1"
errorprone "com.google.errorprone:error_prone_core:2.19.1"
checkstyle 'com.puppycrawl.tools:checkstyle:8.18'
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/" + v_repository)
credentials {
username = System.getenv("USERNAME")
password = System.getenv("GH_PACKAGES_UPLOAD_TOKEN")
}
}
maven {
name = "Sonatype"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
publications {
gpr(MavenPublication) {
groupId = v_groupId
artifactId = v_artifactId
version = v_version
from components.java
pom {
name = v_artifactId
description = 'Use beautiful Java code to generate beautiful Java code.'
url = "https://github.com/" + v_repository
// properties = [
// myProp : "value",
// "prop.with.dots": "anotherValue"
// ]
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = v_developerId
name = v_developerName
email = v_developerEmail
organization = v_org
organizationUrl = v_url
}
}
scm {
connection = "scm:git:git://github.com/" + v_repository + ".git"
developerConnection = "scm:git:ssh://github.com/" + v_repository + ".git"
url = "http://github.com/" + v_repository
}
}
}
}
}
signing {
sign publishing.publications.gpr
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaExec).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
checkstyle {
toolVersion "8.17"
configFile = file("${projectDir}/checkstyle.xml")
ignoreFailures = true
}
tasks.withType(Checkstyle).configureEach {
exclude("**/module-info.java")
}
tasks.withType(Test) {
systemProperty "file.encoding", "utf-8"
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(Javadoc).configureEach {
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(17)
}
failOnError false
options.addBooleanOption('html5', true)
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
options.addBooleanOption('-ignore-source-errors', true)
options.addStringOption('Xdoclint:none', '-quiet')
}