Skip to content

Commit 098afc0

Browse files
restructured gradle configs into separate files
1 parent 1ada8da commit 098afc0

File tree

6 files changed

+104
-73
lines changed

6 files changed

+104
-73
lines changed

gradle.properties

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ gradleWrapperVersion=5.6.4
44
org.gradle.daemon=true
55
org.gradle.parallel=true
66
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
7+
8+
vcsUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
9+
websiteUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
10+
issueTrackerUrl=https://github.com/robertoschwald/grails-audit-logging-plugin/issues

gradle/artifactoryPublish.gradle

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
artifactory {
2+
contextUrl = 'https://oss.jfrog.org'
3+
publish {
4+
repository {
5+
repoKey = 'oss-snapshot-local'
6+
username = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : ''
7+
password = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : ''
8+
}
9+
defaults {
10+
publications('maven')
11+
}
12+
}
13+
}

gradle/docs.gradle

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
asciidoctor {
2+
logDocuments true
3+
baseDirFollowsSourceDir()
4+
5+
sourceDir = file('src/docs')
6+
sources {
7+
include 'index.adoc'
8+
}
9+
10+
outputDir new File(buildDir, 'docs')
11+
12+
outputOptions {
13+
backends = ['html5', 'pdf', 'epub3']
14+
separateOutputDirs = false
15+
}
16+
17+
attributes 'experimental': 'true',
18+
'source-highlighter': 'coderay',
19+
'compat-mode': 'true',
20+
toc: 'left',
21+
icons: 'font',
22+
setanchors: 'true',
23+
idprefix: '',
24+
idseparator: '-',
25+
toc2: '',
26+
numbered: '',
27+
version: project.version,
28+
groupId: project.group,
29+
artifactId: project.name,
30+
revnumber: project.version,
31+
revdate: buildDate()
32+
}
33+
34+
task docs(dependsOn: 'asciidoctor') {
35+
doLast {
36+
File dir = new File(buildDir, 'docs')
37+
dir.mkdirs()
38+
39+
['pdf', 'epub'].each { String ext ->
40+
File f = new File(dir, 'index.' + ext)
41+
if (f.exists()) {
42+
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
43+
}
44+
}
45+
46+
new File(buildDir, 'docs/ghpages.html') << file('src/docs/templates/index.tmpl').text.replaceAll("@VERSION@", project.version).replaceAll("@DOCDATE@", buildDate())
47+
48+
copy {
49+
from 'src/docs'
50+
into new File(buildDir, 'docs').path
51+
include '**/*.png'
52+
}
53+
}
54+
}

gradle/grailsPublish.gradle

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def setIfNotSet = { String name, value ->
2+
if (!project.ext.has(name)) {
3+
project.ext[name] = value
4+
}
5+
}
6+
setIfNotSet 'issueTrackerUrl', project.vcsUrl + '/issues'
7+
setIfNotSet 'websiteUrl', project.vcsUrl
8+
9+
grailsPublish {
10+
user = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : ''
11+
key = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : ''
12+
githubSlug = 'robertoschwald/grails-audit-logging-plugin'
13+
websiteUrl = project.hasProperty('websiteUrl') ? project.websiteUrl : "https://grails.org/plugin/$project.name"
14+
license {
15+
name = project.hasProperty('license') ? [project.license] : ['Apache-2.0']
16+
}
17+
issueTrackerUrl = project.hasProperty('issueTrackerUrl') ? project.issueTrackerUrl : "https://github.com/grails-plugins/$project.name/issues"
18+
vcsUrl = project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/robertoschwald/$project.name"
19+
title = "Grails Audit-Logging Plugin"
20+
desc = "Grails Audit-Logging Plugin for Grails 4.x"
21+
developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"]
22+
}

plugin/build.gradle

+8-70
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99
dependencies {
1010
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
11-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
11+
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
1212
}
1313
}
1414

@@ -26,13 +26,7 @@ apply plugin: "idea"
2626
apply plugin: "org.grails.grails-plugin"
2727
apply plugin: "org.grails.grails-plugin-publish"
2828
apply plugin: "org.grails.grails-gsp"
29-
apply plugin: 'com.jfrog.bintray'
30-
31-
32-
33-
// Used for publishing to central repository, remove if not needed
34-
// apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'
35-
// apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle'
29+
apply plugin: "com.jfrog.artifactory"
3630

3731
ext {
3832
grailsVersion = project.grailsVersion
@@ -41,9 +35,12 @@ ext {
4135

4236
repositories {
4337
mavenLocal()
38+
mavenCentral()
4439
maven { url "https://repo.grails.org/grails/core" }
4540
}
4641

42+
sourceCompatibility = targetCompatibility = 1.8
43+
4744
dependencies {
4845
profile "org.grails.profiles:web-plugin"
4946

@@ -80,69 +77,10 @@ task wrapper(type: Wrapper) {
8077
gradleVersion = gradleWrapperVersion
8178
}
8279

83-
grailsPublish {
84-
user = System.getenv('BINTRAY_USER')
85-
key = System.getenv('BINTRAY_KEY')
86-
githubSlug = 'robertoschwald/grails-audit-logging-plugin'
87-
license {
88-
name = project.hasProperty('license') ? [project.license] : ['Apache-2.0']
89-
}
90-
title = "Grails Audit-Logging Plugin"
91-
desc = "Grails Audit-Logging Plugin for Grails 3.3.x"
92-
developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"]
93-
}
80+
apply from: "${rootProject.projectDir}/gradle/grailsPublish.gradle"
81+
apply from: "${rootProject.projectDir}/gradle/artifactoryPublish.gradle"
82+
apply from: "${rootProject.projectDir}/gradle/docs.gradle"
9483

95-
asciidoctor {
96-
logDocuments true
97-
baseDirFollowsSourceDir()
9884

99-
sourceDir = file('src/docs')
100-
sources {
101-
include 'index.adoc'
102-
}
10385

104-
outputDir new File(buildDir, 'docs')
10586

106-
outputOptions {
107-
backends = ['html5', 'pdf', 'epub3']
108-
separateOutputDirs = false
109-
}
110-
111-
attributes 'experimental': 'true',
112-
'source-highlighter': 'coderay',
113-
'compat-mode': 'true',
114-
toc: 'left',
115-
icons: 'font',
116-
setanchors: 'true',
117-
idprefix: '',
118-
idseparator: '-',
119-
toc2: '',
120-
numbered: '',
121-
version: project.version,
122-
groupId: project.group,
123-
artifactId: project.name,
124-
revnumber: project.version,
125-
revdate: buildDate()
126-
}
127-
128-
task docs(dependsOn: 'asciidoctor') {
129-
doLast {
130-
File dir = new File(buildDir, 'docs')
131-
dir.mkdirs()
132-
133-
['pdf', 'epub'].each { String ext ->
134-
File f = new File(dir, 'index.' + ext)
135-
if (f.exists()) {
136-
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
137-
}
138-
}
139-
140-
new File(buildDir, 'docs/ghpages.html') << file('src/docs/templates/index.tmpl').text.replaceAll("@VERSION@", project.version).replaceAll("@DOCDATE@", buildDate())
141-
142-
copy {
143-
from 'src/docs'
144-
into new File(buildDir, 'docs').path
145-
include '**/*.png'
146-
}
147-
}
148-
}

travis-build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ if [[ ( -n "$TRAVIS_TAG" ) || ( "$TRAVIS_BRANCH" == "master" ) ]]; then
2424

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

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

0 commit comments

Comments
 (0)