Additional code changes and link fixes

This commit is contained in:
Mike Richmond committed 2016-07-19 16:41:13 -07:00
1 parent 8948aa7efb
commit 77a26b6b77
14 files changed
+563 -83

No files matched your search

+67 -34
View File
@@ -62,7 +62,7 @@ function Start-PSBuild {
[ValidateSet('x86', 'x64')]
[string]$NativeHostArch = "x64",
[ValidateSet('Linux', 'Debug', 'Release', '')]
[ValidateSet('Linux', 'Debug', 'Release', '')] # We might need "Checked" as well
[string]$Configuration
)
@@ -156,36 +156,36 @@ function Start-PSBuild {
$Arguments += "--runtime", $Options.Runtime
# handle Restore
if ($Restore -or -not (Test-Path "$($Options.Top)/project.lock.json")) {
log "Run dotnet restore"
# if ($Restore -or -not (Test-Path "$($Options.Top)/project.lock.json")) {
# log "Run dotnet restore"
$RestoreArguments = @("--verbosity")
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
$RestoreArguments += "Info"
} else {
$RestoreArguments += "Warning"
}
$RestoreArguments += "$PSScriptRoot"
Start-NativeExecution { dotnet restore $RestoreArguments }
}
# $RestoreArguments = @("--verbosity")
# if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
# $RestoreArguments += "Info"
# } else {
# $RestoreArguments += "Warning"
# }
#
# $RestoreArguments += "$PSScriptRoot"
#
# Start-NativeExecution { dotnet restore $RestoreArguments }
# }
# handle ResGen
# Heuristic to run ResGen on the fresh machine
if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen"))
{
log "Run ResGen (generating C# bindings for resx files)"
Start-ResGen
}
# if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen"))
# {
# log "Run ResGen (generating C# bindings for resx files)"
# Start-ResGen
# }
# handle xaml files
# Heuristic to resolve xaml on the fresh machine
if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs")))
{
log "Run XamlGen (generating .g.cs and .resources for .xaml files)"
Start-XamlGen -MSBuildConfiguration $msbuildConfiguration
}
# if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs")))
# {
# log "Run XamlGen (generating .g.cs and .resources for .xaml files)"
# Start-XamlGen -MSBuildConfiguration $msbuildConfiguration
# }
# Build native components
if ($IsLinux -or $IsOSX) {
@@ -217,6 +217,12 @@ function Start-PSBuild {
try {
Push-Location "$PSScriptRoot\src\powershell-native"
$vcPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
if ((Test-Path -Path $vcPath\vcvarsall.bat) -eq $false)
{
throw "Could not find Visual Studio vcvarsall.bat at" + $vcPath
}
# Compile native resources
@("nativemsh/pwrshplugin") | % {
$nativeResourcesFolder = $_
@@ -224,18 +230,46 @@ function Start-PSBuild {
& $mcexe -o -d -c -U $_.FullName -h $nativeResourcesFolder -r $nativeResourcesFolder
}
}
if ($cmakeGenerator) {
Start-NativeExecution { cmake -G $cmakeGenerator . }
} else {
Start-NativeExecution { cmake . }
}
Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration }
$overrideFlags = "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$PSScriptRoot\src\powershell-native\windows-compiler-override.txt"
$vcArch = "Win64"
$cmakeGenerator = "Visual Studio 14 2015 $vcArch"
# $CMakeArguments = "-G $cmakeGenerator ."
$vcPlatform = "x64"
$location = Get-Location
# $MSBuildArguments = "ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration"
# if ($cmakeGenerator) {
# Start-NativeExecution { cmake $overrideFlags -G $cmakeGenerator . }
# } else {
# Start-NativeExecution { cmake $overrideFlags . }
# }
# #
# # BUILD_ONECORE
# #
$command = @"
cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" cmake "$overrideFlags" -DBUILD_ONECORE=ON -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
"@
#cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" "$cmakeCmd" "&" "msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration"
# "&" exit
log " Executing command: $command"
#Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration }
Start-NativeExecution { Invoke-Expression -Command:$command }
#
# NOT BUILD_ONECORE
#
$command = @"
cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" cmake "$overrideFlags" -DBUILD_ONECORE=OFF -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
"@
#cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" "$cmakeCmd" "&" "msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration"
# "&" exit
log " Executing command: $command"
#Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration }
Start-NativeExecution { Invoke-Expression -Command:$command }
} finally {
Pop-Location
}
throw "All done"
}
# handle TypeGen
@@ -254,7 +288,6 @@ function Start-PSBuild {
} finally {
Pop-Location
}
}
@@ -1312,7 +1345,7 @@ function script:Start-NativeExecution([scriptblock]$sb)
try
{
& $sb
# note, if $sb doens't have a native invokation, $LASTEXITCODE will
# note, if $sb doens't have a native invocation, $LASTEXITCODE will
# point to the obsolete value
if ($LASTEXITCODE -ne 0)
{