view build.gradle @ 709:497e697636fc

Report merged lines as changed block if possible, not as a sequence of added/deleted blocks. To facilitate access to merge parent lines AddBlock got mergeLineAt() method that reports index of the line in the second parent (if any), while insertedAt() has been changed to report index in the first parent always
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 21 Aug 2013 16:23:27 +0200
parents 6e7786086f77
children
line wrap: on
line source
/*
 * Copyright (c) 2012-2013 TMate Software Ltd
 *  
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * For information on how to redistribute this software under
 * the terms of a license other than GNU General Public License
 * contact TMate Software at support@hg4j.com
 */
def isRelease = false

  version = '1.2.0-SNAPSHOT'
  description = 'Pure Java API and Toolkit for Mercurial DVCS'
  group = 'org.tmatesoft.hg4j'
  
  apply plugin : 'java'
  apply plugin : 'maven'

  sourceCompatibility = '1.5'
  targetCompatibility = '1.5'
  
  sourceSets {
    main {
      java {
        srcDir 'src/'
      }
    }
    test {
      java {
        srcDir 'test/'
      }
      resources {
        srcDir 'test-data/'
      }
    }
    cli {
      java {
        srcDir 'cmdline/'
      }
    }
  }
  
  repositories {
    mavenLocal()
    mavenCentral()
  }
  
  configurations {
    deployJars
  }
  
  dependencies {
    compile 'com.trilead:trilead-ssh2:1.0.0-build217'
    testCompile 'junit:junit:4.8.2'
    cliCompile 'junit:junit:4.8.2'
    cliCompile files(sourceSets.main.output) {
      builtBy compileJava
    }
    deployJars "org.apache.maven.wagon:wagon-http:1.0-beta-2"
  }
    
  def sharedMetaInf = {
    from project.file('COPYING')
    from project.file('LICENSE-TRILEAD.txt')
  }


  task sourcesJar(type: Jar) {
    classifier = 'src'
    from sourceSets.main.java, sourceSets.test.java, sourceSets.cli.java
    metaInf sharedMetaInf
  }
  
  task cmdlineJar(type: Jar) {
    appendix = 'console'
    from sourceSets.cli.output
    metaInf sharedMetaInf
  }

  jar {
    manifest {
      attributes ("Implementation-Version": version)
    }
    metaInf sharedMetaInf
  }
  
  artifacts {
    archives sourcesJar, cmdlineJar
    deployJars jar, sourcesJar
  }
  
  install {
    configuration = configurations.deployJars
/*
    repositories.mavenDeployer {
      addFilter('f1') { artifact, file ->
         println file.name
         println artifact.ext
         println file.name - ('.' + artifact.ext)
         println '   '
         def fname = file.name - ('.' + artifact.ext)
         println fname.endsWith('src')
         fname.endsWith('src')
      }
      addFilter('f2') { artifact, file ->
         def fname = file.name - ('.' + artifact.ext)
         fname.endsWith('console')
      }
      addFilter('f3') { artifact, file ->
         def fname = file.name - ('.' + artifact.ext)
         fname.endsWith(version)
      }
    }
*/
  }
  
  uploadArchives {
    configuration = configurations.deployJars
    repositories {
        mavenDeployer {
            configuration = configurations.deployJars
            repository(url: "http://maven.tmatesoft.com/content/repositories/snapshots/") {
              authentication(userName: project.ext.deploySnapshotsRepositoryUser, password: project.ext.deploySnapshotsRepositoryPassword)
            }
        }
    }
}


 task findOutWhyProjectCopyDoesntWork() << {
   // files under .hg/ are not copied with copy {}
   ext.myjar = zipTree( 'test-data/test-repos.jar' )
   ext.destDir = new File(project.getBuildDir(), "hg4j-tests1/")
   outputs.dir ext.destDir
   CopySpec ss = copySpec {
     from ext.myjar
     into ext.destDir
     include '*', '*/.*', '**/.*/*', '**/.*', '**/*', '*/.*/**', '**/**', '.*/**', '**/.hg/*', '**/.hg*'
     eachFile {element ->
       println "AAA:$element.relativePath"
     }
   }
   println "includeEmptyDir: $ss.includeEmptyDirs"
   println "includes: $ss.includes"
   println "allIncludes: $ss.allIncludes"
   println "excludes: $ss.excludes"
   println "allExcludes: $ss.allExcludes"
 }


  test {
// <property name="test-repos-root" value="${java.io.tmpdir}/hg4j-tests/"/>
// <delete dir="${test-repos-root}" quiet="yes"/>
// <unjar src="test-data/test-repos.jar" dest="${test-repos-root}"/>
  
    File testReposRoot = new File(project.getBuildDir(), "hg4j-tests/");
    if ( testReposRoot.exists() ) {
      project.delete(testReposRoot)
    }
    testReposRoot.mkdirs();
    
    zipTree('test-data/test-repos.jar').visit {element ->
     element.copyTo(element.relativePath.getFile(testReposRoot))
    }

    systemProperties 'hg4j.tests.repos'  : testReposRoot
    systemProperties 'hg4j.tests.remote' : 'http://hg.serpentine.com/tutorial/hello'
  }