Skip to content
Permalink
Browse files

add a lot of options to gradle build

  • Loading branch information
Zasch committed Jun 25, 2014
1 parent 670465f commit ba61eb0f9f36c1e719238cfe7d840a0be64a6d55
Showing with 76 additions and 65 deletions.
  1. +7 −1 .gitignore
  2. +7 −12 artifactory.gradle
  3. +25 −31 build.gradle
  4. +2 −2 gradle/wrapper/gradle-wrapper.properties
  5. +1 −19 settings.gradle
  6. +34 −0 version.gradle
@@ -13,4 +13,10 @@
/junitvmwatcher4615577556086699874.properties
/junitvmwatcher7015473125784659852.properties
/junitvmwatcher7720677413329481740.properties
/doc
/doc
.idea
atlassian-ide-plugin.xml
*.iml
*.ipr
*.iws
*.*~
@@ -1,3 +1,6 @@
apply plugin: 'artifactory'
apply plugin: 'maven'

buildscript {
repositories {
maven {
@@ -7,17 +10,9 @@ buildscript {
password = "${artifactory_password}"
}
}

}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
}
}

allprojects {
apply plugin: 'artifactory'
}

artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
@@ -26,7 +21,7 @@ artifactory {
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true

}
}
resolve {
@@ -35,7 +30,7 @@ artifactory {
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true

}
}
}
}
@@ -1,10 +1,24 @@
apply plugin: 'java'
apply plugin: 'maven'
//apply plugin: 'jacoco'
//apply from file: 'artifactory.gradle'
apply plugin: 'eclipse'
apply plugin: 'idea'

// apply plugins/external files only on jenkins build
// jenkins needs -Pjenkins switch
if(project.hasProperty('jenkins')) {
apply plugin: 'jacoco'
apply from: 'artifactory.gradle'
apply from: 'version.gradle'
}

version = '1.1-SNAPSHOT' //getCheckedOutGitCommitHash() + '-SNAPSHOT'
group = 'org.sdmlib'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.4')
}
}

sourceSets {
main.java.srcDirs = ['src', 'NetworkParser', 'replicationsrc']
@@ -13,36 +27,18 @@ sourceSets {
test.resources.srcDir 'test/resources'
}

def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 12
/*
* '.git/HEAD' contains either
* in case of detached head: the currently checked out commit hash
* otherwise: a reference to a file containing the current commit hash
*/
def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd
// def isRef = head.length > 1 // ref: refs/heads/master

if(isCommit) return head[0].trim().take(takeFromHash) // e5a7c79edabb

def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master
refHead.text.trim().take takeFromHash
}

repositories {
maven {
url 'http://141.51.167.92/nexus/content/repositories/snapshots'
}
jcenter()
mavenLocal()
mavenCentral()

maven {
url 'http://141.51.167.92/nexus/content/repositories/central'
}
// NetworkParser
maven { url "https://se.cs.uni-kassel.de/artifactory/libs-snapshot-local" }
}

dependencies {
compile group: "junit", name: "junit", version: "4.11"
compile group: "junit", name: "junit", version: "4.+"
compile 'de.uniks:Networkparser:0+'
}

test {
@@ -57,7 +53,5 @@ test {
tasks.withType(JavaCompile) {
//Suppress underscore warnings
options.compilerArgs << '-Xlint:none'
//Fix java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager on Jenkins
// options.compilerArgs << '-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager'
}

@@ -1,6 +1,6 @@
#Wed Jun 18 11:25:42 CEST 2014
#Wed Jun 25 11:55:44 CEST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip
@@ -1,19 +1 @@
/*
* This settings file was auto generated by the Gradle buildInit task
* by 'zasch' at '18.06.14 11:25' with Gradle 1.12
*
* The settings file is used to specify which projects to include in your build.
* In a single project build this file can be empty or even removed.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at http://gradle.org/docs/1.12/userguide/multi_project_builds.html
*/

/*
// To declare projects as part of a multi-project build use the 'include' method
include 'shared'
include 'api'
include 'services:webservice'
*/

rootProject.name = 'sdmlib'
rootProject.name = 'SDMLib'
@@ -0,0 +1,34 @@
// MAJOR VERSION - Manually set
//----------------------
def majorVersion = 1
//----------------------

task printVersion {
doFirst {
println "$version"
}
}

version = new Version(major: majorVersion, minor: getGitTag())
group = 'org.sdmlib'

class Version {
int major, minor
int revision = System.getenv().BUILD_NUMBER as int
// change, if release is needed some day: boolean release
// also change version above to accept release property
boolean release = false

String toString() {
"$major.$minor.$revision${release ? '' : '-SNAPSHOT'}"
}
}

def getGitTag() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--abbrev=0', '--tags'
standardOutput = stdout
}
stdout.toString().trim() as int
}

0 comments on commit ba61eb0

Please sign in to comment.
You can’t perform that action at this time.