make FeatureType.default an xs:boolean - fixes #296

Sun, 10 Sep 2023 13:10:07 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 10 Sep 2023 13:10:07 +0200
changeset 44
1d963f2c7e91
parent 43
741a0d9efa47
child 45
f4ec2feccebb

make FeatureType.default an xs:boolean - fixes #296

src/main/java/de/unixwork/uwproj/Feature.java 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/Feature.java	Sun Sep 10 13:04:02 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Feature.java	Sun Sep 10 13:10:07 2023 +0200
@@ -23,10 +23,8 @@
             throw new Exception("feature element requires name attribute");
         }
 
-        String ld = def.toLowerCase();
-        boolean on = ld.equals("on") || ld.equals("true");
         feature.setName(name);
-        feature.setDefault(on);
+        feature.setDefault(Boolean.parseBoolean(def));
         if (arg.isBlank()) {
             feature.setArg(name);
         } else {
--- a/test/make/project2.xml	Sun Sep 10 13:04:02 2023 +0200
+++ b/test/make/project2.xml	Sun Sep 10 13:10:07 2023 +0200
@@ -44,7 +44,7 @@
 	</dependency>
 	
 	<target name="dav">
-		<feature name="db" default="on">
+		<feature name="db" default="true">
 			<dependencies>sqlite</dependencies>
 			<define name="DATABASE"/>
 		</feature>
--- a/uwproj.xsd	Sun Sep 10 13:04:02 2023 +0200
+++ b/uwproj.xsd	Sun Sep 10 13:10:07 2023 +0200
@@ -71,17 +71,7 @@
         </xs:choice>
         <xs:attribute name="name" type="xs:string" use="required"/>
         <xs:attribute name="arg" type="xs:string"/>
-        <xs:attribute name="default" default="false">
-            <!-- TODO: this should be just Boolean -->
-            <xs:simpleType>
-                <xs:restriction base="xs:string">
-                    <xs:enumeration value="true"/>
-                    <xs:enumeration value="false"/>
-                    <xs:enumeration value="on"/>
-                    <xs:enumeration value="off"/>
-                </xs:restriction>
-            </xs:simpleType>
-        </xs:attribute>
+        <xs:attribute name="default" type="xs:boolean" default="false"/>
     </xs:complexType>
 
     <xs:complexType name="OptionType">

mercurial