Additional fixes in preparation for review and pull request
This commit is contained in:
parent
4e349ddc2c
commit
d7618d731d
101
build.psm1
101
build.psm1
|
@ -59,7 +59,7 @@ function Start-PSBuild {
|
|||
[switch]$XamlGen,
|
||||
|
||||
[Parameter(ParameterSetName='FullCLR')]
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[ValidateSet('x86', 'x64')] # TODO: At some point, we need to add ARM support to match CoreCLR
|
||||
[string]$NativeHostArch = "x64",
|
||||
|
||||
[ValidateSet('Linux', 'Debug', 'Release', '')] # We might need "Checked" as well
|
||||
|
@ -106,6 +106,12 @@ function Start-PSBuild {
|
|||
}
|
||||
#>
|
||||
|
||||
$vcVarsPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
|
||||
if ((Test-Path -Path $vcVarsPath\vcvarsall.bat) -eq $false)
|
||||
{
|
||||
throw "Could not find Visual Studio vcvarsall.bat at" + $vcVarsPath
|
||||
}
|
||||
|
||||
# setup msbuild configuration
|
||||
if ($Configuration -eq 'Debug' -or $Configuration -eq 'Release')
|
||||
{
|
||||
|
@ -156,36 +162,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,12 +223,6 @@ 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") | % {
|
||||
|
@ -236,44 +236,23 @@ function Start-PSBuild {
|
|||
# Disabling until I figure out if it is necessary
|
||||
# $overrideFlags = "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$PSScriptRoot\src\powershell-native\windows-compiler-override.txt"
|
||||
$overrideFlags = ""
|
||||
$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
|
||||
# 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"
|
||||
|
||||
$BuildOneCoreValues = @("ON","OFF")
|
||||
foreach ($oneCoreValue in $BuildOneCoreValues)
|
||||
{
|
||||
$command = @"
|
||||
cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" cmake "$overrideFlags" -DBUILD_ONECORE=$oneCoreValue -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 }
|
||||
log " Executing command: $command"
|
||||
Start-NativeExecution { Invoke-Expression -Command:$command }
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
throw "All done"
|
||||
}
|
||||
|
||||
# handle TypeGen
|
||||
|
|
|
@ -77,12 +77,12 @@ add_definitions(
|
|||
|
||||
set(CMAKE_ENABLE_EXPORTS ON)
|
||||
|
||||
set(MY_COMMON_LINK_FLAGS "/INCREMENTAL:NO /NOLOGO /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /TLBID:1 /MACHINE:x64 /guard:cf /OPT:REF /OPT:ICF /NODEFAULTLIB")
|
||||
set(MY_COMMON_LINK_FLAGS "/NOLOGO /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /TLBID:1 /MACHINE:x64 /guard:cf /OPT:REF /OPT:ICF /NODEFAULTLIB")
|
||||
set(MY_COMMON_LINK_FLAGS "${MY_COMMON_LINK_FLAGS} /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:advapi32.lib") # Explicitly exclude kernel32 and advapi32 since CMake is including them and they block execution on Nano Server
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MY_COMMON_LINK_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.00") #windows subsystem
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.00 /INCREMENTAL:NO") #windows subsystem
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MY_COMMON_LINK_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE") #windows subsystem
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /INCREMENTAL:NO") #windows subsystem
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ static PwrshCommon sPwrshCommon;
|
|||
// pwszRuntimeVersion and pRuntimeVersionLength represents the size of pwszRuntimeVersion.
|
||||
// returns: 0 on success, non-zero on failure.
|
||||
_Success_(return == 0) //EXIT_CODE_SUCCESS
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
unsigned int GetCLRVersionForPSVersion(int iPSMajorVersion,
|
||||
int iPSMinorVersion,
|
||||
size_t runtimeVersionLength,
|
||||
|
@ -324,7 +324,6 @@ DWORD ReportOperationComplete(WSMAN_PLUGIN_REQUEST *requestDetails, DWORD errorC
|
|||
// initialized more than once within the same process, but only once per
|
||||
// applicationIdentification.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
DWORD WINAPI WSManPluginStartup(
|
||||
__in DWORD flags,
|
||||
|
@ -409,7 +408,6 @@ DWORD WINAPI WSManPluginStartup(
|
|||
// reason: If this is a system shutdown this will be WSMAN_PLUGIN_SHUTDOWN_SYSTEM.
|
||||
// For WSMan service shutdown this will be WSMAN_PLUGIN_SHUTDOWN_SERVICE. For an IIS host
|
||||
//shutdown this will be WSMAN_PLUGIN_SHUTDOWN_IISHOST.
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
DWORD WINAPI WSManPluginShutdown(
|
||||
__in PVOID pluginContext,
|
||||
|
@ -458,7 +456,6 @@ DWORD WINAPI WSManPluginShutdown(
|
|||
// requestDetails the plug-in needs to call WSManPluginOperationComplete.
|
||||
// The shell is active until this time.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginShell(
|
||||
__in PVOID pluginContext,
|
||||
|
@ -535,7 +532,6 @@ VOID WINAPI WSManPluginShell(
|
|||
// corresponding release function has been called. Failure to follow the contract
|
||||
// will result in errors being generated.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginReleaseShellContext(__in PVOID shellContext)
|
||||
{
|
||||
|
@ -569,7 +565,6 @@ VOID WINAPI WSManPluginReleaseShellContext(__in PVOID shellContext)
|
|||
// requestDetails the plug-in needs to call WSManPluginOperationComplete.
|
||||
// The command is active until this time.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginCommand(
|
||||
__in WSMAN_PLUGIN_REQUEST *requestDetails,
|
||||
|
@ -604,7 +599,6 @@ VOID WINAPI WSManPluginCommand(
|
|||
// corresponding release function has been called. Failure to follow the contract
|
||||
// will result in errors being generated.
|
||||
// ---------------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginReleaseCommandContext(
|
||||
__in PVOID shellContext,
|
||||
|
@ -637,7 +631,6 @@ VOID WINAPI WSManPluginReleaseCommandContext(
|
|||
// For each piece of data the plug-in calls WSManPluginResultComplete to
|
||||
// acknowledge receipt and to allow the next piece of data to be delivered.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginSend(
|
||||
__in WSMAN_PLUGIN_REQUEST *requestDetails,
|
||||
|
@ -678,7 +671,6 @@ VOID WINAPI WSManPluginSend(
|
|||
// WSManPluginResultComplete. The operation is marked as active until this
|
||||
// time.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginReceive(
|
||||
__in WSMAN_PLUGIN_REQUEST *requestDetails,
|
||||
|
@ -715,7 +707,6 @@ VOID WINAPI WSManPluginReceive(
|
|||
// of this callback may be many completion calls for the Signal, Receive, Command
|
||||
// and Shell operations.
|
||||
// -----------------------------------------------------------------------------
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginSignal(
|
||||
__in WSMAN_PLUGIN_REQUEST *requestDetails,
|
||||
|
@ -742,7 +733,6 @@ VOID WINAPI WSManPluginSignal(
|
|||
}
|
||||
}
|
||||
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
VOID WINAPI WSManPluginConnect(
|
||||
__in WSMAN_PLUGIN_REQUEST *requestDetails,
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
// returns: 0 on success, non-zero on failure.
|
||||
_Success_(return == 0) // EXIT_CODE_SUCCESS
|
||||
extern "C"
|
||||
__declspec(dllexport)
|
||||
unsigned int GetCLRVersionForPSVersion(int iPSMajorVersion,
|
||||
int iPSMinorVersion,
|
||||
size_t runtimeVersionLength,
|
||||
|
|
|
@ -1091,7 +1091,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
__declspec(dllexport)
|
||||
extern "C"
|
||||
void WINAPI PerformWSManPluginReportCompletion()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue