diff --git a/.github/images/screenshot.png b/.github/images/screenshot.png new file mode 100644 index 0000000..10b4268 Binary files /dev/null and b/.github/images/screenshot.png differ diff --git a/.github/images/screenshot2.png b/.github/images/screenshot2.png new file mode 100644 index 0000000..c1a6aa9 Binary files /dev/null and b/.github/images/screenshot2.png differ diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 9dfe284..cbd520d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -15,46 +15,53 @@ jobs: GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 SIGNING_KEYRING: ${{ secrets.SECRING_FILE }} steps: - - uses: actions/checkout@v4 - - name: Setup up node + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "🧱 Setup up node" uses: actions/setup-node@v3 with: node-version: '20.5.1' - - run: npm install - - run: npx gulp grailsRelease - - name: Set up JDK + - name: "Pull node dependencies" + run: npm install + - name: "Package node dependencies" + run: npx gulp grailsRelease + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' - java-version: '11' - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - - name: Run build with Gradle Wrapper - run: ./gradlew build -Dgeb.env=chromeHeadless - working-directory: plugin + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ”¨ Run Base Tests" + run: ./gradlew check --continue publish: if: github.event_name == 'push' - needs: ['build'] + needs: build runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v4 - - name: Setup up node + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "🧱 Setup up node" uses: actions/setup-node@v3 with: node-version: '20.5.1' - - run: npm install - - run: npx gulp grailsRelease - - name: Set up JDK + - name: "Pull node dependencies" + run: npm install + - name: "Package node dependencies" + run: npx gulp grailsRelease + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' - java-version: '11' - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 - - name: Publish Artifacts (repo.grails.org) - id: publish + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ“€ Publish to Snapshot (repo.grails.org)" env: - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - working-directory: plugin - run: ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish \ No newline at end of file + MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} + MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} + MAVEN_PUBLISH_URL: 'https://repo.grails.org/artifactory/plugins3-snapshots-local' + working-directory: ./plugin + run: ../gradlew publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1d6e3b2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,122 @@ +name: Release +on: + release: + types: [published] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JAVA_VERSION: '17.0.15' # this must be a specific version for reproducible builds + RELEASE_TAG_PREFIX: 'v' +jobs: + publish: + permissions: + packages: read # pre-release workflow + contents: write # to create release + issues: write # to modify milestones + runs-on: ubuntu-24.04 + outputs: + release_version: ${{ steps.release_version.outputs.value }} + extract_repository_name: ${{ steps.extract_repository_name.outputs.repository_name }} + steps: + - name: "πŸ“ Store the current release version" + id: release_version + run: | + export RELEASE_VERSION="${{ github.ref_name }}" + export RELEASE_VERSION=${RELEASE_VERSION:${#RELEASE_TAG_PREFIX}} + echo "Found Release Version: ${RELEASE_VERSION}" + echo "value=${RELEASE_VERSION}" >> $GITHUB_OUTPUT + - name: "Extract repository name" + id: extract_repository_name + run: | + echo "repository_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: v${{ steps.release_version.outputs.value }} + - name: 'Ensure Common Build Date' # to ensure a reproducible build + run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV" + - name: "Ensure source files use common date" + run: | + find . -depth \( -type f -o -type d \) -exec touch -d "@${SOURCE_DATE_EPOCH}" {} + + - name: "🧱 Setup up node" + uses: actions/setup-node@v3 + with: + node-version: '20.5.1' + - name: "Pull node dependencies" + run: npm install + - name: "Package node dependencies" + run: npx gulp grailsRelease + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: liberica + java-version: ${{ env.JAVA_VERSION }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "βš™οΈ Run pre-release" + uses: grails/github-actions/pre-release@asf + env: + RELEASE_VERSION: ${{ steps.release_version.outputs.value }} + - name: "🧩 Run Assemble" + id: assemble + run: ./gradlew -U assemble + - name: "πŸ” Generate key file for artifact signing" + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg + - name: "πŸ“€ Publish to Maven Central" + env: + GRAILS_PUBLISH_RELEASE: 'true' + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_URL: 'https://ossrh-staging-api.central.sonatype.com/service/local/' + NEXUS_PUBLISH_DESCRIPTION: '${{ steps.extract_repository_name.outputs.repository_name }}:${{ steps.release_version.outputs.value }}' + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + run: > + ./gradlew + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishMavenPublicationToSonatypeRepository + closeSonatypeStagingRepository + - name: "Generate Build Date file" + run: echo "$SOURCE_DATE_EPOCH" >> build/BUILD_DATE.txt + - name: "Upload Build Date file" + uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 + with: + files: build/BUILD_DATE.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + release: + needs: publish + runs-on: ubuntu-latest + environment: release + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ref: v${{ needs.publish.outputs.release_version }} + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: liberica + java-version: ${{ env.JAVA_VERSION }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ“€ Release staging repository" + env: + GRAILS_PUBLISH_RELEASE: 'true' + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_URL: 'https://ossrh-staging-api.central.sonatype.com/service/local/' + NEXUS_PUBLISH_DESCRIPTION: '${{ needs.publish.outputs.extract_repository_name }}:${{ needs.publish.outputs.release_version }}' + run: > + ./gradlew + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: "βš™οΈ Run post-release" + uses: apache/grails-github-actions/post-release@asf diff --git a/.sdkmanrc b/.sdkmanrc index e2a1d58..215786f 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1 +1 @@ -java=11.0.24-librca +java=17.0.12-librca diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1fe3244..3b7a2a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,14 +22,9 @@ This plugin uses [Gulp](http://gulpjs.com/) to build its resources. | release-all | Builds all release resources and copy to graisl2 and grails3.| ## File structure - . - β”œβ”€β”€ grails2 - β”‚ β”œβ”€β”€ app # grails2 test app - β”‚ └── plugin # grails2 plugin - β”œβ”€β”€ grails3 - β”‚ β”œβ”€β”€ app # grails3 test app - β”‚ └── plugin # grails3 plugin + │── app # test app + │── plugin # plugin β”œβ”€β”€ web # shared web resources β”‚ β”œβ”€β”€ app # coffeescript β”‚ β”œβ”€β”€ img @@ -42,6 +37,6 @@ This plugin uses [Gulp](http://gulpjs.com/) to build its resources. ## Running -When developing, use `grails2/app` and `grails3/app`. +When developing, use `app` diff --git a/LOCALDEPLOYMENT.md b/LOCALDEPLOYMENT.md index 29c3a10..22c7e7b 100644 --- a/LOCALDEPLOYMENT.md +++ b/LOCALDEPLOYMENT.md @@ -5,12 +5,12 @@ This page is meant for people not willing to wait for an official plugin release ### Build ```shell -npm run grails3:release +npm install +npx gulp grailsRelease -cd grails3/plugin +cd plugin -./gradlew clean -./gradlew build +./gradlew clean build ``` ### Public local diff --git a/README.md b/README.md index 23f798f..4d03311 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ +[![Java CI](https://github.com/grails-plugins/grails-web-console/actions/workflows/gradle.yml/badge.svg)](https://github.com/grails-plugins/grails-web-console/actions/workflows/gradle.yml) + +# Grails Web Console + ## Summary A web-based Groovy console for interactive runtime application management and debugging -![Screenshot](https://raw.github.com/gpc/grails-web-console/images/screenshot.png) +![Screenshot](.github/images/screenshot.png) ## Versions @@ -11,6 +15,7 @@ A web-based Groovy console for interactive runtime application management and de - `4.X.X` for Grails 4+ - `5.X.X` for Grails 5+ - `6.X.X` for Grails 6+ +- `7.X.X` for Grails 7+ ## Installation @@ -18,33 +23,14 @@ Add a dependency in build.gradle ```groovy repositories { - maven { url "https://jitpack.io" } + maven { url "https://repo.grails.org/grails/core/" } } dependencies { - compile 'com.github.gpc:grails-web-console:6.0-M2' + runtimeOnly 'com.github.grails-plugins:grails-web-console:7.0.0-M1' } ``` -In addition if you don't want to use jitpack.io then use following github package registry: - -```groovy -repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/gpc/grails-web-console") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } - } - -dependencies { - compile 'org.grails.plugins:grails-web-console:6.0-M2' -} - -``` ## Usage @@ -75,7 +61,7 @@ Calls made to the implicit `console` variable will be executed on the browser's The arguments are serialized as JSON and the calls are queued to run after the script completes. Example: -![Screenshot](https://raw.github.com/gpc/grails-web-console/images/screenshot2.png) +![Screenshot](.github/images/screenshot2.png) ## Implicit variables @@ -88,7 +74,7 @@ The following implicit variables are available: * `session` - the current [HTTP session](http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html) * `out` - the output [PrintStream](http://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html) -See [Script Examples](https://github.com/gpc/grails-web-console/wiki/Script-Examples) for example usage. +See [Script Examples](https://github.com/grails-plugins/grails-web-console/wiki/Script-Examples) for example usage. ## Keyboard Shortcuts @@ -146,6 +132,9 @@ grails.plugin.springsecurity.controllerAnnotations.staticRules = [ * [Mike Hugo](https://github.com/mjhugo) * [Kamil Dybicz](https://github.com/kdybicz) * [Sachin Verma](https://github.com/vsachinv) +* [James Daugherty](https://github.com/jdaugherty) +* [Scott Murphy](https://github.com/codeconsole) +* [SΓΈren Berg Glasius](https://github.com/sbglasius) ## Development diff --git a/app/build.gradle b/app/build.gradle index 9267059..d06fbf9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,96 +1,56 @@ plugins { id "groovy" - id "org.grails.grails-web" - id "org.grails.grails-gsp" - id "com.github.erdi.webdriver-binaries" - id "war" - id "idea" - id "com.bertramlabs.asset-pipeline" - id "application" - id "eclipse" + id "cloud.wondrify.asset-pipeline" } -group = "grails.app" +apply plugin: "org.apache.grails.gradle.grails-web" +apply plugin: "org.apache.grails.gradle.grails-gsp" -repositories { - mavenLocal() - mavenCentral() - maven { url "https://repo.grails.org/grails/core/" } -} -configurations { - all { - resolutionStrategy.eachDependency { DependencyResolveDetails details-> - if (details.requested.group == 'org.seleniumhq.selenium') { - details.useVersion('4.19.1') - } - } - } -} +version = project.projectVersion +group = "grails.app" dependencies { - implementation("org.grails:grails-core") - implementation("org.grails:grails-logging") - implementation("org.grails:grails-plugin-databinding") - implementation("org.grails:grails-plugin-i18n") - implementation("org.grails:grails-plugin-interceptors") - implementation("org.grails:grails-plugin-rest") - implementation("org.grails:grails-plugin-services") - implementation("org.grails:grails-plugin-url-mappings") - implementation("org.grails:grails-web-boot") - implementation("org.grails.plugins:gsp") - implementation("org.grails.plugins:hibernate5") - implementation("org.grails.plugins:scaffolding") + implementation platform("org.apache.grails:grails-bom:$grailsVersion") + + implementation("org.apache.grails:grails-core") + implementation("org.apache.grails:grails-logging") + implementation("org.apache.grails:grails-databinding") + implementation("org.apache.grails:grails-i18n") + implementation("org.apache.grails:grails-interceptors") + implementation("org.apache.grails:grails-rest-transforms") + implementation("org.apache.grails:grails-services") + implementation("org.apache.grails:grails-url-mappings") + implementation("org.apache.grails:grails-web-boot") + implementation("org.apache.grails:grails-gsp") + implementation("org.apache.grails:grails-data-hibernate5") + implementation("org.apache.grails:grails-scaffolding") implementation("org.springframework.boot:spring-boot-autoconfigure") implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-logging") implementation("org.springframework.boot:spring-boot-starter-tomcat") implementation("org.springframework.boot:spring-boot-starter-validation") - compileOnly("io.micronaut:micronaut-inject-groovy") - console("org.grails:grails-console") - runtimeOnly("com.bertramlabs.plugins:asset-pipeline-grails:4.3.0") + console("org.apache.grails:grails-console") + runtimeOnly("cloud.wondrify:asset-pipeline-grails") runtimeOnly("com.h2database:h2") runtimeOnly("org.apache.tomcat:tomcat-jdbc") - runtimeOnly("org.fusesource.jansi:jansi:1.18") - testImplementation("io.micronaut:micronaut-inject-groovy") - testImplementation("org.grails:grails-gorm-testing-support") - testImplementation("org.grails:grails-web-testing-support") - testImplementation("org.grails.plugins:geb") - testImplementation("org.seleniumhq.selenium:selenium-api:4.19.1") - testImplementation("org.seleniumhq.selenium:selenium-remote-driver:4.19.1") - testImplementation("org.seleniumhq.selenium:selenium-support:4.19.1") - testImplementation("org.spockframework:spock-core") - testRuntimeOnly("org.seleniumhq.selenium:selenium-chrome-driver:4.19.1") - testRuntimeOnly("org.seleniumhq.selenium:selenium-firefox-driver:4.19.1") - testRuntimeOnly("org.seleniumhq.selenium:selenium-safari-driver:4.19.1") - testImplementation("io.micronaut:micronaut-http-client") - - implementation project(':plugin') + runtimeOnly("org.fusesource.jansi:jansi") + testImplementation("org.apache.grails:grails-testing-support-datamapping") + testImplementation("org.apache.grails:grails-testing-support-web") -} + integrationTestImplementation testFixtures("org.apache.grails:grails-geb") + testImplementation("org.spockframework:spock-core") -application { - mainClass.set("grails.app.Application") + implementation project(':grails-web-console') } -java { - sourceCompatibility = JavaVersion.toVersion("11") +apply { + from project.rootProject.layout.projectDirectory.file('gradle/java-config.gradle') + from project.rootProject.layout.projectDirectory.file('gradle/test-config.gradle') } -tasks.withType(Test) { - useJUnitPlatform() - systemProperty "geb.env", System.getProperty('geb.env') - systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") - systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" - systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" -} -webdriverBinaries { - chromedriver '122.0.6260.0' - geckodriver '0.33.0' - edgedriver '110.0.1587.57' -} assets { minifyJs = true minifyCss = true -} +} \ No newline at end of file diff --git a/app/buildSrc/build.gradle b/app/buildSrc/build.gradle deleted file mode 100644 index 4b68763..0000000 --- a/app/buildSrc/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - maven { url "https://repo1.maven.org/maven2/" } - maven { url "https://repo.grails.org/grails/core" } -} -dependencies { - implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0") - implementation("org.grails:grails-gradle-plugin:6.1.2") - implementation("org.grails.plugins:hibernate5:8.1.0") -} diff --git a/app/gradle.properties b/app/gradle.properties deleted file mode 100644 index 680ac62..0000000 --- a/app/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -grailsVersion=6.2.0 -grailsGradlePluginVersion=6.1.2 -version=6.0 -org.gradle.caching=true -org.gradle.daemon=true -org.gradle.parallel=true -org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M diff --git a/app/gradle/wrapper/gradle-wrapper.jar b/app/gradle/wrapper/gradle-wrapper.jar index 7454180..a4b76b9 100644 Binary files a/app/gradle/wrapper/gradle-wrapper.jar and b/app/gradle/wrapper/gradle-wrapper.jar differ diff --git a/app/gradle/wrapper/gradle-wrapper.properties b/app/gradle/wrapper/gradle-wrapper.properties index 3994438..df97d72 100644 --- a/app/gradle/wrapper/gradle-wrapper.properties +++ b/app/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/app/gradlew b/app/gradlew index 1b6c787..f5feea6 100755 --- a/app/gradlew +++ b/app/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/app/gradlew.bat b/app/gradlew.bat index 107acd3..9b42019 100644 --- a/app/gradlew.bat +++ b/app/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/app/grails-app/conf/logback-spring.xml b/app/grails-app/conf/logback-spring.xml new file mode 100644 index 0000000..3b41fb9 --- /dev/null +++ b/app/grails-app/conf/logback-spring.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/grails-app/conf/logback.xml b/app/grails-app/conf/logback.xml deleted file mode 100644 index 70b1484..0000000 --- a/app/grails-app/conf/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - true - - 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 - - - - - - - - diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b3cac7d --- /dev/null +++ b/build.gradle @@ -0,0 +1,37 @@ +buildscript { + repositories { + maven { url 'https://plugins.gradle.org/m2/' } + maven { url 'https://repo.grails.org/grails/restricted' } + } + dependencies { + classpath platform("org.apache.grails:grails-bom:${grailsVersion}") + classpath 'org.apache.grails:grails-gradle-plugins' + } +} + +allprojects { + repositories { + maven { url "https://repo.grails.org/grails/restricted" } + mavenCentral() + } +} + +version project.projectVersion +group "org.grails.plugins" + +subprojects { project -> + if(project.name.endsWith('grails-web-console')) { + apply plugin: "org.apache.grails.gradle.grails-publish" + + grailsPublish { + githubSlug = 'grails-plugins/grails-web-console' + + license { + name = 'Apache-2.0' + } + title = "Grails Web Console Plugin" + desc = "A Grails Plugin that adds a web-based Groovy console for interactive runtime application management and debugging" + developers = [ziegfried: 'Siegfried Puchbauer', mingfai: 'Mingfai Ma', burtbeckwith: 'Burt Beckwith', sheehan: 'Matt Sheehan', mjhugo: 'Mike Hugo', kdybicz: 'Kamil Dybicz', vsachinv: 'vsachinv' ] + } + } +} \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 1b7f0f0..483cda1 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,13 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +plugins { + id 'groovy-gradle-plugin' +} + +file('../gradle.properties').withInputStream { + Properties props = new Properties() + props.load(it) + project.ext.gradleProperties = props +} + +compileJava.options.release = gradleProperties.javaVersion.toString().toInteger() + repositories { - mavenLocal() + maven { url = 'https://repo.grails.org/grails/restricted' } mavenCentral() - maven { url "https://repo1.maven.org/maven2/" } - maven { url "https://repo.grails.org/grails/core" } + gradlePluginPortal() } dependencies { - implementation("org.grails:grails-gradle-plugin:6.1.2") - implementation("org.grails.plugins:hibernate5:8.1.0") - implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0") - implementation("com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.2") -} \ No newline at end of file + implementation platform("org.apache.grails:grails-gradle-bom:${gradleProperties.grailsVersion}") + implementation 'cloud.wondrify:asset-pipeline-gradle' + implementation 'org.apache.grails:grails-gradle-plugins' + implementation "com.adarshr.test-logger:com.adarshr.test-logger.gradle.plugin:${gradleProperties.testLoggerVersion}" +} diff --git a/plugin/gradle.properties b/gradle.properties similarity index 56% rename from plugin/gradle.properties rename to gradle.properties index 1f60f3d..a7144c0 100644 --- a/plugin/gradle.properties +++ b/gradle.properties @@ -1,6 +1,8 @@ -grailsVersion=6.2.0 -grailsGradlePluginVersion=6.1.2 -version=6.0.0-SNAPSHOT +projectVersion=7.0.0-SNAPSHOT +grailsVersion=7.0.0-M5 +javaVersion=17 +testLoggerVersion=4.0.0 + org.gradle.caching=true org.gradle.daemon=true org.gradle.parallel=true diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle new file mode 100644 index 0000000..4869b6d --- /dev/null +++ b/gradle/java-config.gradle @@ -0,0 +1,41 @@ +compileJava.options.release = javaVersion.toInteger() + +extensions.configure(JavaPluginExtension) { + // Explicit `it` is required here + it.withJavadocJar() + it.withSourcesJar() +} + +tasks.withType(Javadoc).configureEach { Javadoc it -> + it.options.noTimestamp true // prevent the file header with the date + it.options.bottom "Version: ${projectVersion}" +} + +tasks.withType(GroovyCompile).configureEach { + groovyOptions.encoding = 'UTF-8' // encoding needs to be the same since it's different across platforms + // Preserve method parameter names in Groovy classes for IDE parameter hints. + groovyOptions.parameters = true + options.encoding = 'UTF-8' // encoding needs to be the same since it's different across platforms + options.fork = true + options.forkOptions.jvmArgs = ['-Xms128M', '-Xmx2G'] +} + +tasks.withType(Jar).configureEach { + manifest.attributes( + 'Implementation-Title': 'Apache Grails', + 'Implementation-Version': grailsVersion, + 'Implementation-Vendor': 'grails.apache.org' + ) +} + +tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false // to prevent timestamp mismatches + reproducibleFileOrder = true // to keep the same ordering + // to avoid platform specific defaults, set the permissions consistently + filePermissions { permissions -> + permissions.unix(0644) + } + dirPermissions { permissions -> + permissions.unix(0755) + } +} diff --git a/gradle/test-config.gradle b/gradle/test-config.gradle new file mode 100644 index 0000000..d2593d2 --- /dev/null +++ b/gradle/test-config.gradle @@ -0,0 +1,18 @@ +tasks.withType(Test) { + useJUnitPlatform() + + testLogging { + exceptionFormat = 'full' + events 'passed', 'skipped', 'failed'//, 'standardOut', 'standardError' + } +} + +apply plugin: 'com.adarshr.test-logger' +testlogger { + theme 'mocha' + showFullStackTraces true + showStandardStreams true + showPassedStandardStreams false + showSkippedStandardStreams false + showFailedStandardStreams true +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3994438..d4081da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugin/.gitignore b/plugin/.gitignore index fa436fe..5c26b88 100644 --- a/plugin/.gitignore +++ b/plugin/.gitignore @@ -14,6 +14,5 @@ build/ .classpath .project -/src/main/resources/static/* /src/main/resources/public/* /grails-app/views/console/_* \ No newline at end of file diff --git a/plugin/build.gradle b/plugin/build.gradle index ecfae37..ea2bd23 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -1,143 +1,40 @@ plugins { id "groovy" - id "idea" - id "org.grails.grails-web" - id "org.grails.grails-gsp" - id "org.grails.grails-plugin" - id "application" - id "eclipse" - id "com.gorylenko.gradle-git-properties" - id "org.grails.internal.grails-plugin-publish" } -group "org.grails.plugins" +apply plugin: "org.apache.grails.gradle.grails-web" +apply plugin: "org.apache.grails.gradle.grails-gsp" +apply plugin: "org.apache.grails.gradle.grails-plugin" -repositories { - mavenLocal() - mavenCentral() - maven { url "https://repo1.maven.org/maven2/" } - maven { url "https://repo.grails.org/grails/core" } -} - -configurations { - all { - } -} +version = project.projectVersion +group = "org.grails.plugins" dependencies { - implementation("org.grails:grails-core") - implementation("org.grails:grails-logging") - implementation("org.grails:grails-plugin-databinding") - implementation("org.grails:grails-plugin-i18n") - implementation("org.grails:grails-plugin-interceptors") - implementation("org.grails:grails-plugin-rest") - implementation("org.grails:grails-plugin-services") - implementation("org.grails:grails-plugin-url-mappings") - implementation("org.grails:grails-web-boot") - implementation("org.grails.plugins:hibernate5") - implementation("org.springframework.boot:spring-boot-autoconfigure") - implementation("org.springframework.boot:spring-boot-starter-logging") - implementation("org.springframework.boot:spring-boot-starter-validation") - compileOnly("io.micronaut:micronaut-inject-groovy") - console("org.grails:grails-console") - runtimeOnly("com.h2database:h2") - runtimeOnly("org.apache.tomcat:tomcat-jdbc") - testImplementation("io.micronaut:micronaut-inject-groovy") - testImplementation("org.grails:grails-gorm-testing-support") - testImplementation("org.grails:grails-web-testing-support") + compileOnly platform("org.apache.grails:grails-bom:$grailsVersion") + + compileOnly("org.apache.grails:grails-core") + compileOnly("org.apache.grails:grails-logging") + compileOnly("org.apache.grails:grails-databinding") + compileOnly("org.apache.grails:grails-interceptors") + compileOnly("org.apache.grails:grails-rest-transforms") + compileOnly("org.apache.grails:grails-services") + compileOnly("org.apache.grails:grails-url-mappings") + compileOnly("org.apache.grails:grails-web-boot") + compileOnly("org.apache.grails:grails-gsp") + + console("org.apache.grails:grails-console") + + testImplementation platform("org.apache.grails:grails-bom:$grailsVersion") + testImplementation("org.apache.grails:grails-testing-support-web") testImplementation("org.spockframework:spock-core") - testImplementation("io.micronaut:micronaut-http-client") - - implementation("org.grails.plugins:scaffolding") - - implementation 'commons-io:commons-io:2.16.1' -} - -application { - mainClass.set("grailsconsole.Application") -} - -java { - sourceCompatibility = JavaVersion.toVersion(11) -} - -bootRun { - ignoreExitValue true - jvmArgs( - '-Dspring.output.ansi.enabled=always', - '-noverify', - '-XX:TieredStopAtLevel=1', - '-Xmx1024m') - sourceResources sourceSets.main - String springProfilesActive = 'spring.profiles.active' - systemProperty springProfilesActive, System.getProperty(springProfilesActive) -} - -tasks.withType(GroovyCompile) { - configure(groovyOptions) { - forkOptions.jvmArgs = ['-Xmx1024m'] - } -} - -task repairPublicFiles(type: Copy) { // https://github.com/grails/grails-core/issues/629 - from 'src/main/resources/static' - into 'build/resources/main/static' -} -processResources.finalizedBy repairPublicFiles - -gitProperties { - keys = ['git.branch', 'git.commit.id', 'git.commit.time', 'git.commit.id.abbrev'] - failOnNoGitDirectory = true - extProperty = 'gitProps' // git properties will be put in a map at project.ext.gitProps -} - -generateGitProperties.outputs.upToDateWhen { - false -} // make sure the generateGitProperties task always executes (even when git.properties is not changed) - -jar { - dependsOn generateGitProperties - manifest { - attributes("Built-By": System.getProperty("user.name")) - attributes(["Plugin-Version" : version, - "Plugin-Title" : project.name, - "Plugin-Build-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - "Git-Commit" : "${-> project.ext.gitProps['git.commit.id.abbrev']}", - "Git-Branch" : "${-> project.ext.gitProps['git.branch']}"]) - } - from sourceSets.main.output - exclude 'git.properties' -} - - -task sourceJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource -} - -task packageJavadoc(type: Jar) { - from javadoc - classifier = 'javadoc' + testRuntimeOnly 'net.bytebuddy:byte-buddy' } -task packageGroovydoc(type: Jar) { - from groovydoc - classifier = 'groovydoc' +apply { + from project.rootProject.layout.projectDirectory.file('gradle/java-config.gradle') + from project.rootProject.layout.projectDirectory.file('gradle/test-config.gradle') } -tasks.withType(Test) { - useJUnitPlatform() -} -// enable if you wish to package this plugin as a standalone application -bootJar.enabled = false - -grailsPublish { - userOrg = "grails" - githubSlug = 'gpc/grails-web-console' - license { - name = 'Apache-2.0' - } - title = "Grails Web Console Plugin" - desc = "A web-based Groovy console for interactive runtime application management and debugging" - developers = [ziegfried: 'Siegfried Puchbauer', mingfai: 'Mingfai Ma', burtbeckwith: 'Burt Beckwith', sheehan: 'Matt Sheehan', mjhugo: 'Mike Hugo', kdybicz: 'Kamil Dybicz', vsachinv: 'vsachinv' ] -} +grails { + springDependencyManagement = false +} \ No newline at end of file diff --git a/plugin/buildSrc/build.gradle b/plugin/buildSrc/build.gradle deleted file mode 100644 index e56144e..0000000 --- a/plugin/buildSrc/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - maven { url "https://repo1.maven.org/maven2/" } - maven { url "https://repo.grails.org/grails/core" } -} - -dependencies { - implementation("org.grails:grails-gradle-plugin:6.1.2") - implementation("org.grails.plugins:hibernate5:8.1.0") - implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0") - implementation("com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.2") -} diff --git a/plugin/gradle/wrapper/gradle-wrapper.jar b/plugin/gradle/wrapper/gradle-wrapper.jar index 7454180..a4b76b9 100644 Binary files a/plugin/gradle/wrapper/gradle-wrapper.jar and b/plugin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/plugin/gradle/wrapper/gradle-wrapper.properties b/plugin/gradle/wrapper/gradle-wrapper.properties index 3994438..df97d72 100644 --- a/plugin/gradle/wrapper/gradle-wrapper.properties +++ b/plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugin/gradlew b/plugin/gradlew index 1b6c787..f5feea6 100755 --- a/plugin/gradlew +++ b/plugin/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/plugin/gradlew.bat b/plugin/gradlew.bat index 107acd3..9b42019 100644 --- a/plugin/gradlew.bat +++ b/plugin/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugin/grails-app/conf/logback-spring.xml b/plugin/grails-app/conf/logback-spring.xml new file mode 100644 index 0000000..3b41fb9 --- /dev/null +++ b/plugin/grails-app/conf/logback-spring.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/grails-app/conf/logback.xml b/plugin/grails-app/conf/logback.xml deleted file mode 100644 index 70b1484..0000000 --- a/plugin/grails-app/conf/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - true - - 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 - - - - - - - - diff --git a/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleController.groovy b/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleController.groovy index 744c7fb..36a443b 100644 --- a/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleController.groovy +++ b/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleController.groovy @@ -1,30 +1,32 @@ package org.grails.plugins.console +import grails.artefact.Controller import grails.converters.JSON -import org.apache.commons.io.FilenameUtils -class ConsoleController { +import java.nio.file.Paths + +class ConsoleController implements Controller { def consoleService def consoleConfig def index() { Map model = [ - json: [ - implicitVars: [ - config: 'the Grails configuration', - console: 'the browser console', - ctx: 'the Spring application context', - grailsApplication: 'the Grails application', - out: 'the output PrintStream', - request: 'the HTTP request', - session: 'the HTTP session', - ], - baseUrl: getBaseUrl(), - remoteFileStoreEnabled: consoleConfig.remoteFileStoreEnabled, - groovyVersion: GroovySystem.version, - grailsVersion: grailsApplication.metadata['app.grails.version'] - ] + json: [ + implicitVars : [ + config : 'the Grails configuration', + console : 'the browser console', + ctx : 'the Spring application context', + grailsApplication: 'the Grails application', + out : 'the output PrintStream', + request : 'the HTTP request', + session : 'the HTTP session', + ], + baseUrl : getBaseUrl(), + remoteFileStoreEnabled: consoleConfig.remoteFileStoreEnabled, + groovyVersion : GroovySystem.version, + grailsVersion : grailsApplication.metadata['app.grails.version'] + ] ] if (consoleConfig.newFileText != null) { @@ -68,12 +70,16 @@ class ConsoleController { return renderError("Directory not found or cannot be read: $path", 400) } Map result = [ - path: FilenameUtils.normalize(baseDir.absolutePath, true), - files: baseDir.listFiles().sort { it.name }.collect { fileToJson it, false } + path : normalizePath(baseDir), + files: baseDir.listFiles().sort { it.name }.collect { fileToJson it, false } ] render result as JSON } + private static String normalizePath(File file) { + Paths.get(file.absolutePath).normalize().toString().replace(File.separator, '/') + } + def file() { if (!consoleConfig.remoteFileStoreEnabled) { return renderError("Remote file store disabled", 403) @@ -187,10 +193,10 @@ class ConsoleController { private static Map fileToJson(File file, boolean includeText = true) { Map json = [ - id: FilenameUtils.normalize(file.absolutePath, true), - name: file.name, - type: file.isDirectory() ? 'dir' : 'file', - lastModified: file.lastModified() + id : normalizePath(file), + name : file.name, + type : file.isDirectory() ? 'dir' : 'file', + lastModified: file.lastModified() ] if (includeText && file.isFile()) { json.text = file.text diff --git a/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleUrlMappings.groovy b/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleUrlMappings.groovy deleted file mode 100644 index 752a44a..0000000 --- a/plugin/grails-app/controllers/org/grails/plugins/console/ConsoleUrlMappings.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package org.grails.plugins.console - -class ConsoleUrlMappings { - - static mappings = { - "/console/$action?"(controller: 'console') - } -} diff --git a/plugin/grails-app/controllers/org/grails/plugins/console/EnabledInterceptor.groovy b/plugin/grails-app/controllers/org/grails/plugins/console/EnabledInterceptor.groovy index ff58fac..edfebe0 100644 --- a/plugin/grails-app/controllers/org/grails/plugins/console/EnabledInterceptor.groovy +++ b/plugin/grails-app/controllers/org/grails/plugins/console/EnabledInterceptor.groovy @@ -1,8 +1,9 @@ package org.grails.plugins.console +import grails.artefact.Interceptor import grails.util.Environment -class EnabledInterceptor { +class EnabledInterceptor implements Interceptor { def consoleConfig diff --git a/plugin/grails-app/controllers/org/grails/plugins/console/TokenInterceptor.groovy b/plugin/grails-app/controllers/org/grails/plugins/console/TokenInterceptor.groovy index 47b7c40..50916f4 100644 --- a/plugin/grails-app/controllers/org/grails/plugins/console/TokenInterceptor.groovy +++ b/plugin/grails-app/controllers/org/grails/plugins/console/TokenInterceptor.groovy @@ -1,8 +1,12 @@ package org.grails.plugins.console -class TokenInterceptor { +import grails.artefact.Interceptor +import org.springframework.beans.factory.annotation.Value - def consoleConfig +class TokenInterceptor implements Interceptor { + + @Value('${grails.plugin.console.csrfProtectionEnabled:true}') + boolean csrfProtectionEnabled TokenInterceptor() { match(controller: 'console').excludes(action: 'index') @@ -10,8 +14,8 @@ class TokenInterceptor { boolean before() { if (actionName - && consoleConfig.csrfProtectionEnabled - && (!session['CONSOLE_CSRF_TOKEN'] || request.getHeader('X-CSRFToken') != session['CONSOLE_CSRF_TOKEN'])) { + && csrfProtectionEnabled + && (!session['CONSOLE_CSRF_TOKEN'] || request.getHeader('X-CSRFToken') != session['CONSOLE_CSRF_TOKEN'])) { response.status = 403 response.writer.println "CSRF token doesn't match. Please refresh the page." return false diff --git a/plugin/grails-app/init/grailsconsole/Application.groovy b/plugin/grails-app/init/grailsconsole/Application.groovy index 3572c28..a028117 100644 --- a/plugin/grails-app/init/grailsconsole/Application.groovy +++ b/plugin/grails-app/init/grailsconsole/Application.groovy @@ -2,8 +2,11 @@ package grailsconsole import grails.boot.GrailsApp import grails.boot.config.GrailsAutoConfiguration +import grails.plugins.metadata.PluginSource +@PluginSource class Application extends GrailsAutoConfiguration { + static void main(String[] args) { GrailsApp.run(Application) } diff --git a/plugin/grails-app/services/org/grails/plugins/console/ConsoleService.groovy b/plugin/grails-app/services/org/grails/plugins/console/ConsoleService.groovy index 5123a33..3f5e8b2 100644 --- a/plugin/grails-app/services/org/grails/plugins/console/ConsoleService.groovy +++ b/plugin/grails-app/services/org/grails/plugins/console/ConsoleService.groovy @@ -1,9 +1,14 @@ package org.grails.plugins.console +import groovy.util.logging.Slf4j import org.codehaus.groovy.control.CompilerConfiguration import org.codehaus.groovy.control.customizers.ImportCustomizer import grails.core.GrailsApplication +import org.grails.core.artefact.DomainClassArtefactHandler +import java.nio.charset.StandardCharsets + +@Slf4j class ConsoleService { GrailsApplication grailsApplication @@ -37,19 +42,19 @@ class ConsoleService { evaluation.totalTime = System.currentTimeMillis() - startTime evaluation.console = console - evaluation.output = baos.toString('UTF8') + evaluation.output = baos.toString(StandardCharsets.UTF_8.name()) evaluation } private Binding createBinding(request, PrintStream out, Console console) { new Binding([ - session : request.session, - request : request, - ctx : grailsApplication.mainContext, - grailsApplication: grailsApplication, - config : grailsApplication.config, - out : out, - console : console + session : request.session, + request : request, + ctx : grailsApplication.mainContext, + grailsApplication: grailsApplication, + config : grailsApplication.config, + out : out, + console : console ]) } @@ -57,7 +62,9 @@ class ConsoleService { CompilerConfiguration configuration = new CompilerConfiguration() if (autoImportDomains) { ImportCustomizer importCustomizer = new ImportCustomizer() - importCustomizer.addImports(*grailsApplication.domainClasses*.fullName) + grailsApplication.getArtefacts(DomainClassArtefactHandler.TYPE).each { domainClass -> + importCustomizer.addImport(domainClass.clazz.simpleName, domainClass.clazz.name) + } configuration.addCompilationCustomizers importCustomizer } configuration diff --git a/plugin/grails-app/views/console/index.gsp b/plugin/grails-app/views/console/index.gsp index 039ec48..3a70a8a 100644 --- a/plugin/grails-app/views/console/index.gsp +++ b/plugin/grails-app/views/console/index.gsp @@ -9,7 +9,7 @@ - + diff --git a/plugin/release.sh b/plugin/release.sh deleted file mode 100755 index af56d72..0000000 --- a/plugin/release.sh +++ /dev/null @@ -1,13 +0,0 @@ -rm -rf target/release -mkdir -p target/release -cd target/release -git clone git@github.com:gpc/grails-web-console.git - -cd grails-web-console -npm install -gulp grails:release - -cd plugin -./gradlew clean -./gradlew compileGroovy -./gradlew publishMavenJarPublicationToGitHubPackagesRepository diff --git a/plugin/settings.gradle b/plugin/settings.gradle deleted file mode 100644 index c420e93..0000000 --- a/plugin/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -pluginManagement { - repositories { - mavenLocal() - maven { url "https://repo.grails.org/grails/core/" } - gradlePluginPortal() - } - plugins { - } -} - -rootProject.name = 'grails-web-console' diff --git a/plugin/src/main/groovy/org/grails/plugins/console/ConsoleConfig.groovy b/plugin/src/main/groovy/org/grails/plugins/console/ConsoleConfig.groovy index ffe9940..6fb5d1e 100644 --- a/plugin/src/main/groovy/org/grails/plugins/console/ConsoleConfig.groovy +++ b/plugin/src/main/groovy/org/grails/plugins/console/ConsoleConfig.groovy @@ -1,57 +1,36 @@ package org.grails.plugins.console +import grails.config.Config import grails.util.Environment class ConsoleConfig { boolean enabled - String newFileText = null - boolean indentWithTabs = false - int tabSize = 4 - int indentUnit = 4 - String remoteFileStoreDefaultPath = null - boolean remoteFileStoreEnabled = true - boolean csrfProtectionEnabled = true + String newFileText + boolean indentWithTabs + int tabSize + int indentUnit + String remoteFileStoreDefaultPath + boolean remoteFileStoreEnabled + boolean csrfProtectionEnabled def baseUrl - ConsoleConfig(Map config) { - - if (config.enabled instanceof Boolean) { - enabled = config.enabled - } else { - enabled = Environment.current == Environment.DEVELOPMENT - } - - if (config.newFileText instanceof String) { - newFileText = config.newFileText - } - - if (config.indentWithTabs instanceof Boolean) { - indentWithTabs = config.indentWithTabs - } - - if (config.tabSize instanceof Integer) { - tabSize = config.tabSize as Integer - } - - if (config.indentUnit instanceof Integer) { - indentUnit = config.indentUnit as Integer - } - - if (config.fileStore && config.fileStore.remote && config.fileStore.remote.defaultPath instanceof String) { - remoteFileStoreDefaultPath = config.fileStore.remote.defaultPath - } - - if (config.fileStore && config.fileStore.remote && config.fileStore.remote.enabled instanceof Boolean) { - remoteFileStoreEnabled = config.fileStore.remote.enabled - } - - if (config.csrfProtection && config.csrfProtection.enabled instanceof Boolean) { - csrfProtectionEnabled = config.csrfProtection.enabled - } - - if (config.baseUrl instanceof List || config.baseUrl instanceof String) { - baseUrl = config.baseUrl + ConsoleConfig(Config config, String basePath) { + enabled = config.getProperty("${basePath}${basePath ? '.' : ''}enabled", Boolean, Environment.current == Environment.DEVELOPMENT) + newFileText = config.getProperty("${basePath}${basePath ? '.' : ''}newFileText") as String + indentWithTabs = config.getProperty("${basePath}${basePath ? '.' : ''}indentWithTabs", Boolean, false) + tabSize = config.getProperty("${basePath}${basePath ? '.' : ''}tabSize", Integer, 4) + indentUnit = config.getProperty("${basePath}${basePath ? '.' : ''}indentUnit", Integer, 4) + remoteFileStoreDefaultPath = config.getProperty("${basePath}${basePath ? '.' : ''}fileStore.remote.defaultPath") as String + remoteFileStoreEnabled = config.getProperty("${basePath}${basePath ? '.' : ''}fileStore.remote.enabled", Boolean, true) + csrfProtectionEnabled = config.getProperty("${basePath}${basePath ? '.' : ''}csrfProtection.enabled", Boolean, true) + + def configuredBaseUrl = config.getProperty("${basePath}${basePath ? '.' : ''}baseUrl") + if(configuredBaseUrl instanceof GString) { + configuredBaseUrl = configuredBaseUrl.toString() + } + if (configuredBaseUrl instanceof List || configuredBaseUrl instanceof String) { + baseUrl = configuredBaseUrl } } } diff --git a/plugin/src/main/groovy/org/grails/plugins/console/WebConsoleGrailsPlugin.groovy b/plugin/src/main/groovy/org/grails/plugins/console/WebConsoleGrailsPlugin.groovy index a3fdf91..49e9871 100644 --- a/plugin/src/main/groovy/org/grails/plugins/console/WebConsoleGrailsPlugin.groovy +++ b/plugin/src/main/groovy/org/grails/plugins/console/WebConsoleGrailsPlugin.groovy @@ -5,7 +5,7 @@ import grails.plugins.* class WebConsoleGrailsPlugin extends Plugin { // the version or versions of Grails the plugin is designed for - def grailsVersion = "6.2.0 > *" + def grailsVersion = "7.0.0-SNAPSHOT > *" // resources that are excluded from plugin packaging def pluginExcludes = [ @@ -20,7 +20,7 @@ class WebConsoleGrailsPlugin extends Plugin { def profiles = ['web'] // URL to the plugin's documentation - String documentation = 'https://github.com/gpc/grails-web-console/blob/6.0.x/README.md' + String documentation = 'https://github.com/grails-plugins/grails-web-console/blob/6.0.x/README.md' String license = 'APACHE' def developers = [ @@ -30,13 +30,14 @@ class WebConsoleGrailsPlugin extends Plugin { [name: 'Matt Sheehan', email: 'mr.sheehan@gmail.com'], [name: 'Sachin Verma', email: 'v.sachin.v@gmail.com'] ] - def issueManagement = [system: 'github', url: 'https://github.com/gpc/grails-web-console/issues'] - def scm = [url: 'https://github.com/gpc/grails-web-console'] + def issueManagement = [system: 'github', url: 'https://github.com/grails-plugins/grails-web-console/issues'] + def scm = [url: 'https://github.com/grails-plugins/grails-web-console'] - Closure doWithSpring() { {-> - consoleConfig(ConsoleConfig, config.getProperty('grails.plugin.console', Map, [:])) - } + Closure doWithSpring() { + {-> + consoleConfig(ConsoleConfig, config, 'grails.plugin.console') + } } void doWithDynamicMethods() { @@ -44,7 +45,7 @@ class WebConsoleGrailsPlugin extends Plugin { } void doWithApplicationContext() { - config.grails.assets.plugin.'console'.excludes = ['**/*'] + config.merge(['config.grails.assets.plugin.console.excludes': ['**/*']]) ConsoleUtil.initJsonConfig() } diff --git a/plugin/src/test/groovy/org/grails/plugins/console/ConsoleControllerSpec.groovy b/plugin/src/test/groovy/org/grails/plugins/console/ConsoleControllerSpec.groovy index 7f77b89..3e3c177 100644 --- a/plugin/src/test/groovy/org/grails/plugins/console/ConsoleControllerSpec.groovy +++ b/plugin/src/test/groovy/org/grails/plugins/console/ConsoleControllerSpec.groovy @@ -2,7 +2,6 @@ package org.grails.plugins.console import grails.converters.JSON import grails.testing.web.controllers.ControllerUnitTest -import org.apache.commons.io.FileUtils import spock.lang.Specification import java.nio.file.Files @@ -14,8 +13,10 @@ class ConsoleControllerSpec extends Specification implements ControllerUnitTest< @Override Closure doWithConfig() {{ config -> - config.grails.plugin.console.fileStore.remote.enabled = true - config.grails.plugin.console.csrfProtection.enabled = true + config.merge([ + ("config.grails.plugin.console.fileStore.remote.enabled"): true, + ("config.grails.plugin.console.csrfProtection.enabled"): true + ]) }} void setup() { @@ -26,11 +27,16 @@ class ConsoleControllerSpec extends Specification implements ControllerUnitTest< tempDir = Files.createTempDirectory('console').toFile() - controller.consoleConfig = new ConsoleConfig(config) + controller.consoleConfig = new ConsoleConfig(config, "grails.plugin.console") } void cleanup() { - FileUtils.deleteDirectory tempDir + tempDir.deleteDir() + config.clear() + config.merge([ + ("config.grails.plugin.console.fileStore.remote.enabled"): true, + ("config.grails.plugin.console.csrfProtection.enabled"): true + ]) } void 'index'() { @@ -52,8 +58,8 @@ class ConsoleControllerSpec extends Specification implements ControllerUnitTest< void 'index - baseUrl with config'() { when: - config.grails.plugin.console.baseUrl = 'http://localhost:5050/x/y/z/console' - controller.consoleConfig = new ConsoleConfig(config.grails.plugin.console) + config.merge(["grails.plugin.console.baseUrl":'http://localhost:5050/x/y/z/console']) + controller.consoleConfig = new ConsoleConfig(config, "grails.plugin.console") controller.index() then: @@ -150,8 +156,9 @@ class ConsoleControllerSpec extends Specification implements ControllerUnitTest< void 'listFiles - remote file store disabled'() { given: String path = tempDir.absolutePath - config.grails.plugin.console.fileStore.remote.enabled = false - controller.consoleConfig = new ConsoleConfig(config.grails.plugin.console) + + config.merge([("grails.plugin.console.fileStore.remote.enabled"):false]) + controller.consoleConfig = new ConsoleConfig(config, "grails.plugin.console") when: controller.listFiles(path) @@ -188,8 +195,9 @@ class ConsoleControllerSpec extends Specification implements ControllerUnitTest< request.method = 'GET' params.path = testFile1.absolutePath - config.grails.plugin.console.fileStore.remote.enabled = false - controller.consoleConfig = new ConsoleConfig(config.grails.plugin.console) + + config.merge([("grails.plugin.console.fileStore.remote.enabled"):false]) + controller.consoleConfig = new ConsoleConfig(config, "grails.plugin.console") when: controller.file() diff --git a/plugin/src/test/groovy/org/grails/plugins/console/ConsoleServiceSpec.groovy b/plugin/src/test/groovy/org/grails/plugins/console/ConsoleServiceSpec.groovy index d342211..115d2ab 100644 --- a/plugin/src/test/groovy/org/grails/plugins/console/ConsoleServiceSpec.groovy +++ b/plugin/src/test/groovy/org/grails/plugins/console/ConsoleServiceSpec.groovy @@ -2,6 +2,7 @@ package org.grails.plugins.console import grails.testing.services.ServiceUnitTest import org.springframework.mock.web.MockHttpServletRequest +import spock.lang.Ignore import spock.lang.Specification class ConsoleServiceSpec extends Specification implements ServiceUnitTest { diff --git a/settings.gradle b/settings.gradle index c578565..c1332ae 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,15 +1,6 @@ -pluginManagement { - repositories { - mavenLocal() - maven { url "https://repo.grails.org/grails/core/" } - gradlePluginPortal() - } - plugins { - id "org.grails.grails-web" version "6.1.2" - id "org.grails.grails-gsp" version "6.1.2" - id "com.bertramlabs.asset-pipeline" version "4.3.0" - id "com.github.erdi.webdriver-binaries" version "3.2" - } -} +rootProject.name = 'grails-web-console-root' -include 'app', 'plugin' +include 'plugin' +findProject(":plugin").name = "grails-web-console" + +include 'app' \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy