Incremental build at daytime using CheckBetween

Jun 3, 2009 at 11:22 AM

Hello,

 

 

I'm trying to configure my build so it builds incrementally if it is started at daytime, but will clean and build completely by our nightly build.

 

I must have misunderstood how to do, since no builds are every built incrementally.

 

I attach my script that runs a makefile building a program for an embedded controller and the build log.
This build failed since the hardware lock was not attached. That problem I can easily fix. :)

 

Any idea how to set the IncrementalGet property as the inversed result from CheckBetween?

 

 

Best regards

 

Erik Carlsson

 

 <font size="1" color="#0000ff"><font size="1" color="#0000ff">

<?

</font></font><font size="1" color="#0000ff">

 

</font>

xml version="1.0" encoding="utf-8"?>
<
Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<
Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />

<ProjectExtensions>
  <
ProjectFileVersion>2</ProjectFileVersion>
  <
Description></Description>
  <
BuildMachine>Riga</BuildMachine>
</
ProjectExtensions><font size="1" color="#0000ff"><font size="1" color="#0000ff">

<

</font></font><font size="1" color="#0000ff">

 

</font>

Import Project="C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks"/><font size="1" color="#0000ff"><font size="1" color="#0000ff">

<

</font></font><font size="1" color="#0000ff">

 

</font>

PropertyGroup>
  <
TeamProject>OTFP</TeamProject>
  <
BuildDirectoryPath>E:\TFSBuildDirectory</BuildDirectoryPath>
  <
DropLocation>\\Riga\Teambuilds</DropLocation>
  <
RunTest>false</RunTest>
  <
RunCodeAnalysis>Never</RunCodeAnalysis><font size="1" color="#0000ff"><font size="1" color="#0000ff">

  <!--

</font></font><font size="1" color="#0000ff">

 

</font>

Additional Properties -->
  <
WorkItemType>Bug</WorkItemType>
  <
WorkItemFieldValues>System.Reason=Build Failure;System.Description=Start the build using Team Build</WorkItemFieldValues>
  <
WorkItemTitle>Build failure in build:</WorkItemTitle>
  <
DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
  <
BuildlogText>The build log file is at:</BuildlogText>
  <
ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
  <
UpdateAssociatedWorkItems>true</UpdateAssociatedWorkItems>
  <
AdditionalVCOverrides></AdditionalVCOverrides>
  <
CustomPropertiesForClean></CustomPropertiesForClean>
  <
CustomPropertiesForBuild></CustomPropertiesForBuild>
</
PropertyGroup><font size="1" color="#0000ff"><font size="1" color="#0000ff">

<

</font></font><font size="1" color="#0000ff">

 

</font>

Target Name="BeforeClean">
  <!--
Find out if it is day or night -->
  <
MSBuild.ExtensionPack.Framework.DateAndTime TaskAction="CheckBetween" Start="00:00" End="07:00">
    <
Output TaskParameter="BoolResult" PropertyName="DTResult"/>
  </
MSBuild.ExtensionPack.Framework.DateAndTime>
  <
Message Text="IsNight: $(DTResult)"/>

  <!-- Incremental get and build but not at night -->
  <
PropertyGroup Condition=" '$(DTResult)'=='False' ">
    <
IncrementalGet>True</IncrementalGet>
    <
IncrementalBuild>True</IncrementalBuild>
  </
PropertyGroup><font size="1" color="#0000ff"><font size="1" color="#0000ff">

  <

</font></font><font size="1" color="#0000ff">

 

</font>

Message Text="IncrementalGet: $(IncrementalGet)"/>
</
Target>

<ItemGroup>
  <
MyDestinationFiles Include="$(SolutionRoot)\MU\Bin\*.mot" />
</
ItemGroup><font size="1" color="#0000ff"><font size="1" color="#0000ff">

<!--

</font></font><font size="1" color="#0000ff">

 

</font>

All compilation is done here, so the TFS 2008 compiler won't get invoked -->
<
Target Name="CoreCompile">
  <
Message Text="IncrementalGet: $(IncrementalGet)"/>

  <!-- Build 16-bit targets -->
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Building 16-bit targets"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
  <
Exec Command="&quot;nmake.exe&quot; &quot;$(SolutionRoot)\MU\MU16.mak&quot; 2&gt;&amp;1" WorkingDirectory="$(SolutionRoot)\MU" />
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/><font size="1" color="#0000ff"><font size="1" color="#0000ff">

  <!--

</font></font><font size="1" color="#0000ff">

 

</font>

Build 32-bit targets -->
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Building 32-bit targets"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
  <
Exec Command="&quot;nmake.exe&quot; &quot;$(SolutionRoot)\MU\MU32.mak&quot; 2&gt;&amp;1" WorkingDirectory="$(SolutionRoot)\MU" />
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/>

  <!-- Copy the target files to destination folder -->
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Copying binaries"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
  <
Copy SourceFiles="@(MyDestinationFiles)" DestinationFolder="$(OutDir)\" />
  <
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/>
</
Target><font size="1" color="#0000ff"><font size="1" color="#0000ff">

</

</font></font><font size="1" color="#0000ff">

 

</font>

Project>

Build started 6/3/2009 10:44:50 AM.
Project "e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" on node 0 (EndToEndIteration target(s)).
  GetBuildProperties TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914"
InitializeEndToEndIteration:
  UpdateBuildNumberDropLocation TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" BuildNumber="EC-Main-MU_20090603.10" DropLocation="\\Riga\Teambuilds\EC-Main-MU_20090603.10"
  
  
CoreInitializeWorkspace:
  DeleteWorkspaceTask TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" Name="RIGA_23" DeleteLocalItems=True
  CreateWorkspaceTask TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" Name="RIGA_23" BuildDirectory="e:\TFSBuildDirectory\OTFP\EC-Main-MU" SourcesDirectory="e:\TFSBuildDirectory\OTFP\EC-Main-MU\Sources" Comment="Workspace created by Team Build"
BeforeClean:
  Checking if: 03 Jun 2009 10:44:51 is between: 03 Jun 2009 00:00:00 and: 03 Jun 2009 07:00:00
  IsNight: False
  IncrementalGet: True
CoreCleanAll:
  Removing directory "e:\TFSBuildDirectory\OTFP\EC-Main-MU\Sources".
InitializeBuild:
  Creating directory "e:\TFSBuildDirectory\OTFP\EC-Main-MU\Sources".
CoreGet:
  Get TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" Force=True Overwrite=False PopulateOutput=False Preview=False Recursive=True Version="C2874" Workspace="RIGA_23"
CoreLabel:
  Label TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" Name="EC-Main-MU_20090603.10" Scope="$/OTFP" Recursive=True Comments="Label created by Team Build" Version="WRIGA_23" Child="Replace" Files="$/"
  Label EC-Main-MU_20090603.10@$/OTFP (version WRIGA_23) was successfully created.
  SetBuildProperties TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" CompilationStatus="Unknown" LabelName="EC-Main-MU_20090603.10@$/OTFP" Status="0" TestStatus="Unknown"
Project "e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (1) is building "e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (1:2) on node 0 (CoreCompile target(s)).
  IncrementalGet: false
  BuildStep TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" ID="-1" Message="Building 16-bit targets" Status="InProgress"
  
  Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
  Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
  
  	if not exist ".\M510_L2Cap\List" mkdir ".\M510_L2Cap\List"
  	if not exist ".\M510_L2Cap\Obj" mkdir ".\M510_L2Cap\Obj"
  	"C:\Program Files\IAR Systems\Embedded Workbench 3.2\M16C\bin\iccm16c.exe" "-I" "C:\Program Files\IAR Systems\Embedded Workbench 3.2\M16C\INC\CLIB"\ "-I" "C:\Program Files\IAR Systems\Embedded Workbench 3.2\M16C\INC"\ "-I" "."\ "-I" "..\SHARED\DATATYPES"\ "-I" "..\SHARED\BTSTACK\INC"\ "-I" "..\SHARED\BTSTACK\SRC"\ "-D" "BLUETOOTH" "-D" "HARDWARE_PLATFORM=1" "-D" "HARDWARE_VERS_3" "-D" "MU_L2CAP_PROT=1" "-D" "NEW_COMM_PROTOCOL=1" "-D" "NEW_PACE_METHOD" "-D" "SAMPLE_FREK=1000" "-D" "SP1" "-lCN" ".\M510_L2Cap\List"\ "--data_model=near" "--calling_convention=normal" "--variable_data=near" "--constant_data=far" "-o" ".\M510_L2Cap\Obj"\ "-s9" "--code_segment=CODE" "-e" "--cpu" "M16C" "..\Shared\BTStack\Src\BufferPool.c"
  
  Fatal error[Cp001]: Copy protection check, No valid license found for this
            product [24]
  Fatal error detected, aborting.
NMAKE : fatal error U1077: '"C:\Program Files\IAR Systems\Embedded Workbench 3.2\M16C\bin\iccm16c.exe"' : return code '0x3'
  Stop.
e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj(163,5): error MSB3073: The command ""nmake.exe" "e:\TFSBuildDirectory\OTFP\EC-Main-MU\Sources\MU\MU16.mak" 2>&1" exited with code 2.
Done Building Project "e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (CoreCompile target(s)) -- FAILED.
SetBuildBreakProperties:
  GetBuildProperties TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914"
CoreGetChangesetsOnBuildBreak:
  GenCheckinNotesUpdateWorkItems TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" CurrentLabel="EC-Main-MU_20090603.10@$/OTFP" LastLabel="EC-Main-MU_20090602.1@$/OTFP" UpdateWorkItems=False BuildNumber="EC-Main-MU_20090603.10" BuildUri="vstfs:///Build/Build/914"
  Analyzing labels EC-Main-MU_20090602.1@$/OTFP and EC-Main-MU_20090603.10@$/OTFP.
  Querying item history.
  No change sets are submitted to build 'EC-Main-MU_20090603.10'.
CoreCreateWorkItem:
  CreateNewWorkItem TeamFoundationServerUrl="http://eldorado:8080/" BuildUri="vstfs:///Build/Build/914" TeamProject="OTFP" BuildNumber="EC-Main-MU_20090603.10" Title="Build failure in build: EC-Main-MU_20090603.10" Description="This work item was created by Team Build on a build failure. <BR/> The build log file is at: <a href='file:///\\Riga\Teambuilds\EC-Main-MU_20090603.10\BuildLog.txt'>\\Riga\Teambuilds\EC-Main-MU_20090603.10\BuildLog.txt</a >. <BR/> " WorkItemFieldValues="System.Reason=Build Failure;System.Description=Start the build using Team Build" WorkItemType="Bug"
  The work item '239' was created for failures in build 'EC-Main-MU_20090603.10'.
Done Building Project "e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (EndToEndIteration target(s)) -- FAILED.

Build FAILED.

"e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (EndToEndIteration target) (1) ->
"e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj" (CoreCompile target) (1:2) ->
(CoreCompile target) -> 
  NMAKE : fatal error U1077: '"C:\Program Files\IAR Systems\Embedded Workbench 3.2\M16C\bin\iccm16c.exe"' : return code '0x3'
  e:\TFSBuildDirectory\OTFP\EC-Main-MU\BuildType\TFSBuild.proj(163,5): error MSB3073: The command ""nmake.exe" "e:\TFSBuildDirectory\OTFP\EC-Main-MU\Sources\MU\MU16.mak" 2>&1" exited with code 2.

    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:23.18

 

Jun 3, 2009 at 11:25 AM

Hi again,


The code became really ugly when I cut and pasted from VS2008, som here it is again. Now cut and pasted from notepad. :)


Best regards

Erik Carlsson

 

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />

  <ProjectExtensions>
    <ProjectFileVersion>2</ProjectFileVersion>
    <Description></Description>
    <BuildMachine>Riga</BuildMachine>
  </ProjectExtensions>

  <Import Project="C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks"/>

  <PropertyGroup>
    <TeamProject>OTFP</TeamProject>
    <BuildDirectoryPath>E:\TFSBuildDirectory</BuildDirectoryPath>
    <DropLocation>\\Riga\Teambuilds</DropLocation>
    <RunTest>false</RunTest>
    <RunCodeAnalysis>Never</RunCodeAnalysis>

    <!-- Additional Properties -->
    <WorkItemType>Bug</WorkItemType>
    <WorkItemFieldValues>System.Reason=Build Failure;System.Description=Start the build using Team Build</WorkItemFieldValues>
    <WorkItemTitle>Build failure in build:</WorkItemTitle>
    <DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
    <BuildlogText>The build log file is at:</BuildlogText>
    <ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
    <UpdateAssociatedWorkItems>true</UpdateAssociatedWorkItems>
    <AdditionalVCOverrides></AdditionalVCOverrides>
    <CustomPropertiesForClean></CustomPropertiesForClean>
    <CustomPropertiesForBuild></CustomPropertiesForBuild>
  </PropertyGroup>

  <Target Name="BeforeClean">
    <!-- Find out if it is day or night -->
    <MSBuild.ExtensionPack.Framework.DateAndTime TaskAction="CheckBetween" Start="00:00" End="07:00">
      <Output TaskParameter="BoolResult" PropertyName="DTResult"/>
    </MSBuild.ExtensionPack.Framework.DateAndTime>

    <Message Text="IsNight: $(DTResult)"/>

    <!-- Incremental get and build but not at night -->
    <PropertyGroup Condition=" '$(DTResult)'=='False' ">
      <IncrementalGet>True</IncrementalGet>
      <IncrementalBuild>True</IncrementalBuild>
    </PropertyGroup>

    <Message Text="IncrementalGet: $(IncrementalGet)"/>
  </Target>

  <ItemGroup>
    <MyDestinationFiles Include="$(SolutionRoot)\MU\Bin\*.mot" />
  </ItemGroup>

  <!-- All compilation is done here, so the TFS 2008 compiler won't get invoked -->
  <Target Name="CoreCompile">
    <Message Text="IncrementalGet: $(IncrementalGet)"/>

    <!-- Build 16-bit targets -->
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Building 16-bit targets"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
    <Exec Command="&quot;nmake.exe&quot; &quot;$(SolutionRoot)\MU\MU16.mak&quot; 2&gt;&amp;1" WorkingDirectory="$(SolutionRoot)\MU" />
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/>

    <!-- Build 32-bit targets  -->
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Building 32-bit targets"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
    <Exec Command="&quot;nmake.exe&quot; &quot;$(SolutionRoot)\MU\MU32.mak&quot; 2&gt;&amp;1" WorkingDirectory="$(SolutionRoot)\MU" />
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/>

    <!-- Copy the target files to destination folder -->
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Message="Copying binaries"><Output TaskParameter="Id" PropertyName="StepId" /></BuildStep>
    <Copy SourceFiles="@(MyDestinationFiles)" DestinationFolder="$(OutDir)\" />
    <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Id="$(StepId)" Status="Succeeded"/>
  </Target>

</Project>

Coordinator
Jun 3, 2009 at 8:53 PM

That's a nice use of the task.

Your need to override BeforeEndToEndIteration rather than BeforeClean, then it will work.

Mike

Jun 4, 2009 at 8:51 AM

It did! At least at daytime. :)

Thanks!

Erik