Skip to content

Commit

Permalink
Fix incremental build when dummy version.cpp is generated (dotnet/cor…
Browse files Browse the repository at this point in the history
…eclr#8547)

This change fixes a problem with incremental build on Unix. When the
version.cpp is generated by the build.sh as a dummy one with no real
version stamp in it, it is recreated every time the build.sh is run.
That means that build needs to rebuild that file and also re-link
all the components that include it.
This change tests the file presence and contents before actually
regenerating it.

Commit migrated from dotnet/coreclr@101168c
  • Loading branch information
janvorli authored Dec 9, 2016
1 parent c1c3321 commit 39b7315
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/coreclr/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,22 @@ build_coreclr()
if [ $__SkipConfigure == 0 ]; then
# if msbuild is not supported, then set __SkipGenerateVersion to 1
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
# Drop version.c file
# Drop version.cpp file
__versionSourceFile=$__IntermediatesDir/version.cpp
if [ $__SkipGenerateVersion == 0 ]; then
"$__ProjectRoot/run.sh" build -Project=$__ProjectDir/build.proj -generateHeaderUnix -NativeVersionSourceFile=$__versionSourceFile $__RunArgs $__UnprocessedBuildArgs
else
# Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
echo $__versionSourceLine > $__versionSourceFile
if [ -e $__versionSourceFile ]; then
read existingVersionSourceLine < $__versionSourceFile
fi
if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
echo $__versionSourceLine > $__versionSourceFile
fi
fi

pushd "$__IntermediatesDir"
pushd "$__IntermediatesDir"
# Regenerate the CMake solution
__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument"
echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator $__ExtraCmakeArgs $__cmakeargs"
Expand Down

0 comments on commit 39b7315

Please sign in to comment.