Fix clean test build
authorKyungwoo Lee <kyulee@microsoft.com>
Fri, 19 Feb 2016 19:06:41 +0000 (11:06 -0800)
committerKyungwoo Lee <kyulee@microsoft.com>
Fri, 19 Feb 2016 22:35:45 +0000 (14:35 -0800)
I often fall into a build failure like the following when passing /clean
E:\Github\coreclr\tests\runtest.proj : error MSB4057: The target "rebuild"
does not exist in the project.
runtest.proj is actually invoked in two places one from a part of
build.cmd targeting CreateTestOverlay only, and the other from
runtest.cmd, which creates wrapper and actually running the tests.
So, definining "rebuild" target that does "clean" and "build" doesn't
solve this problem.
The fix is to not target "rebuild" in the former case since we are
explicitly targeting "CreateTestOverlay" only. Instead of putting "/t:rebuild"
in the common msbuild argument, I added it to each instance except this case.

Commit migrated from https://github.com/dotnet/coreclr/commit/06f6edeffcae1905cc77a130c7bc916188eba1c7

src/coreclr/tests/buildtest.cmd

index 279ec2a..3e1b4af 100644 (file)
@@ -156,7 +156,7 @@ if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see h
 ::       The issue is that we extend the build with our own targets which
 ::       means that that rebuilding cannot successfully delete the task
 ::       assembly. 
-set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildCleanBuildArgs% %__msbuildExtraArgs%
+set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildExtraArgs%
 
 if not defined __BuildSequential (
     set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount
@@ -204,7 +204,7 @@ if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" (
 )
 
 set __BuildLogRootName=Tests_Native
-call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" /p:Configuration=%__BuildType% /p:Platform=%__BuildArch%
+call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildCleanBuildArgs% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch%
 if errorlevel 1 exit /b 1
 
 REM endlocal to rid us of environment changes from vcvarsall.bat
@@ -230,7 +230,7 @@ if not defined VSINSTALLDIR (
     exit /b 1
 )
 
-set __msbuildManagedBuildArgs=
+set __msbuildManagedBuildArgs=%__msbuildCleanBuildArgs%
 
 if defined __crossgen (
     echo Building tests with CrossGen enabled.