src/main/java/de/unixwork/uwproj/Dependency.java

changeset 5
895bf81d3b6e
parent 0
38775db5fdf5
child 8
82cd9f1d94cb
equal deleted inserted replaced
4:6bf4c948d0ba 5:895bf81d3b6e
16 * @author olaf 16 * @author olaf
17 */ 17 */
18 public class Dependency { 18 public class Dependency {
19 private String name; 19 private String name;
20 private String platform; 20 private String platform;
21 private String not;
21 22
22 private List<Flags> flags = new LinkedList<>(); 23 private List<Flags> flags = new LinkedList<>();
23 private List<PkgConfigPackage> pkgconfig = new LinkedList<>(); 24 private List<PkgConfigPackage> pkgconfig = new LinkedList<>();
24 private List<String> tests = new LinkedList<>(); 25 private List<String> tests = new LinkedList<>();
26 private StringBuilder make = new StringBuilder();
25 27
26 private boolean abortOnError = false; 28 private boolean abortOnError = false;
27 29
28 private int num = 0; 30 private int num = 0;
29 31
30 public static Dependency parse(Element element) throws Exception { 32 public static Dependency parse(Element element) throws Exception {
31 Dependency d = new Dependency(); 33 Dependency d = new Dependency();
32 34
33 String name = element.getAttribute("name"); 35 String name = element.getAttribute("name");
34 String platform = element.getAttribute("platform"); 36 String platform = element.getAttribute("platform");
37 String not = element.getAttribute("not");
35 if(name.length() > 0) { 38 if(name.length() > 0) {
36 d.setName(name); 39 d.setName(name);
37 } 40 }
38 if(platform.length() > 0) { 41 if(platform.length() > 0) {
39 d.setPlatform(platform); 42 d.setPlatform(platform);
43 }
44 if(not.length() > 0) {
45 d.setNotString(not);
40 } 46 }
41 47
42 NodeList nodes = element.getChildNodes(); 48 NodeList nodes = element.getChildNodes();
43 for(int i=0;i<nodes.getLength();i++) { 49 for(int i=0;i<nodes.getLength();i++) {
44 Node node = nodes.item(i); 50 Node node = nodes.item(i);
51 } else if(n.equals("pkgconfig")) { 57 } else if(n.equals("pkgconfig")) {
52 PkgConfigPackage pcp = PkgConfigPackage.parse(elm); 58 PkgConfigPackage pcp = PkgConfigPackage.parse(elm);
53 d.addPkgconfig(pcp); 59 d.addPkgconfig(pcp);
54 } else if(n.equals("test")) { 60 } else if(n.equals("test")) {
55 d.tests.add(Xml.getContent(elm)); 61 d.tests.add(Xml.getContent(elm));
62 } else if(n.equals("make")) {
63 String m = Xml.getContent(elm);
64 d.addMake(m);
56 } 65 }
57 } 66 }
58 } 67 }
59 68
60 return d; 69 return d;
76 if(platform == null || platform.length() == 0) { 85 if(platform == null || platform.length() == 0) {
77 return ""; 86 return "";
78 } else { 87 } else {
79 return "platform=\""+platform+'"'; 88 return "platform=\""+platform+'"';
80 } 89 }
90 }
91
92 public void setNotString(String not) {
93 this.not = not;
94 }
95
96 public List<String> getNotList() {
97 List<String> notPlatforms = new LinkedList<>();
98 if(not != null) {
99 String[] n = not.split(",");
100 for(String s : n) {
101 notPlatforms.add(s);
102 }
103 }
104 return notPlatforms;
81 } 105 }
82 106
83 public void setPlatform(String platform) { 107 public void setPlatform(String platform) {
84 this.platform = platform; 108 this.platform = platform;
85 } 109 }
117 } 141 }
118 142
119 public List<String> getTests() { 143 public List<String> getTests() {
120 return tests; 144 return tests;
121 } 145 }
146
147 public void addMake(String m) {
148 make.append(m.trim());
149 make.append('\n');
150 }
151
152 public String getMake() {
153 return make.toString();
154 }
122 } 155 }

mercurial