Skip to content

Commit 24ecd14

Browse files
committed
Merge branch 'upgrade-gradle-build-files'
2 parents 6a79389 + 8a5ae26 commit 24ecd14

16 files changed

Lines changed: 345 additions & 78 deletions

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary
12+

build.gradle

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
plugins {
2-
id("java-library")
3-
id "com.github.ben-manes.versions" version "0.52.0"
1+
project.ext {
2+
VERSION_JAVACC = '7.0.13'
3+
DEP_SPOCK_BOM = 'org.spockframework:spock-bom:2.3-groovy-4.0'
44
}
5+
/*
56
project.ext {
67
VERSION_JAVACC = '7.0.13'
78
DEP_SERVLET_API = 'jakarta.servlet:jakarta.servlet-api:6.1.0'
@@ -24,78 +25,12 @@ project.ext {
2425
DEP_RECORD_BUILDER = '48'
2526
DEP_OPEN_REWRITE_BOM = '3.9.0'
2627
}
27-
28-
29-
// ben-manes version-plugin:
30-
def isNonStable = { String version ->
31-
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
32-
def regex = /^[0-9,.v-]+(-r)?$/
33-
return !stableKeyword && !(version ==~ regex)
34-
}
35-
// https://github.com/ben-manes/gradle-versions-plugin
36-
tasks.named("dependencyUpdates").configure {
37-
rejectVersionIf {
38-
isNonStable(it.candidate.version)
39-
}
40-
}
41-
42-
allprojects {
43-
// apply plugin: 'java'
44-
apply plugin: 'groovy'
45-
46-
repositories {
47-
mavenCentral()
48-
}
49-
50-
dependencies {
51-
annotationProcessor "io.soabase.record-builder:record-builder-processor:${DEP_RECORD_BUILDER}"
52-
compileOnly "io.soabase.record-builder:record-builder-core:${DEP_RECORD_BUILDER}"
53-
54-
implementation "org.slf4j:slf4j-api:${DEP_VERSION_SLF4J}"
55-
implementation "org.slf4j:slf4j-simple:${DEP_VERSION_SLF4J}"
56-
testImplementation "org.junit.jupiter:junit-jupiter-api:${DEP_VERSION_JUNIT}"
57-
testImplementation "org.junit.jupiter:junit-jupiter-params:${DEP_VERSION_JUNIT}"
58-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${DEP_VERSION_JUNIT}"
59-
testImplementation "org.assertj:assertj-core:${DEP_VERSION_ASSERTJ}"
60-
testImplementation "org.mockito:mockito-core:${DEP_VERSION_MOCKITO}"
61-
testImplementation "org.mockito:mockito-junit-jupiter:${DEP_VERSION_MOCKITO}"
62-
63-
testImplementation "com.google.jimfs:jimfs:${DEP_VERSION_JIMFS}"
64-
65-
}
66-
67-
java {
68-
toolchain {
69-
languageVersion = JavaLanguageVersion.of(23)
70-
}
71-
}
72-
tasks.withType(JavaCompile).each {
73-
it.options.deprecation = true
74-
//it.options.compilerArgs.add('--enable-preview')
75-
}
76-
77-
task ('copyToLib', type: Copy) {
78-
into('build/_artifacts')
79-
from configurations.compileClasspath
80-
from configurations.default.allArtifacts*.file
81-
from configurations.compileClasspath.allArtifacts*.file
82-
}
83-
84-
task renameJCC(type: Copy, dependsOn: 'copyToLib') {
85-
from("build/_artifacts/javacc-${VERSION_JAVACC}.jar")
86-
into('build/_artifacts')
87-
rename("javacc-${VERSION_JAVACC}.jar", 'javacc.jar')
88-
}
89-
90-
test {
91-
jvmArgs(['--enable-preview'])
92-
useJUnitPlatform {
93-
// includeEngines 'junit-jupiter' // enabling this line causes spock tests not to be executed
94-
}
28+
*/
29+
subprojects {
30+
tasks.withType(Test) {
9531
testLogging {
96-
events /*'passed',*/ 'skipped', 'failed'
32+
events "passed", "skipped", "failed"
33+
exceptionFormat "short"
9734
}
9835
}
9936
}
100-
version = '1.0'
101-

buildSrc/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
3+
id 'groovy-gradle-plugin'
4+
}
5+
6+
repositories {
7+
// Use the plugin portal to apply community plugins in convention plugins.
8+
gradlePluginPortal()
9+
}

buildSrc/settings.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dependencyResolutionManagement {
2+
// Reuse version catalog from the main build.
3+
versionCatalogs {
4+
create('libs', { from(files("../gradle/libs.versions.toml")) })
5+
}
6+
}
7+
8+
rootProject.name = 'buildSrc'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the common convention plugin for shared build configuration between library and application projects.
7+
id 'buildlogic.groovy-common-conventions'
8+
9+
// Apply the application plugin to add support for building a CLI application in Java.
10+
id 'application'
11+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the groovy Plugin to add support for Groovy.
7+
id 'groovy'
8+
}
9+
10+
repositories {
11+
// Use Maven Central for resolving dependencies.
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
constraints {
17+
// Define dependency versions as constraints
18+
implementation 'org.apache.commons:commons-text:1.13.0'
19+
20+
implementation 'org.apache.groovy:groovy-all:4.0.27'
21+
}
22+
23+
// Use the latest Groovy version for building this library
24+
implementation 'org.apache.groovy:groovy-all'
25+
26+
// Use JUnit Jupiter for testing.
27+
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.1'
28+
29+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
30+
}
31+
32+
// Apply a specific Java toolchain to ease working on different environments.
33+
java {
34+
toolchain {
35+
languageVersion = JavaLanguageVersion.of(21)
36+
}
37+
}
38+
39+
tasks.named('test') {
40+
// Use JUnit Platform for unit tests.
41+
useJUnitPlatform()
42+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the common convention plugin for shared build configuration between library and application projects.
7+
id 'buildlogic.groovy-common-conventions'
8+
9+
// Apply the java-library plugin for API and implementation separation.
10+
id 'java-library'
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the common convention plugin for shared build configuration between library and application projects.
7+
id 'buildlogic.java-common-conventions'
8+
9+
// Apply the application plugin to add support for building a CLI application in Java.
10+
id 'application'
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the java Plugin to add support for Java.
7+
id 'java'
8+
}
9+
10+
repositories {
11+
// Use Maven Central for resolving dependencies.
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
constraints {
17+
// Define dependency versions as constraints
18+
implementation 'org.apache.commons:commons-text:1.13.0'
19+
}
20+
21+
// Use JUnit Jupiter for testing.
22+
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.1'
23+
24+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
25+
}
26+
27+
// Apply a specific Java toolchain to ease working on different environments.
28+
java {
29+
toolchain {
30+
languageVersion = JavaLanguageVersion.of(21)
31+
}
32+
}
33+
34+
tasks.named('test') {
35+
// Use JUnit Platform for unit tests.
36+
useJUnitPlatform()
37+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
// Apply the common convention plugin for shared build configuration between library and application projects.
7+
id 'buildlogic.java-common-conventions'
8+
9+
// Apply the java-library plugin for API and implementation separation.
10+
id 'java-library'
11+
}

0 commit comments

Comments
 (0)