blob: 340c80fb381c91b5a22f768083665c32367001dc [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
group = 'org.apache.freemarker.onlinetester'
project.ext.projectName = "freemarker-online"
def BUILD_NUMBER = project.hasProperty('BUILD_NUMBER') ? "$BUILD_NUMBER" : 'undef'
project.version = "0.1.$BUILD_NUMBER"
project.ext.yml = "$rootDir/src/main/resources/${projectName}.yml"
project.ext.jarName = "${projectName}-${project.version}"
apply from: "intellij.gradle"
apply from: "${rootDir}/dependencies.gradle"
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'project-report'
apply plugin: 'fpm-packaging'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: "com.github.kt3k.coveralls"
// Because Spring 3 doesn't officially support Java 8, and indeed asm fails with it:
// Must be after `apply plugin: 'java'`!
project.sourceCompatibility = "1.8"
project.targetCompatibility = "1.8"
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.kenshoo:gradle-fpm:+'
}
}
repositories {
mavenCentral()
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4"
}
}
dependencies {
compile libraries.dropwizard
compile libraries.dropwizard_views
compile libraries.dropwizard_views_freemarker
compile libraries.dropwizard_assets
compile libraries.springCore
compile libraries.springContext
compile libraries.springContextSupport
compile libraries.springExpression
compile libraries.springSecurityCore
compile libraries.springTransaction
compile libraries.springBeans
compile libraries.springWeb
testCompile libraries.dropwizard_testing
testCompile libraries.springTest
testCompile libraries.junit
testCompile libraries.mockito
testCompile libraries.hamcrest
compile libraries.freemarker
compile libraries.jackson_databind
compile libraries.commonLangs
compile libraries.findBugs
testCompile libraries.selenium_java
testCompile libraries.jersey_grrizle
testCompile libraries.jersey_client
testCompile libraries.springJersey
}
compileJava {
options.compilerArgs << "-Werror"
}
compileTestJava {
options.compilerArgs << "-Werror"
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5'
}
jar {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
manifest {
attributes 'Main-Class': 'org.apache.freemarker.onlinetester.dropwizard.FreeMarkerOnlineTester'
attributes 'Implementation-Version': "$version"
}
}
// wrap jar, upstart and yml into deb package:
def stagingDir = new File(project.buildDir, "staging")
task stageArtifacts(type: Copy) {
stagingDir.mkdir()
// place yml file and jar under staging dir
into new File(stagingDir, "/opt/${projectName}")
from "build/resources/main/${projectName}.yml"
from 'build/libs'
}
task stageStartScript << {
new File(stagingDir, "opt/${projectName}/start").withWriter("UTF-8") {
it.println "#!/usr/bin/env sh\n" +
" set -e\n" +
" exec java \$* -jar ${project.name}-${project.version}.jar server ${project.name}.yml"
}
}
task stageFiles(dependsOn: [stageArtifacts, stageStartScript]) << {
println "staging debian files"
}
// configure plugin to package the staging dir we've
// just created, and to declare java-7 dependency
packaging {
dependencies = ['openjdk-7-jre']
baseDir = stagingDir
}
shadowJar {
baseName = "${jarName}"
classifier = null
version = null
mergeServiceFiles()
}
jacocoTestReport {
reports {
xml.enabled true
}
}
check.dependsOn jacocoTestReport
shadowJar.dependsOn jar
build.dependsOn shadowJar
stageFiles.dependsOn build
debian.dependsOn stageFiles