changeset 481:def3b8cf9749 prerelease

build_pd_heavy: Parametrized hvresources path, looking for changes in hvresources as well
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 14:26:33 +0100
parents 4ff80956c27a
children 4d5edf7ee953
files scripts/build_pd_heavy.sh
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/build_pd_heavy.sh	Tue Jun 21 05:44:21 2016 +0100
+++ b/scripts/build_pd_heavy.sh	Tue Jun 21 14:26:33 2016 +0100
@@ -23,6 +23,7 @@
 
 SCRIPTDIR=$(dirname "$0")
 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+[ -z $HVRESOURCES_DIR ] && HVRESOURCES_DIR=$SCRIPTDIR/hvresources/
 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 if [ -z "$BELA_PYTHON27" ]; then
@@ -118,7 +119,7 @@
 	done
 
         # invoke the online compiler
-        "$BELA_PYTHON27" $SCRIPTDIR/hvresources/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\
+        "$BELA_PYTHON27" $HVRESOURCES_DIR/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\
             { echo "ERROR: an error occurred while executing the uploader.py script"; exit 1; }
     fi;
 
@@ -130,8 +131,9 @@
     do
         ls "$projectpath"/$file >/dev/null 2>&1 || { echo "The online compiler failed, please try again."; exit 1; }
     done
+
     # Apply any Bela-specific patches here 
-    cp "$SCRIPTDIR/hvresources/HvUtils.h" $projectpath/ || exit 1;
+    cp "$HVRESOURCES_DIR/HvUtils.h" $projectpath/ || exit 1;
 
     BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here
     BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER
@@ -145,7 +147,7 @@
         cp "$CUSTOM_RENDER_SOURCE_PATH" "$projectpath/render.cpp" || exit 1
     else
         echo "Using default heavy/render.cpp"
-        cp "$SCRIPTDIR/hvresources/heavy_render.cpp" "$projectpath/render.cpp" || exit 1
+        cp "$HVRESOURCES_DIR/heavy_render.cpp" "$projectpath/render.cpp" || exit 1
     fi
     
     echo "Updating files on board..."
@@ -205,8 +207,22 @@
 	BACK_NO_UPLOAD=$NO_UPLOAD
 	while true
 	do
+		# actually we are watching multiple paths : $pdpath and $HVRESOURCES_DIR
+		# so that it is easier to edit hvresources code without risk of being 
+		# overwritten, but we avoid mentioning it to the end user, otherwise they
+		# get confused.
 		echo "Waiting for changes in $pdpath, or press ctrl-c to terminate"
-		wait_for_change "$pdpath" "$reference_time_file"
+		while sleep 1
+		do
+			folder_has_changed "$pdpath" "$reference_time_file" && {
+				echo "Content of $pdpath has changed"
+				break
+			}
+			folder_has_changed "$HVRESOURCES_DIR" "$reference_time_file" && {
+				echo "Content of $pdpath has changed"
+				break
+			}
+		done
 		echo "Files changed"
 		# if .pd files did not change, no point in re-uploading
 		folder_has_changed "$pdpath" "$reference_time_file" "\.pd" &&\