Skip to content

Commit

Permalink
Move to plugin dir
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jun 3, 2024
1 parent 45cd607 commit d30d5fa
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 0 deletions.
153 changes: 153 additions & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'
}
}
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
}
}
4 changes: 4 additions & 0 deletions plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
projectName=view-components
graceVersion=2022.2.0
groovyVersion=3.0.16
exploded=true

0 comments on commit d30d5fa

Please sign in to comment.