From cf49957e52520971e9df7560b3f5f0ac506fd750 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Thu, 29 Aug 2024 11:47:22 -0400 Subject: [PATCH 1/3] Add support for grails environments in logback xml config using spring boot extensions (#362) * Transition logback xml config to use spring logback extensions which supports environment specific configuration Close to old logback.groovy configuration, except it writes everything to console by default --- .../grails/forge/feature/logging/Logback.java | 9 ++++- .../logging/template/logback.rocker.raw | 38 ++++++++++++++----- .../forge/feature/logging/LogbackSpec.groovy | 4 +- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/grails-forge-core/src/main/java/org/grails/forge/feature/logging/Logback.java b/grails-forge-core/src/main/java/org/grails/forge/feature/logging/Logback.java index 1c5f4c99..29447b49 100644 --- a/grails-forge-core/src/main/java/org/grails/forge/feature/logging/Logback.java +++ b/grails-forge-core/src/main/java/org/grails/forge/feature/logging/Logback.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 original authors + * Copyright 2017-2024 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,10 +60,15 @@ public boolean shouldApply(ApplicationType applicationType, Options options, Set public void apply(GeneratorContext generatorContext) { OperatingSystem operatingSystem = generatorContext.getOperatingSystem(); boolean jansi = false; + if (operatingSystem != OperatingSystem.WINDOWS) { jansi = true; } - generatorContext.addTemplate("loggingConfig", new RockerTemplate("grails-app/conf/logback.xml", logback.template(jansi))); + + String projectName = generatorContext.getProject().getName(); + String packageName = generatorContext.getProject().getPackageName(); + + generatorContext.addTemplate("loggingConfig", new RockerTemplate("grails-app/conf/logback-spring.xml", logback.template(projectName, packageName, jansi))); generatorContext.addDependency(Dependency.builder() .groupId("org.grails") .artifactId("grails-logging") diff --git a/grails-forge-core/src/main/java/org/grails/forge/feature/logging/template/logback.rocker.raw b/grails-forge-core/src/main/java/org/grails/forge/feature/logging/template/logback.rocker.raw index c74bfcb7..b09d5be1 100644 --- a/grails-forge-core/src/main/java/org/grails/forge/feature/logging/template/logback.rocker.raw +++ b/grails-forge-core/src/main/java/org/grails/forge/feature/logging/template/logback.rocker.raw @@ -1,21 +1,41 @@ -@args (boolean jansi) +@args (String projectName, String packageName, boolean jansi) + - - - - + @jansi + + ${CONSOLE_LOG_THRESHOLD} + - UTF-8 - %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + ${CONSOLE_LOG_PATTERN} + ${CONSOLE_LOG_CHARSET} - - + + + + + + + + + + + + + + + + + + + + + diff --git a/grails-forge-core/src/test/groovy/org/grails/forge/feature/logging/LogbackSpec.groovy b/grails-forge-core/src/test/groovy/org/grails/forge/feature/logging/LogbackSpec.groovy index 00ac0600..381a3dd6 100644 --- a/grails-forge-core/src/test/groovy/org/grails/forge/feature/logging/LogbackSpec.groovy +++ b/grails-forge-core/src/test/groovy/org/grails/forge/feature/logging/LogbackSpec.groovy @@ -23,12 +23,12 @@ class LogbackSpec extends ApplicationContextSpec implements CommandOutputFixture } @Unroll - void "test logback.xml config file is present for #applicationType application"() { + void "test logback-spring.xml config file is present for #applicationType application"() { when: def output = generate(applicationType, new Options(TestFramework.SPOCK, JdkVersion.JDK_11)) then: - output.containsKey("grails-app/conf/logback.xml") + output.containsKey("grails-app/conf/logback-spring.xml") where: applicationType << ApplicationType.values().toList() From c6ddc34f311c8ec0d9fbc619cbe4c6d2d29f2e59 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Fri, 30 Aug 2024 16:48:47 +0200 Subject: [PATCH 2/3] Update versions for 7.0.x branch (#367) * chore: Update versions for 7.0.x branch * test: Update version for 7.0.x branch * chore: Revert to 6.2.1-SNAPSHOT for grailsVersion Grails 7.0.0-SNAPSHOT apps are not building yes. * ci: Change to 7.0.x branch name in Github workflows --- .github/workflows/release.yml | 4 ++-- .github/workflows/snapshot.yml | 8 ++++---- gradle.properties | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 591ba315..921724da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: commit_user_email: ${{ env.GIT_USER_EMAIL }} commit_author: ${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}> file_pattern: . - branch: 6.2.x + branch: 7.0.x - name: "⚙️ Run pre-release" uses: micronaut-projects/github-actions/pre-release@master with: @@ -79,7 +79,7 @@ jobs: env: BETA: ${{ contains(steps.release_version.outputs.value, 'M') }} GH_TOKEN: ${{ secrets.GH_TOKEN }} - BASE_BRANCH: 6.2.x + BASE_BRANCH: 7.0.x BRANCH: gh-pages FOLDER: build/docs VERSION: ${{ steps.release_version.outputs.value }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 10147e8a..7b2eebc8 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -176,7 +176,7 @@ jobs: cp ./LICENSE grails-linux-amd64-snapshot/ zip -r grails-linux-amd64-snapshot.zip ./grails-linux-amd64-snapshot - name: Upload Snapshot - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.2.x' + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/7.0.x' uses: actions/upload-artifact@v4 with: name: grails-linux-amd64-snapshot @@ -212,7 +212,7 @@ jobs: cp ./LICENSE grails-darwin-amd64-snapshot/ zip -r grails-darwin-amd64-snapshot.zip ./grails-darwin-amd64-snapshot -x '*.DS_Store*' -x '__MAC_OSX' - name: "📤 Upload Snapshot" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.2.x' + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/7.0.x' uses: actions/upload-artifact@v4 with: name: grails-darwin-amd64-snapshot @@ -250,7 +250,7 @@ jobs: cp ./LICENSE grails-darwin-aarch64-snapshot/ zip -r grails-darwin-aarch64-snapshot.zip grails-darwin-aarch64-snapshot/ -x '*.DS_Store*' -x '__MAC_OSX' - name: "📤 Upload Snapshot" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.2.x' + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/7.0.x' uses: actions/upload-artifact@v4 with: name: grails-darwin-aarch64-snapshot @@ -292,7 +292,7 @@ jobs: Copy-Item "./LICENSE" -Destination "./grails-win-amd64-snapshot" Compress-Archive -Path "./grails-win-amd64-snapshot" -Update -DestinationPath ./grails-win-amd64-snapshot.zip - name: "📤 Publish artifact" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.2.x' + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/7.0.x' uses: actions/upload-artifact@v4 with: name: grails-win-amd64-snapshot diff --git a/gradle.properties b/gradle.properties index c9aae8f3..128d38aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=6.2.1-SNAPSHOT +projectVersion=7.0.0-SNAPSHOT micronautBuildVersion=1.1.5 micronautDocsVersion=2.0.0 micronautVersion=3.10.4 @@ -10,7 +10,7 @@ title=Grails Application Forge projectDesc=Generates Grails applications projectUrl=https://grails.org githubSlug=grails/grails-forge -githubBranch=6.2.x +githubBranch=7.0.x developers=Puneet Behl org.gradle.parallel=true org.gradle.caching=true From b59d399025bfa31f85c78e0f9f49f6239d693103 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:46:44 +0000 Subject: [PATCH 3/3] chore(deps): update dependency gradle.plugin.com.github.johnrengelman:shadow to v8 --- buildSrc/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 36a9af0a..4dfc3c3d 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -31,7 +31,7 @@ dependencies { implementation "org.asciidoctor:asciidoctor-gradle-jvm:4.0.3" implementation "com.diffplug.spotless:spotless-plugin-gradle:6.25.0" implementation "io.spring.nohttp:nohttp-gradle:0.0.11" - implementation "gradle.plugin.com.github.johnrengelman:shadow:7.1.2" + implementation "gradle.plugin.com.github.johnrengelman:shadow:8.0.0" implementation "io.github.gradle-nexus:publish-plugin:1.3.0" }