Skip to content

Commit 2e54c5e

Browse files
committed
standardized .gitignore, build.gradle, and gradle.properties across plugins using common includes
updated to Grails v3.0.11, Gradle 2.10 minor build cleanup
1 parent 4522b5f commit 2e54c5e

File tree

10 files changed

+167
-99
lines changed

10 files changed

+167
-99
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
*.iml
2+
*.ipr
23
*.iws
34
*.log
5+
*.sublime-workspace
6+
.asscache
47
.DS_Store
58
.gradle
69
.idea
710
build
11+
cobertura.ser
812
/test-app/grails-app/domain

build.gradle

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,11 @@ buildscript {
1616
}
1717

1818
plugins {
19-
id 'io.spring.dependency-management' version '0.5.2.RELEASE'
19+
id 'io.spring.dependency-management' version '0.5.4.RELEASE'
2020
id 'com.jfrog.bintray' version '1.2'
2121
}
2222

23-
version = file('version.txt').text.trim()
24-
group 'org.grails.plugins'
25-
26-
apply plugin: 'maven-publish'
27-
apply plugin: 'org.grails.grails-plugin'
28-
apply plugin: 'org.asciidoctor.convert'
29-
30-
apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'
31-
apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle'
32-
33-
ext {
34-
grailsVersion = project.grailsVersion
35-
gradleWrapperVersion = project.gradleWrapperVersion
36-
}
37-
38-
sourceCompatibility = targetCompatibility = 1.7
39-
40-
repositories {
41-
mavenLocal()
42-
mavenCentral()
43-
maven { url 'https://repo.grails.org/grails/core' }
44-
}
45-
46-
dependencyManagement {
47-
imports {
48-
mavenBom "org.grails:grails-bom:$grailsVersion"
49-
}
50-
applyMavenExclusions false
51-
}
23+
apply from: 'gradle/plugin.gradle'
5224

5325
dependencies {
5426

@@ -62,34 +34,3 @@ dependencies {
6234

6335
compile 'org.hibernate:hibernate-core:4.3.10.Final'
6436
}
65-
66-
asciidoctor {
67-
separateOutputDirs = false
68-
sourceDir = file('src/docs')
69-
sources {
70-
include 'index.adoc'
71-
}
72-
outputDir file('build/docs')
73-
backends 'html5', 'pdf', 'epub3'
74-
attributes 'source-highlighter': 'prettify',
75-
icons: 'font',
76-
setanchors: 'true',
77-
idprefix: '',
78-
idseparator: '-',
79-
toc2: '',
80-
numbered: '',
81-
revnumber: project.version
82-
}
83-
84-
task docs(dependsOn: asciidoctor) << {
85-
File dir = file('build/docs')
86-
87-
['pdf', 'epub'].each { String ext ->
88-
File f = new File(dir, 'index.' + ext)
89-
if (f.exists()) {
90-
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
91-
}
92-
}
93-
94-
file('build/docs/ghpages.html') << file('src/docs/index.tmpl').text.replaceAll('@VERSION@', project.version)
95-
}

gradle.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
grailsVersion=3.0.11
2-
gradleWrapperVersion=2.10
3-
4-
websiteUrl=https://github.com/grails-plugins/grails-db-reverse-engineer
5-
issueTrackerUrl=http://jira.grails.org/browse/GPREVERSEENGINEER
62
vcsUrl=https://github.com/grails-plugins/grails-db-reverse-engineer

gradle/common.gradle

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
def versionTxt = file('version.txt')
2+
version = versionTxt.exists() ? versionTxt.text.trim() : '0.1'
3+
4+
project.ext.setIfNotSet = { String name, value, boolean ext = true ->
5+
if (!project.ext.has(name) || !project[name]) {
6+
(ext ? project.ext : project)[name] = value
7+
}
8+
}
9+
10+
setIfNotSet 'gradleWrapperVersion', '2.10'
11+
setIfNotSet 'group', 'org.grails.plugins', false
12+
setIfNotSet 'sourceCompatibility', 1.7
13+
setIfNotSet 'targetCompatibility', 1.7
14+
15+
apply plugin: 'idea'
16+
apply plugin: 'war'
17+
apply plugin: 'org.grails.grails-gsp'
18+
19+
repositories {
20+
mavenLocal()
21+
mavenCentral()
22+
maven { url 'https://repo.grails.org/grails/core' }
23+
}
24+
25+
dependencyManagement {
26+
imports {
27+
mavenBom "org.grails:grails-bom:$grailsVersion"
28+
}
29+
applyMavenExclusions false
30+
}
31+
32+
dependencies {
33+
testCompile 'org.grails:grails-plugin-testing'
34+
}
35+
36+
// deletes everything from the build directory except for test reports
37+
task cleanBuild {
38+
if (!buildDir.exists()) return
39+
40+
buildDir.eachFile {
41+
if (it.file) {
42+
it.delete()
43+
}
44+
else if (it.name != 'reports' && !it.name.startsWith('geb-reports') && !it.name.startsWith('test-results')) {
45+
it.deleteDir()
46+
}
47+
}
48+
}
49+
50+
test {
51+
testLogging {
52+
exceptionFormat = 'full'
53+
events 'failed', 'standardOut', 'standardError'
54+
}
55+
56+
beforeTest { descriptor -> logger.quiet " -- $descriptor" }
57+
}
58+
59+
task wrapper(type: Wrapper) {
60+
gradleVersion = gradleWrapperVersion
61+
}

gradle/plugin.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apply from: 'gradle/common.gradle'
2+
3+
apply plugin: 'maven-publish'
4+
apply plugin: 'spring-boot'
5+
apply plugin: 'org.grails.grails-plugin'
6+
apply plugin: 'org.asciidoctor.convert'
7+
8+
apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'
9+
apply from: 'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle'
10+
11+
setIfNotSet 'issueTrackerUrl', project.vcsUrl + '/issues'
12+
setIfNotSet 'websiteUrl', project.vcsUrl
13+
14+
dependencies {
15+
provided 'javax.servlet:javax.servlet-api:3.1.0'
16+
provided 'org.grails:grails-dependencies'
17+
provided 'org.grails:grails-web-boot'
18+
provided 'org.springframework.boot:spring-boot-starter-logging'
19+
}
20+
21+
asciidoctor {
22+
separateOutputDirs = false
23+
sourceDir = file('src/docs')
24+
sources {
25+
include 'index.adoc'
26+
}
27+
outputDir new File(buildDir, 'docs')
28+
backends 'html5', 'pdf', 'epub3'
29+
attributes 'source-highlighter': 'prettify',
30+
icons: 'font',
31+
setanchors: 'true',
32+
idprefix: '',
33+
idseparator: '-',
34+
toc2: '',
35+
numbered: '',
36+
revnumber: project.version
37+
}
38+
39+
task docs(dependsOn: asciidoctor) << {
40+
File dir = new File(buildDir, 'docs')
41+
42+
['pdf', 'epub'].each { String ext ->
43+
File f = new File(dir, 'index.' + ext)
44+
if (f.exists()) {
45+
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
46+
}
47+
}
48+
49+
new File(buildDir, 'docs/ghpages.html') << file('src/docs/index.tmpl').text.replaceAll('@VERSION@', project.version)
50+
51+
copy {
52+
from 'src/docs'
53+
into new File(buildDir, 'docs').path
54+
include '**/*.png'
55+
}
56+
}

gradle/testapp.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
File pluginDir = file('.').parentFile
2+
File versionTxt
3+
while (true) {
4+
versionTxt = new File(pluginDir, 'version.txt')
5+
if (versionTxt.exists()) {
6+
break
7+
}
8+
pluginDir = pluginDir.parentFile
9+
}
10+
11+
apply plugin: 'org.grails.grails-web'
12+
13+
apply from: new File(pluginDir, 'gradle/common.gradle').path
14+
15+
project.ext.pluginVersion = versionTxt.text.trim()
16+
project.ext.pluginName = pluginDir.name - 'grails-'
17+
18+
dependencies {
19+
compile "org.grails.plugins:$pluginName:$pluginVersion"
20+
compile 'com.h2database:h2:1.4.190'
21+
compile 'org.grails:grails-dependencies'
22+
compile 'org.springframework.boot:spring-boot-autoconfigure'
23+
compile 'org.springframework.boot:spring-boot-starter-logging'
24+
compile 'org.springframework.boot:spring-boot-starter-tomcat'
25+
console 'org.grails:grails-console'
26+
runtime 'org.grails.plugins:asset-pipeline'
27+
testCompile 'org.gebish:geb-core:0.12.2'
28+
testCompile 'org.grails.plugins:geb'
29+
30+
String seleniumVersion = '2.48.2'
31+
// testCompile 'com.github.detro:phantomjsdriver:1.2.0'
32+
testCompile 'com.codeborne:phantomjsdriver:1.2.1' // TODO switch back to com.github.detro:phantomjsdriver when this
33+
// issue is resolved: https://github.com/detro/ghostdriver/issues/397
34+
35+
testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
36+
['chrome', 'firefox'].each { String name ->
37+
testCompile "org.seleniumhq.selenium:selenium-${name}-driver:$seleniumVersion"
38+
}
39+
}

src/docs/index.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
32

43
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

test-app/build.gradle

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,13 @@ buildscript {
1414
}
1515

1616
plugins {
17-
id 'io.spring.dependency-management' version '0.5.2.RELEASE'
17+
id 'io.spring.dependency-management' version '0.5.4.RELEASE'
1818
}
1919

20-
version '0.1'
21-
group 'reveng.test'
22-
2320
apply plugin: 'spring-boot'
24-
apply plugin: 'org.grails.grails-web'
25-
26-
ext {
27-
grailsVersion = project.grailsVersion
28-
}
29-
30-
repositories {
31-
mavenLocal()
32-
maven { url 'https://repo.grails.org/grails/core' }
33-
}
34-
35-
dependencyManagement {
36-
imports {
37-
mavenBom "org.grails:grails-bom:$grailsVersion"
38-
}
39-
applyMavenExclusions false
40-
}
21+
apply from: '../gradle/testapp.gradle'
4122

4223
dependencies {
43-
compile 'org.springframework.boot:spring-boot-starter-logging'
44-
compile 'org.springframework.boot:spring-boot-autoconfigure'
45-
compile 'org.springframework.boot:spring-boot-starter-tomcat'
46-
compile 'org.grails:grails-dependencies'
47-
compile 'org.grails:grails-web-boot'
48-
4924
compile 'org.grails.plugins:hibernate'
50-
compile 'org.grails.plugins:db-reverse-engineer:4.0.0'
51-
5225
runtime 'mysql:mysql-connector-java:5.1.38'
53-
54-
console 'org.grails:grails-console'
5526
}

test-app/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
grailsVersion=3.0.11
2-
gradleWrapperVersion=2.10

test-app/grails-app/conf/application.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ grails:
2323
hibernate:
2424
cache:
2525
queries: false
26-
use_second_level_cache: false
2726
use_query_cache: false
27+
use_second_level_cache: false
28+
format_sql: true
29+
use_sql_comments: true
2830

2931
environments:
3032
development:

0 commit comments

Comments
 (0)