All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openscm.kundo.plugins.CopyDependenciesDelegate.groovy Maven / Gradle / Ivy

package org.openscm.kundo.plugins

/*
 * Copyright (C) 2008 The Ultimate People Company Ltd ("UPCO").
 *
 * 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.openscm.kundo.plugins.context.BuildContext
import org.openscm.kundo.common.logging.SimpleLogger

 /**
 * Copy Dependencies Delegate
 * @author Ben Leedham
 * @version 1.0.0
 * 
 * Description: Delegate to copy dependencies from a specified scope to a specified location.
 * 
 * 

the copy dependencies delegate will look at a set of indexed properties loaded from either * the default plugin.properties or the project's build.properties file, for each property matching * the key "copy" the dependencies of the specified scope will be copied to the specified dir.

* */ /* * @ant-target doCopyDependencies */ class CopyDependenciesDelegate extends AbstractDependenciesDelegate { /** * Constructor * @param ant AntBuilder instance * @param buildContext BuildContext instance */ CopyDependenciesDelegate( AntBuilder ant, BuildContext buildContext ){ super( ant, buildContext) } /* * A set of scopes and destination directories for dependencies to be copied to. Format: [plugin].[key].[index].[fieldname] * @indexed-ant-property indexed */ Map indexedProps /** * Implementation of abstract method from AbstractPluginTargetDelegate * to hold assertions that all global and local properties are available to the plugin. * This method is automatically called prior to execution. */ void doCheck(){ assert buildContext.get( "pom.location" ) != null assert buildContext.get( "artifactid" ) != null assert indexedProps != null } /** * Setter method for member variable indexedProps * @param indexedProps Map of aggregated properties objects containing scope and destination info. */ void setIndexedProps( Map indexedProps ){ this.indexedProps = indexedProps } /** * delegate implementation method to be called by doExecute * */ void doCopyDependencies(){ if( log.isDebugEnabled() ){ log.debug( "Entering -CopyDependenciesDelegate.doCopyDependencies( )" ) } this.pomLocation = buildContext.get( "pom.location" ) def artifactId = buildContext.get( "artifactid" ) indexedProps.each{ key, value -> if( key.equals( "copy" ) ){ value.sort().each{ aggregatedProperties -> ant.copy( todir : aggregatedProperties.dir ){ ant.fileset( refid : "global.${artifactId}.${aggregatedProperties.scope}.fileset" ){} } } } } if( log.isDebugEnabled() ){ log.debug( "Exiting -CopyDependenciesDelegate.doCopyDependencies( )" ) } } /** * Concrete implementation of the AbstractPluginTargetDelegate.execute() method */ void doExecute(){ doCopyDependencies() } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy