tikhomirov@452: def isRelease = false
tikhomirov@452:
tikhomirov@459: version = '0.9.5-SNAPSHOT'
tikhomirov@452: description = 'Pure Java API and Toolkit for Mercurial DVCS'
tikhomirov@452: group = 'org.tmatesoft.hg4j'
tikhomirov@452:
tikhomirov@452: apply plugin : 'java'
tikhomirov@452: apply plugin : 'maven'
tikhomirov@452:
tikhomirov@452: sourceCompatibility = '1.5'
tikhomirov@452: targetCompatibility = '1.5'
tikhomirov@452:
tikhomirov@452: sourceSets {
tikhomirov@452: main {
tikhomirov@452: java {
tikhomirov@452: srcDir 'src/'
tikhomirov@452: }
tikhomirov@452: }
tikhomirov@452: test {
tikhomirov@452: java {
tikhomirov@452: srcDir 'test/'
tikhomirov@452: }
tikhomirov@452: resources {
tikhomirov@452: srcDir 'test-data/'
tikhomirov@452: }
tikhomirov@452: }
tikhomirov@452: cli {
tikhomirov@452: java {
tikhomirov@452: srcDir 'cmdline/'
tikhomirov@452: }
tikhomirov@452: }
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452: repositories {
tikhomirov@452: mavenLocal()
tikhomirov@452: mavenCentral()
tikhomirov@452: }
tikhomirov@452:
tikhomirov@453: configurations {
tikhomirov@453: deployJars
tikhomirov@453: }
tikhomirov@453:
tikhomirov@452: dependencies {
tikhomirov@452: testCompile 'junit:junit:4.8.2'
tikhomirov@452: cliCompile 'junit:junit:4.8.2'
tikhomirov@452: cliCompile files(sourceSets.main.output) {
tikhomirov@452: builtBy compileJava
tikhomirov@453: }
tikhomirov@453: deployJars "org.apache.maven.wagon:wagon-http:1.0-beta-2"
tikhomirov@452: }
tikhomirov@453:
tikhomirov@452: def sharedMetaInf = {
tikhomirov@452: from project.file('COPYING')
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452:
tikhomirov@452: task sourcesJar(type: Jar) {
tikhomirov@452: classifier = 'src'
tikhomirov@452: from sourceSets.main.java, sourceSets.test.java, sourceSets.cli.java
tikhomirov@452: metaInf sharedMetaInf
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452: task cmdlineJar(type: Jar) {
tikhomirov@452: appendix = 'console'
tikhomirov@452: from sourceSets.cli.output
tikhomirov@452: metaInf sharedMetaInf
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452: jar {
tikhomirov@452: manifest {
tikhomirov@452: attributes ("Implementation-Version": version)
tikhomirov@452: }
tikhomirov@452: metaInf sharedMetaInf
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452: artifacts {
tikhomirov@452: archives sourcesJar, cmdlineJar
tikhomirov@452: deployJars jar, sourcesJar
tikhomirov@452: }
tikhomirov@452:
tikhomirov@452: install {
tikhomirov@452: configuration = configurations.deployJars
tikhomirov@453: /*
tikhomirov@452: repositories.mavenDeployer {
tikhomirov@452: addFilter('f1') { artifact, file ->
tikhomirov@452: println file.name
tikhomirov@452: println artifact.ext
tikhomirov@452: println file.name - ('.' + artifact.ext)
tikhomirov@452: println ' '
tikhomirov@452: def fname = file.name - ('.' + artifact.ext)
tikhomirov@452: println fname.endsWith('src')
tikhomirov@452: fname.endsWith('src')
tikhomirov@452: }
tikhomirov@452: addFilter('f2') { artifact, file ->
tikhomirov@452: def fname = file.name - ('.' + artifact.ext)
tikhomirov@452: fname.endsWith('console')
tikhomirov@452: }
tikhomirov@452: addFilter('f3') { artifact, file ->
tikhomirov@452: def fname = file.name - ('.' + artifact.ext)
tikhomirov@452: fname.endsWith(version)
tikhomirov@452: }
tikhomirov@452: }
tikhomirov@453: */
tikhomirov@452: }
tikhomirov@453:
tikhomirov@453: uploadArchives {
tikhomirov@453: configuration = configurations.deployJars
tikhomirov@453: repositories {
tikhomirov@453: mavenDeployer {
tikhomirov@453: configuration = configurations.deployJars
tikhomirov@453: repository(url: "http://maven.tmatesoft.com/content/repositories/snapshots/") {
tikhomirov@453: authentication(userName: "", password: "")
tikhomirov@453: }
tikhomirov@453: }
tikhomirov@453: }
tikhomirov@453: }
tikhomirov@452:
tikhomirov@459:
tikhomirov@459: task findOutWhyProjectCopyDoesntWork() << {
tikhomirov@459: // files under .hg/ are not copied with copy {}
tikhomirov@459: ext.myjar = zipTree( 'test-data/test-repos.jar' )
tikhomirov@459: ext.destDir = new File(project.getBuildDir(), "hg4j-tests1/")
tikhomirov@459: outputs.dir ext.destDir
tikhomirov@459: CopySpec ss = copySpec {
tikhomirov@459: from ext.myjar
tikhomirov@459: into ext.destDir
tikhomirov@459: include '*', '*/.*', '**/.*/*', '**/.*', '**/*', '*/.*/**', '**/**', '.*/**', '**/.hg/*', '**/.hg*'
tikhomirov@459: eachFile {element ->
tikhomirov@459: println "AAA:$element.relativePath"
tikhomirov@459: }
tikhomirov@459: }
tikhomirov@459: println "includeEmptyDir: $ss.includeEmptyDirs"
tikhomirov@459: println "includes: $ss.includes"
tikhomirov@459: println "allIncludes: $ss.allIncludes"
tikhomirov@459: println "excludes: $ss.excludes"
tikhomirov@459: println "allExcludes: $ss.allExcludes"
tikhomirov@459: }
tikhomirov@459:
tikhomirov@459:
tikhomirov@452: test {
tikhomirov@452: //
tikhomirov@452: //
tikhomirov@452: //
tikhomirov@452:
tikhomirov@459: File testReposRoot = new File(project.getBuildDir(), "hg4j-tests2/");
tikhomirov@459: if ( testReposRoot.exists() ) {
tikhomirov@459: project.delete(testReposRoot)
tikhomirov@459: }
tikhomirov@459: testReposRoot.mkdirs();
tikhomirov@459:
tikhomirov@459: zipTree('test-data/test-repos.jar').visit {element ->
tikhomirov@459: element.copyTo(element.relativePath.getFile(testReposRoot))
tikhomirov@459: }
tikhomirov@459:
tikhomirov@459: systemProperties 'hg4j.tests.repos' : testReposRoot
tikhomirov@452: systemProperties 'hg4j.tests.remote' : 'http://hg.serpentine.com/tutorial/hello'
tikhomirov@452: }