123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- subprojects {
- apply plugin: GitVersion
-
- group = 'com.dmdirc.parser'
-
- apply plugin: 'maven-publish'
- apply plugin: 'java'
-
- sourceSets {
- main {
- java {
- srcDir 'src'
- }
- }
- test {
- java {
- srcDir 'test'
- }
- }
- }
-
- publishing {
- publications {
- mavenJava(MavenPublication) {
- artifact jar
-
- pom.withXml {
- def root = asNode()
- root.appendNode('inceptionYear', '2006')
- root.appendNode('url', 'http://www.dmdirc.com/')
- root.appendNode('name', "${group}:${artifactId}")
- root.appendNode('description', project.name == 'common'
- ? 'Framework for building parsers for connecting to chat networks '
- : 'IRC library')
-
- def scm = root.appendNode('scm')
- scm.appendNode('url', 'https://github.com/DMDirc/parser')
- scm.appendNode('connection', 'scm:https://github.com/DMDirc/Parser.git')
- scm.appendNode('developerConnection', 'scm:ssh://git@github.com:DMDirc/Parser.git')
-
- def license = root.appendNode('licenses').appendNode('license')
- license.appendNode('name', 'MIT License')
- license.appendNode('url', 'http://www.opensource.org/licenses/mit-license.php')
- license.appendNode('distribution', 'repo')
-
- def issues = root.appendNode('issueManagement')
- issues.appendNode('system', 'GitHub Issues')
- issues.appendNode('url', 'https://github.com/DMDirc/Parser/issues')
-
- def developers = root.appendNode('developers')
- def chris = developers.appendNode('developer')
- chris.appendNode('name', 'Chris Smith')
- chris.appendNode('email', 'chris@dmdirc.com')
-
- def greg = developers.appendNode('developer')
- greg.appendNode('name', 'Greg Holmes')
- greg.appendNode('email', 'greg@dmdirc.com')
-
- def shane = developers.appendNode('developer')
- shane.appendNode('name', 'Shane McCormack')
- shane.appendNode('email', 'shane@dmdirc.com')
-
- def dependenciesNode = asNode().appendNode('dependencies')
-
- configurations.compile.allDependencies.each {
- def dependencyNode = dependenciesNode.appendNode('dependency')
- dependencyNode.appendNode('groupId', it.group)
- dependencyNode.appendNode('artifactId', it.name)
- dependencyNode.appendNode('version', it.version)
- }
-
- configurations.testCompile.allDependencies.each {
- def dependencyNode = dependenciesNode.appendNode('dependency')
- dependencyNode.appendNode('groupId', it.group)
- dependencyNode.appendNode('artifactId', it.name)
- dependencyNode.appendNode('version', it.version)
- dependencyNode.appendNode('scope', 'test')
- }
- }
- }
- }
- repositories {
- maven {
- name 'snapshots'
- url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
- }
- }
- }
-
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
-
- repositories.mavenCentral()
-
- dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.+'
- testCompile group: 'org.mockito', name: 'mockito-all', version: '1.+'
- }
-
- 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 javadocJar(type: Jar) {
- classifier = 'javadoc'
- from javadoc
- }
-
- task sourcesJar(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.allSource
- }
-
- artifacts {
- archives javadocJar, sourcesJar
- }
- }
-
- task wrapper(type: Wrapper) {
- gradleVersion = '2.1'
- }
-
- def find(name) {
- if (allprojects.find { it.name == name }) {
- project(name)
- } else if (allprojects.find { it.name == 'parser:' + name }) {
- project('parser:' + name)
- } else if (allprojects.find { it.name == 'modules:parser:' + name }) {
- project('modules:parser:' + name)
- } else {
- println "Couldn't find project $name"
- }
- }
-
- 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.+'
- }
- }
-
- class GitVersion implements Plugin<Project> {
- void apply(Project project) {
- def jgit = new org.mdonoughe.JGitDescribeTask()
- jgit.dir = getGitDirectory(project)
-
- def subdir = getRelativeSubdir(project, jgit.dir)
- if (!subdir.isEmpty()) {
- jgit.subdir = subdir
- }
-
- def version = jgit.description
- project.version = getProjectVersion(version)
- }
-
- File getGitDirectory(Project project) {
- def target = project.projectDir
- def gitDir = new File(target, '.git')
- while (!gitDir.exists() && target.parentFile != null) {
- target = target.parentFile
- gitDir = new File(target, '.git')
- }
- return gitDir
- }
-
- String getRelativeSubdir(Project project, File gitDir) {
- def parent = gitDir.parentFile.absolutePath
- def target = project.projectDir.absolutePath
- return target.substring(parent.length())
- }
-
- String getProjectVersion(String gitVersion) {
- if (gitVersion.matches('.*-[0-9]+-[0-9a-f]+$')) {
- return gitVersion + '-SNAPSHOT'
- } else {
- return gitVersion
- }
- }
-
- }
|