Skip to content

Commit

Permalink
Added gradle support.
Browse files Browse the repository at this point in the history
Includes the following changes
 - gradle wrapper
 - license configuration
 - code coverage (jaCoCo)
 - coveralls support
 - Travis-ci support
 - running the application using Jetty
  • Loading branch information
aalmiray committed Jan 29, 2015
1 parent 23a88d9 commit a362773
Show file tree
Hide file tree
Showing 11 changed files with 495 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
.settings/
.idea/
*.iml
*.ipr
*.iws
/build/
.gradle/
deploy*.sh
18 changes: 10 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
language: java

install:
- TERM=dumb ./gradlew -q assemble

script:
- TERM=dumb ./gradlew build jacocoTestReport jacocoRootReport

jdk:
- oraclejdk8

notifications:
email:
recipients:
- [email protected]
- [email protected]
- [email protected]
- oraclejdk8

after_success:
./gradlew coveralls
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ alf.io

alf.io

[![Build Status](https://travis-ci.org/exteso/alf.io.png?branch=master)](https://travis-ci.org/exteso/alf.io) [![Coverage Status](https://img.shields.io/coveralls/exteso/alf.io.svg)](https://coveralls.io/r/exteso/alf.io)
[![Build Status](http://img.shields.io/travis/exteso/alf.io/master.svg)](https://travis-ci.org/exteso/alf.io) [![Coverage Status](https://img.shields.io/coveralls/exteso/alf.io.svg)](https://coveralls.io/r/exteso/alf.io)

read the [Requirements](https://github.com/exteso/alf.io/wiki/Requirements)

Expand All @@ -27,3 +27,28 @@ When running with hsqldb, you can launch the integrated db manager with:
>mvn jetty:run -DstartDBManager
You will need to do a refresh (View -> Refresh Tree) to see the up to date schema.


## Gradle Build

This build includes a copy of the Gradle wrapper. You don't have to have Gradle installed on your system in order to build
the project. Simply execute the wrapper along with the appropiate task, for example

>./gradlew clean
### Running with multiple profiles

You must specify a project property at the commmand line, such as

>./gradlew -Pprofile=dev appRun
The following profiles are supported

* dev
* dev-pgsql
* docker-test

You can get a list of all supported Gradle tasks by running

>./gradlew tasks --all
167 changes: 167 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
plugins {
id 'java'
id 'idea'
id 'jacoco'
id 'org.akhikhl.gretty' version '1.1.8'
id 'com.github.kt3k.coveralls' version '2.1.0'
id 'com.github.ben-manes.versions' version '0.7'
id 'com.github.hierynomus.license' version '0.11.0'
}

idea {
project {
jdkName sourceCompatibility
languageLevel sourceCompatibility
}
}

def profile = project.hasProperty('profile') ? project.profile : 'dev'

ext {
// default settings
jettyPort = 8080
jettyHost = '0.0.0.0'
datasourceDialect = 'HSQLDB'
datasourceDriver = 'org.hsqldb.jdbcDriver'
datasourceUrl = 'jdbc:hsqldb:mem:alfio'
datasourceUsername = 'sa'
datasourcePassword = ''
datasourceValidationQuery = 'SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS'
springProfilesActive = 'dev'

switch (profile) {
case 'dev-pgsql':
datasourceDialect = 'PGSQL'
datasourceDriver = 'org.postgresql.Driver'
datasourceUrl = 'jdbc:postgresql://localhost:5432/alfio'
datasourceUsername = 'postgres'
datasourcePassword = 'password'
datasourceValidationQuery = 'SELECT 1'
break
case 'docker-test':
datasourceDialect = 'PGSQL'
datasourceDriver = 'org.postgresql.Driver'
datasourceUrl = 'jdbc:postgresql://0.0.0.0:5432/postgres'
datasourceUsername = 'postgres'
datasourcePassword = 'postgres'
datasourceValidationQuery = 'SELECT 1'
}
}

configurations {
compileOnly
testCompileOnly
}

repositories {
jcenter()
}

dependencies {
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-context-support:$springVersion"
compile "org.springframework:spring-jdbc:$springVersion"
compile "org.springframework:spring-aop:$springVersion"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion"
compile "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile "org.springframework.security:spring-security-web:$springSecurityConfigVersion"
compile "org.springframework.security:spring-security-config:$springSecurityConfigVersion"
compile "com.samskivert:jmustache:1.9"
compile "com.github.sps.mustache:mustache-spring-view:1.3"
compile "javax.mail:mail:1.4.6"
compile("org.xhtmlrenderer:flying-saucer-pdf:9.0.7") {
exclude(module: 'bcmail-jdk14')
exclude(module: 'bcprov-jdk14')
exclude(module: 'bctsp-jdk14')
}
compile "com.google.zxing:core:3.1.0"
compile "com.google.zxing:javase:3.1.0"
compile "org.flywaydb:flyway-core:3.1"
compile "org.postgresql:postgresql:9.3-1102-jdbc41"
compile "org.apache.tomcat:tomcat-jdbc:8.0.8"
compile "org.apache.logging.log4j:log4j-api:$log4jVersion"
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
compile "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
compile "com.stripe:stripe-java:$stripeVersion"
compile "com.google.maps:google-maps-services:0.1.4"
compile "org.apache.commons:commons-lang3:3.3.2"
compile "com.squareup.okhttp:okhttp:2.2.0"

testCompile "org.springframework:spring-test:$springVersion"
testCompile "com.insightfullogic:lambda-behave:0.3"

compileOnly "org.projectlombok:lombok:1.14.8"
compileOnly "javax.servlet:javax.servlet-api:3.1.0"
testCompile "javax.servlet:javax.servlet-api:3.1.0"
runtime "org.hsqldb:hsqldb:$hsqldbVersion"
}

sourceSets {
main {
compileClasspath += [configurations.compileOnly]
}
test {
compileClasspath += [configurations.testCompileOnly]
}
}

javadoc {
classpath += [configurations.compileOnly]
}

idea {
module {
scopes.PROVIDED.plus += [configurations.compileOnly]
scopes.PROVIDED.plus += [configurations.testCompileOnly]
}
}

// -- license configuration

license {
header = rootProject.file('config/HEADER')
strictCheck = true
ignoreFailures = true
mapping {
java = 'JAVADOC_STYLE'
sql = 'DOUBLEDASHES_STYLE'
}
ext.year = '2014-2015'
include '**/*.java'
include '**/*.sql'
}

// -- jetty

gretty {
port = project.jettyPort
jvmArgs = [
"-Dspring.profiles.active=${project.springProfilesActive}",
"-Ddatasource.dialect=${project.datasourceDialect}",
"-Ddatasource.driver=${project.datasourceDriver}",
"-Ddatasource.url=${project.datasourceUrl}",
"-Ddatasource.username=${project.datasourceUsername}",
"-Ddatasource.password=${project.datasourcePassword}",
"-Ddatasource.validationQuery=${project.datasourceValidationQuery}"
]
}

// -- code-coverage

jacoco {
toolVersion = '0.7.2.201409121644'
}

jacocoTestReport {
group = 'Reporting'
description = 'Generate Jacoco coverage reports after running tests.'
additionalSourceDirs = project.files(sourceSets.main.allSource.srcDirs)
sourceDirectories = project.files(sourceSets.main.allSource.srcDirs)
classDirectories = project.files(sourceSets.main.output)
reports {
xml.enabled = true
csv.enabled = false
html.enabled = true
}
}
14 changes: 14 additions & 0 deletions config/HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
This file is part of alf.io.

alf.io is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

alf.io is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with alf.io. If not, see <http://www.gnu.org/licenses/>.
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
group=alfio
version=1.3-SNAPSHOT

sourceCompatibility=1.8
targetCompatibility=1.8

springVersion=4.1.4.RELEASE
jettyVersion=9.2.2.v20140723
springSecurityConfigVersion=3.2.5.RELEASE
log4jVersion=2.1
jacksonVersion=2.4.4
stripeVersion=1.19.1
hsqldbVersion=2.3.2
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Jan 29 19:12:18 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
Loading

0 comments on commit a362773

Please sign in to comment.