Skip to content

Commit

Permalink
restructured gradle configs into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoschwald committed May 15, 2020
1 parent 1ada8da commit 098afc0
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 73 deletions.
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ gradleWrapperVersion=5.6.4
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M

vcsUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
websiteUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
issueTrackerUrl=https://github.com/robertoschwald/grails-audit-logging-plugin/issues
13 changes: 13 additions & 0 deletions gradle/artifactoryPublish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : ''
password = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : ''
}
defaults {
publications('maven')
}
}
}
54 changes: 54 additions & 0 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
asciidoctor {
logDocuments true
baseDirFollowsSourceDir()

sourceDir = file('src/docs')
sources {
include 'index.adoc'
}

outputDir new File(buildDir, 'docs')

outputOptions {
backends = ['html5', 'pdf', 'epub3']
separateOutputDirs = false
}

attributes 'experimental': 'true',
'source-highlighter': 'coderay',
'compat-mode': 'true',
toc: 'left',
icons: 'font',
setanchors: 'true',
idprefix: '',
idseparator: '-',
toc2: '',
numbered: '',
version: project.version,
groupId: project.group,
artifactId: project.name,
revnumber: project.version,
revdate: buildDate()
}

task docs(dependsOn: 'asciidoctor') {
doLast {
File dir = new File(buildDir, 'docs')
dir.mkdirs()

['pdf', 'epub'].each { String ext ->
File f = new File(dir, 'index.' + ext)
if (f.exists()) {
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
}
}

new File(buildDir, 'docs/ghpages.html') << file('src/docs/templates/index.tmpl').text.replaceAll("@VERSION@", project.version).replaceAll("@DOCDATE@", buildDate())

copy {
from 'src/docs'
into new File(buildDir, 'docs').path
include '**/*.png'
}
}
}
22 changes: 22 additions & 0 deletions gradle/grailsPublish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def setIfNotSet = { String name, value ->
if (!project.ext.has(name)) {
project.ext[name] = value
}
}
setIfNotSet 'issueTrackerUrl', project.vcsUrl + '/issues'
setIfNotSet 'websiteUrl', project.vcsUrl

grailsPublish {
user = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : ''
key = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : ''
githubSlug = 'robertoschwald/grails-audit-logging-plugin'
websiteUrl = project.hasProperty('websiteUrl') ? project.websiteUrl : "https://grails.org/plugin/$project.name"
license {
name = project.hasProperty('license') ? [project.license] : ['Apache-2.0']
}
issueTrackerUrl = project.hasProperty('issueTrackerUrl') ? project.issueTrackerUrl : "https://github.com/grails-plugins/$project.name/issues"
vcsUrl = project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/robertoschwald/$project.name"
title = "Grails Audit-Logging Plugin"
desc = "Grails Audit-Logging Plugin for Grails 4.x"
developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"]
}
78 changes: 8 additions & 70 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
}
}

Expand All @@ -26,13 +26,7 @@ apply plugin: "idea"
apply plugin: "org.grails.grails-plugin"
apply plugin: "org.grails.grails-plugin-publish"
apply plugin: "org.grails.grails-gsp"
apply plugin: 'com.jfrog.bintray'



// Used for publishing to central repository, remove if not needed
// apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'
// apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle'
apply plugin: "com.jfrog.artifactory"

ext {
grailsVersion = project.grailsVersion
Expand All @@ -41,9 +35,12 @@ ext {

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}

sourceCompatibility = targetCompatibility = 1.8

dependencies {
profile "org.grails.profiles:web-plugin"

Expand Down Expand Up @@ -80,69 +77,10 @@ task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

grailsPublish {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
githubSlug = 'robertoschwald/grails-audit-logging-plugin'
license {
name = project.hasProperty('license') ? [project.license] : ['Apache-2.0']
}
title = "Grails Audit-Logging Plugin"
desc = "Grails Audit-Logging Plugin for Grails 3.3.x"
developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"]
}
apply from: "${rootProject.projectDir}/gradle/grailsPublish.gradle"
apply from: "${rootProject.projectDir}/gradle/artifactoryPublish.gradle"
apply from: "${rootProject.projectDir}/gradle/docs.gradle"

asciidoctor {
logDocuments true
baseDirFollowsSourceDir()

sourceDir = file('src/docs')
sources {
include 'index.adoc'
}

outputDir new File(buildDir, 'docs')

outputOptions {
backends = ['html5', 'pdf', 'epub3']
separateOutputDirs = false
}

attributes 'experimental': 'true',
'source-highlighter': 'coderay',
'compat-mode': 'true',
toc: 'left',
icons: 'font',
setanchors: 'true',
idprefix: '',
idseparator: '-',
toc2: '',
numbered: '',
version: project.version,
groupId: project.group,
artifactId: project.name,
revnumber: project.version,
revdate: buildDate()
}

task docs(dependsOn: 'asciidoctor') {
doLast {
File dir = new File(buildDir, 'docs')
dir.mkdirs()

['pdf', 'epub'].each { String ext ->
File f = new File(dir, 'index.' + ext)
if (f.exists()) {
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
}
}

new File(buildDir, 'docs/ghpages.html') << file('src/docs/templates/index.tmpl').text.replaceAll("@VERSION@", project.version).replaceAll("@DOCDATE@", buildDate())

copy {
from 'src/docs'
into new File(buildDir, 'docs').path
include '**/*.png'
}
}
}
6 changes: 3 additions & 3 deletions travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ if [[ ( -n "$TRAVIS_TAG" ) || ( "$TRAVIS_BRANCH" == "master" ) ]]; then

if [[ -n $TRAVIS_TAG ]]; then
echo " *** Publishing to Bintray.."
./gradlew audit-logging:bintrayUpload -S || EXIT_STATUS=$?
./gradlew :audit-logging:bintrayUpload || EXIT_STATUS=$?
else
echo " *** Publishing to Grails Artifactory, as no release-tag was found (Currently disabled due to Artifactory error)"
# ./gradlew audit-logging:publish -S || EXIT_STATUS=$?
echo " *** Publishing SNAPSHOT to OJO, as no release-tag was found (SKIPPED. Disabled for now, as we do not have right for deployment, yet)"
# ./gradlew :audit-logging:artifactoryPublish || EXIT_STATUS=$?
fi

echo "*** Building docs and publish to gh-pages branch.."
Expand Down

0 comments on commit 098afc0

Please sign in to comment.