
org.openscm.kundo.strategy.DefaultModuleStrategy.groovy Maven / Gradle / Ivy
The newest version!
package org.openscm.kundo.strategy
/*
* 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.Module
/**
* Default Module Strategy
* @author Nigel Garner
* @version 1.0.0
*
* Description: The Default Module Strategy loads a list of modules based based on a default ant property.
*
* The Default Module Strategy creates a list of modules based on the comma delimited 'reactor.module.list' property
*/
/*
* @ant-target doReactor
*/
public class DefaultModuleStrategy extends ModuleStrategy{
/**
* Constructor sets ant instance by calling super
* @param ant AntBuilder instance
*/
DefaultModuleStrategy( ant ) {
super( ant )
}
/**
* Concrete implementation of the ModuleStrategy.loadModules() method
*
* Loads a list of modules based upon the ant comma delimited 'reactor.module.list' property
*/
void loadModules( buildContext, childBuildFile, childTarget , inheritConfiguration, profiles ) {
// Closure for creating a module and adding it to the list.
def addModule = { m ->
def Module module = new Module()
module.name = m
module.buildFile = childBuildFile
module.dir = m
module.target = childTarget
module.inheritConfiguration = inheritConfiguration
modules.add(module)
}
// Get the string list of modules, comma delimited.
log.debug( 'Reactor module list loaded as ' + ant.project.properties.'reactor.module.list')
def modules = ant.project.properties.'reactor.module.list'
// Split the string and create a module for each entry
modules.split(',').each{ m ->
// If m is not an empty string (happens if the property is empty)
if( !m.equals('') ) {
// Add the module
addModule( m )
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy