Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jun 4, 2024
1 parent a279d2d commit 2ec7181
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 99 deletions.
187 changes: 89 additions & 98 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,109 @@ buildscript {
repositories {
// mavenLocal()
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
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 "org.graceframework:grace-gradle-plugin:$graceVersion"
classpath "org.graceframework.plugins:asset-pipeline-gradle:5.1.0"
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")

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

apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "java-library"
apply plugin: "org.graceframework.grace-plugin"
apply plugin: "org.graceframework.grace-gsp"
apply plugin: "org.graceframework.asset-pipeline"
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 {
// mavenLocal()
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}

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

dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
compileOnly "org.springframework.boot:spring-boot-autoconfigure"
developmentOnly('org.springframework.boot:spring-boot-devtools')
console "org.graceframework:grace-console"
implementation "org.springframework.boot:spring-boot-autoconfigure"
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"
implementation "org.graceframework:grace-boot"
implementation "org.graceframework:grace-core"
implementation "org.graceframework:grace-logging"
implementation "org.graceframework:grace-plugin-codecs"
implementation "org.graceframework:grace-plugin-controllers"
implementation "org.graceframework:grace-plugin-databinding"
implementation "org.graceframework:grace-plugin-datasource"
implementation "org.graceframework:grace-plugin-domain-class"
implementation "org.graceframework:grace-plugin-dynamic-modules"
implementation "org.graceframework.plugins:gsp"
implementation "org.apache.commons:commons-lang3:3.12.0"
profile "org.graceframework.profiles:web-plugin"
implementation "org.graceframework:grace-plugin-gsp"
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"
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 "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 @@ -67,77 +117,25 @@ tasks.withType(Test) {
useJUnitPlatform()
}

assets {
packagePlugin = true
}

bootJar.enabled = false

jar {
dependsOn 'assetCompile'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grace Admin Plugin",
"Implementation-Version": projectVersion,
"Implementation-Vendor": 'Grace Plugins')
enabled = true
archiveClassifier.set('')
includeEmptyDirs = false
}

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

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
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')
}

pom {
name = "Grace Admin Plugin"
description = "A powerful and flexible, extensible administration framework and management console for Grace."
url = 'https://github.com/grace-plugins/grace-admin'
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-admin.git'
developerConnection = 'scm:git:ssh://github.com:grace-plugins/grace-admin.git'
url = 'https://github.com/grace-plugins/grace-admin/tree/main'
}
}
}
}
assets {
minifyJs = true
minifyCss = true
}

nexusPublishing {
Expand All @@ -154,10 +152,3 @@ nexusPublishing {
}
}
}

afterEvaluate {
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.maven
}
}
158 changes: 158 additions & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
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")

version projectVersion
group "org.graceframework.plugins"

apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "groovy"
apply plugin: "org.graceframework.asset-pipeline"
apply plugin: "org.graceframework.grace-plugin"
apply plugin: "org.graceframework.grace-gsp"
apply plugin: "maven-publish"
apply plugin: "signing"

repositories {
mavenCentral()
}

dependencies {
compileOnly "org.springframework.boot:spring-boot-autoconfigure"
compileOnly "org.graceframework:grace-core"
compileOnly "org.graceframework:grace-plugin-controllers"
compileOnly "org.graceframework:grace-plugin-dynamic-modules"
compileOnly "org.graceframework:grace-plugin-gsp"
implementation "org.apache.commons:commons-lang3:3.12.0"
profile "org.graceframework.profiles:web-plugin"
}

tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}

tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
}

tasks.withType(Test) {
useJUnitPlatform()
}

tasks.withType(org.grails.gradle.plugin.web.gsp.GroovyPageForkCompileTask) {
packageName = 'admin.console'
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grace Admin Plugin",
"Implementation-Version": projectVersion,
"Implementation-Vendor": 'Grace Plugins')
enabled = true
archiveClassifier.set('')
includeEmptyDirs = false
}

assets {
packagePlugin = true
}

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 Admin Plugin"
description = "A powerful and flexible, extensible administration framework and management console for Grace."
url = 'https://github.com/grace-plugins/grace-admin'
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-admin.git'
developerConnection = 'scm:git:ssh://github.com:grace-plugins/grace-admin.git'
url = 'https://github.com/grace-plugins/grace-admin'
}
}

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
}
}
Loading

0 comments on commit 2ec7181

Please # to comment.