// Path: weaver-common/src/main/java/weaver/common/Logger.java
// public interface Logger {
// 
//     /**
//      * To see your debug messages run your gradle task with -d option.
//      *
//      * @param message the log message.
//      */
//     void debug(String message);
// 
//     /**
//      * To see your quiet messages run your gradle task with -q option.
//      *
//      * @param message the log message.
//      */
//     void quiet(String message);
// 
//     /**
//      * To see your info messages run your gradle task with -i option.
//      *
//      * @param message the log message.
//      */
//     void info(String message);
// 
//     /**
//      * Log a message at the WARN level.
//      *
//      * @param message the log message.
//      */
//     void warning(String message);
// 
// }
// 
// Path: weaver-common/src/main/java/weaver/common/Processor.java
// public interface Processor {
// 
//     /**
//      * Initializes the processor with the weave environment.
//      *
//      * @param processingEnvironment Weave environment for processor.
//      */
//     void init(WeaveEnvironment processingEnvironment);
// 
//     /**
//      * Weaver plugin will call this method for all defined processors, it gives all classes
//      * <p>
//      * Transformation can be confirmed by calling {@linkplain #writeClass(CtClass)}.
//      *
//      * @param candidateClasses All classes from project source set.
//      * @throws Exception Throws if an error occurred during bytecode manipulation.
//      */
//     void transform(Set<? extends CtClass> candidateClasses) throws Exception;
// 
//     /**
//      * Specifies which classes should be transformed, for example by returning {@link Scope#PROJECT}
//      * all classes from source set will be passed to {@link #transform(Set)}.
//      *
//      * @return Returns the scope.
//      */
//     Scope getScope();
// 
//     /**
//      * @return
//      */
//     String getName();
// 
//     /**
//      * Call this method to store manipulated class otherwise your source will not take effect.
//      * <p>
//      * Note: No need to call this method, if you are using android transform API.
//      *
//      * @param candidateClass Given {@link CtClass}.
//      * @return Returns true, if writes successfully the <code>CtClass</code> in the proper directory
//      * otherwise returns false.
//      */
//     boolean writeClass(CtClass candidateClass);
// }
// 
// Path: weaver-common/src/main/java/weaver/common/Scope.java
// public enum Scope {
//     PROJECT
// }
// 
// Path: weaver-common/src/main/java/weaver/common/WeaveEnvironment.java
// public interface WeaveEnvironment {
// 
//     /**
//      * @return Returns the logger.
//      */
//     Logger getLogger();
// 
//     /**
//      * @return Returns the ClassPool.
//      */
//     ClassPool getClassPool();
// 
//     /**
//      * @return Returns the output directory which contains all transformed classes.
//      */
//     File getOutputDir();
// }
// 
// Path: weaver-instrumentation/src/main/java/weaver/instrumentation/Instrumentation.java
// public class Instrumentation {
//     private ClassPool pool;
// 
//     public Instrumentation(ClassPool pool) {
//         this.pool = pool;
//     }
// 
//     public ClassInjector startWeaving(CtClass ctClass) {
//         return new ClassInjector(ctClass, pool);
//     }
// 
// }


import java.io.IOException;
import javassist.CannotCompileException;
import javassist.CtClass;
import weaver.common.Logger;
import weaver.common.Processor;
import weaver.common.Scope;
import weaver.common.WeaveEnvironment;
import weaver.instrumentation.Instrumentation;
package weaver.processor;



/**
 * A concrete implementation of {@link Processor}. It also provides {@link Instrumentation} utilities.
 *
 * @author Saeed Masoumi (saeed@6thsolution.com)
 */
public abstract class WeaverProcessor implements Processor {

    protected WeaveEnvironment weaveEnvironment;
    protected Logger logger;
    protected Instrumentation instrumentation;

    private String outputPath;

    /**
     * {@inheritDoc}
     */
    public synchronized void init(WeaveEnvironment env) {
        weaveEnvironment = env;
        logger = env.getLogger();
        instrumentation = new Instrumentation(env.getClassPool());
        try {
            outputPath = weaveEnvironment.getOutputDir().getCanonicalPath();
        } catch (IOException e) {
// Path: weaver-common/src/main/java/weaver/common/Logger.java
// public interface Logger {
// 
//     /**
//      * To see your debug messages run your gradle task with -d option.
//      *
//      * @param message the log message.
//      */
//     void debug(String message);
// 
//     /**
//      * To see your quiet messages run your gradle task with -q option.
//      *
//      * @param message the log message.
//      */
//     void quiet(String message);
// 
//     /**
//      * To see your info messages run your gradle task with -i option.
//      *
//      * @param message the log message.
//      */
//     void info(String message);
// 
//     /**
//      * Log a message at the WARN level.
//      *
//      * @param message the log message.
//      */
//     void warning(String message);
// 
// }
// 
// Path: weaver-common/src/main/java/weaver/common/Processor.java
// public interface Processor {
// 
//     /**
//      * Initializes the processor with the weave environment.
//      *
//      * @param processingEnvironment Weave environment for processor.
//      */
//     void init(WeaveEnvironment processingEnvironment);
// 
//     /**
//      * Weaver plugin will call this method for all defined processors, it gives all classes
//      * <p>
//      * Transformation can be confirmed by calling {@linkplain #writeClass(CtClass)}.
//      *
//      * @param candidateClasses All classes from project source set.
//      * @throws Exception Throws if an error occurred during bytecode manipulation.
//      */
//     void transform(Set<? extends CtClass> candidateClasses) throws Exception;
// 
//     /**
//      * Specifies which classes should be transformed, for example by returning {@link Scope#PROJECT}
//      * all classes from source set will be passed to {@link #transform(Set)}.
//      *
//      * @return Returns the scope.
//      */
//     Scope getScope();
// 
//     /**
//      * @return
//      */
//     String getName();
// 
//     /**
//      * Call this method to store manipulated class otherwise your source will not take effect.
//      * <p>
//      * Note: No need to call this method, if you are using android transform API.
//      *
//      * @param candidateClass Given {@link CtClass}.
//      * @return Returns true, if writes successfully the <code>CtClass</code> in the proper directory
//      * otherwise returns false.
//      */
//     boolean writeClass(CtClass candidateClass);
// }
// 
// Path: weaver-common/src/main/java/weaver/common/Scope.java
// public enum Scope {
//     PROJECT
// }
// 
// Path: weaver-common/src/main/java/weaver/common/WeaveEnvironment.java
// public interface WeaveEnvironment {
// 
//     /**
//      * @return Returns the logger.
//      */
//     Logger getLogger();
// 
//     /**
//      * @return Returns the ClassPool.
//      */
//     ClassPool getClassPool();
// 
//     /**
//      * @return Returns the output directory which contains all transformed classes.
//      */
//     File getOutputDir();
// }
// 
// Path: weaver-instrumentation/src/main/java/weaver/instrumentation/Instrumentation.java
// public class Instrumentation {
//     private ClassPool pool;
// 
//     public Instrumentation(ClassPool pool) {
//         this.pool = pool;
//     }
// 
//     public ClassInjector startWeaving(CtClass ctClass) {
//         return new ClassInjector(ctClass, pool);
//     }
// 
// }


// Path: weaver-processor/src/main/java/weaver/processor/WeaverProcessor.java
import java.io.IOException;
import javassist.CannotCompileException;
import javassist.CtClass;
import weaver.common.Logger;
import weaver.common.Processor;
import weaver.common.Scope;
import weaver.common.WeaveEnvironment;
import weaver.instrumentation.Instrumentation;

package weaver.processor;



/**
 * A concrete implementation of {@link Processor}. It also provides {@link Instrumentation} utilities.
 *
 * @author Saeed Masoumi (saeed@6thsolution.com)
 */
public abstract class WeaverProcessor implements Processor {

    protected WeaveEnvironment weaveEnvironment;
    protected Logger logger;
    protected Instrumentation instrumentation;

    private String outputPath;

    /**
     * {@inheritDoc}
     */
    public synchronized void init(WeaveEnvironment env) {
        weaveEnvironment = env;
        logger = env.getLogger();
        instrumentation = new Instrumentation(env.getClassPool());
        try {
            outputPath = weaveEnvironment.getOutputDir().getCanonicalPath();
        } catch (IOException e) {
            outputPath = weaveEnvironment.getOutputDir().getAbsolutePath();