@@ -0,0 +1,2791 @@
+package com.redhat.ceylon.ant;%0A%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0A%0Aimport org.apache.tools.ant.BuildException;%0Aimport org.apache.tools.ant.Task;%0A%0Aimport com.redhat.ceylon.common.ant.Rep;%0Aimport com.redhat.ceylon.common.config.Repositories;%0Aimport com.redhat.ceylon.compiler.js.Runner;%0A%0A/** Ant task to run Ceylon code compiled to JS from ant.%0A * %0A * @author Enrique Zamudio%0A */%0Apublic class Ceylonjs extends Task %7B%0A%0A    private String nodePath;%0A    private String module;%0A    private String func = %22run%22;%0A    private List%3CRep%3E repos = new LinkedList%3CRep%3E();%0A    private Rep sysrepo;%0A%0A    /**%0A     * Adds a module repository%0A     * @param rep the new module repository%0A     */%0A    public void addRep(Rep rep) %7B%0A        repos.add(rep);%0A    %7D%0A    protected List%3CRep%3E getRepositories() %7B%0A        return repos;%0A    %7D%0A%0A    protected Rep getSystemRepository() %7B%0A        return sysrepo;%0A    %7D%0A%0A    /**%0A     * Sets the system repository%0A     * @param rep the new system repository%0A     */%0A    public void setSysRep(Rep rep) %7B%0A        sysrepo = rep;%0A    %7D%0A%0A    public void setModule(String value) %7B%0A        module = value;%0A    %7D%0A    public void setMethod(String value) %7B%0A        func = value;%0A    %7D%0A    public void setNodePath(String value) %7B%0A        nodePath = value;%0A    %7D%0A%0A    @Override%0A    public void execute() throws BuildException %7B%0A        if (nodePath == null) %7B%0A            try %7B%0A                nodePath = Runner.findNode();%0A            %7D catch (FileNotFoundException ex) %7B%0A                throw new BuildException(%22Cannot find Node.js executable%22, ex);%0A            %7D%0A        %7D%0A        if (module == null) %7B%0A            throw new BuildException(%22ceylonjs requires module attribute to be set%22);%0A        %7D%0A        if (func == null) %7B%0A            throw new BuildException(%22ceylonjs requires method attribute to be set%22);%0A        %7D%0A        List%3CString%3E reps = new ArrayList%3CString%3E(repos.size());%0A        for (Rep r : repos) %7B%0A            reps.add(r.toString());%0A        %7D%0A        if (reps.isEmpty()) %7B%0A            //Use defaults%0A            reps.add(%22modules%22);%0A            File r = Repositories.get().getSystemRepoDir();%0A            if (r != null) %7B%0A                reps.add(r.getAbsolutePath());%0A            %7D%0A            r = Repositories.get().getUserRepoDir();%0A            if (r != null) %7B%0A                reps.add(r.getAbsolutePath());%0A            %7D%0A            System.out.println(reps);%0A        %7D%0A        try %7B%0A            Runner.run(reps, module, func, System.out, true);%0A        %7D catch (IOException ex) %7B%0A            throw new BuildException(ex);%0A        %7D catch (InterruptedException ex) %7B%0A            throw new BuildException(ex);%0A        %7D%0A    %7D%0A%7D%0A

work on #82 - JS runner task for ant