My favorites | Sign in
Project Logo
                
Code license: Mozilla Public License 1.1
Labels: java, build, ant
Feeds:
People details
Project owners:
  thomas.tom.mueller

PJMake is a build tool that uses a pure Java build definition. It is like Apache Ant, but instead of build.xml, the build file is called Build.java.

To use PJMake in your application:

An example build definition looks like this:

package org.pjmake;

import java.io.File;

/**
 * The build definition.
 */
public class Build extends BuildBase {

    public static void main(String[] args) {
        new Build().run(args);
    }

    public void all() {
        compile();
        test();
        javadoc();
        jar();
    }
    
    public void clean() {
        delete("temp");
        delete("docs");
        mkdir("docs");
        mkdir("bin");
    }
    
    public void compile() {
        clean();
        mkdir("temp");
        download();
        String classpath = "temp" + 
                File.pathSeparator + 
                "ext/junit-4.4.jar" + 
                File.pathSeparator + 
                System.getProperty("java.home") + 
                "/../lib/tools.jar";
        FileList files = getFiles("src/main");
        javac(new String[] { 
                "-d", "temp", 
                "-sourcepath", "src/main", 
                "-classpath", classpath }, files);
    }

    public void download() {
        download("ext/junit-3.8.2.jar",
                "http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar",
                "07e4cde26b53a9a0e3fe5b00d1dbbc7cc1d46060");
    }
    
    private String getVersion() {
        return getStaticField(
                "org.pjmake.demo.HelloWorld", 
                "VERSION");
    }
    
    public void jar() {
        FileList files = getFiles("temp");
        jar("bin/pjmake-" + getVersion() + ".jar", 
                files, "temp");
    }
    
    public void javadoc() {
        delete("docs");
        mkdir("docs/javadoc");
        javadoc(new String[] { 
                "-sourcepath", "src/main" + 
                File.pathSeparator + "src/tools", 
                "-d", "docs", 
                "org.pjmake.demo", "org.pjmake" });
    }        
    
    public void test() {
        junit(new String[] { "org.pjmake.test.TestAll" });
    }
    
    public void zip() {
        FileList files = getFiles("../pjmake").keep("../pjmake/build.*");
        files.addAll(getFiles("../pjmake/docs"));
        files.addAll(getFiles("../pjmake/src"));
        zip("../pjmake.zip", files, "../", false, false);
    }
    
}








Hosted by Google Code