Skip to content

Commit

Permalink
Merge pull request #13713 from jdaugherty/6.2.x
Browse files Browse the repository at this point in the history
Merge Missing Changes from 6.1.x into 6.2.x
  • Loading branch information
jdaugherty authored Oct 2, 2024
2 parents 333f0ab + e43ceee commit 83a9ee9
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 149 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ jobs:
uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build groovydoc
publish:
Expand All @@ -55,8 +53,6 @@ jobs:
uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/groovy-joint-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ jobs:
- name: Checkout Groovy 3_0_X (Grails 5 and later)
if: startsWith(github.ref, 'refs/heads/6.') || startsWith(github.base_ref, '6.') || startsWith(github.ref, 'refs/heads/5.') || startsWith(github.base_ref, '5.')
run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_3_0_X --single-branch
- name: Set CI_GROOVY_VERSION for Grails
- name: Get Groovy version for Grails
id: groovy-version
run: |
cd ../groovy
echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
- name: Prepare GE Set-up Configuration
id: ge_conf
Expand Down Expand Up @@ -130,7 +129,7 @@ jobs:
distribution: 'adopt'
java-version: '11'
- name: Cache local Maven repository & Groovy
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
path: |
~/groovy
Expand All @@ -143,10 +142,11 @@ jobs:
id: build_grails
uses: gradle/gradle-build-action@29c0906b64b8fc82467890bfb7a0a7ef34bda89e # v3
env:
ORG_GRADLE_PROJECT_groovyVersion: ${{ needs.build_groovy.outputs.groovyVersion }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: |
build
-x groovydoc
-x groovydoc
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
- name: Upload Distribution
if: success()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: grails-${{ steps.release_version.outputs.value }}.zip
path: build/distributions/grails-${{ steps.release_version.outputs.value }}.zip
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/retry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ jobs:
arguments: assemble
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
- name: Upload artifacts to the Github release
id: upload_artifact
if: steps.assemble.outcome == 'success'
Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ext {
// When making changes in the dependencyVersions, remember to also update the Grails BOM Documentation:
// https://docs.grails.org/snapshot/ref/Dependency%20Versions/Grails%20BOM.html
dependencyVersions = [
'fieldsPlugin' : [version: feildsPluginVersion,
'fieldsPlugin' : [version: fieldsPluginVersion,
group : 'org.grails.plugins',
names : ['fields'],
modules: ['']
Expand Down Expand Up @@ -220,14 +220,14 @@ if (isReleaseVersion) {

allprojects {
repositories {
mavenLocal()
mavenLocal() // Used by the Groovy Joint Validation Github workflow after building groovy locally in CI
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://repo.grails.org/grails/core" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
if (groovyVersion.endsWith('-SNAPSHOT')) {
maven {
name 'JFrog OSS snapshot repo'
url 'https://oss.jfrog.org/oss-snapshot-local/'
maven { // Used for testing with Groovy snapshots locally
name = 'Groovy Snapshot repository'
url = 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/'
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cglibVersion=2.2.2
commonsLangVersion=2.6
datastoreVersion=8.1.2
directoryWatcherVersion=0.9.9
feildsPluginVersion=5.1.0-SNAPSHOT
fieldsPluginVersion=5.1.0-SNAPSHOT
gdocEngineVersion=1.0.1
gradleNexusPluginVersion=2.3.1
gradleNexusStagingPluginVersion=0.12.0
Expand Down Expand Up @@ -42,6 +42,7 @@ spockVersion=2.1-groovy-3.0
springBootVersion=2.7.18
springLoadedVersion=1.2.8.RELEASE
springVersion=5.3.39
spring.version=5.3.39
testingSupportVersion=3.2.1
testingSupportVersionForTests=3.2.2
tomcatLog4jVersion=8.5.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,10 @@ class GrailsApplicationPostProcessor implements BeanDefinitionRegistryPostProces

GrailsApplicationPostProcessor(GrailsApplicationLifeCycle lifeCycle, ApplicationContext applicationContext, Class...classes) {
this.lifeCycle = lifeCycle
if(lifeCycle instanceof GrailsApplicationClass) {
this.applicationClass = (GrailsApplicationClass)lifeCycle
}
else {
this.applicationClass = null
}
this.classes = classes != null ? classes : [] as Class[]
grailsApplication = applicationClass != null ? new DefaultGrailsApplication(applicationClass) : new DefaultGrailsApplication()
pluginManager = new DefaultGrailsPluginManager(grailsApplication)
this.applicationClass = lifeCycle instanceof GrailsApplicationClass ? (GrailsApplicationClass) lifeCycle : null
this.classes = classes ?: [] as Class[]
this.grailsApplication = applicationClass ? new DefaultGrailsApplication(applicationClass) : new DefaultGrailsApplication()
this.pluginManager = applicationContext?.getBeanNamesForType(GrailsPluginManager) ? applicationContext.getBean(GrailsPluginManager) : new DefaultGrailsPluginManager(grailsApplication)
if(applicationContext != null) {
setApplicationContext(applicationContext)
}
Expand Down Expand Up @@ -290,30 +285,22 @@ class GrailsApplicationPostProcessor implements BeanDefinitionRegistryPostProces
}
}

@SuppressWarnings("GrMethodMayBeStatic")
private void loadPluginConfigurationsToMicronautContext(ConfigurableApplicationContext applicationContext) {
String[] beanNames = applicationContext.getBeanNamesForType(GrailsPluginManager)
if (beanNames.length == 0) {
// do not continue if PluginManager is not available
ConfigurableApplicationContext parentApplicationContext = (ConfigurableApplicationContext) applicationContext.parent
if (!parentApplicationContext) {
// No Micronaut parent context, return early
return
}

GrailsPluginManager pluginManager = applicationContext.getBean(GrailsPluginManager)
ConfigurableApplicationContext parentApplicationContext = (ConfigurableApplicationContext) applicationContext.parent
ConfigurableEnvironment parentContextEnv = parentApplicationContext.getEnvironment()
if (parentContextEnv instanceof MicronautEnvironment) {
if (log.isDebugEnabled()) {
log.debug("Loading configurations from the plugins to the parent Micronaut context")
}
log.debug('Loading configurations from the plugins to the parent Micronaut context')
final io.micronaut.context.env.Environment micronautEnv = ((io.micronaut.context.env.Environment) parentContextEnv.getEnvironment())
final GrailsPlugin[] plugins = pluginManager.allPlugins
Integer priority = AbstractPropertySourceLoader.DEFAULT_POSITION
Arrays.stream(plugins)
.filter({ GrailsPlugin plugin -> plugin.propertySource != null })
.forEach({ GrailsPlugin plugin ->
if (log.isDebugEnabled()) {
log.debug("Loading configurations from {} plugin to the parent Micronaut context", plugin.name)
}
log.debug('Loading configurations from {} plugin to the parent Micronaut context', plugin.name)
micronautEnv.addPropertySource(PropertySource.of("grails.plugins.$plugin.name", (Map) plugin.propertySource.source, --priority))
})
micronautEnv.refresh()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package org.grails.plugins

import grails.boot.config.GrailsAutoConfiguration
import grails.core.DefaultGrailsApplication
import grails.core.GrailsApplication
import grails.plugins.GrailsPlugin
import grails.plugins.GrailsPluginManager
import groovy.transform.CompileStatic
import org.grails.plugins.DefaultGrailsPlugin
import org.grails.plugins.MockGrailsPluginManager
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.io.FileSystemResource
Expand All @@ -24,17 +21,17 @@ class GrailsPluginConfigurationClass extends GrailsAutoConfiguration {

@Bean(name = "grailsPluginManager")
GrailsPluginManager getGrailsPluginManager() {
String tempDir = System.getProperty("java.io.tmpdir")
GrailsApplication grailsApplication = new DefaultGrailsApplication()
final MockGrailsPluginManager pluginManager = new MockGrailsPluginManager(grailsApplication)
final List<DefaultGrailsPlugin> plugins = createGrailsPlugins(grailsApplication)
plugins.forEach({ plugin -> pluginManager.registerMockPlugin((GrailsPlugin) plugin)})
return pluginManager
MockGrailsPluginManager pluginManager = new MockGrailsPluginManager()
createGrailsPlugins(pluginManager.application).each {
pluginManager.registerMockPlugin(it)
}
pluginManager
}

private List<DefaultGrailsPlugin> createGrailsPlugins(DefaultGrailsApplication grailsApplication) {
private List<GrailsPlugin> createGrailsPlugins(GrailsApplication grailsApplication) {
final String grailsVersion = '4.0.1'
def gcl = new GroovyClassLoader()

GrailsPlugin plugin = new MockTestGrailsPlugin(gcl.parseClass("""class TestGrailsPlugin {
def version = '1.0.0'
def grailsVersion = '$grailsVersion'
Expand All @@ -45,7 +42,8 @@ class GrailsPluginConfigurationClass extends GrailsAutoConfiguration {
def version = '1.0.0'
def grailsVersion = '$grailsVersion'
}"""), grailsApplication)
[plugin, plugin2]

List<GrailsPlugin>.of(plugin, plugin2)
}

class MockTestGrailsPlugin extends DefaultGrailsPlugin {
Expand Down Expand Up @@ -82,10 +80,6 @@ class GrailsPluginConfigurationClass extends GrailsAutoConfiguration {

class MockTestTwoGrailsPlugin extends DefaultGrailsPlugin {

MockTestTwoGrailsPlugin(Class<?> pluginClass, Resource resource, GrailsApplication application) {
super(pluginClass, resource, application)
}

MockTestTwoGrailsPlugin(Class<?> pluginClass, GrailsApplication application) {
super(pluginClass, application)
}
Expand Down
Loading

0 comments on commit 83a9ee9

Please sign in to comment.