remove explicit calls of getters in velocity template

Mon, 02 Oct 2023 16:55:40 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 02 Oct 2023 16:55:40 +0200
changeset 79
ef0635b78b7b
parent 78
c3a62e0baa9e
child 80
e55f318a8b8b

remove explicit calls of getters in velocity template

src/main/java/de/unixwork/uwproj/Feature.java file | annotate | diff | comparison | revisions
src/main/java/de/unixwork/uwproj/Target.java file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
--- a/src/main/java/de/unixwork/uwproj/Feature.java	Mon Oct 02 16:46:20 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Feature.java	Mon Oct 02 16:55:40 2023 +0200
@@ -10,7 +10,7 @@
 public class Feature {
     private String name;
     private String arg;
-    private boolean def;
+    private boolean auto;
 
     private TargetData targetData;
 
@@ -18,14 +18,14 @@
         Feature feature = new Feature();
         String name = e.getAttribute("name");
         String arg = e.getAttribute("arg");
-        String def = e.getAttribute("default");
+        String auto = e.getAttribute("default");
 
         if (name.isBlank()) {
             throw new Exception("feature element requires name attribute");
         }
 
         feature.setName(name);
-        feature.setDefault(Boolean.parseBoolean(def));
+        feature.setAuto(Boolean.parseBoolean(auto));
         if (arg.isBlank()) {
             feature.setArg(name);
         } else {
@@ -73,12 +73,12 @@
         this.arg = arg;
     }
 
-    public boolean isDefault() {
-        return def;
+    public boolean isAuto() {
+        return auto;
     }
 
-    public void setDefault(boolean def) {
-        this.def = def;
+    public void setAuto(boolean auto) {
+        this.auto = auto;
     }
 
     public TargetData getTargetData() {
--- a/src/main/java/de/unixwork/uwproj/Target.java	Mon Oct 02 16:46:20 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Target.java	Mon Oct 02 16:55:40 2023 +0200
@@ -87,11 +87,11 @@
         return withPrefix("CFLAGS");
     }
 
-    public String getLDFlags() {
+    public String getLdFlags() {
         return withPrefix("LDFLAGS");
     }
 
-    public String getCXXFlags() {
+    public String getCxxFlags() {
         return withPrefix("CXXFLAGS");
     }
 
--- a/test/make/configure.vm	Mon Oct 02 16:46:20 2023 +0200
+++ b/test/make/configure.vm	Mon Oct 02 16:55:40 2023 +0200
@@ -39,8 +39,8 @@
 
 # features
 #foreach( $feature in $features )
-#if( ${feature.isDefault()} )
-${feature.getVarName()}=auto
+#if( ${feature.auto} )
+${feature.varName}=auto
 #end
 #end
 
@@ -80,14 +80,14 @@
   --debug                 add extra compile flags for debug builds
   --release               add extra compile flags for release builds
 #foreach( $opt in $options )
-  --${opt.getArgument()}=${opt.getValuesString()}
+  --${opt.argument}=${opt.valuesString}
 #end
 
 #end
 #if( $features.size() > 0 )
 Optional Features:
 #foreach( $feature in $features )
-#if( $feature.default )
+#if( $feature.auto )
   --disable-${feature.arg}
 #else
   --enable-${feature.arg}
@@ -123,11 +123,11 @@
         "--debug")           BUILD_TYPE="debug" ;;
         "--release")         BUILD_TYPE="release" ;;
     #foreach( $opt in $options )
-        "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
+        "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;;
     #end
     #foreach( $feature in $features )
-        "--enable-${feature.arg}") ${feature.getVarName()}=on ;;
-        "--disable-${feature.arg}") unset ${feature.getVarName()} ;;
+        "--enable-${feature.arg}") ${feature.varName}=on ;;
+        "--disable-${feature.arg}") unset ${feature.varName} ;;
     #end
         "-"*) echo "unknown option: $ARG"; abort_configure ;;
     esac
@@ -259,8 +259,8 @@
 dependency_error_${dependency.id}()
 {
     printf "checking for ${dependency.name}... "
-    #foreach( $sub in $dependency.getSubdependencies() )
-    # dependency $sub.getFullName()
+    #foreach( $sub in $dependency.subdependencies )
+    # dependency $sub.fullName
     while true
     do
         #if( $sub.platform )
@@ -268,7 +268,7 @@
             break
         fi
         #end
-        #foreach( $np in $sub.getNotList() )
+        #foreach( $np in $sub.notList )
         if isplatform "${np}"; then
             break
         fi
@@ -346,7 +346,7 @@
         break
     fi
     #end
-    #foreach( $np in $dependency.getNotList() )
+    #foreach( $np in $dependency.notList )
     if isplatform "${np}"; then
         break
     fi
@@ -471,28 +471,28 @@
 
 # Features
 #foreach( $feature in $target.features )
-if [ -n "$${feature.getVarName()}" ]; then
+if [ -n "$${feature.varName}" ]; then
 #foreach( $dependency in $feature.dependencies )
     # check dependency
     if dependency_error_$dependency ; then
         # "auto" features can fail and are just disabled in this case
-        if [ "$${feature.getVarName()}" = "auto" ]; then
-            DISABLE_${feature.getVarName()}=1
+        if [ "$${feature.varName}" = "auto" ]; then
+            DISABLE_${feature.varName}=1
         else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
             ERROR=1
         fi
     fi
 #end
-    if [ -n "$DISABLE_${feature.getVarName()}" ]; then
-        unset ${feature.getVarName()}
+    if [ -n "$DISABLE_${feature.varName}" ]; then
+        unset ${feature.varName}
     fi
 fi
 #end
 
 #foreach( $opt in $target.options )
 # Option: --${opt.argument}
-if [ -z ${D}${opt.getVarName()} ]; then
+if [ -z ${D}${opt.varName} ]; then
     SAVED_ERROR="$ERROR"
     SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
     ERROR=1
@@ -522,8 +522,8 @@
     if false; then
         false
     #foreach( $optval in $opt.values )
-    elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
-        echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
+    elif [ "${D}${opt.varName}" = "${optval.value}" ]; then
+        echo "  ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options
         if $optval.func ; then
             :
         else
@@ -535,29 +535,29 @@
 #end
 
 if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "${target.getCFlags()}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
+    echo "${target.cFlags}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "${target.getCXXFlags()}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
+    echo "${target.cxxFlags}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
     if [ -n "$lang_c" ]; then
-        echo '${target.getCFlags()} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+        echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
     fi
     if [ -n "$lang_cpp" ]; then
-        echo '${target.getCXXFlags()} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+        echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
     fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
     if [ -n "$lang_c" ]; then
-        echo '${target.getCFlags()} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+        echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
     fi
     if [ -n "$lang_cpp" ]; then
-        echo '${target.getCXXFlags()} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+        echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
     fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
+    echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 
 #end
@@ -582,7 +582,7 @@
 #if ( $features.size() > 0 )
 echo "Features:"
 #foreach( $feature in $features )
-if [ -n "$${feature.getVarName()}" ]; then
+if [ -n "$${feature.varName}" ]; then
 echo "  $feature.name: on"
 else
 echo "  $feature.name: off"

mercurial