Skip to content

Commit

Permalink
More updates for 7.0.0-M1 (#170)
Browse files Browse the repository at this point in the history
* build(deps): update Asciidoctor to `4.0.4`

Updated Asciidoctor to `4.0.4`, enabling the removal of the transitive dependency workaround and the Ruby repository configuration.

* chore: add `.sdkmanrc` file

Add an `.sdkmanrc` file to define JDK version for consistent development environment setup.

* fix(deps): use separate version for `grails-gradle-plugin`

* refactor(build): extract common configuration

- Extract java configuration
- Combine test configuration to one file

* build: add `slf4jPreventExclusion` property

This prevents the Grails Gradle Plugin from unnecessarily excluding `slf4j-simple` in the generated POMs (grails/grails-gradle-plugin#222)

* build: use correct notation for BOM inclusion

* build: remove unused/already applied gradle plugins

* build: write better log message

* build: move grails-publish to root build file

* build: cleanup

* build: rephrase log message to be more correct

* ci: adjust environment vars for `grails-publish`
  • Loading branch information
matrei authored Jan 9, 2025
1 parent 3c3116a commit 5fb4d0b
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 119 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ jobs:
- name: "📤 Publish Snapshot"
if: github.event_name == 'push' && steps.build.outcome == 'success' && matrix.java == '17'
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GRADLE_PUBLISH_RELEASE: 'false'
MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }}
run: ./gradlew publish
- name: "✍️ Generate Documentation"
id: docs
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ jobs:
- name: "📤 Publish release artifacts to Sonatype"
id: publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GRAILS_PUBLISH_RELEASE: 'true'
NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }}
NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
run: >
Expand Down
2 changes: 2 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable auto-env through the sdkman_auto_env config - https://sdkman.io/usage#env
java=17.0.13-librca
28 changes: 27 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
version = project.projectVersion
import org.grails.gradle.plugin.publishing.GrailsPublishExtension

buildscript {
repositories {
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
}
}

version = projectVersion

subprojects {
if (name == 'spring-security-ui') {
// This has to be configured here in the rootProject build file: https://github.com/grails/grails-gradle-plugin/issues/364
version = projectVersion
apply plugin: 'org.grails.grails-publish'
extensions.getByType(GrailsPublishExtension).with {
githubSlug = 'grails/grails-spring-security-ui'
license.name = 'Apache-2.0'
title = 'Grails Spring Security UI'
desc = 'The Spring Security UI plugin provides CRUD screens and other user management workflows.'
developers = [burtbeckwith: 'Burt Beckwith']
}
}
}
21 changes: 2 additions & 19 deletions docs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
buildscript {
configurations.classpath {
resolutionStrategy.eachDependency {
if (requested.group == 'com.burgstaller' && requested.name == 'okhttp-digest' && requested.version == '1.10') {
useTarget('io.github.rburgst:okhttp-digest:1.21')
because('Dependency was on Bintray which is no longer available')
}
}
}
repositories {
mavenCentral()
}
}

plugins {
id 'org.asciidoctor.jvm.convert' version '4.0.2'
id 'org.asciidoctor.jvm.gems' version '4.0.2'
id 'org.asciidoctor.jvm.convert' version '4.0.4'
id 'org.asciidoctor.jvm.gems' version '4.0.4'
}

repositories {
mavenCentral()
ruby {
gems()
}
}

def asciidoctorAttributes = [
Expand Down
7 changes: 3 additions & 4 deletions examples/extended/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
}
}

Expand Down Expand Up @@ -53,6 +53,5 @@ dependencies {

}

compileJava.options.release = javaVersion.toInteger()

apply from: rootProject.layout.projectDirectory.file('gradle/integrationTestVerbose.gradle')
apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
7 changes: 3 additions & 4 deletions examples/simple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
}
}

Expand Down Expand Up @@ -48,6 +48,5 @@ dependencies {

}

compileJava.options.release = javaVersion.toInteger()

apply from: rootProject.layout.projectDirectory.file('gradle/integrationTestVerbose.gradle')
apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
projectVersion=5.0.0-SNAPSHOT
grailsVersion=7.0.0-SNAPSHOT
grailsGradlePluginVersion=7.0.0-SNAPSHOT
javaVersion=17

dumbsterVersion=1.6
Expand All @@ -8,6 +9,10 @@ grailsSpringSecurityCoreVersion=7.0.0-SNAPSHOT
hibernateCoreVersion=5.6.15.Final
mailVersion=5.0.0-SNAPSHOT

# This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs
# https://github.com/grails/grails-gradle-plugin/issues/222
slf4jPreventExclusion=true

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
31 changes: 0 additions & 31 deletions gradle/integrationTestVerbose.gradle

This file was deleted.

1 change: 1 addition & 0 deletions gradle/java-config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
compileJava.options.release = javaVersion.toInteger()
35 changes: 35 additions & 0 deletions gradle/test-config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
tasks.withType(Test).configureEach {
useJUnitPlatform()
afterTest { desc, result ->
logger.quiet " -- Executed test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut'
showExceptions true
exceptionFormat 'full'
showCauses true
showStackTraces true

// set options for log level DEBUG and INFO
debug {
events 'started', 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
exceptionFormat 'full'
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
logger.quiet "\n${'-' * repeatLength}\n${startItem}${output}${endItem}\n${'-' * repeatLength}"
}
}

}

tasks.named('integrationTest', Test) {
// options: RECORD_ALL, RECORD_FAILING, SKIP (https://github.com/grails/geb)
systemProperty('grails.geb.recording.mode', 'SKIP')
}
30 changes: 0 additions & 30 deletions gradle/testVerbose.gradle

This file was deleted.

37 changes: 13 additions & 24 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ buildscript {
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-bom:$grailsVersion"
classpath platform("org.grails:grails-bom:$grailsVersion")
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle'
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
}
}

Expand All @@ -14,17 +13,14 @@ group = 'org.grails.plugins'

apply plugin: 'com.bertramlabs.asset-pipeline'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.grails.grails-gsp'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'org.grails.grails-publish'
apply plugin: 'signing'

repositories {
maven { url = 'https://repo.grails.org/grails/core' }
mavenCentral()
if (System.getenv('GITHUB_MAVEN_PASSWORD') && !grailsVersion.endsWith('-SNAPSHOT')) {
logger.lifecycle('Adding Milestone Grails Core Repo for project {}', project.name)
logger.lifecycle('Adding Grails Core Staging Repo for project {}', project.name)
maven {
url = 'https://maven.pkg.github.com/grails/grails-core'
credentials {
Expand All @@ -35,21 +31,10 @@ repositories {
}
}

compileJava.options.release = javaVersion.toInteger()

grailsPublish {
githubSlug = 'grails/grails-spring-security-ui'
license {
name = 'Apache-2.0'
}
title = 'Grails Spring Security UI'
desc = 'The Spring Security UI plugin provides CRUD screens and other user management workflows.'
developers = [burtbeckwith: 'Burt Beckwith']
}

dependencies {

// Needed to compile subclasses of AbstractS2UiDomainController in consuming applications
// Must be on the compileClasspath of consuming applications to
// enable compilation of AbstractS2UiDomainController subclasses.
compileOnlyApi 'org.grails.plugins:converters'

implementation 'org.grails:grails-plugin-controllers'
Expand All @@ -71,16 +56,20 @@ dependencies {
}

tasks.register('copyGspIntoTemplates', Copy) {
from "${layout.projectDirectory}/grails-app/views"
into "${layout.projectDirectory}/src/main/templates/views"
from layout.projectDirectory.dir('grails-app/views')
into layout.projectDirectory.dir('src/main/templates/views')
dependsOn 'copyTemplates', 'processResources'
}

tasks.register('removeGspFromTemplates', Delete) {
delete "${layout.projectDirectory}/src/main/templates/views"
delete layout.projectDirectory.dir('src/main/templates/views')
}

tasks.named('compileAstJava') {
dependsOn 'copyGspIntoTemplates'
}

assets.packagePlugin = true
compileAstJava.dependsOn('copyGspIntoTemplates')

apply from: "${rootProject.projectDir}/gradle/testVerbose.gradle"
apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle')

0 comments on commit 5fb4d0b

Please sign in to comment.