/* * Copyright 2000-2010 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.tools.ant.filters.*; def TCPathVar = "path.variable.teamcitydistribution" def TCPathVarServer = "teamcity.path.variable.teamcitydistribution" def version = System.getProperties()["build.number"]; if (version == null) version = project.getProperties()["build.number"]; if (version == null) version = System.getenv("BUILD_NUMBER"); if (version == null) version = "snapshot-" + new Date().format("yyyyMMdd"+"'z'"+"hhmmss"); dependencies { def teamCityDir = ""; [TCPathVar, TCPathVarServer].each { if (project.hasProperty(it)) { teamCityDir = project.getProperties()[it]; } } def tmp = System.getProperty(TCPathVarServer); if (tmp != null) { teamCityDir = tmp; } tmp = System.getenv(TCPathVarServer); if (tmp != null) { teamCityDir = tmp; } if (!new File(teamCityDir).isDirectory()) { throw new StopExecutionException("Failed to find TeamCity home at ${teamCityDir}"); } teamCityLib = fileTree(teamCityDir + "/webapps/ROOT/WEB-INF/lib").matching { include 'annotations.jar' include 'openapi.jar' include 'util.jar' } annotationsJar = fileTree(teamCityDir + "/webapps/ROOT/WEB-INF/lib").matching { include 'annotations.jar' } log4j = fileTree(teamCityDir + "/webapps/ROOT/WEB-INF/lib").matching { include 'log4j*.jar' } agentApi = fileTree(teamCityDir + "/devPackage").matching { include 'agent-api.jar' } serverApi = fileTree(teamCityDir + "/devPackage").matching { include 'server-api.jar' } commonApi = fileTree(teamCityDir + "/devPackage").matching { include 'common-api.jar' } testApi = fileTree(teamCityDir + "/devPackage/tests").matching { include 'tests-support.jar' } } allprojects { tcVersion="7.1-SNAPSHOT" apply plugin: 'java' sourceCompatibility = '1.5' targetCompatibility = '1.5' } subprojects { dependencies { compile annotationsJar compile log4j compile teamCityLib } } task debug << { [annotationsJar, commonApi, log4j, testApi].each { println it; println "${it.empty}"} } project(':powershell-common') { dependencies { compile commonApi compile annotationsJar } } project (':powershell-agent') { dependencies { compile project(':powershell-common') compile agentApi } } project (':powershell-server') { dependencies { compile project(':powershell-common') compile serverApi } } project (':powershell-test') { dependencies { compile project(':powershell-common') compile project(':powershell-agent') compile project(':powershell-server') } } def pluginDist = new File(distsDir, 'powershell') task initDistrDestinations(dependsOn: [':powershell-common:build', ':powershell-agent:build', ':powershell-server:build']) << { pluginServer = new File(pluginDist, 'server') pluginServer.mkdirs() copy { from project(':powershell-server').libsDir from project(':powershell-common').libsDir into pluginServer } copy { into pluginDist from (projectDir) { include 'teamcity-plugin.xml' filter(ReplaceTokens, tokens:[VERSION: version ]) } } } task zipAgent(type: Zip, dependsOn: ['initDistrDestinations', ':powershell-agent:build']) { from(project(':powershell-common').libsDir ){ into('powershell-agent') } from(project(':powershell-agent').libsDir ) { into('powershell-agent') } archiveName ='powershell-agent.zip' destinationDir = new File(pluginDist, 'agent') } task zipPlugin(type: Zip, dependsOn: ['initDistrDestinations', 'zipAgent']) { from pluginDist archiveName='teamcity-powershell.zip' } task dist(dependsOn: ['zipPlugin']) << { println "##teamcity[publishArtifacts '${zipPlugin.archivePath}']" } task wrapper(type: Wrapper) { gradleVersion = '1.0-rc-3' jarPath = 'wrapper' }