view init.gradle @ 77:e9605748e5ce

disable local publish for bamboo builds
author smith@nwoca.org
date Mon, 06 Feb 2012 15:27:43 -0500
parents 15a5fd89d80b
children e47f80ef056b
line wrap: on
line source

logger.debug("applying SSDT artifactory Gradle Settings")

gradle.addListener(new ArtifactoryGradleSettings())

gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
logger.info "bamboo build: $gradle.bambooBuild"

subprojects {

    task cleanLocal << {
        def local = project.repositories.find { it.name == 'local' } 
        println local
        if ( local ) {                

        }
    }
    
    task publishLocal(dependsOn: 'uploadArchives')  << { println "published to local repository" }

}
    

class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {

    def void projectsEvaluated(Gradle gradle) {
        
        Project root = gradle.getRootProject()
        root.subprojects {
        
            configurations.all {
                resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
                resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
            }
        
            buildscript {
                repositories {
                    mavenRepo name: 'plugins-repo', url: "http://repos.ssdt.nwoca.org/artifactory/gradle-plugins"
                }
            }
            
            repositories {

                if (!gradle.bambooBuild) {
                    flatDir {
                        name "local"
                        dirs System.properties['user.home'] + "/.ssdt/local-repo"
                    }    
                }
                
                add(new org.apache.ivy.plugins.resolver.URLResolver()) {
                  name = 'ssdt-snapshots'
                  m2compatible =  true
                  url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots'
                  addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
                  addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/ivy-[revision].xml')
                  checkmodified = true
                  changingMatcher = 'regexp'
                  changingPattern = '.*SNAPSHOT'                  
                }
                add(new org.apache.ivy.plugins.resolver.URLResolver()) {
                  name = 'ssdt-releases'
                  m2compatible = false
                  url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases'
                  addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
                  addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml')
                }
                mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo'
                 
            }           
              
            uploadArchives {
                repositories {
                    if ( project.repositories.find { it.name == 'local' } ) {                
                        add project.repositories.local
                    }
                }
            }          
        }
    }
}