Skip to content

Commit

Permalink
Merge branch '5.5.x' into 6.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Nov 9, 2023
2 parents 0823928 + c2b26ec commit 03be5ff
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 94 deletions.
124 changes: 92 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,118 @@ buildscript {
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails:grails-docs:$grailsVersion"
classpath "org.gradle:test-retry-gradle-plugin:1.4.0"
classpath "io.spring.gradle:dependency-management-plugin:$springDependencyManagementPluginVersion"
}
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
ext {
isReleaseVersion = !project.projectVersion.endsWith('-SNAPSHOT')
grailsVersion = project.grailsVersion
userOrg = "grails"
}

version project.projectVersion
apply plugin:'idea'

ext {
commonBuild = 'https://raw.githubusercontent.com/rainboyan/grails-common-build/23.0.x'
if (isReleaseVersion) {
apply plugin: 'maven-publish'
apply plugin: "io.github.gradle-nexus.publish-plugin"

nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
}
}

subprojects {
subprojects { project->
group "org.grails"
version project.projectVersion

ext {
userOrg = "grails"
isGrailsPlugin = name.startsWith('grails-plugin')
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
if (project.name.startsWith('examples') || project.name.endsWith('docs')) {
return
}

if (isGrailsPlugin) {
group "org.grails.plugins"
}
else {
group "org.grails"
}
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "org.gradle.test-retry"
apply plugin: "io.spring.dependency-management"

sourceCompatibility = 17
targetCompatibility = 17

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}

if (it.projectDir.path.endsWith("examples/${it.name}".toString())) {
apply plugin:"org.grails.grails-web"
}
else if (isGrailsPlugin) {
apply from: resources.text.fromInsecureUri("${commonBuild}/common-plugin.gradle")
}
else {
apply from: resources.text.fromInsecureUri("${commonBuild}/common-project.gradle")
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

dependencies {
compileOnly "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationVersion"
apply from: '../publishing/grailsCentralPublishing.gradle'


if (project.name.startsWith('grails-')) {
configurations {
documentation
}

dependencies {
api "org.apache.groovy:groovy:$groovyVersion"
api "org.slf4j:slf4j-api:$slf4jVersion"
documentation "org.fusesource.jansi:jansi:$jansiVersion"
documentation "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
documentation "info.picocli:picocli:$picocliVersion"
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"

testImplementation "org.spockframework:spock-core:$spockVersion"
testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:$junitJupiterPlatformVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
}

java {
withJavadocJar()
withSourcesJar()
}

tasks.withType(Test) {
useJUnitPlatform()
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
}
configure {
retry {
maxRetries = 2
maxFailures = 20
failOnPassedAfterRetry = true
}
}
}

groovydoc.classpath = configurations.documentation
}
}

apply from: resources.text.fromInsecureUri("${commonBuild}/common-publishing.gradle")
apply from: resources.text.fromInsecureUri("${commonBuild}/common-docs.gradle")
}
11 changes: 9 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ developers=Graeme Rocher
grailsVersion=2023.1.0-M2
groovyVersion=4.0.15
gormVersion=2023.1.0-M1
hibernateCoreVersion=5.6.15.Final
jakartaAnnotationVersion=2.1.1
jansiVersion=1.18
javaParserCoreVersion=3.15.14
junitJupiterVersion=5.8.2
junitJupiterPlatformVersion=1.8.2
picocliVersion=4.6.3
servletApiVersion=6.0.0
spockVersion=2.3-groovy-4.0
slf4jVersion=2.0.9
hibernateCoreVersion=5.6.15.Final
spockVersion=2.3-groovy-4.0
springVersion=6.0.12
springDependencyManagementPluginVersion=1.1.3
1 change: 1 addition & 0 deletions grails-plugin-scaffolding/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies {
api "org.grails:grails-core:$grailsVersion"
api "org.grails:grails-bootstrap:$grailsVersion"
api "org.grails:grails-plugin-rest:$grailsVersion"
api "org.grails:grails-web-gsp:$grailsVersion"
compileOnly "org.grails:grails-boot:$grailsVersion"
Expand Down
13 changes: 0 additions & 13 deletions grails-plugin-scaffolding/grails-app/conf/application.yml

This file was deleted.

Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.grails.plugin.scaffolding;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.util.ClassUtils;

import grails.config.Config;
import grails.config.Settings;
import grails.core.GrailsApplication;
import grails.plugin.scaffolding.ScaffoldingViewResolver;
import grails.util.Environment;
import org.grails.gsp.GroovyPagesTemplateEngine;
import org.grails.web.gsp.io.GrailsConventionGroovyPageLocator;
import org.grails.web.servlet.view.GroovyPageViewResolver;
import org.grails.web.util.GrailsApplicationAttributes;

@AutoConfiguration
@AutoConfigureOrder
public class ScaffoldingAutoConfiguration {

private static final String GSP_RELOAD_INTERVAL = "grails.gsp.reload.interval";

@Bean
@Order(-10)
@ConditionalOnMissingBean
public ScaffoldingViewResolver jspViewResolver(ObjectProvider<GrailsApplication> grailsApplication,
ObjectProvider<GroovyPagesTemplateEngine> groovyPagesTemplateEngine,
ObjectProvider<GrailsConventionGroovyPageLocator> groovyPageLocator) {

Config config = grailsApplication.getIfAvailable().getConfig();
Environment env = Environment.getCurrent();
boolean developmentMode = Environment.isDevelopmentEnvironmentAvailable();
boolean gspEnableReload = config.getProperty(Settings.GSP_ENABLE_RELOAD, Boolean.class, false);
boolean enableReload = env.isReloadEnabled() || gspEnableReload || (developmentMode && env == Environment.DEVELOPMENT);
long gspCacheTimeout = config.getProperty(GSP_RELOAD_INTERVAL, Long.class, (developmentMode && env == Environment.DEVELOPMENT) ? 0L : 5000L);

boolean jstlPresent = ClassUtils.isPresent("javax.servlet.jsp.jstl.core.Config", Thread.currentThread().getContextClassLoader());

final ScaffoldingViewResolver scaffoldingViewResolver = new ScaffoldingViewResolver();
scaffoldingViewResolver.setPrefix(GrailsApplicationAttributes.PATH_TO_VIEWS);

if (jstlPresent) {
scaffoldingViewResolver.setSuffix(GroovyPageViewResolver.JSP_SUFFIX);
}
else {
scaffoldingViewResolver.setSuffix(GroovyPageViewResolver.GSP_SUFFIX);
}
groovyPagesTemplateEngine.ifAvailable(scaffoldingViewResolver::setTemplateEngine);
groovyPageLocator.ifAvailable(scaffoldingViewResolver::setGroovyPageLocator);

if (enableReload) {
scaffoldingViewResolver.setCacheTimeout(gspCacheTimeout);
}
scaffoldingViewResolver.setOrder(Ordered.LOWEST_PRECEDENCE - 100);
return scaffoldingViewResolver;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
grails.compiler.ast.ClassInjector=\
org.grails.compiler.scaffolding.ScaffoldingControllerInjector
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.grails.plugin.scaffolding.ScaffoldingAutoConfiguration
Loading

0 comments on commit 03be5ff

Please sign in to comment.