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

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

The newest version!
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

/**
 * Abstract Compile Delegate
 * @author Ben Leedham
 * @version 1.0.0
 * 
 * Description: Delegate to compile java files using paths from the
 * kundo-dependency-management-plugin and the javac ant task
 * 
 * 

The abstract compile delegate is the base class for test and compile delegates. * It holds the javac ant task wrapper and uses paths set by it's children * to execute the task.

* */ abstract class AbstractCompileDelegate extends AbstractPluginTargetDelegate{ /* * compiler debug switch * @ant-property-name compile.debug */ String debug /** * Constructor * @param ant AntBuilder instance * @param buildContext BuildContext instance */ AbstractCompileDelegate( AntBuilder ant, BuildContext buildContext ){ super( ant, buildContext ) } /* * Setters and getters for automatic property population */ void setDebug( String debug ){ if(debug == '' || debug == null ){ this.debug = Boolean.FALSE }else{ this.debug = debug } } /** * Method that wraps the javac ant task * @param includes files to include in the compilation * @param excludes files to exclude from compilation * @param srcDir location of Java source files to compile * @param outputDir location to store compiled class files * @param classpathRef ant reference of the classpath to use for compilation */ void doCompile( includes, excludes, srcDir, outputDir, classpathRef ){ def destDir = outputDir if(!new File(destDir).exists()){ ant.mkdir(dir:destDir) } ant.javac(includes:includes, excludes:excludes, srcdir:srcDir, destdir:destDir, classpathref:classpathRef, debug:debug ) } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy