Skip to content

Commit

Permalink
Update app sources
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed May 11, 2024
1 parent 3d1030a commit fde85e4
Show file tree
Hide file tree
Showing 10 changed files with 248 additions and 98 deletions.
103 changes: 101 additions & 2 deletions app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
grails:
profile: plugin
profile: web
codegen:
defaultPackage: org.graceframework.plugin.htmx
defaultPackage: grace.demos
gorm:
reactor:
# Whether to translate GORM events into Reactor events
Expand Down Expand Up @@ -42,3 +43,101 @@ environments:
management:
endpoints:
enabled-by-default: false

---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlet: html
taglib: none
staticparts: none

---
hibernate:
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password: ''

environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: none
url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
3 changes: 2 additions & 1 deletion app/conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<appender-ref ref="STDOUT" />
</root>
<logger name="org.hibernate.orm.deprecation" level="error" />
<logger name="org.graceframework.plugin.htmx.Application" level="debug" />
<logger name="org.grails.plugins.support" level="debug" />
<logger name="grace.demos.Application" level="debug" />
</configuration>
16 changes: 16 additions & 0 deletions app/controllers/grace/demos/UrlMappings.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package grace.demos

class UrlMappings {

static mappings = {
"/$controller/$action?/$id?(.$format)?"{
constraints {
// apply constraints here
}
}

"/"(view:"/index")
"500"(view:'/error')
"404"(view:'/notFound')
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.graceframework.plugins.htmx
package grace.demos

import grails.boot.Grails
import grails.plugins.metadata.PluginSource
import groovy.transform.CompileStatic

@PluginSource
@CompileStatic
class Application {

static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.graceframework.plugins.htmx
package grace.demos

class BootStrap {

Expand Down
183 changes: 95 additions & 88 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,48 +1,107 @@
buildscript {
repositories {
// mavenLocal()
mavenCentral()
maven { url "https://repo.gradle.org/gradle/libs-releases" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
classpath "org.graceframework:grace-gradle-plugin:$graceVersion"
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:3.2"
classpath "org.graceframework.plugins:asset-pipeline-gradle:5.2.4"
}
}

ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY')
ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE')
ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : ("${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg")
ext.isReleaseVersion = !projectVersion.endsWith("SNAPSHOT")

ext {
springBootVersion = '2.6.6'
servletVersion = '4.0.1'
}

group "grace.demos"
version projectVersion
group "org.graceframework.plugins"

apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "groovy"
apply plugin: "war"
apply plugin: "io.github.gradle-nexus.publish-plugin"
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "org.graceframework.grace-web"
apply plugin: "com.github.erdi.webdriver-binaries"
apply plugin: "org.graceframework.asset-pipeline"
apply plugin: "org.graceframework.grace-gsp"

repositories {
mavenCentral()
}

configurations {
developmentOnly
}

grails {
plugins {
implementation project(":plugin")
}
}

dependencies {
compileOnly "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
compileOnly "javax.servlet:javax.servlet-api:$servletVersion"
compileOnly "org.graceframework:grace-core:$graceVersion"
compileOnly "org.graceframework:grace-web-common:$graceVersion"
developmentOnly('org.springframework.boot:spring-boot-devtools')
compileOnly "io.micronaut:micronaut-inject-groovy"
console "org.graceframework:grace-console"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.graceframework:grace-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.graceframework:grace-boot"
implementation "org.graceframework:grace-logging"
implementation "org.graceframework:grace-plugin-controllers"
implementation "org.graceframework:grace-plugin-codecs"
implementation "org.graceframework:grace-plugin-databinding"
implementation "org.graceframework:grace-plugin-datasource"
implementation "org.graceframework:grace-plugin-domain-class"
implementation "org.graceframework:grace-plugin-i18n"
implementation "org.graceframework:grace-plugin-interceptors"
implementation "org.graceframework:grace-plugin-management"
implementation "org.graceframework:grace-plugin-rest"
implementation "org.graceframework:grace-plugin-services"
implementation "org.graceframework:grace-plugin-url-mappings"
implementation "org.graceframework.plugins:cache"
implementation "org.graceframework.plugins:async"
implementation "org.graceframework.plugins:scaffolding"
implementation "org.graceframework.plugins:fields"
implementation "org.graceframework.plugins:events"
implementation "org.graceframework.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:5.6.15.Final"
implementation "org.graceframework:grace-plugin-gsp"
profile "org.graceframework.profiles:web"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"
runtimeOnly "jakarta.el:jakarta.el-api:3.0.3"
runtimeOnly "org.glassfish:jakarta.el:3.0.4"
runtimeOnly "org.graceframework.plugins:asset-pipeline-plugin:5.2.4"
testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation "org.graceframework:grace-test-support"
testImplementation "org.mockito:mockito-core"
testImplementation "org.graceframework.plugins:geb"
testImplementation "org.seleniumhq.selenium:selenium-remote-driver:4.2.2"
testImplementation "org.seleniumhq.selenium:selenium-api:4.2.2"
testImplementation "org.seleniumhq.selenium:selenium-support:4.2.2"
testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:4.2.2"
testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:4.2.2"
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(Sign) {
onlyIf { isReleaseVersion }
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) {
Expand All @@ -55,70 +114,25 @@ tasks.withType(Test) {
useJUnitPlatform()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
webdriverBinaries {
chromedriver {
version = '122.0.6260.0'
fallbackTo32Bit = true
}
withJavadocJar()
withSourcesJar()
geckodriver '0.33.0'
}

jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grace Htmx Plugin",
"Implementation-Version": projectVersion,
"Implementation-Vendor": 'Grace Plugins')
enabled = true
archiveClassifier.set('')
includeEmptyDirs = false
tasks.withType(Test) {
useJUnitPlatform()
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
}

publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = project.name
version = project.version

versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}

from components.java

pom {
name = "Grace Htmx Plugin"
description = "Grace Plugin for using Grace with htmx."
url = 'https://github.com/grace-plugins/grace-htmx'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'rainboyan'
name = 'Michael Yan'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/grace-plugins/grace-htmx.git'
developerConnection = 'scm:git:ssh://github.com:grace-plugins/grace-htmx.git'
url = 'https://github.com/grace-plugins/grace-htmx'
}
}
}
}
assets {
minifyJs = true
minifyCss = true
}

nexusPublishing {
Expand All @@ -135,10 +149,3 @@ nexusPublishing {
}
}
}

afterEvaluate {
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.maven
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
projectVersion=0.5.0-SNAPSHOT
graceVersion=2020.0.0
groovyVersion=3.0.11
graceVersion=2022.2.4
groovyVersion=3.0.17
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'htmx'
rootProject.name = 'grace-htmx'

include 'plugin'
Loading

0 comments on commit fde85e4

Please sign in to comment.