Skip to content

Commit 4de9b64

Browse files
authored
Update and cleanup build (#97)
* fix(deps): update and cleanup build - Remove buildSrc - Remove pluginManagement - Update dependencies - Use Groovy provided by Gradle for documentation generation - Set `grails-core` dependency as provided - Remove redundant `assets` config - Remove redundant Gradle plugins - Use Groovy style in build files - Set `grailsCentral` as the first dependency repository - Move `sourceCompatibility` inside java config block (target is inherited) - Add `textFixtures` sources to `groovydoc` generation - Add `slf4j-nop` to clear compile warning - Move all versions to `gradle.properties` - Change to proper exclusions for `geb-spock` dependency - Override `selenium` version set by `spring-boot-dependencies` * ci: add develocity gradle plugins for build scans and remote cache * ci: add build scan tags * test: set the correct `grails-gradle-plugin` version in the test app * build: clarify and refactor documentation configuration registration Refactored the registration logic for documentation configuration to enhance readability and make the purpose of the code clearer. This change improves maintainability and reduces potential confusion. * chore: remove explicit `bootJar` task disabling The grails-gradle-plugin now handles this functionality, so the explicit disabling is no longer necessary. * chore: cleanup
1 parent ef0d5ae commit 4de9b64

File tree

7 files changed

+140
-99
lines changed

7 files changed

+140
-99
lines changed

build.gradle

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
plugins {
11-
id 'com.github.ben-manes.versions' version '0.39.0'
11+
id 'com.github.ben-manes.versions' version '0.51.0'
1212
}
1313

1414
version = projectVersion
@@ -20,34 +20,34 @@ apply plugin: 'org.grails.grails-plugin'
2020
apply plugin: 'org.grails.internal.grails-plugin-publish'
2121
apply plugin: 'maven-publish'
2222

23-
sourceCompatibility = 11
24-
targetCompatibility = 11
25-
2623
repositories {
27-
maven { url "https://repo.grails.org/grails/core" }
24+
maven { url = 'https://repo.grails.org/grails/core' }
2825
}
2926

30-
configurations {
31-
documentation.extendsFrom compileClasspath
32-
}
27+
configurations.register('documentation')
28+
29+
ext.set('selenium.version', seleniumVersion) // Override selenium version from spring-boot-dependencies
3330

3431
dependencies {
35-
api "org.grails:grails-core:$grailsVersion"
32+
33+
compileOnly "org.grails:grails-core:$grailsVersion" // Provided, as this is a Grails plugin
3634

3735
testFixturesApi "org.gebish:geb-spock:$gebVersion", {
38-
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
39-
exclude group: 'org.seleniumhq.selenium', module: 'selenium-api'
36+
exclude group: 'org.codehaus.groovy', module: 'groovy' // Provided by Grails
4037
}
41-
testFixturesApi 'org.grails:grails-testing-support:3.0.0'
42-
testFixturesApi 'org.grails:grails-datastore-gorm:8.0.0'
38+
testFixturesApi "org.grails:grails-testing-support:$grailsTestingSupportVersion"
39+
testFixturesApi "org.grails:grails-datastore-gorm:$gormVersion"
4340
testFixturesApi "org.testcontainers:selenium:$testcontainersVersion"
4441
testFixturesApi "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
4542
testFixturesApi "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
4643

47-
documentation "org.codehaus.groovy:groovy:$groovyVersion"
48-
documentation "org.codehaus.groovy:groovy-ant:$groovyVersion"
49-
documentation "org.codehaus.groovy:groovy-templates:$groovyVersion"
50-
documentation "com.github.javaparser:javaparser-core:3.15.14"
44+
testFixturesCompileOnly "org.slf4j:slf4j-nop:$slf4jVersion" // Remove warning about missing slf4j binding during compilation
45+
46+
documentation "org.codehaus.groovy:groovy:$GroovySystem.version"
47+
documentation "org.codehaus.groovy:groovy-ant:$GroovySystem.version"
48+
documentation "org.codehaus.groovy:groovy-templates:$GroovySystem.version"
49+
documentation "org.codehaus.groovy:groovy-xml:$GroovySystem.version"
50+
documentation "com.github.javaparser:javaparser-core:$javaparserVersion"
5151
}
5252

5353

@@ -72,6 +72,7 @@ tasks.withType(Groovydoc).configureEach {
7272
destinationDir = layout.buildDirectory.dir('docs/api').get().asFile
7373
docTitle = "Grails Geb Plugin ${version}"
7474
classpath = configurations.documentation
75+
source = files(source, sourceSets.testFixtures.allSource)
7576
}
7677

7778
tasks.withType(Test).configureEach {
@@ -85,6 +86,9 @@ tasks.withType(Test).configureEach {
8586
}
8687
}
8788

88-
tasks.named('bootJar') { enabled = false }
89+
java {
90+
sourceCompatibility = JavaVersion.VERSION_11
91+
}
92+
8993
tasks.named('bootRun') { enabled = false }
9094
tasks.named('findMainClass') { enabled = false }

gradle.properties

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
projectVersion=4.1.0-SNAPSHOT
2-
grailsVersion=6.0.0
3-
grailsGradlePluginVersion=6.0.0
4-
groovyVersion=3.0.11
5-
gebVersion=5.1
6-
seleniumVersion=4.1.4
7-
testcontainersVersion=1.20.2
2+
3+
grailsVersion=6.2.2
4+
gebVersion=6.0
5+
grailsGradlePluginVersion=6.2.3
6+
grailsTestingSupportVersion=3.2.2
7+
gormVersion=8.1.2
8+
javaparserVersion=3.26.2
9+
seleniumVersion=4.27.0
10+
slf4jVersion=1.7.36
11+
testcontainersVersion=1.20.4
812

913
org.gradle.parallel=true
1014
org.gradle.caching=true

settings.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1+
plugins {
2+
id 'com.gradle.develocity' version '3.18.2'
3+
id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2'
4+
}
5+
6+
def isCI = System.getenv('CI') != null
7+
def isLocal = !isCI
8+
def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null
9+
10+
develocity {
11+
server = 'https://ge.grails.org'
12+
buildScan {
13+
tag('grails')
14+
tag('grails/geb')
15+
publishing.onlyIf { isAuthenticated }
16+
uploadInBackground = isLocal
17+
}
18+
}
19+
20+
buildCache {
21+
local { enabled = isLocal }
22+
remote(develocity.buildCache) {
23+
push = isCI && isAuthenticated
24+
enabled = true
25+
}
26+
}
27+
128
rootProject.name = 'geb'

spock-container-test-app/build.gradle

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,66 @@
1-
plugins {
2-
id "groovy"
3-
id "org.grails.grails-web"
4-
id "org.grails.grails-gsp"
5-
id "war"
6-
id "idea"
7-
id "com.bertramlabs.asset-pipeline"
8-
id "eclipse"
1+
buildscript {
2+
repositories {
3+
maven { url = 'https://repo.grails.org/grails/core' }
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:$assetPipelineVersion"
8+
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
9+
}
910
}
1011

11-
group = "org.demo.spock"
12+
apply plugin: 'groovy'
13+
apply plugin: 'org.grails.grails-web'
14+
apply plugin: 'org.grails.grails-gsp'
15+
apply plugin: 'com.bertramlabs.asset-pipeline'
16+
17+
group = 'org.demo.spock'
1218

1319
repositories {
20+
maven { url = 'https://repo.grails.org/grails/core' }
1421
mavenCentral()
15-
maven { url "https://repo.grails.org/grails/core/" }
16-
maven { url "https://repository.apache.org/content/repositories/snapshots"}
1722
}
1823

1924
dependencies {
20-
implementation("org.grails:grails-core")
21-
implementation("org.grails:grails-logging")
22-
implementation("org.grails:grails-plugin-databinding")
23-
implementation("org.grails:grails-plugin-i18n")
24-
implementation("org.grails:grails-plugin-interceptors")
25-
implementation("org.grails:grails-plugin-rest")
26-
implementation("org.grails:grails-plugin-services")
27-
implementation("org.grails:grails-plugin-url-mappings")
28-
implementation("org.grails:grails-web-boot")
29-
implementation("org.grails.plugins:gsp")
30-
implementation("org.grails.plugins:hibernate5")
31-
implementation("org.grails.plugins:scaffolding")
32-
implementation("org.hibernate:hibernate-core:5.6.15.Final")
33-
implementation("org.springframework.boot:spring-boot-autoconfigure")
34-
implementation("org.springframework.boot:spring-boot-starter")
35-
implementation("org.springframework.boot:spring-boot-starter-actuator")
36-
implementation("org.springframework.boot:spring-boot-starter-logging")
37-
implementation("org.springframework.boot:spring-boot-starter-tomcat")
38-
implementation("org.springframework.boot:spring-boot-starter-validation")
39-
compileOnly("io.micronaut:micronaut-inject-groovy")
40-
console("org.grails:grails-console")
41-
runtimeOnly("com.bertramlabs.plugins:asset-pipeline-grails:4.3.0")
42-
runtimeOnly("com.h2database:h2")
43-
runtimeOnly("javax.xml.bind:jaxb-api:2.3.1")
44-
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
45-
runtimeOnly("org.fusesource.jansi:jansi:1.18")
46-
runtimeOnly("org.glassfish.web:el-impl:2.2.1-b05")
47-
testImplementation("io.micronaut:micronaut-inject-groovy")
48-
testImplementation("org.grails:grails-gorm-testing-support")
49-
testImplementation("org.grails:grails-web-testing-support")
50-
testImplementation("org.grails.plugins:geb")
51-
testImplementation("org.spockframework:spock-core")
52-
testImplementation("io.micronaut:micronaut-http-client")
25+
26+
implementation 'org.grails:grails-core'
27+
implementation 'org.grails:grails-logging'
28+
implementation 'org.grails:grails-plugin-databinding'
29+
implementation 'org.grails:grails-plugin-i18n'
30+
implementation 'org.grails:grails-plugin-interceptors'
31+
implementation 'org.grails:grails-plugin-rest'
32+
implementation 'org.grails:grails-plugin-services'
33+
implementation 'org.grails:grails-plugin-url-mappings'
34+
implementation 'org.grails:grails-web-boot'
35+
implementation 'org.grails.plugins:gsp'
36+
implementation 'org.grails.plugins:hibernate5'
37+
implementation 'org.grails.plugins:scaffolding'
38+
implementation 'org.springframework.boot:spring-boot-autoconfigure'
39+
implementation 'org.springframework.boot:spring-boot-starter'
40+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
41+
implementation 'org.springframework.boot:spring-boot-starter-logging'
42+
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
43+
implementation 'org.springframework.boot:spring-boot-starter-validation'
44+
45+
compileOnly 'io.micronaut:micronaut-inject-groovy'
46+
47+
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineVersion"
48+
runtimeOnly 'com.h2database:h2'
49+
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
50+
runtimeOnly 'org.fusesource.jansi:jansi:1.18'
51+
52+
testImplementation 'org.grails:grails-gorm-testing-support'
53+
testImplementation 'org.grails:grails-web-testing-support'
54+
testImplementation 'org.spockframework:spock-core'
5355

5456
integrationTestImplementation testFixtures(project(':geb'))
5557
}
5658

57-
sourceCompatibility = 1.11
58-
targetCompatibility = 1.11
59+
java {
60+
sourceCompatibility = JavaVersion.VERSION_11
61+
}
5962

60-
tasks.withType(Test) {
63+
tasks.withType(Test).configureEach {
6164
useJUnitPlatform()
62-
systemProperty 'grails.geb.recording.mode', 'RECORD_ALL'
63-
}
64-
assets {
65-
minifyJs = true
66-
minifyCss = true
67-
}
65+
systemProperty('grails.geb.recording.mode', 'RECORD_ALL')
66+
}

spock-container-test-app/buildSrc/build.gradle

Lines changed: 0 additions & 10 deletions
This file was deleted.

spock-container-test-app/gradle.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
grailsVersion=6.0.0
2-
grailsGradlePluginVersion=6.0.0
31
version=0.1
2+
3+
grailsVersion=6.2.2
4+
grailsGradlePluginVersion=6.2.3
5+
assetPipelineVersion=4.5.2
6+
47
org.gradle.caching=true
58
org.gradle.daemon=true
69
org.gradle.parallel=true
Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
1+
plugins {
2+
id 'com.gradle.develocity' version '3.18.2'
3+
id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2'
4+
}
5+
6+
def isCI = System.getenv('CI') != null
7+
def isLocal = !isCI
8+
def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null
19

2-
pluginManagement {
3-
repositories {
4-
mavenLocal()
5-
maven { url "https://repo.grails.org/grails/core/" }
6-
gradlePluginPortal()
10+
develocity {
11+
server = 'https://ge.grails.org'
12+
buildScan {
13+
tag('grails')
14+
tag('grails/geb')
15+
publishing.onlyIf { isAuthenticated }
16+
uploadInBackground = isLocal
717
}
8-
plugins {
9-
id "org.grails.grails-web" version "6.0.0"
10-
id "org.grails.grails-gsp" version "6.0.0"
18+
}
19+
20+
buildCache {
21+
local { enabled = isLocal }
22+
remote(develocity.buildCache) {
23+
push = isCI && isAuthenticated
24+
enabled = true
1125
}
1226
}
1327

14-
rootProject.name="spock-container-test-app"
15-
include 'geb'
28+
rootProject.name = 'spock-container-test-app'
1629

30+
include 'geb'
1731
project(':geb').projectDir = file('..')

0 commit comments

Comments
 (0)