-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCompileSettings.java
More file actions
56 lines (42 loc) · 1.82 KB
/
CompileSettings.java
File metadata and controls
56 lines (42 loc) · 1.82 KB
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
package crml.compiler;
import java.io.File;
import java.net.URL;
public class CompileSettings {
public String testFolderIn;
public String verifModelFolder;
public String referenceResFolder;
public String outputFolder = defaultOutputRoot; // if not set explicitly
public String within = "";
static final String defaultOutputRoot = "build/testSuiteGenerated";
static final String CRMLtoModelicaLibrary = "libraries/modelica/CRMLtoModelica.mo";
static final String CRMLLibrary = "libraries/modelica/CRML.mo";
public ProcessBuilder processBuilder; // used for running omc commands
public void initAllDirs(String testF, String verifF, String refResF, String subFolder){
String sf = java.io.File.separator + subFolder;
testFolderIn = getResourcePath(testF) + sf;
verifModelFolder = getResourcePath(verifF) + sf;
referenceResFolder = getResourcePath(refResF) + sf;
}
public void initTestDir(String testF){
testFolderIn = getResourcePath(testF);
}
/**
* Puts the tests in a sub-folder in the default putput directory
*/
public void setOutputSubFolder(String subFolder){
outputFolder = defaultOutputRoot + java.io.File.separator + subFolder;
}
private static String getResourcePath(String dirName){
System.out.println(Thread.currentThread().getContextClassLoader().toString());
URL url = Thread.currentThread().getContextClassLoader().getResource(dirName);
String path;
if(url != null) {
path = url.getPath();
path = Utilities.removeWindowsDriveLetter(path);
} else {
String dir = "src/test/resources/" + dirName;
path = new File(dir).getAbsolutePath();
}
return path;
}
}