123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- 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 {
- transitive = false
- }
-
- 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'
- compile group: 'com.google.auto.value', name: 'auto-value', version: '1.0-rc4'
-
- 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: 'tabcompletion_bash', version: '+', changing: true
- plugin group: 'com.dmdirc', name: 'tabcompletion_mirc', version: '+', changing: true
-
- testCompile group: 'junit', name: 'junit', version: '4.12'
- testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.17'
- testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
-
- pmd group: 'net.sourceforge.pmd', name: 'pmd-core', version: '5.2.3'
- pmd group: 'net.sourceforge.pmd', name: 'pmd-java', version: '5.2.3'
- }
-
- publishing {
- publications {
- mavenJava(MavenPublication) {
- groupId 'com.dmdirc'
- artifactId 'client'
-
- artifact jar
- }
- }
- repositories {
- maven {
- name 'snapshots'
- url 'http://artifactory.dmdirc.com/artifactory/repo'
- }
- }
- }
-
- sourceSets {
- main {
- java.srcDirs = ['src']
- resources.srcDirs = ['res']
- }
- test {
- java.srcDirs = ['test']
- resources.srcDirs = ['test-res']
- }
- }
-
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
-
- repositories {
- mavenCentral()
- maven {
- url 'http://artifactory.dmdirc.com/artifactory/repo'
- }
- }
-
- pmd {
- ruleSets = []
- ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
- toolVersion = '5.2.3'
- ignoreFailures = true
- }
-
- 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 {
- inputs.dir 'src'
- inputs.dir 'res'
- outputs.file new File(buildDir, 'version.config')
- dependsOn classes
-
- doLast {
- 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"
- }
- }
- }
-
- task createFatVersionConfig {
- inputs.file new File(buildDir, 'version.config')
- outputs.file new File(buildDir, 'fat.version.config')
- dependsOn createVersionConfig
-
- doLast {
- def sourceFile = new File(buildDir, 'version.config')
- def targetFile = new File(buildDir, 'fat.version.config')
-
- java.nio.file.Files.copy(sourceFile.toPath(), targetFile.toPath(),
- java.nio.file.StandardCopyOption.REPLACE_EXISTING)
-
- targetFile << "\nbundledplugins_versions:\n"
- configurations.plugin.each { p ->
- targetFile << " " + p.name.replaceFirst('-', '=').replaceAll('.jar$', '\n');
- }
- }
- }
-
- test.dependsOn createVersionConfig
-
- jar {
- outputs.file "dist/DMDirc.jar"
- dependsOn createVersionConfig
-
- exclude 'com/dmdirc/version.config'
-
- 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'
- }
-
- doLast {
- copy {
- from jar.archivePath
- into "dist/"
- rename ".*", "DMDirc.jar"
- }
- }
- }
-
- task('fatjar', type: Jar) {
- dependsOn createFatVersionConfig
- baseName = 'fat-client'
-
- from("$buildDir/fat.version.config") {
- into 'com/dmdirc'
- rename 'fat.version.config', 'version.config'
- }
-
- into('plugins') {
- from configurations.plugin
- rename '(.*?)-.*(\\.jar)', '$1$2'
- }
-
- with jar {
- exclude 'com/dmdirc/version.config'
- }
-
- manifest {
- attributes 'Main-Class': 'com.dmdirc.Main'
- }
- }
-
- buildscript {
- repositories {
- mavenCentral()
- maven {
- url 'http://artifactory.dmdirc.com/artifactory/repo'
- }
- }
-
- 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.2.1'
- }
|