|
1 |
| -import nl.javadude.gradle.plugins.license.LicensePlugin |
2 |
| -import org.checkerframework.gradle.plugin.CheckerFrameworkPlugin |
3 |
| -import java.util.* |
4 |
| - |
5 | 1 | plugins {
|
6 |
| - java |
7 |
| - `java-library` |
8 |
| - `maven-publish` |
9 |
| - checkstyle |
10 |
| - jacoco |
11 |
| - id("com.github.hierynomus.license") version "0.16.1" |
12 |
| - id("org.checkerframework") version "0.5.22" |
13 |
| -} |
14 |
| - |
15 |
| -allprojects { |
16 |
| - group = "net.kyori.moonshine" |
17 |
| - version = "2.0.0-SNAPSHOT" |
18 |
| -} |
19 |
| - |
20 |
| -subprojects { |
21 |
| - apply { |
22 |
| - plugin<JavaPlugin>() |
23 |
| - plugin<JavaLibraryPlugin>() |
24 |
| - plugin<MavenPublishPlugin>() |
25 |
| - plugin<CheckstylePlugin>() |
26 |
| - plugin<JacocoPlugin>() |
27 |
| - plugin<LicensePlugin>() |
28 |
| - plugin<CheckerFrameworkPlugin>() |
29 |
| - } |
30 |
| - |
31 |
| - dependencies { |
32 |
| - api("io.leangen.geantyref:geantyref:1.3.11") |
33 |
| - |
34 |
| - testImplementation("org.junit.jupiter:junit-jupiter:5.+") |
35 |
| - testImplementation("org.assertj:assertj-core:3.+") |
36 |
| - testImplementation("org.mockito:mockito-junit-jupiter:3.+") |
37 |
| - } |
38 |
| - |
39 |
| - tasks { |
40 |
| - test { |
41 |
| - useJUnitPlatform() |
42 |
| - dependsOn(checkstyleMain, checkstyleTest) |
43 |
| - if (!System.getenv("CI").toBoolean()) { |
44 |
| - dependsOn(licenseFormat) |
45 |
| - } |
46 |
| - dependsOn(licenseMain, licenseTest) |
47 |
| - finalizedBy(jacocoTestReport) |
48 |
| - } |
49 |
| - |
50 |
| - jacocoTestReport { |
51 |
| - dependsOn(test) |
52 |
| - reports { |
53 |
| - xml.required.set(true) |
54 |
| - html.required.set(true) |
55 |
| - csv.required.set(false) |
56 |
| - } |
57 |
| - } |
58 |
| - |
59 |
| - javadoc { |
60 |
| - val opt = options as StandardJavadocDocletOptions |
61 |
| - opt.addStringOption("Xdoclint:none", "-quiet") |
62 |
| - |
63 |
| - opt.encoding("UTF-8") |
64 |
| - opt.charSet("UTF-8") |
65 |
| - opt.source("8") |
66 |
| - doFirst { |
67 |
| - opt.links( |
68 |
| - "https://docs.oracle.com/javase/8/docs/api/" |
69 |
| - ) |
70 |
| - } |
71 |
| - } |
72 |
| - } |
| 2 | + id("moonshine.publishing") |
73 | 3 | }
|
74 | 4 |
|
75 |
| -// These are some options that either won't apply to rootProject, or |
76 |
| -// will be nice to have to disable potential warnings and errors. |
77 |
| -allprojects { |
78 |
| - repositories { |
79 |
| - mavenCentral() |
80 |
| - } |
81 |
| - |
82 |
| - extensions.configure(JavaPluginExtension::class) { |
83 |
| - sourceCompatibility = JavaVersion.VERSION_1_8 |
84 |
| - targetCompatibility = sourceCompatibility |
85 |
| - disableAutoTargetJvm() |
86 |
| - } |
87 |
| - |
88 |
| - license { |
89 |
| - header = rootProject.file("LICENCE-HEADER") |
90 |
| - ext["year"] = Calendar.getInstance().get(Calendar.YEAR) |
91 |
| - include("**/*.java") |
92 |
| - |
93 |
| - mapping("java", "DOUBLESLASH_STYLE") |
94 |
| - } |
95 |
| - |
96 |
| - checkstyle { |
97 |
| - toolVersion = "8.44" |
98 |
| - val configRoot = rootProject.projectDir.resolve(".checkstyle") |
99 |
| - configDirectory.set(configRoot) |
100 |
| - configProperties["basedir"] = configRoot.absolutePath |
101 |
| - } |
102 |
| - |
103 |
| - jacoco { |
104 |
| - reportsDirectory.set(rootProject.buildDir.resolve("reports").resolve("jacoco")) |
105 |
| - } |
106 |
| - |
107 |
| - java { |
108 |
| - withSourcesJar() |
109 |
| - withJavadocJar() |
110 |
| - } |
111 |
| - |
112 |
| - tasks { |
113 |
| - compileJava { |
114 |
| - options.compilerArgs.add("-parameters") |
115 |
| - } |
116 |
| - |
117 |
| - compileTestJava { |
118 |
| - options.compilerArgs.add("-parameters") |
119 |
| - sourceCompatibility = "11" |
120 |
| - targetCompatibility = sourceCompatibility |
121 |
| - } |
122 |
| - } |
123 |
| - |
124 |
| - publishing { |
125 |
| - publications { |
126 |
| - create<MavenPublication>("maven") { |
127 |
| - from(components["java"]) |
128 |
| - } |
129 |
| - } |
130 |
| - |
131 |
| - repositories { |
132 |
| - maven { |
133 |
| - name = "proxi-nexus" |
134 |
| - val repo = if (project.version.toString().endsWith("-SNAPSHOT")) { |
135 |
| - "snapshots" |
136 |
| - } else { |
137 |
| - "releases" |
138 |
| - } |
139 |
| - url = uri("https://nexus.mardroemmar.dev/repository/maven-$repo/") |
140 |
| - credentials { |
141 |
| - val proxiUser: String? by project |
142 |
| - val proxiPassword: String? by project |
143 |
| - username = proxiUser |
144 |
| - password = proxiPassword |
145 |
| - } |
146 |
| - } |
147 |
| - } |
148 |
| - } |
149 |
| -} |
150 |
| - |
151 |
| -tasks { |
152 |
| - test { |
153 |
| - finalizedBy(jacocoTestReport) |
154 |
| - } |
155 |
| - |
156 |
| - jacocoTestReport { |
157 |
| - dependsOn(allprojects.map { it.tasks.test }) |
158 |
| - |
159 |
| - additionalSourceDirs(files(subprojects.map { it.sourceSets.main.get().allSource.srcDirs })) |
160 |
| - additionalClassDirs(files(subprojects.map { it.sourceSets.main.get().output })) |
161 |
| - executionData.setFrom(files( |
162 |
| - subprojects.flatMap { it.tasks.jacocoTestReport.map { it.executionData }.get() } |
163 |
| - .filter { it.exists() } |
164 |
| - )) |
165 |
| - |
166 |
| - reports { |
167 |
| - xml.required.set(true) |
168 |
| - html.required.set(true) |
169 |
| - csv.required.set(false) |
170 |
| - } |
171 |
| - } |
172 |
| -} |
| 5 | +group = "net.kyori.moonshine" |
| 6 | +version = "2.0.0-SNAPSHOT" |
0 commit comments