blob: 588b9dbce2e2198c98698d7ee78bc7cfce44aaa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/********************************************************************
* Copyright (c) 2006 Contributors. All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v 2.0
* which accompanies this distribution and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
*
* Contributors: IBM Corporation - initial API and implementation
* Helen Hawkins - initial version
*******************************************************************/
package org.aspectj.systemtest.incremental.tools;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.aspectj.ajde.core.IOutputLocationManager;
/**
* OutputLocationManger tests which check whether the correct type of build has happened.
*/
public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
public void testPr166580() {
initialiseProject("PR166580");
configureOutputLocationManager("PR166580", new MyOutputLocationManager("PR166580", 2));
build("PR166580");
checkWasFullBuild();
alter("PR166580", "inc1");
build("PR166580");
checkWasntFullBuild();
}
/**
* Will send output from src dir 'srcX' to directory 'binX'
*/
private class MyOutputLocationManager implements IOutputLocationManager {
private String projectDir;
private int numberOfSrcDirs;
private List<File> allOutputDirs;
public MyOutputLocationManager(String projectName, int numberOfSrcDirs) {
projectDir = getWorkingDir() + File.separator + projectName;
this.numberOfSrcDirs = numberOfSrcDirs;
}
public void reportFileWrite(String outputfile, int filetype) {
}
public void reportFileRemove(String outputfile, int filetype) {
}
public Map<File,String> getInpathMap() {
return Collections.emptyMap();
}
public File getOutputLocationForClass(File compilationUnit) {
String path = compilationUnit.getAbsolutePath();
int index = path.indexOf("src");
String number = path.substring(index + 3, index + 4);
File ret = new File(projectDir + File.separator + "bin" + number);
if (!ret.exists()) {
ret.mkdirs();
}
return ret;
}
public File getOutputLocationForResource(File resource) {
return getOutputLocationForClass(resource);
}
public List<File> getAllOutputLocations() {
if (allOutputDirs == null) {
allOutputDirs = new ArrayList<>();
for (int i = 0; i < numberOfSrcDirs + 1; i++) {
File f = null;
if (i == 0) {
f = new File(projectDir + File.separator + "bin");
} else {
f = new File(projectDir + File.separator + "bin" + i);
}
allOutputDirs.add(f);
}
}
return allOutputDirs;
}
public File getDefaultOutputLocation() {
return new File(projectDir + File.separator + "bin");
}
public String getSourceFolderForFile(File sourceFile) {
return null;
}
public int discoverChangesSince(File dir, long buildtime) {
// TODO Auto-generated method stub
return 0;
}
}
}
|