📄 sotask.java
字号:
/* * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Ant", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */package org.apache.jk.ant;import org.apache.tools.ant.types.*;import org.apache.tools.ant.util.*;import org.apache.tools.ant.taskdefs.*;import org.apache.tools.ant.*;import org.apache.jk.ant.compilers.*;import java.io.*;import java.util.*;/** Global properties Same idea as in javac, some user .properties will set the local preferences, including machine-specific. If one is not specified we'll guess it. The build file will be clean. TODO: can we get configure to generate such a file ? build.native.cc=gcc # Path to libtool ( used as a backup ) build.native.libtool= # Platform-specific flags for compilation. build.native.extra_cflags=*//* XXX add a optional "compiler" attribute to not guess the compiler based on the executable name present in a global property.*//** * Task to generate a .so file, similar with ( or using ) libtool. * I hate libtool, so long term I would like to replace most of it * with decent java code. Short term it'll just use libtool and * hide some of the ugliness. * * arguments: * <ul> * <li>source * </ul> * * <p> * * @author Costin Manolache * @author Mike Anderson * @author Ignacio J. Ortega */public class SoTask extends Task { protected String apxs; // or FileSet ? protected Vector src; //[FileSet] protected PatternSet includes; protected Path depends; protected Path libs; protected String module; protected String soFile; protected String soExt = ".so"; protected String cflags; protected File buildDir; protected int debug; protected boolean optG=true; protected boolean optWgcc=true; protected boolean optimize=false; protected boolean profile=false; protected Vector defines = new Vector(); protected Vector imports = new Vector(); // used by the NetWare, win32 linkers protected Vector exports = new Vector(); // used by the NetWare, win32 linkers protected Vector modules = new Vector(); // used by the NetWare linker protected Vector linkOpts = new Vector(); // used by the NetWare, win32 linkers protected Vector altSoFiles = new Vector(); // used by the NetWare linker protected Vector resources = new Vector(); // used by the win32 linker // Computed fields // protected Vector compileList; // [Source] protected Vector srcList=new Vector(); protected CompilerAdapter compiler; // protected GlobPatternMapper co_mapper; public SoTask() {}; // Hack to allow individual compilers/linkers to work // as regular Tasks, independnetly. public void duplicateTo(SoTask so) { // This will act as a proxy for the child task so.project=project; so.target=target; so.location=location; so.taskName=taskName; so.taskType=taskType; so.apxs=apxs; so.src=src; so.includes=includes; so.depends=depends; so.libs=libs; so.module=module; so.soFile=soFile; so.soExt=soExt; so.cflags=cflags; so.buildDir=buildDir; so.debug=debug; so.optG=optG; so.optWgcc=optWgcc; so.optimize=optimize; so.profile=profile; so.defines=defines; so.imports=imports; so.exports=exports; so.resources=resources; so.modules=modules; so.linkOpts=linkOpts; so.srcList=srcList; // so.compileList=compileList; so.compiler=compiler; // so.co_mapper=co_mapper; so.altSoFiles=altSoFiles; } /** @deprecated use setTarget */ public void setSoFile(String s ) { soFile=s; } /** Add debug information */ public void setDebug(boolean b) { optG=b; } /** Add debug information */ public void setOptimize(boolean b) { optimize=b; } /** Add profiling information */ public void setProfile(boolean b) { profile=b; } /** Gcc warnings */ public void setGccWarn(boolean b) { optWgcc=b; } /** Debug the <so> task */ public void setTaskDebug(int i) { debug=i; } /** Add a -D option. Note that each define has * an if/unless attribute */ public void addDef(Def var ) { var.setProject( project ); defines.addElement(var); } /** * Add an import file/symbol for NetWare or win32 platform * * */ public void addImport(JkData imp) { imp.setProject( project ); imports.add(imp); } /** * Add an export file/symbol for NetWare or win32 platform * * */ public void addExport(JkData exp) { exp.setProject( project ); exports.add(exp); } /** * Add an resource file on win32 platform * * */ public void addResource(JkData res) { res.setProject( project ); resources.add(res); } /** * Add a link option for NetWare or win32 platform * * */ public void addLinkOpt(JkData option) { option.setProject( project ); linkOpts.add(option); } /** * Add an NLMModule dependancy * * */ public void addNLMModule(JkData module) { module.setProject( project ); modules.add(module); } /** * Add an alternate target since some platforms (NetWare) have file name * limitations. * */ public void addAltSoFile(JkData altSo) { altSo.setProject( project ); altSoFiles.add(altSo); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -