From 5f7d2acb9c4746eaaa62c03975e681bd64def6fb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Dec 2008 12:13:08 +0100 Subject: [PATCH 1/3] tweaked build version strings - added wmakePrintBuild -check, -update, -version options - only update .build cache when explictly requested and from within the wmake Cver rules - use -check option to avoid unnecessary remake in src/Allwmake --- src/Allwmake | 4 +- wmake/rules/General/version | 4 +- wmake/wmakePrintBuild | 98 ++++++++++++++++++++++++++++--------- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/src/Allwmake b/src/Allwmake index c451cff8dd..e0324141cd 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -2,8 +2,8 @@ cd ${0%/*} || exit 1 # run from this directory set -x -# force update of Foam::FOAMversion string (git tag or $WM_PROJECT_VERSION) -/bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null +# update Foam::FOAMversion string if required +wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null wmakeLnInclude -f OpenFOAM wmakeLnInclude -f OSspecific/$WM_OS diff --git a/wmake/rules/General/version b/wmake/rules/General/version index 0d74179f8c..3584779c67 100644 --- a/wmake/rules/General/version +++ b/wmake/rules/General/version @@ -1,10 +1,10 @@ .SUFFIXES: .Cver # -# update version string +# update version string in C++ file and in $WM_PROJECT_DIR/.build file # Cvertoo = \ - sed s/WM_PROJECT_VERSION/\"$(shell wmakePrintBuild)\"/ $$SOURCE > $*.C; \ + sed s/WM_PROJECT_VERSION/\"$(shell wmakePrintBuild -update)\"/ $$SOURCE > $*.C; \ $(CC) $(c++FLAGS) -c $*.C -o $@ .Cver.dep: diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 61e9b80790..3232727163 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -35,7 +35,12 @@ Script=${0##*/} usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null) -# -# building under git -# note: could also use --abbrev=32 for maximum resolution -# -version=$(git describe --always --tags 2>/dev/null) -if [ $? -eq 0 ] +# specified a version +if [ -n "$version" ] then - # update persistent build tag (this could be made optional or removed) - if [ "$version" != "$previous" ] + # specified a version - no error possible + rc=0 +else + # building under git (could use --abbrev=32 for maximum resolution) + version=$(git describe --always --tags 2>/dev/null) + rc=$? +fi + + +# update persistent build tag if possible +if [ $rc -eq 0 -a -n "$update" -a "$version" != "$previous" ] +then + if [ -w "$build" -a \( -w "$WM_PROJECT_DIR" -o ! -e "$build" \) ] then - if [ -w "$build" -a \( -w "$WM_PROJECT_DIR" -o ! -e "$build" \) ] - then - echo $version >| "$build" 2>/dev/null - fi + echo $version >| "$build" 2>/dev/null fi +fi + +# check git vs. persistent build tag - no output +if [ -n "$checkOnly" ] +then + if [ $rc -eq 0 ] + then + test "$version" = "$previous" + rc=$? + if [ $rc -eq 0 ] + then + echo "same version as previous build" + else + echo "version changed from previous build" + fi + else + echo "no git description found" + fi + exit $rc +fi + + + +if [ $rc -eq 0 ] +then + # output the git description or -version version echo $version - elif [ -n "$previous" ] then - # use previous build tag echo $previous - else - # fallback to WM_PROJECT_VERSION echo ${WM_PROJECT_VERSION:-unknown} - fi #------------------------------------------------------------------------------ From 0c5571519f445b5b2fd7208dc5804fbdcb4fee0e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Dec 2008 13:20:14 +0100 Subject: [PATCH 2/3] changes to build version string - version is WM_PROJECT_VERSION prefix + SHA1 from current git head - move double quotes from make rules to global.Cver for extra safety --- src/OpenFOAM/global/global.Cver | 15 +++++++-------- wmake/rules/General/version | 2 +- wmake/wmakePrintBuild | 22 +++++++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index e67b67b22a..e2f411603e 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -23,20 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Define the globals used in the FOAM library. It is important that these - are constructed in the appropriate order to avoid the use of unconstructed - data in the global namespace. + Define the globals used in the OpenFOAM library. + It is important that these are constructed in the appropriate order to + avoid the use of unconstructed data in the global namespace. - This file has the extension .ver to force it to be parsed by the script - which converts WM_PROJECT_VERSION into the appropriate version number - string. + This file has the extension .Cver to trigger a Makefile rule that converts + WM_PROJECT_VERSION into the appropriate version string. \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "foamVersion.H" -const char* const Foam::FOAMversion = WM_PROJECT_VERSION; +const char* const Foam::FOAMversion = "WM_PROJECT_VERSION"; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Setup an error handler for the global new operator @@ -51,7 +50,7 @@ const char* const Foam::FOAMversion = WM_PROJECT_VERSION; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "JobInfo.H" -bool Foam::JobInfo::constructed = false; +bool Foam::JobInfo::constructed(false); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Global error definitions (initialised by construction) diff --git a/wmake/rules/General/version b/wmake/rules/General/version index 3584779c67..64f272ed08 100644 --- a/wmake/rules/General/version +++ b/wmake/rules/General/version @@ -4,7 +4,7 @@ # update version string in C++ file and in $WM_PROJECT_DIR/.build file # Cvertoo = \ - sed s/WM_PROJECT_VERSION/\"$(shell wmakePrintBuild -update)\"/ $$SOURCE > $*.C; \ + sed 's/WM_PROJECT_VERSION/$(shell wmakePrintBuild -update)/' $$SOURCE > $*.C; \ $(CC) $(c++FLAGS) -c $*.C -o $@ .Cver.dep: diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 3232727163..868357fe58 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -37,13 +37,13 @@ usage() { cat</dev/null) -# specified a version if [ -n "$version" ] then # specified a version - no error possible rc=0 else - # building under git (could use --abbrev=32 for maximum resolution) - version=$(git describe --always --tags 2>/dev/null) + # building under git (get the head SHA1) + version=$(git show-ref --hash=12 --head HEAD 2>/dev/null) rc=$? + + # prefix with WM_PROJECT_VERSION + if [ $rc -eq 0 ] + then + version="${WM_PROJECT_VERSION}-$version" + fi fi @@ -130,17 +135,16 @@ then fi - if [ $rc -eq 0 ] then - # output the git description or -version version + # output the git information or the -version version echo $version elif [ -n "$previous" ] then # use previous build tag echo $previous else - # fallback to WM_PROJECT_VERSION + # fallback to WM_PROJECT_VERSION alone echo ${WM_PROJECT_VERSION:-unknown} fi From d9b9d7f2c099994e64e8859b1389a3c0e81441c7 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 19 Dec 2008 13:03:45 +0000 Subject: [PATCH 3/3] Corrections to Niklas' contribution for 1.5 to dev. --- src/lagrangian/dieselSpray/spray/spray.C | 4 +--- src/lagrangian/dieselSpray/spray/spray.H | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lagrangian/dieselSpray/spray/spray.C b/src/lagrangian/dieselSpray/spray/spray.C index fb9e16bc9b..4aa5c775ef 100644 --- a/src/lagrangian/dieselSpray/spray/spray.C +++ b/src/lagrangian/dieselSpray/spray/spray.C @@ -52,7 +52,6 @@ defineTemplateTypeNameAndDebug(IOPtrList, 0); // Construct from components Foam::spray::spray ( - const volPointInterpolation& vpi, const volVectorField& U, const volScalarField& rho, const volScalarField& p, @@ -67,7 +66,6 @@ Foam::spray::spray runTime_(U.time()), time0_(runTime_.value()), mesh_(U.mesh()), - volPointInterpolation_(vpi), rndGen_(label(0)), U_(U), @@ -263,7 +261,7 @@ Foam::spray::spray { FatalErrorIn ( - "spray::spray(const pointMesh& pMesh, const volVectorField& U, " + "spray::spray(const volVectorField& U, " "const volScalarField& rho, const volScalarField& p, " "const volScalarField& T, const combustionMixture& composition," "const PtrList& gaseousFuelProperties, " diff --git a/src/lagrangian/dieselSpray/spray/spray.H b/src/lagrangian/dieselSpray/spray/spray.H index 83c93c16f0..603d0c8b68 100644 --- a/src/lagrangian/dieselSpray/spray/spray.H +++ b/src/lagrangian/dieselSpray/spray/spray.H @@ -36,7 +36,6 @@ Description #include "parcel.H" #include "injector.H" #include "IOPtrList.H" -#include "volPointInterpolation.H" #include "interpolation.H" #include "liquid.H" #include "sprayThermoTypes.H" @@ -76,7 +75,6 @@ class spray const Time& runTime_; scalar time0_; const fvMesh& mesh_; - const volPointInterpolation& volPointInterpolation_; //- Random number generator Random rndGen_; @@ -189,7 +187,6 @@ public: //- Construct from components spray ( - const volPointInterpolation& vpi, const volVectorField& U, const volScalarField& rho, const volScalarField& p,