Source

clojuresque / build.gradle

The default branch has multiple heads

Full commit
apply {
    plugin 'java'
    plugin 'groovy'
    plugin 'maven'
}

group = 'clojuresque'
version = '1.4.0-SNAPSHOT'

configurations {
    clojarsDeployerJars {
        visible = false
        description = 'Private configuration to hold ssh wagon dependencies'
    }
}

repositories {
    flatDir name: 'gradle', dirs: new File(System.getenv('GRADLE_HOME') + '/lib')
    flatDir name: 'plugins', dirs: new File(System.getenv('GRADLE_HOME') + '/lib/plugins')
    mavenCentral()
}

dependencies {
    groovy 'org.clojure:clojure:1.0.0'

    groovy name: 'groovy-all', version: '1.7.1'
    groovy name: 'gradle-core', version: '0.9-preview-1'
    groovy name: 'gradle-plugins', version: '0.9-preview-1'
    groovy name: 'asm-all', version: '3.2'
    groovy name: 'slf4j-api', version:'1.5.10'
    groovy name: 'logback-core', version:'0.9.18'
    groovy name: 'logback-classic', version:'0.9.18'
    groovy name: 'ant', version:'1.8.0'
    groovy name: 'ivy', version:'2.1.0'
}

File dummyRepo = new File(project.buildDir, 'deploy')

uploadArchives {
    repositories.mavenDeployer {
        name = 'dummyClojarsLocalDeployer'
        description  = 'Dummy deployer to trick gradle into pom generation'
        repository(url: 'file://' + dummyRepo.path)
        if (project.hasProperty('snapshotsrepo'))
            snapshotRepository url: project.snapshotsrepo
    }
}

uploadArchives.doLast {
    if (!project.version.endsWith("-SNAPSHOT")) {
        project.fileTree(dir: dummyRepo, includes: ['**/*.pom']).each {
            String name = it.path
            String basename = name.substring(0, name.length() - 4)
            String newname = basename + '.xml'

            project.ant.move(file: it, tofile: project.file(newname))
        }

        Map args = [
            executable:  '/usr/bin/scp',
            failOnError: true
        ]

        project.ant.exec(args) {
            project.fileTree(dummyRepo).each { arg value: it }
            arg value: 'clojars@clojars.org:'
        }
    }
}