Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 70527 invoked from network); 5 May 2009 14:29:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 May 2009 14:29:35 -0000 Received: (qmail 92835 invoked by uid 500); 5 May 2009 14:29:35 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 92781 invoked by uid 500); 5 May 2009 14:29:35 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 92772 invoked by uid 99); 5 May 2009 14:29:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 14:29:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 14:29:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7512E238895F; Tue, 5 May 2009 14:28:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r771741 - in /ant/antlibs/dotnet/trunk: changes.xml docs/index.html docs/tallow.html src/main/org/apache/ant/dotnet/wix/TallowTask.java Date: Tue, 05 May 2009 14:28:36 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090505142836.7512E238895F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Tue May 5 14:28:35 2009 New Revision: 771741 URL: http://svn.apache.org/viewvc?rev=771741&view=rev Log: Add a tallow task, submitted by zhihengz AT hotmail DOT com. PR 47078 Added: ant/antlibs/dotnet/trunk/docs/tallow.html (with props) ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java (with props) Modified: ant/antlibs/dotnet/trunk/changes.xml ant/antlibs/dotnet/trunk/docs/index.html Modified: ant/antlibs/dotnet/trunk/changes.xml URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/changes.xml?rev=771741&r1=771740&r2=771741&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/changes.xml (original) +++ ant/antlibs/dotnet/trunk/changes.xml Tue May 5 14:28:35 2009 @@ -38,6 +38,10 @@ + + A new tallow task has been added to ease creation of WiX built + installers. + The wix task has new nested elements that allow users to send addtional command line arguments to candle and light. Modified: ant/antlibs/dotnet/trunk/docs/index.html URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/docs/index.html?rev=771741&r1=771740&r2=771741&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/docs/index.html (original) +++ ant/antlibs/dotnet/trunk/docs/index.html Tue May 5 14:28:35 2009 @@ -160,6 +160,9 @@
  • wix - execute candle and/or light of the WiX toolset.
  • +
  • tallow - execute tallow of the WiX + toolset.
  • +
  • nunit - execute the nunit-console.exe NUnit test runner.
  • Added: ant/antlibs/dotnet/trunk/docs/tallow.html URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/docs/tallow.html?rev=771741&view=auto ============================================================================== --- ant/antlibs/dotnet/trunk/docs/tallow.html (added) +++ ant/antlibs/dotnet/trunk/docs/tallow.html Tue May 5 14:28:35 2009 @@ -0,0 +1,113 @@ + + + + + + Tallow Task + + + +

    tallow

    + +

    Description

    + +

    Runs tallow from the Wix toolset +

    + +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    AttributeDescriptionRequired
    sourceThe single source directory to process.Either this or at least one nested + <sources> set.
    targetThe expected target file.Yes
    vmSame as dotnetexec's vm attribute. + Specify the framework to use.No.
    wixHomeInstallation directory of WiX.No - Ant will assume WiX is on your PATH + otherwise.
    + +

    Parameters specified as nested elements

    + +

    sources

    + +

    Specify source directories that shall be passed on the command line. + This is a dirset.

    + +

    arg

    + +

    Specifies additional arguments for talow

    + +

    arg is + a command + line argument.

    + +

    Examples

    + +

    Create product.wxs from product directory:

    + +
    +      <tallow source="product" target="product.wxs"/>
    +    
    + +

    Create product.wxs from bin,docs, + and conf under product directory:

    + +
    +      <tallow target="bin.wxs"/>
    +        <sources dir="product", includes="bin,docs,conf"/>
    +      </tallow>
    +    
    + +

    Create product.wxs from bin,docs, + and conf under product directory:, and + set all files vital +

    + +
    +      <tallow target="bin.wxs"/>
    +        <sources dir="product", includes="bin,docs,conf"/>
    +        <arg value="-dav"/>
    +      </tallow>
    +    
    + + Propchange: ant/antlibs/dotnet/trunk/docs/tallow.html ------------------------------------------------------------------------------ svn:eol-style = native Added: ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java?rev=771741&view=auto ============================================================================== --- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java (added) +++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java Tue May 5 14:28:35 2009 @@ -0,0 +1,220 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + * + */ + +package org.apache.ant.dotnet.wix; + +import org.apache.ant.dotnet.DotNetExecTask; +import org.apache.ant.dotnet.build.AbstractBuildTask; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.DirSet; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +/** + * Task to run the tallow on packaging content to create a wxs file + * + * @see http://sf.net/projects/wix + */ +public class TallowTask extends Task { + + /** + * The vm attribute - if given. + */ + private String vm; + + /** + * The source dirs. + */ + private ArrayList sources = new ArrayList(); + + /** + * A single source file. + */ + private File source; + + /** + * The target file. + */ + private File target; + + /** + * Where is WiX installed? + */ + private File wixHome = null; + /** + * addtional command line arguments for tallow. + */ + private Commandline cmdl = new Commandline(); + + public TallowTask() { + super(); + } + + /** + * Set the name of the executable for the virtual machine. + * + * @param value the name of the executable for the virtual machine + */ + public void setVm(String value) { + this.vm = value; + } + + /** + * The main source file. + * + *

    tallow may include more directories than this one, + * the main source is the one passed on the command line.

    + * + * @param File object of the main source file. + */ + public void setSource(File f) { + source = f; + } + + /** + * The main target file. + * + * @param File object of the main target file. + */ + public void setTarget(File f) { + target = f; + } + + /** + * A set of source files. + */ + public void addSources(DirSet ds) { + sources.add(ds); + } + /** + * Sets the installation directory of WiX. + * + *

    If omitted, Ant will assume that WiX's executables can be + * found on the PATH.

    + */ + public void setWixHome(File f) { + wixHome = f; + } + /** + * Adds a command-line argument for tallow.exe. + * + * @return new command line argument created. + */ + public Commandline.Argument createArg() { + return cmdl.createArgument(); + } + public void execute() { + + Collection grabbedDirs = grabSources(); + + if (target == null) { + throw new BuildException("You must specify the target if you want" + + " to run tallow."); + } + runTallow(grabbedDirs); + } + + private Collection grabSources() { + + Set r = new HashSet(); + + if (source != null) { + + if (!source.exists()) { + throw new BuildException("Source " + source + + " doesn't exist."); + } else if (!source.isDirectory()) { + + throw new BuildException("Source " + source + + " is not directory."); + } + + r.add(source); + + } else if (sources.size() == 0) { + throw new BuildException("You must specify at least one source" + + " file."); + } else { + Iterator iter = sources.iterator(); + while (iter.hasNext()) { + DirSet ds = (DirSet) iter.next(); + DirectoryScanner scanner = ds.getDirectoryScanner(getProject()); + String[] f = scanner.getIncludedDirectories(); + File base = ds.getDir(getProject()); + for (int i = 0; i < f.length; i++) { + r.add(new File(base, f[i])); + } + } + if (r.isEmpty()) { + throw new BuildException("No sources found"); + } + } + + return r; + } + /** + * Run tallow passing all files of the collection on the command line. + */ + private void runTallow(Collection s) { + run(wixExecutable("tallow.exe"), s, target, cmdl); + } + /** + * returns an absolute path for the given executable if wixHome + * has been specified, the given name otherwise. + */ + private String wixExecutable(String name) { + return wixHome == null ? name + : new File(wixHome, name).getAbsolutePath(); + } + + /** + * Runs the specified command passing all files of the collection + * on the command line - potentially adding an /out parameter. + */ + private void run(String executable, Collection s, File target, + Commandline cmdl) { + DotNetExecTask exec = + DotNetExecTask.getTask(this, vm, executable, null); + exec.setFailonerror(true); + exec.setTaskType("wix"); + + exec.createArg().setValue("/nologo"); + + Iterator iter = s.iterator(); + while (iter.hasNext()) { + File f = (File) iter.next(); + exec.createArg().setValue("-d"); + exec.createArg().setValue(f.getAbsolutePath()); + } + String[] extraArgs = cmdl.getArguments(); + for (int i = 0; i < extraArgs.length; i++) { + exec.createArg().setValue(extraArgs[i]); + } + exec.setOutput (target); + + exec.execute(); + } +} Propchange: ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/TallowTask.java ------------------------------------------------------------------------------ svn:eol-style = native