diff --git a/plugin/build.gradle b/plugin/build.gradle new file mode 100644 index 0000000..fa48d74 --- /dev/null +++ b/plugin/build.gradle @@ -0,0 +1,153 @@ +buildscript { + repositories { + mavenCentral() + } +} + +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 { + servletVersion = '4.0.1' +} + +version projectVersion +group "org.graceframework.plugins" + +apply plugin: "eclipse" +apply plugin: "idea" +apply plugin: "groovy" +apply plugin: "org.graceframework.grace-plugin" +apply plugin: "maven-publish" +apply plugin: "signing" + +repositories { + mavenCentral() +} + +dependencies { + compileOnly "javax.servlet:javax.servlet-api:$servletVersion" + compileOnly "org.springframework.boot:spring-boot-autoconfigure" + compileOnly "org.graceframework:grace-boot" + compileOnly "org.graceframework:grace-core" + compileOnly "org.graceframework:grace-web-common" + compileOnly "org.graceframework.plugins:views-markup:5.2.0" + implementation "commons-beanutils:commons-beanutils:1.9.4" + profile "org.graceframework.profiles:web-plugin" +} + +tasks.withType(Sign) { + onlyIf { isReleaseVersion } +} + +tasks.withType(GroovyCompile) { + configure(groovyOptions) { + forkOptions.jvmArgs = ['-Xmx1024m'] + } +} + +tasks.withType(Test) { + useJUnitPlatform() +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withJavadocJar() + withSourcesJar() +} + +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 Policy Plugin", + "Implementation-Version": projectVersion, + "Implementation-Vendor": 'Grace Plugins') + enabled = true + archiveClassifier.set('') + includeEmptyDirs = false +} + +bootJar.enabled = false +bootRun.enabled = false +findMainClass.enabled = false +shell.enabled = false + +publishing { + publications { + maven(MavenPublication) { + groupId = project.group + artifactId = projectName + version = project.version + + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } + + from components.java + + pom { + name = "Grace Policy Plugin" + description = "Authorization plugin for Grails/Grace applications." + url = 'https://github.com/grace-plugins/grace-policy' + 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 = 'rain@rainboyan.com' + } + } + scm { + connection = 'scm:git:git://github.com/grace-plugins/grace-policy.git' + developerConnection = 'scm:git:ssh://github.com:grace-plugins/grace-policy.git' + url = 'https://github.com/grace-plugins/grace-policy' + } + } + + pom.withXml { + def pomNode = asNode() + + try { + pomNode.dependencyManagement.replaceNode {} + } catch (Throwable e) { + // ignore + } + + // simply remove dependencies without a version + // version-less dependencies are handled with dependencyManagement + // see https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/8 for more complete solutions + pomNode.dependencies.dependency.findAll { + it.version.text().isEmpty() + }.each { + try { + it.replaceNode {} + } catch (Throwable e) { + // ignore + } + } + } + } + } +} + +afterEvaluate { + signing { + required { isReleaseVersion && gradle.taskGraph.hasTask("publish") } + sign publishing.publications.maven + } +} diff --git a/plugin/gradle.properties b/plugin/gradle.properties new file mode 100644 index 0000000..cf7cbc9 --- /dev/null +++ b/plugin/gradle.properties @@ -0,0 +1,4 @@ +projectName=view-components +graceVersion=2022.2.0 +groovyVersion=3.0.16 +exploded=true \ No newline at end of file diff --git a/src/main/groovy/grails/compiler/traits/ComponentRenderer.groovy b/plugin/src/main/groovy/grails/compiler/traits/ComponentRenderer.groovy similarity index 100% rename from src/main/groovy/grails/compiler/traits/ComponentRenderer.groovy rename to plugin/src/main/groovy/grails/compiler/traits/ComponentRenderer.groovy diff --git a/src/main/groovy/grails/compiler/traits/ComponentTraitInjector.groovy b/plugin/src/main/groovy/grails/compiler/traits/ComponentTraitInjector.groovy similarity index 100% rename from src/main/groovy/grails/compiler/traits/ComponentTraitInjector.groovy rename to plugin/src/main/groovy/grails/compiler/traits/ComponentTraitInjector.groovy diff --git a/src/main/groovy/grails/compiler/traits/ControllerComponentTraitInjector.groovy b/plugin/src/main/groovy/grails/compiler/traits/ControllerComponentTraitInjector.groovy similarity index 100% rename from src/main/groovy/grails/compiler/traits/ControllerComponentTraitInjector.groovy rename to plugin/src/main/groovy/grails/compiler/traits/ControllerComponentTraitInjector.groovy diff --git a/src/main/groovy/grails/views/Component.groovy b/plugin/src/main/groovy/grails/views/Component.groovy similarity index 100% rename from src/main/groovy/grails/views/Component.groovy rename to plugin/src/main/groovy/grails/views/Component.groovy diff --git a/src/main/groovy/grails/views/GrailsComponentClass.java b/plugin/src/main/groovy/grails/views/GrailsComponentClass.java similarity index 100% rename from src/main/groovy/grails/views/GrailsComponentClass.java rename to plugin/src/main/groovy/grails/views/GrailsComponentClass.java diff --git a/src/main/groovy/org/graceframework/plugin/components/ViewComponentsGrailsPlugin.groovy b/plugin/src/main/groovy/org/graceframework/plugin/components/ViewComponentsGrailsPlugin.groovy similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/ViewComponentsGrailsPlugin.groovy rename to plugin/src/main/groovy/org/graceframework/plugin/components/ViewComponentsGrailsPlugin.groovy diff --git a/src/main/groovy/org/graceframework/plugin/components/artefact/ComponentArtefactHandler.java b/plugin/src/main/groovy/org/graceframework/plugin/components/artefact/ComponentArtefactHandler.java similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/artefact/ComponentArtefactHandler.java rename to plugin/src/main/groovy/org/graceframework/plugin/components/artefact/ComponentArtefactHandler.java diff --git a/src/main/groovy/org/graceframework/plugin/components/component/DefaultGrailsComponentClass.java b/plugin/src/main/groovy/org/graceframework/plugin/components/component/DefaultGrailsComponentClass.java similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/component/DefaultGrailsComponentClass.java rename to plugin/src/main/groovy/org/graceframework/plugin/components/component/DefaultGrailsComponentClass.java diff --git a/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentNamespacedTagDispatcher.groovy b/plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentNamespacedTagDispatcher.groovy similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/taglib/ComponentNamespacedTagDispatcher.groovy rename to plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentNamespacedTagDispatcher.groovy diff --git a/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagInvocationContextCustomizer.java b/plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagInvocationContextCustomizer.java similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagInvocationContextCustomizer.java rename to plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagInvocationContextCustomizer.java diff --git a/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagLib.groovy b/plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagLib.groovy similarity index 100% rename from src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagLib.groovy rename to plugin/src/main/groovy/org/graceframework/plugin/components/taglib/ComponentTagLib.groovy diff --git a/src/main/groovy/org/graceframework/plugin/util/StringUtils.java b/plugin/src/main/groovy/org/graceframework/plugin/util/StringUtils.java similarity index 100% rename from src/main/groovy/org/graceframework/plugin/util/StringUtils.java rename to plugin/src/main/groovy/org/graceframework/plugin/util/StringUtils.java diff --git a/src/main/resources/META-INF/grails-plugin.xml b/plugin/src/main/resources/META-INF/grails-plugin.xml similarity index 100% rename from src/main/resources/META-INF/grails-plugin.xml rename to plugin/src/main/resources/META-INF/grails-plugin.xml diff --git a/src/main/resources/META-INF/grails.factories b/plugin/src/main/resources/META-INF/grails.factories similarity index 100% rename from src/main/resources/META-INF/grails.factories rename to plugin/src/main/resources/META-INF/grails.factories