View | Details | Raw Unified | Return to bug 113191
Collapse All | Expand All

(-)testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParents.java (-3 / +9 lines)
Lines 332-338 Link Here
332
        if (result.getErrorMessages().size()!=0) System.err.println("Expecting no errors from jar building but got\n"+result.getErrorMessages());
332
        if (result.getErrorMessages().size()!=0) System.err.println("Expecting no errors from jar building but got\n"+result.getErrorMessages());
333
        assertTrue("Should get no errors for this compile, but got: "+result.getErrorMessages().size(),result.getErrorMessages().size()==0);
333
        assertTrue("Should get no errors for this compile, but got: "+result.getErrorMessages().size(),result.getErrorMessages().size()==0);
334
        // Execute: "ajc -inpath classes -showWeaveInfo -d classes2 -aspectpath aspects.jar"
334
        // Execute: "ajc -inpath classes -showWeaveInfo -d classes2 -aspectpath aspects.jar"
335
        result = ajc(testBase,new String[]{"-inpath","classes","-showWeaveInfo","-d","classes2","-aspectpath","aspects.jar"});
335
        result = weave(testBase,new String[]{"-inpath","classes","-showWeaveInfo","-d","classes2","-aspectpath","aspects.jar"});
336
336
337
        if (!expectErrors) assertTrue("unexpected errors? \n"+result.getErrorMessages(),!result.hasErrorMessages());
337
        if (!expectErrors) assertTrue("unexpected errors? \n"+result.getErrorMessages(),!result.hasErrorMessages());
338
        
338
        
Lines 415-421 Link Here
415
//		}
415
//		}
416
    }
416
    }
417
    
417
    
418
    public String[] mergeOptions(String[] input,String[] extras) {
418
    // default to testing with ajc
419
    protected CompilationResult weave(File testBase, String[] strings) {
420
        return ajc(testBase, strings);
421
	}
422
423
424
	public String[] mergeOptions(String[] input,String[] extras) {
419
       String[] ret = new String[input.length+extras.length];
425
       String[] ret = new String[input.length+extras.length];
420
       System.arraycopy(input,0,ret,0,input.length);
426
       System.arraycopy(input,0,ret,0,input.length);
421
       System.arraycopy(extras,0,ret,input.length,extras.length);
427
       System.arraycopy(extras,0,ret,input.length,extras.length);
Lines 425-431 Link Here
425
    
431
    
426
    
432
    
427
433
428
    private List getWeaveMessages(CompilationResult result) {
434
    protected List getWeaveMessages(CompilationResult result) {
429
        List infoMessages = result.getInfoMessages();
435
        List infoMessages = result.getInfoMessages();
430
        List weaveMessages = new ArrayList();
436
        List weaveMessages = new ArrayList();
431
        for (Iterator iter = infoMessages.iterator(); iter.hasNext();) {
437
        for (Iterator iter = infoMessages.iterator(); iter.hasNext();) {
(-)testsrc/org/aspectj/tools/ajc/Ajc.java (-1 / +15 lines)
Lines 30-35 Link Here
30
import org.aspectj.bridge.IMessage.Kind;
30
import org.aspectj.bridge.IMessage.Kind;
31
import org.aspectj.bridge.context.CompilationAndWeavingContext;
31
import org.aspectj.bridge.context.CompilationAndWeavingContext;
32
import org.aspectj.util.FileUtil;
32
import org.aspectj.util.FileUtil;
33
import org.aspectj.weaver.tools.CmdLineWeaver;
33
34
34
/**
35
/**
35
 * The Ajc class is intended for use as part of a unit-test suite, it drives
36
 * The Ajc class is intended for use as part of a unit-test suite, it drives
Lines 76-81 Link Here
76
	private File sandbox;
77
	private File sandbox;
77
	private File baseDir;
78
	private File baseDir;
78
	private Main main;
79
	private Main main;
80
	private CmdLineWeaver weaver;
79
	private String[] ajcArgs;
81
	private String[] ajcArgs;
80
	private int incrementalStage = 10;
82
	private int incrementalStage = 10;
81
	private boolean shouldEmptySandbox = true;
83
	private boolean shouldEmptySandbox = true;
Lines 194-199 Link Here
194
			  // important to sleep after preparing the sandbox on first incremental stage (see notes in pr90806)
196
			  // important to sleep after preparing the sandbox on first incremental stage (see notes in pr90806)
195
			  try { Thread.sleep(1000); } catch (Exception e) {}
197
			  try { Thread.sleep(1000); } catch (Exception e) {}
196
			}
198
			}
199
			if (weaver != null) {
200
				weaver.setMessageHander(holder);
201
				weaver.run(args);
202
				weaver = null;
203
			} else 
197
			if (isIncremental) {
204
			if (isIncremental) {
198
				controller.doIncremental(holder);
205
				controller.doIncremental(holder);
199
			} else {
206
			} else {
Lines 269-274 Link Here
269
		if ((dir != null) && !dir.isDirectory()) throw new IllegalArgumentException(dir.getPath() + " is not a directory");
276
		if ((dir != null) && !dir.isDirectory()) throw new IllegalArgumentException(dir.getPath() + " is not a directory");
270
		baseDir = dir;
277
		baseDir = dir;
271
	}
278
	}
279
280
	/**
281
	 * Set a jar weaver to be used for the next compile only
282
	 */
283
	public void setJarWeaverNext(CmdLineWeaver weaver) {
284
		this.weaver = weaver;
285
	}
272
	
286
	
273
	private void addMessagesTo(List aList, IMessage[] messages) {
287
	private void addMessagesTo(List aList, IMessage[] messages) {
274
		for (int i = 0; i < messages.length; i++) {
288
		for (int i = 0; i < messages.length; i++) {
Lines 314-320 Link Here
314
	 * Make every relative file name and dir be absolute under sandbox
328
	 * Make every relative file name and dir be absolute under sandbox
315
	 * Add TESTER_PATH to classpath
329
	 * Add TESTER_PATH to classpath
316
	 */
330
	 */
317
	private String[] adjustToSandbox(String[] args,boolean doCopy) throws IOException {
331
	String[] adjustToSandbox(String[] args,boolean doCopy) throws IOException {
318
		String[] newArgs = new String[args.length];
332
		String[] newArgs = new String[args.length];
319
		boolean hasClasspath = false;
333
		boolean hasClasspath = false;
320
		boolean hasOutdir = false;
334
		boolean hasOutdir = false;
(-)testsrc/org/aspectj/tools/ajc/AjcTestCase.java (-1 / +10 lines)
Lines 30-35 Link Here
30
import org.aspectj.testing.util.TestUtil;
30
import org.aspectj.testing.util.TestUtil;
31
import org.aspectj.weaver.loadtime.WeavingURLClassLoader;
31
import org.aspectj.weaver.loadtime.WeavingURLClassLoader;
32
32
33
import org.aspectj.weaver.tools.CmdLineWeaver;
34
33
import junit.framework.TestCase;
35
import junit.framework.TestCase;
34
36
35
/**
37
/**
Lines 519-525 Link Here
519
		return lastRunResult;
521
		return lastRunResult;
520
	}
522
	}
521
    public void testNothingForAntJUnit() {}
523
    public void testNothingForAntJUnit() {}
522
    
524
	
523
	/**
525
	/**
524
	 * Run the given class (main method), and return the result in a RunResult. The program runs with
526
	 * Run the given class (main method), and return the result in a RunResult. The program runs with
525
	 * a classpath containing the sandbox directory, runtime, testing-client, bridge, and
527
	 * a classpath containing the sandbox directory, runtime, testing-client, bridge, and
Lines 725-730 Link Here
725
		}
727
		}
726
	}
728
	}
727
	
729
	
730
	/**
731
	 * Set a jar weaver to be used for the next compile only
732
	 */
733
	public void setJarWeaverNext(CmdLineWeaver weaver) {
734
		ajc.setJarWeaverNext(weaver);
735
	}
736
	
728
	/* (non-Javadoc)
737
	/* (non-Javadoc)
729
	 * @see junit.framework.TestCase#setUp()
738
	 * @see junit.framework.TestCase#setUp()
730
	 */
739
	 */
(-)aspects.jar (+1 lines)
Added Link Here
1
PKb~I3META-INF/MANIFEST.MFþÊ
(-)testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParentsJarWeaver.java (+17 lines)
Added Link Here
1
package org.aspectj.ajdt.internal.compiler.batch;
2
3
import java.io.File;
4
5
import org.aspectj.tools.ajc.CompilationResult;
6
import org.aspectj.weaver.tools.CmdLineWeaver;
7
8
/** run declare parents tests using the jar weaver command line weaver */
9
public class DeclareParentsJarWeaver extends DeclareParents {
10
11
	public CompilationResult weave(File baseDir, String[] args) {
12
		ajc.setJarWeaverNext(new CmdLineWeaver());
13
		return super.weave(baseDir, args);
14
	}
15
	
16
17
}

Return to bug 113191