123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- def jgit = new org.mdonoughe.JGitDescribeTask()
- jgit.dir = new File(projectDir, '.git')
- project.version = jgit.getDescription() + '-SNAPSHOT'
-
- group = 'com.dmdirc'
-
- apply plugin: 'maven-publish'
- apply plugin: 'java'
- apply plugin: 'findbugs'
- apply plugin: 'pmd'
-
- configurations {
- bundle
- plugin
- compile {
- extendsFrom bundle
- }
- }
-
- configurations.all {
- resolutionStrategy.cacheDynamicVersionsFor 2, 'minutes'
- resolutionStrategy.cacheChangingModulesFor 2, 'minutes'
- }
-
- dependencies {
- compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
- compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.1'
-
- bundle group: 'com.squareup.dagger', name: 'dagger', version: '1.2.1'
- bundle group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.08'
- bundle group: 'com.brsanthu', name: 'migbase64', version: '2.2'
- bundle group: 'net.kencochrane.raven', name: 'raven', version: '5.0.1'
- bundle group: 'com.google.guava', name:'guava', version: '18.0'
- bundle group: 'net.engio', name: 'mbassador', version: '1.2.0'
- bundle group: 'com.dmdirc', name: 'util', version: '+', changing: true
- bundle group: 'com.dmdirc.parser', name: 'common', version: '+', changing: true
-
- plugin group: 'com.dmdirc', name: 'ui_swing', version: '+', changing: true
- plugin group: 'com.dmdirc', name: 'parser_irc', version: '+', changing: true
- plugin group: 'com.dmdirc', name: 'tabcompleter_bash', version: '+', changing: true
- plugin group: 'com.dmdirc', name: 'tabcompleter_mirc', version: '+', changing: true
-
- testCompile group: 'junit', name: 'junit', version: '4.11'
- testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
- testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
- }
-
- publishing {
- publications {
- mavenJava(MavenPublication) {
- groupId 'com.dmdirc'
- artifactId 'client'
-
- artifact jar
- }
- }
- repositories {
- maven {
- name 'snapshots'
- url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
- }
- }
- }
-
- sourceSets {
- main {
- java {
- srcDir 'src'
- }
- resources {
- srcDir 'res'
- }
- }
- test {
- java {
- srcDir 'test'
- }
- resources {
- srcDir 'test-res'
- }
- }
- }
-
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-
- repositories {
- mavenCentral()
- maven {
- url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
- }
- maven {
- url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
- }
- }
-
- pmd {
- ruleSets = []
- ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
- }
-
- tasks.withType(FindBugs) {
- reports {
- html.enabled = true
- xml.enabled = false
- }
- }
-
- findbugs {
- reportLevel = 'low'
- effort = 'max'
- ignoreFailures = true
- }
-
- task getCredentials << {
- def target = file('nexus-teamcity.gradle')
- if (!target.exists()) {
- new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{
- i -> target.withOutputStream { it << i }
- }
- }
-
- apply from: 'nexus-teamcity.gradle'
- project.publishing.repositories[0].credentials {
- username "$nexusUser"
- password "$nexusPass"
- }
- }
-
- task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << {
- }
-
- task createVersionConfig << {
- def targetFile = new File(buildDir, 'version.config')
-
- targetFile.text = ''
- targetFile << "keysections:\n identity\n version\n updater\n bundledplugins_versions\n\n"
- targetFile << "identity:\n name=DMDirc version information\n globaldefault=true\n order=95000\n\n"
- targetFile << "version:\n version=${version}\n\n"
- targetFile << "updater:\n channel=${updaterChannel}\n\n"
- targetFile << "buildenv:\n"
- def compileConfiguration = project.configurations.getByName("compile")
- def resolvedConfiguration = compileConfiguration.resolvedConfiguration
- def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
- resolvedArtifacts.each { dp ->
- def version = dp.moduleVersion.id
- targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
- }
-
- // Copy to the build directory so it's accessible during tests
- java.nio.file.Files.copy(targetFile.toPath(),
- sourceSets.main.output.classesDir.toPath().resolve('com').resolve('dmdirc').resolve('version.config'),
- java.nio.file.StandardCopyOption.REPLACE_EXISTING);
- }
-
- jar.dependsOn createVersionConfig
- test.dependsOn createVersionConfig
-
- jar {
- from("$buildDir/version.config") {
- into 'com/dmdirc/'
- }
-
- from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
- exclude 'META-INF/**'
- }
-
- manifest {
- attributes 'Main-Class': 'com.dmdirc.Main'
- }
- }
-
- buildscript {
- repositories {
- mavenCentral()
- maven {
- url 'http://nexus.dmdirc.com/nexus/content/repositories/thirdparty/'
- }
- }
-
- dependencies {
- classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
- classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
- }
- }
-
- task wrapper(type: Wrapper) {
- gradleVersion = '2.1'
- }
|