Skip to content

Commit

Permalink
Merge pull request #69 from sbglasius/grails-6.x
Browse files Browse the repository at this point in the history
Grails 6.1.x
  • Loading branch information
sbglasius authored Dec 29, 2023
2 parents 0e99fcb + 9af4e1b commit f21cbd6
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 231 deletions.
40 changes: 15 additions & 25 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,20 @@
name: Run tests in project

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v2
with:
path: ./gradle/
key: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew check
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@ jobs:
GIT_USER_NAME: sbglasius
GIT_USER_EMAIL: [email protected]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
- name: Get latest release version number
java-version: 11
distribution: temurin
- uses: dhkatz/get-version[email protected]
id: get_version
uses: dhkatz/[email protected]
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
- uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Sonatype OSSRH
Expand Down
5 changes: 1 addition & 4 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
java=8.0.392-librca
grails=5.3.5
gradle=7.2
groovy=3.0.8
java=11.0.21-tem
43 changes: 17 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,44 @@
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository

buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
plugins {
id 'java'
id 'groovy'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}

version project.projectVersion

ext {
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
isReleaseVersion = !isBuildSnapshot
}

allprojects {
apply plugin: 'groovy'

version rootProject.version

repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}

java {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}


ext {
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
isReleaseVersion = !isBuildSnapshot
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
useJUnitPlatform()
}

tasks.withType(GroovyCompile) {
tasks.withType(GroovyCompile).configureEach {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
}

}

if (project.isReleaseVersion) {
apply plugin: 'io.github.gradle-nexus.publish-plugin'

nexusPublishing {
repositories {
sonatype {
Expand All @@ -66,12 +56,13 @@ if (project.isReleaseVersion) {
}
}
//do not generate extra load on Nexus with new staging repository if signing fails or if not a release version
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository
tasks.withType(InitializeNexusStagingRepository).configureEach {
onlyIf { isReleaseVersion }
shouldRunAfter(tasks.withType(Sign))
}

tasks.register('snapshotVersion') {
tasks.register('snapshotVersion') {
doLast {
if (!isBuildSnapshot) {
ant.propertyfile(file: "gradle.properties") {
Expand Down
26 changes: 16 additions & 10 deletions external-config/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
group "dk.glasius"
plugins {
id 'java'
id 'groovy'
id 'maven-publish'
id 'signing'
id 'io.spring.dependency-management' version '1.1.4'
}

apply plugin: 'maven-publish'
group "dk.glasius"

sourceCompatibility = "1.8"
targetCompatibility = "1.8"
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

dependencies {
implementation(platform("org.grails:grails-bom:$grailsVersion"))

implementation "org.grails:grails-core"
implementation "org.codehaus.groovy:groovy-yaml:${groovyVersion}"

implementation "io.micronaut:micronaut-core"
implementation "io.micronaut:micronaut-inject"
Expand All @@ -19,15 +28,12 @@ dependencies {
runtimeOnly 'org.yaml:snakeyaml:2.2'
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
systemProperty 'TEST_HOME', 'home-value'
systemProperty 'user.home', System.getProperty('user.home')
systemProperty 'grails.env', 'TEST'
}

apply plugin: 'maven-publish'
apply plugin: 'signing'

java {
withSourcesJar()
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class ExternalConfigRunListener implements SpringApplicationRunListener {
private ResourceLoader defaultResourceLoader = new DefaultResourceLoader()
private YamlPropertySourceLoader yamlPropertySourceLoader = new YamlPropertySourceLoader()
private PropertiesPropertySourceLoader propertiesPropertySourceLoader = new PropertiesPropertySourceLoader()

private String userHome = System.properties.getProperty('user.home')
private String separator = System.properties.getProperty('file.separator')

Expand Down Expand Up @@ -112,7 +111,6 @@ class ExternalConfigRunListener implements SpringApplicationRunListener {
} catch (FileNotFoundException ignore) {
return null
}

}
}
return null
Expand Down Expand Up @@ -166,22 +164,22 @@ class ExternalConfigRunListener implements SpringApplicationRunListener {
List<String> sources = System.getProperty('micronaut.config.files', System.getenv('MICRONAUT_CONFIG_FILES') ?: '').tokenize(',')
sources.addAll(newSources.collect { it.toString() })
sources = filterMissingMicronautLocations(sources)
log.debug("---> Setting 'micronaut.config.files' to ${sources.join(',')}")
System.setProperty('micronaut.config.files', sources.join(',') )
log.debug("Setting 'micronaut.config.files' to ${sources.join(',')}")
System.setProperty('micronaut.config.files', sources.join(','))
}

private List<String> filterMissingMicronautLocations(List<String> sources) {
sources.findAll { String location ->
try {
def resource = defaultResourceLoader.getResource(location)
if (!resource.exists()) {
log.debug("Configuration file ${location} not found, ignoring.")
return false
}
} catch (FileNotFoundException ignore) {
try {
def resource = defaultResourceLoader.getResource(location)
if (!resource.exists()) {
log.debug("Configuration file ${location} not found, ignoring.")
return false
}
} catch (FileNotFoundException ignore) {
log.debug("Configuration file ${location} not found, ignoring.")
return false
}
true
}
}
Expand Down
2 changes: 0 additions & 2 deletions external-config/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
<appender-ref ref="STDOUT"/>
</root>
<logger name="grails.plugin.externalconfig" level="DEBUG"/>
<logger name="io.micronaut.context" level="DEBUG"/>
<logger name="io.micronaut.context.env" level="TRACE"/>
</configuration>
12 changes: 5 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#Thu, 28 Dec 2023 10:38:29 +0100
grailsVersion=5.3.5
grailsGradlePluginVersion=5.2.3
#Thu, 01 Sep 2022 14:38:14 +0000
grailsVersion=6.1.1
grailsGradlePluginVersion=6.1.0
groovyVersion=3.0.11
projectVersion=3.2.0
version=4.0.0
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding\=UTF-8 -Xmx1024M

version=3.2.1-SNAPSHOT
org.gradle.jvmArgs=-Dfile.encoding\=UTF-8 -Xmx1024M
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit f21cbd6

Please sign in to comment.