Example usage for org.aspectj.tools.ant.taskdefs AjcTask setAspectpath

List of usage examples for org.aspectj.tools.ant.taskdefs AjcTask setAspectpath

Introduction

In this page you can find the example usage for org.aspectj.tools.ant.taskdefs AjcTask setAspectpath.

Prototype

public void setAspectpath(Path path) 

Source Link

Usage

From source file:org.mitre.sim.ant.taskdefs.TortugaTask.java

License:Open Source License

/**
 * Performs the AspectJ Compilation/*from  w  ww  . j ava2 s .c o m*/
 * @throws BuildException
 */
private void compile() throws BuildException {
    AjcTask ajc = new AjcTask();
    ajc.setProject(getProject());
    ajc.setTaskName(getTaskName() + "-ajc");

    Path ajcPath = (Path) sourceroots.clone();
    Path scratchPath = new Path(ajcPath.getProject(), scratchdir.getAbsolutePath());
    ajcPath.add(scratchPath);

    ajc.setSourceRoots(ajcPath);
    ajc.setDestdir(destdir);
    if (!aspectJ5)
        ajc.setXReweavable(true); //true by default as of AJ 5
    //Whenever we're ready to allow test programs to be Java 5 source, we need
    //to tell ajc to expect Java 5 source
    //    String ajv = getProject().getProperty("ant.java.version");
    //    log("ant.java.version:" + ajv, Project.MSG_INFO);
    //    ajc.setSource(ajv);
    //for now, copy source attribute off tortuga task invocation
    ajc.setSource(source);

    if (destdir.exists()) {
        Path destDirPath = new Path(this.getProject(), destdir.getAbsolutePath());
        ajc.setInpath(destDirPath);
    }

    File tortugaJar = findTortugaJar();
    if (tortugaJar == null)
        throw new BuildException("Can't find tortuga JAR");
    Path aspectPath = new Path(getProject(), tortugaJar.getAbsolutePath());

    ajc.setAspectpath(aspectPath);

    ajc.setFork(true);
    ajc.setForkclasspath(classpath);
    ajc.setMaxmem("256M");

    ajc.execute();
}