Skip to content

Commit

Permalink
A bunch of build updates during Hackergarten at Javaland
Browse files Browse the repository at this point in the history
 - apply the license plugin (file headers were not updated).
 - apply the versions plugin.
 - apply jacoco anc codevarge support
 - configure travis build
 - apply clirr plugin
  • Loading branch information
aalmiray committed Mar 25, 2015
1 parent 2d5e73d commit b9be5a5
Show file tree
Hide file tree
Showing 15 changed files with 703 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .gitignore
@@ -1,3 +1,7 @@
*.iml
*.ipr
*.iws
build/
.idea
out/
.idea/
.gradle/
17 changes: 17 additions & 0 deletions .travis.yml
@@ -0,0 +1,17 @@
language: java

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

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

jdk:
- oraclejdk8

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
./gradlew coveralls
85 changes: 78 additions & 7 deletions build.gradle
@@ -1,10 +1,27 @@
buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
classpath 'org.kordamp.gradle:clirr-gradle-plugin:0.2.0'
}
}

defaultTasks = ['build']

apply plugin: 'com.github.kt3k.coveralls'

allprojects {
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'com.github.ben-manes.versions'

group = 'com.jidefx'
version = "${VERSION}"
Expand All @@ -17,13 +34,41 @@ allprojects {
options.compilerArgs = ["-g:${DEBUG_LEVELS}"]
}

repositories {
mavenCentral()
}
repositories {
jcenter()
}
}

apply plugin: 'jacoco'

jacoco {
toolVersion = jacocoVersion
}

ext {
jacocoProjects = []
projectsWithClirr = []
}

configure(subprojects) {
apply from: '../common.gradle'
configure(subprojects) { subproj ->
subproj.apply from: rootProject.file('common.gradle')
subproj.apply from: rootProject.file('gradle/publishing.gradle')
subproj.apply from: rootProject.file('gradle/code-coverage.gradle')
subproj.apply from: rootProject.file('gradle/code-quality.gradle')
subproj.apply plugin: 'org.kordamp.gradle.clirr'

subproj.clirr {
failOnErrors = false
}

projectsWithClirr << subproj

task sourcesJar(type: Jar) {
group 'Build'
description 'An archive of the source code'
classifier 'sources'
from sourceSets.main.allSource
}
}

project(':module-decoration') {
Expand All @@ -42,8 +87,8 @@ project(':module-fields') {
dependencies {
compile project(':module-converters')
compile project(':module-decoration')
compile 'com.miglayout:miglayout-core:4.2'
compile 'com.miglayout:miglayout-javafx:4.2'
compile 'com.miglayout:miglayout-core:5.0'
compile 'com.miglayout:miglayout-javafx:5.0'
}
}

Expand Down Expand Up @@ -163,3 +208,29 @@ task cleanBuild << {

task clean(overwrite: true, dependsOn: cleanBuild) {
}

coveralls {
sourceDirs = files(jacocoProjects.sourceSets.main.allSource.srcDirs).files.absolutePath
}

evaluationDependsOnChildren()

task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = jacocoProjects.test
additionalSourceDirs = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(jacocoProjects.sourceSets.main.output)
executionData = files(jacocoProjects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
html.destination = "${buildDir}/reports/jacoco/test/html"
xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}

task clirrRootReport(type: org.kordamp.gradle.clirr.ClirrReportTask) {
dependsOn = projectsWithClirr.tasks.clirr
reports = files(projectsWithClirr.tasks.clirr.xmlReport)
}
2 changes: 1 addition & 1 deletion common.gradle
Expand Up @@ -29,7 +29,7 @@ dependencies {
compile files(jfxrtLocation)
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'junit:junit-dep:4.11'
testCompile 'junit:junit:4.11'
testCompile 'junit:junit:4.12'
}

tasks.withType(Test) {
Expand Down
18 changes: 18 additions & 0 deletions config/HEADER
@@ -0,0 +1,18 @@
Copyright (c) ${year}, JIDE Software Inc. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.

This code 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
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).

You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
82 changes: 82 additions & 0 deletions config/checkstyle/checkstyle.xml
@@ -0,0 +1,82 @@
<!--
~ Copyright 2014 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- Blocks -->
<module name="EmptyBlock">
<property name="option" value="stmt"/>
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
</module>
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_CATCH"/>
</module>
<module name="AvoidNestedBlocks"/>

<!-- Braces -->
<!--<module name="NeedBraces"/>-->

<!-- Coding -->
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!--<module name="ExplicitInitialization"/>-->
<!--<module name="MultipleVariableDeclarations"/>-->
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="RedundantThrows">
<property name="allowUnchecked" value="true"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<!--<module name="UnnecessaryParentheses"/>-->

<!-- Design -->
<!--<module name="InterfaceIsType"/>-->

<!-- Imports -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<!-- Naming -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]+([A-Z_]*)*$"/>
</module>
<!--<module name="ConstantName"/> -->
<module name="LocalFinalVariableName"/>
<!--<module name="LocalVariableName"/>-->
<module name="MemberName"/>
<module name="MethodName">
<property name="format" value="^(\$)?[a-z]?([a-zA-Z0-9_]*)*$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]+([A-Z_]*)*$"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<module name="ParameterName"/>
<!--<module name="StaticVariableName"/>-->
<module name="TypeName"/>

</module>
<module name="FileTabCharacter"/>
</module>
52 changes: 52 additions & 0 deletions config/codenarc/codenarc.groovy
@@ -0,0 +1,52 @@
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ruleset {
ruleset('rulesets/basic.xml') {
exclude 'EmptyCatchBlock'
exclude 'EmptyMethod'
}
ruleset('rulesets/imports.xml') {
exclude 'MisorderedStaticImports'
}
ruleset('rulesets/naming.xml') {
exclude 'PropertyName'
'ClassName' {
regex = '^[A-Z][a-zA-Z0-9]*$'
}
'FieldName' {
finalRegex = '^_?[a-z][a-zA-Z0-9]*$'
staticFinalRegex = '^[A-Z][A-Z_0-9]*$'
}
'MethodName' {
regex = '^[a-z][a-zA-Z0-9_]*$'
}
'VariableName' {
finalRegex = '^_?[a-z][a-zA-Z0-9]*$'
}
}
ruleset('rulesets/unused.xml')
ruleset('rulesets/exceptions.xml')
// ruleset('rulesets/logging.xml')
ruleset('rulesets/braces.xml') {
exclude 'IfStatementBraces'
}
ruleset('rulesets/size.xml')
ruleset('rulesets/junit.xml')
ruleset('rulesets/unnecessary.xml')
ruleset('rulesets/dry.xml')
ruleset('rulesets/design.xml')
}
11 changes: 9 additions & 2 deletions gradle.properties
Expand Up @@ -3,8 +3,6 @@ VERSION=b128
OLD_VERSION=109
DEBUG_LEVELS=source,lines,vars

JDK_HOME=C:/Program Files/Java/jdk1.8.0_20

PATH_DIST=dist
PATH_BUILD=build
PATH_JAVADOC_OUTPUT=build/javadoc
Expand All @@ -17,3 +15,12 @@ DIST_SOURCE_SUFFIX=-sources

SONATYPE_USERNAME=
SONATYPE_PASSWORD=

project_vendor=jidesoft
project_description=JideFX Common Layer
project_url=https://github.com/jidesoft/jidefx-oss
project_scm=https://github.com/jidesoft/jidefx-oss.git
project_issues=https://github.com/jidesoft/jidefx-oss/issues
project_bintray_repo=maven
project_bintray_org=jidesoft
jacocoVersion=0.7.3.201502191951
20 changes: 20 additions & 0 deletions gradle/code-coverage.gradle
@@ -0,0 +1,20 @@
apply plugin: 'jacoco'

jacoco {
toolVersion = jacocoVersion
}

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

jacocoProjects << project

0 comments on commit b9be5a5

Please sign in to comment.