meerkat-java/voting-booth-gui/build.gradle

226 lines
5.4 KiB
Groovy

plugins {
id "us.kirchmeier.capsule" version "1.0.2"
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven-publish'
// Uncomment the lines below to define an application
// (this will also allow you to build a "fatCapsule" which includes
// the entire application, including all dependencies in a single jar)
apply plugin: 'application'
mainClassName='meerkat.voting.gui.VotingBoothToyGraphicalRun'
// Is this a snapshot version?
ext { isSnapshot = false }
ext {
groupId = 'org.factcenter.meerkat'
// Credentials for publishing repositories
publishRepository = "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
publishUser = project.hasProperty('publishUser') ? project.property('publishUser') : ""
publishPassword = project.hasProperty('publishPassword') ? project.property('publishPassword') : ""
}
description = "GUI for voting booth"
// Your project version
version = "0.1"
version += "${isSnapshot ? '-SNAPSHOT' : ''}"
//
//repositories {
// flatDir {
// dirs '/src/main/resources/jars'
// }
//}
dependencies {
// Meerkat common
compile project(':meerkat-common')
compile project(':voting-booth')
// TODO: Remove this dependency
compile project(':polling-station')
// Google protobufs
compile 'com.google.protobuf:protobuf-java:3.+'
// Command-line option parsing:
compile 'net.sf.jopt-simple:jopt-simple:5.0.3'
// Json configuraiton parsing
// TODO: Remove this dependency
compile group: 'org.json', name: 'json', version: '20160810'
// Jar that creates barcodes
compile group: 'net.sourceforge.barbecue', name: 'barbecue', version: '1.5-beta1'
// Json configuration parsing for the test
// TODO: Remove this dependency
testCompile group: 'org.json', name: 'json', version: '20160810'
testCompile 'junit:junit:4.+'
// Jar that creates QRcodes
compile 'com.google.zxing:core:3.3.0'
}
/*==== You probably don't have to edit below this line =======*/
// Setup test configuration that can appear as a dependency in
// other subprojects
configurations {
testOutput.extendsFrom (testCompile)
}
task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests'
from sourceSets.test.output
}
artifacts {
testOutput testJar
}
// The run task added by the application plugin
// is also of type JavaExec.
tasks.withType(JavaExec) {
// Assign all Java system properties from
// the command line to the JavaExec task.
systemProperties System.properties
}
protobuf {
// Configure the protoc executable
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.+'
}
}
idea {
module {
project.sourceSets.each { sourceSet ->
def srcDir = "${protobuf.generatedFilesBaseDir}/$sourceSet.name/java"
// add protobuf generated sources to generated source dir.
if ("test".equals(sourceSet.name)) {
testSourceDirs += file(srcDir)
} else {
sourceDirs += file(srcDir)
}
generatedSourceDirs += file(srcDir)
}
// Don't exclude build directory
excludeDirs -= file(buildDir)
}
}
/*===================================
* "Fat" Build targets
*===================================*/
if (project.hasProperty('mainClassName') && (mainClassName != null)) {
task mavenCapsule(type: MavenCapsule) {
description = "Generate a capsule jar that automatically downloads and caches dependencies when run."
applicationClass mainClassName
destinationDir = buildDir
}
task fatCapsule(type: FatCapsule) {
description = "Generate a single capsule jar containing everything. Use -Pfatmain=... to override main class"
destinationDir = buildDir
def fatMain = hasProperty('fatmain') ? fatmain : mainClassName
applicationClass fatMain
def testJar = hasProperty('test')
if (hasProperty('fatmain')) {
appendix = "fat-${fatMain}"
} else {
appendix = "fat"
}
if (testJar) {
from sourceSets.test.output
}
}
}
/*===================================
* Repositories
*===================================*/
repositories {
// Use local maven repository
mavenLocal()
// Use 'maven central' for other dependencies.
mavenCentral()
}
task "info" {
doLast {
println "Project: ${project.name}"
println "Description: ${project.description}"
println "--------------------------"
println "GroupId: $groupId"
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
println ""
}
}
info.description 'Print some information about project parameters'
/*===================================
* Publishing
*===================================*/
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.groupId
pom.withXml {
asNode().appendNode('description', project.description)
}
from project.components.java
}
}
repositories {
maven {
url publishRepository
credentials { username
password
username publishUser
password publishPassword
}
}
}
}