tikhomirov@468: /*
tikhomirov@641: * Copyright (c) 2012-2013 TMate Software Ltd
tikhomirov@641: *
tikhomirov@641: * This program is free software; you can redistribute it and/or modify
tikhomirov@641: * it under the terms of the GNU General Public License as published by
tikhomirov@641: * the Free Software Foundation; version 2 of the License.
tikhomirov@641: *
tikhomirov@641: * This program is distributed in the hope that it will be useful,
tikhomirov@641: * but WITHOUT ANY WARRANTY; without even the implied warranty of
tikhomirov@641: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tikhomirov@641: * GNU General Public License for more details.
tikhomirov@641: *
tikhomirov@641: * For information on how to redistribute this software under
tikhomirov@641: * the terms of a license other than GNU General Public License
tikhomirov@641: * contact TMate Software at support@hg4j.com
tikhomirov@468: */
tikhomirov@452: def isRelease = false
tikhomirov@452:
tikhomirov@470: version = '1.1.0-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@470: repository(url: "http://maven.tmatesoft.com/content/repositories/snapshots/") {
tikhomirov@466: authentication(userName: project.ext.deploySnapshotsRepositoryUser, password: project.ext.deploySnapshotsRepositoryPassword)
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@462: File testReposRoot = new File(project.getBuildDir(), "hg4j-tests/");
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: }