add support for cxxflags and fix lang parser

Mon, 18 Sep 2023 22:49:54 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 18 Sep 2023 22:49:54 +0200
changeset 65
6db50c6df6e3
parent 64
00586d892855
child 66
dc758dcd4645

add support for cxxflags and fix lang parser

src/main/java/de/unixwork/uwproj/Dependency.java file | annotate | diff | comparison | revisions
test/make/project.xml file | annotate | diff | comparison | revisions
test/make/project2.xml file | annotate | diff | comparison | revisions
uwproj.xsd file | annotate | diff | comparison | revisions
--- a/src/main/java/de/unixwork/uwproj/Dependency.java	Sun Sep 17 13:26:22 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Dependency.java	Mon Sep 18 22:49:54 2023 +0200
@@ -45,7 +45,7 @@
             if (node.getNodeType() == Node.ELEMENT_NODE) {
                 Element elm = (Element) node;
                 String n = elm.getNodeName();
-                if (n.equals("cflags") || n.equals("ldflags")) {
+                if (n.equals("cflags") || n.equals("cxxflags") || n.equals("ldflags")) {
                     Optional.ofNullable(ConfigVar.parse(elm, true)).ifPresent(d::addFlags);
                 } else if (n.equals("pkgconfig")) {
                     PkgConfigPackage pcp = PkgConfigPackage.parse(elm);
@@ -53,10 +53,9 @@
                 } else if (n.equals("test")) {
                     d.tests.add(Util.getContent(elm));
                 } else if (n.equals("make")) {
-                    String m = Util.getContent(elm);
-                    d.addMake(m);
+                    d.addMake(Util.getContent(elm));
                 } else if (n.equals("lang")) {
-                    d.lang.add(n.trim().toLowerCase());
+                    d.lang.add(Util.getContent(elm).trim().toLowerCase());
                 }
             }
         }
--- a/test/make/project.xml	Sun Sep 17 13:26:22 2023 +0200
+++ b/test/make/project.xml	Mon Sep 18 22:49:54 2023 +0200
@@ -8,7 +8,7 @@
 	</config>
 	
 	<dependency>
-		<lang>c++</lang>
+		<lang>cpp</lang>
 	</dependency>
 
 	<!-- library dependencies -->
--- a/test/make/project2.xml	Sun Sep 17 13:26:22 2023 +0200
+++ b/test/make/project2.xml	Mon Sep 18 22:49:54 2023 +0200
@@ -39,6 +39,7 @@
 	</dependency>
 	
 	<dependency>
+		<lang>c</lang>
 		<make>MVAR = 123</make>
 		<make>MVAR += 123</make>
 	</dependency>
--- a/uwproj.xsd	Sun Sep 17 13:26:22 2023 +0200
+++ b/uwproj.xsd	Mon Sep 18 22:49:54 2023 +0200
@@ -40,10 +40,18 @@
         </xs:simpleContent>
     </xs:complexType>
 
+    <xs:simpleType name="LangType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="c"/>
+            <xs:enumeration value="cpp"/>
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:complexType name="DependencyType">
         <xs:choice minOccurs="0" maxOccurs="unbounded">
-            <xs:element name="lang" type="xs:string"/>
+            <xs:element name="lang" type="LangType"/>
             <xs:element name="cflags" type="FlagsType"/>
+            <xs:element name="cxxflags" type="FlagsType"/>
             <xs:element name="ldflags" type="FlagsType"/>
             <xs:element name="pkgconfig" type="PkgConfigType"/>
             <xs:element name="test" type="xs:string"/>

mercurial