当前位置: 首页>>代码示例>>Java>>正文


Java Echo.setAppend方法代码示例

本文整理汇总了Java中org.apache.tools.ant.taskdefs.Echo.setAppend方法的典型用法代码示例。如果您正苦于以下问题:Java Echo.setAppend方法的具体用法?Java Echo.setAppend怎么用?Java Echo.setAppend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.taskdefs.Echo的用法示例。


在下文中一共展示了Echo.setAppend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendDeliveryList

import org.apache.tools.ant.taskdefs.Echo; //导入方法依赖的package包/类
private void appendDeliveryList(String msg) {
    Echo echo = (Echo) getProject().createTask("echo");
    echo.setOwningTarget(getOwningTarget());
    echo.init();
    echo.setFile(deliveryList);
    echo.setMessage(msg + "\n");
    echo.setAppend(true);
    echo.perform();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:10,代码来源:IvyDeliver.java

示例2: execute

import org.apache.tools.ant.taskdefs.Echo; //导入方法依赖的package包/类
public void execute() {
	// Make sure we have all the required fields set.
	if (outFile == null) {
		throw new BuildException("The outFile attribute is required");
	}


	// First, populate all of the properties we care about for this task.
	if (getProject().getProperty("ant.build.native.toolchain") != null) {
		this.setToolchain(getProject().getProperty("ant.build.native.toolchain"));
	}

	if (getProject().getProperty("ant.build.native.host") != null) {
		this.setHost(getProject().getProperty("ant.build.native.host"));
	}


	// Setup the compiler.
	LinkerAdapter linker = ToolchainFactory.getLinker(toolchain);
	linker.setProject(getProject());
	linker.setOutFile(outFile);

	if (host != null && host.length() > 0) {
		// Prepend the host string to the executable.
		linker.setExecutable(host + '-' + linker.getExecutable());
	}

	for (AbstractFeature feat : features) {
		if (feat.isIfConditionValid() && feat.isUnlessConditionValid()) {
			linker.addArg(feat);
		}
	}

	long newest = 0;
	Iterator<File> inFile = linker.getInFiles();
	while (inFile.hasNext()) {
		long modified = inFile.next().lastModified();

		if (newest < modified) {
			newest = modified;
		}
	}

	if (newest >= outFile.lastModified()) {
		// Print the executed command.
		Echo echo = (Echo) getProject().createTask("echo");
		echo.setTaskName(this.getTaskName());
		echo.setAppend(true);

		// Create an exec task to run a shell.  Using the current shell to
		// execute commands is required for Windows support.
		ExecTask shell = (ExecTask) getProject().createTask("exec");
		shell.setTaskName(this.getTaskName());
		shell.setFailonerror(true);
		//shell.setDir(dir);

		echo.addText(linker.getExecutable());
		shell.setExecutable(linker.getExecutable());

		Iterator<String> args = linker.getArgs();
		while (args.hasNext()) {
			String arg = args.next();

			echo.addText(" " + arg);
			shell.createArg().setLine(arg);
		}

		echo.execute();
		shell.execute();
	}
}
 
开发者ID:kwhat,项目名称:jnitasks,代码行数:72,代码来源:LdTask.java


注:本文中的org.apache.tools.ant.taskdefs.Echo.setAppend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。