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

Sun, 12 Jan 2025 16:28:08 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 12 Jan 2025 16:28:08 +0100
changeset 135
9afe68b15c66
parent 116
41981a23aff8
permissions
-rw-r--r--

improve toolchain detection to also get the wordsize and stdc version, issue #439, issue #508

0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 package de.unixwork.uwproj;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 import org.w3c.dom.Element;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
5 import java.util.Arrays;
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
6 import java.util.LinkedList;
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
7 import java.util.List;
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
8 import java.util.function.Predicate;
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
9 import java.util.stream.Collectors;
39
3ca85da78515 add RegressionTest - fixes #264
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
10
116
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
11 public final class Config {
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
12 private final String platform;
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
13 private final String not;
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
14
116
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
15 private final List<ConfigVar> vars = new LinkedList<>();
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
16
116
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
17 public Config(Element element) {
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
18 platform = element.getAttribute("platform");
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
19 not = element.getAttribute("not");
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
20
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
21 Util.getChildElements(element).forEach(elm -> {
116
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
22 if (elm.getNodeName().equals("var")) {
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
23 vars.add(new ConfigVar(elm));
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 }
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
25 });
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
26 }
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
27
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 public String getPlatform() {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 return platform;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 }
40
b42bfc9e9983 first minor code improvements
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
32
5
895bf81d3b6e add missing source changes
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
33 public List<String> getNotList() {
113
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
34 return Arrays.stream(not.split(","))
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
35 .map(String::trim)
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
36 .filter(Predicate.not(String::isEmpty))
24f32dbd88cd minimize application code
Mike Becker <universe@uap-core.de>
parents: 103
diff changeset
37 .collect(Collectors.toList());
103
01ec9f32835e add toolchain attribute - relates to #346
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
38 }
01ec9f32835e add toolchain attribute - relates to #346
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
39
116
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
40 public List<ConfigVar> getVars() {
41981a23aff8 add platform attributes to config element
Mike Becker <universe@uap-core.de>
parents: 113
diff changeset
41 return vars;
8
82cd9f1d94cb add c++ compiler detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
42 }
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 }

mercurial