2 ***********************************************************************************************
3 CLRTest.Execute.targets
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6 created a backup copy. Incorrect changes to this file will make it
7 impossible to load or build your projects from the command-line or the IDE.
9 This file contains the logic for providing Execution Script generation.
11 WARNING: When setting properties based on their current state (for example:
12 <Foo Condition="'$(Foo)'==''>Bar</Foo>). Be very careful. Another script generation
13 target might be trying to do the same thing. It's better to avoid this by instead setting a new property.
15 Additionally, be careful with itemgroups. Include will propagate outside of the target too!
17 ***********************************************************************************************
19 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22 <BashScriptSnippetGen>$(BashScriptSnippetGen);GetCrossgenBashScript</BashScriptSnippetGen>
23 <BatchScriptSnippetGen>$(BatchScriptSnippetGen);GetCrossgenBatchScript</BatchScriptSnippetGen>
26 <CLRTestBashEnvironmentVariable Condition="'$(CrossGenTest)' == 'true'" Include = "export RunCrossGen=1"/>
27 <CLRTestBatchEnvironmentVariable Condition="'$(CrossGenTest)' == 'true'" Include = "set RunCrossGen=1"/>
28 <CLRTestBashEnvironmentVariable Condition="'$(CrossGenTest)' == 'false'" Include = "unset RunCrossGen"/>
29 <CLRTestBatchEnvironmentVariable Condition="'$(CrossGenTest)' == 'false'" Include = "set RunCrossGen="/>
33 This returns the portion of the execution script that generates the required lines to crossgen the test executable.
35 <Target Name="GetCrossgenBashScript">
38 <CrossgenBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun'">
41 if [ ! -z ${RunCrossGen+x} ]%3B then
42 export COMPlus_ZapRequire=$(ZapRequire)
43 export COMPlus_ZapRequireList=$(MSBuildProjectName)
46 echo Inconsistency, IL dir already exists, reinstall tests
53 __Command="$CORE_ROOT/crossgen $CrossGenOptions /p $CORE_ROOT%3A$PWD/IL /in $PWD/IL/$(MSBuildProjectName).exe /out $PWD/$(MSBuildProjectName).ni.exe"
55 echo "Running CrossGen: $__Command"
58 if [ $__cgExitCode -ne 0 ]
61 rm -rf $(MSBuildProjectName).ni.exe
63 echo Crossgen failed with exitcode: $__cgExitCode
67 # Need to copy this to coreroot so that ni gets into TPA list (it's not loaded otherwise)
68 mv $(MSBuildProjectName).ni.exe $CORE_ROOT
73 <CrossgenCleanupBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(CrossGenTest)' != 'false'">
75 if [ ! -z ${RunCrossGen+x} ] || [ ! -z ${RunCrossGen2+x} ]%3B then
77 rm -rf $CORE_ROOT/$(MSBuildProjectName).ni.exe
81 </CrossgenCleanupBashScript>
83 <BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(CrossgenBashScript)</BashCLRTestPreCommands>
84 <BashCLRTestPostCommands>$(BashCLRTestPostCommands);$(CrossgenCleanupBashScript)</BashCLRTestPostCommands>
88 <Target Name="GetCrossgenBatchScript">
91 <CrossgenBatchScript Condition="'$(CLRTestKind)' == 'BuildAndRun'">
95 </CrossgenBatchScript>
97 <CLRTestBatchPreCommands>$(CLRTestBatchPreCommands);$(CrossgenBatchScript)</CLRTestBatchPreCommands>