From c3a48546de6ebc693efc8ebe5cac5a025e2ba817 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 11 Sep 2018 15:36:25 -0700 Subject: [PATCH 1/2] [Feature] Cleanup all native code from repository --- .gitmodules | 4 - build.psm1 | 284 - .../CMakeLists.txt | 75 - .../PowerShell.Core.Instrumentation.man | 5679 ----------------- .../PowerShell.Core.Instrumentation.nuspec | 12 - src/PowerShell.Core.Instrumentation/README.md | 5 + .../RegisterManifest.ps1 | 97 - .../version.rc | 15 - src/libpsl-native/.gitignore | 12 - src/libpsl-native/CMakeLists.txt | 25 - src/libpsl-native/README.md | 2 +- src/libpsl-native/arm.toolchain.cmake | 20 - src/libpsl-native/src/.gitignore | 1 - src/libpsl-native/src/CMakeLists.txt | 37 - src/libpsl-native/src/createhardlink.cpp | 39 - src/libpsl-native/src/createhardlink.h | 12 - src/libpsl-native/src/createprocess.cpp | 220 - src/libpsl-native/src/createprocess.h | 25 - src/libpsl-native/src/createsymlink.cpp | 42 - src/libpsl-native/src/createsymlink.h | 14 - src/libpsl-native/src/followsymlink.cpp | 55 - src/libpsl-native/src/followsymlink.h | 12 - src/libpsl-native/src/getcomputername.cpp | 31 - src/libpsl-native/src/getcomputername.h | 12 - .../src/getcurrentprocessorid.cpp | 11 - src/libpsl-native/src/getcurrentprocessorid.h | 14 - src/libpsl-native/src/getcurrentthreadid.cpp | 22 - src/libpsl-native/src/getcurrentthreadid.h | 14 - src/libpsl-native/src/geterrorcategory.cpp | 66 - src/libpsl-native/src/geterrorcategory.h | 12 - src/libpsl-native/src/getfileowner.cpp | 44 - src/libpsl-native/src/getfileowner.h | 12 - .../src/getfullyqualifiedname.cpp | 54 - src/libpsl-native/src/getfullyqualifiedname.h | 12 - src/libpsl-native/src/getinodedata.cpp | 57 - src/libpsl-native/src/getinodedata.h | 12 - src/libpsl-native/src/getlinkcount.cpp | 51 - src/libpsl-native/src/getlinkcount.h | 12 - src/libpsl-native/src/getppid.cpp | 46 - src/libpsl-native/src/getppid.h | 13 - src/libpsl-native/src/getpwuid.cpp | 67 - src/libpsl-native/src/getpwuid.h | 14 - src/libpsl-native/src/getstat.cpp | 47 - src/libpsl-native/src/getstat.h | 14 - src/libpsl-native/src/getuserfrompid.cpp | 54 - src/libpsl-native/src/getuserfrompid.h | 14 - src/libpsl-native/src/getusername.cpp | 19 - src/libpsl-native/src/getusername.h | 12 - src/libpsl-native/src/isdirectory.cpp | 43 - src/libpsl-native/src/isdirectory.h | 14 - src/libpsl-native/src/isexecutable.cpp | 31 - src/libpsl-native/src/isexecutable.h | 14 - src/libpsl-native/src/isfile.cpp | 35 - src/libpsl-native/src/isfile.h | 14 - .../src/issamefilesystemitem.cpp | 49 - src/libpsl-native/src/issamefilesystemitem.h | 14 - src/libpsl-native/src/issymlink.cpp | 40 - src/libpsl-native/src/issymlink.h | 14 - src/libpsl-native/src/nativesyslog.cpp | 93 - src/libpsl-native/src/nativesyslog.h | 14 - src/libpsl-native/src/pal.h | 27 - src/libpsl-native/src/pal_config.h.in | 3 - src/libpsl-native/src/setdate.cpp | 65 - src/libpsl-native/src/setdate.h | 35 - src/libpsl-native/test/CMakeLists.txt | 26 - src/libpsl-native/test/googletest | 1 - src/libpsl-native/test/main.cpp | 10 - .../test/test-createhardlink.cpp | 83 - src/libpsl-native/test/test-createsymlink.cpp | 115 - .../test/test-getcomputername.cpp | 34 - .../test/test-getcurrentprocessid.cpp | 19 - .../test/test-getcurrentthreadid.cpp | 19 - src/libpsl-native/test/test-getfileowner.cpp | 20 - .../test/test-getfullyqualifiedname.cpp | 42 - src/libpsl-native/test/test-getlinkcount.cpp | 89 - .../test/test-getuserfrompid.cpp | 14 - src/libpsl-native/test/test-getusername.cpp | 14 - src/libpsl-native/test/test-isdirectory.cpp | 26 - src/libpsl-native/test/test-isexecutable.cpp | 79 - src/libpsl-native/test/test-isfile.cpp | 25 - src/libpsl-native/test/test-issymlink.cpp | 84 - src/libpsl-native/test/test-locale.cpp | 22 - src/powershell-native/.gitignore | 17 - src/powershell-native/CMakeLists.txt | 86 - .../Install-PowerShellRemoting.ps1 | 232 - src/powershell-native/coreclr_defs.cmake | 174 - src/powershell-native/dsc_defs.cmake | 111 - src/powershell-native/nano_defs.cmake | 88 - .../nativemsh/pwrshcommon/CMakeLists.txt | 39 - .../nativemsh/pwrshcommon/ClrHostWrapper.h | 443 -- .../pwrshcommon/ConfigFileReader.cpp | 138 - .../nativemsh/pwrshcommon/ConfigFileReader.h | 36 - .../pwrshcommon/IPwrshCommonOutput.h | 30 - .../nativemsh/pwrshcommon/NativeMsh.h | 196 - .../pwrshcommon/NativeMshConstants.h | 72 - .../nativemsh/pwrshcommon/SystemCallFacade.h | 60 - .../pwrshcommon/WinSystemCallFacade.cpp | 70 - .../pwrshcommon/WinSystemCallFacade.h | 58 - .../nativemsh/pwrshcommon/pwrshcommon.cpp | 1558 ----- .../nativemsh/pwrshexe/CMakeLists.txt | 62 - .../nativemsh/pwrshexe/CssMainEntry.cpp | 239 - .../nativemsh/pwrshexe/MainEntry.cpp | 1781 ------ .../nativemsh/pwrshexe/Monad.ico | Bin 55244 -> 0 bytes .../nativemsh/pwrshexe/MshResources.rc | 46 - .../nativemsh/pwrshexe/NativeMsh.mc | 235 - .../nativemsh/pwrshexe/OutputWriter.h | 196 - .../pwrshexe/PowerShell.exe.manifest | 36 - .../pwrshexe/PowerShell_securitybadge.ico | Bin 300318 -> 0 bytes .../nativemsh/pwrshexe/version.rc | 13 - .../nativemsh/pwrshplugin/CMakeLists.txt | 41 - .../nativemsh/pwrshplugin/entrypoints.cpp | 776 --- .../nativemsh/pwrshplugin/entrypoints.h | 19 - .../nativemsh/pwrshplugin/pwrshclrhost.cpp | 447 -- .../nativemsh/pwrshplugin/pwrshclrhost.h | 171 - .../nativemsh/pwrshplugin/pwrshheaders.h | 23 - .../nativemsh/pwrshplugin/pwrshplugin.def | 17 - .../pwrshplugin/pwrshplugin.dll.manifest | 17 - .../nativemsh/pwrshplugin/pwrshplugin.h | 1101 ---- .../pwrshplugin/pwrshpluginResources.rc | 13 - .../nativemsh/pwrshplugin/pwrshplugindefs.h | 163 - .../pwrshplugin/pwrshpluginerrorcodes.mc | 80 - .../nativemsh/pwrshplugin/version.rc | 13 - .../windows-compiler-override.txt | 16 - 123 files changed, 6 insertions(+), 17557 deletions(-) delete mode 100644 src/PowerShell.Core.Instrumentation/CMakeLists.txt delete mode 100644 src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man delete mode 100644 src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.nuspec create mode 100644 src/PowerShell.Core.Instrumentation/README.md delete mode 100644 src/PowerShell.Core.Instrumentation/RegisterManifest.ps1 delete mode 100644 src/PowerShell.Core.Instrumentation/version.rc delete mode 100644 src/libpsl-native/.gitignore delete mode 100644 src/libpsl-native/CMakeLists.txt delete mode 100644 src/libpsl-native/arm.toolchain.cmake delete mode 100644 src/libpsl-native/src/.gitignore delete mode 100644 src/libpsl-native/src/CMakeLists.txt delete mode 100644 src/libpsl-native/src/createhardlink.cpp delete mode 100644 src/libpsl-native/src/createhardlink.h delete mode 100644 src/libpsl-native/src/createprocess.cpp delete mode 100644 src/libpsl-native/src/createprocess.h delete mode 100644 src/libpsl-native/src/createsymlink.cpp delete mode 100644 src/libpsl-native/src/createsymlink.h delete mode 100644 src/libpsl-native/src/followsymlink.cpp delete mode 100644 src/libpsl-native/src/followsymlink.h delete mode 100644 src/libpsl-native/src/getcomputername.cpp delete mode 100644 src/libpsl-native/src/getcomputername.h delete mode 100644 src/libpsl-native/src/getcurrentprocessorid.cpp delete mode 100644 src/libpsl-native/src/getcurrentprocessorid.h delete mode 100644 src/libpsl-native/src/getcurrentthreadid.cpp delete mode 100644 src/libpsl-native/src/getcurrentthreadid.h delete mode 100644 src/libpsl-native/src/geterrorcategory.cpp delete mode 100644 src/libpsl-native/src/geterrorcategory.h delete mode 100644 src/libpsl-native/src/getfileowner.cpp delete mode 100644 src/libpsl-native/src/getfileowner.h delete mode 100644 src/libpsl-native/src/getfullyqualifiedname.cpp delete mode 100644 src/libpsl-native/src/getfullyqualifiedname.h delete mode 100644 src/libpsl-native/src/getinodedata.cpp delete mode 100644 src/libpsl-native/src/getinodedata.h delete mode 100644 src/libpsl-native/src/getlinkcount.cpp delete mode 100644 src/libpsl-native/src/getlinkcount.h delete mode 100644 src/libpsl-native/src/getppid.cpp delete mode 100644 src/libpsl-native/src/getppid.h delete mode 100644 src/libpsl-native/src/getpwuid.cpp delete mode 100644 src/libpsl-native/src/getpwuid.h delete mode 100644 src/libpsl-native/src/getstat.cpp delete mode 100644 src/libpsl-native/src/getstat.h delete mode 100644 src/libpsl-native/src/getuserfrompid.cpp delete mode 100644 src/libpsl-native/src/getuserfrompid.h delete mode 100644 src/libpsl-native/src/getusername.cpp delete mode 100644 src/libpsl-native/src/getusername.h delete mode 100644 src/libpsl-native/src/isdirectory.cpp delete mode 100644 src/libpsl-native/src/isdirectory.h delete mode 100644 src/libpsl-native/src/isexecutable.cpp delete mode 100644 src/libpsl-native/src/isexecutable.h delete mode 100644 src/libpsl-native/src/isfile.cpp delete mode 100644 src/libpsl-native/src/isfile.h delete mode 100644 src/libpsl-native/src/issamefilesystemitem.cpp delete mode 100644 src/libpsl-native/src/issamefilesystemitem.h delete mode 100644 src/libpsl-native/src/issymlink.cpp delete mode 100644 src/libpsl-native/src/issymlink.h delete mode 100755 src/libpsl-native/src/nativesyslog.cpp delete mode 100644 src/libpsl-native/src/nativesyslog.h delete mode 100644 src/libpsl-native/src/pal.h delete mode 100644 src/libpsl-native/src/pal_config.h.in delete mode 100644 src/libpsl-native/src/setdate.cpp delete mode 100644 src/libpsl-native/src/setdate.h delete mode 100644 src/libpsl-native/test/CMakeLists.txt delete mode 160000 src/libpsl-native/test/googletest delete mode 100644 src/libpsl-native/test/main.cpp delete mode 100644 src/libpsl-native/test/test-createhardlink.cpp delete mode 100644 src/libpsl-native/test/test-createsymlink.cpp delete mode 100644 src/libpsl-native/test/test-getcomputername.cpp delete mode 100644 src/libpsl-native/test/test-getcurrentprocessid.cpp delete mode 100644 src/libpsl-native/test/test-getcurrentthreadid.cpp delete mode 100644 src/libpsl-native/test/test-getfileowner.cpp delete mode 100644 src/libpsl-native/test/test-getfullyqualifiedname.cpp delete mode 100644 src/libpsl-native/test/test-getlinkcount.cpp delete mode 100644 src/libpsl-native/test/test-getuserfrompid.cpp delete mode 100644 src/libpsl-native/test/test-getusername.cpp delete mode 100644 src/libpsl-native/test/test-isdirectory.cpp delete mode 100644 src/libpsl-native/test/test-isexecutable.cpp delete mode 100644 src/libpsl-native/test/test-isfile.cpp delete mode 100644 src/libpsl-native/test/test-issymlink.cpp delete mode 100644 src/libpsl-native/test/test-locale.cpp delete mode 100644 src/powershell-native/.gitignore delete mode 100644 src/powershell-native/CMakeLists.txt delete mode 100644 src/powershell-native/Install-PowerShellRemoting.ps1 delete mode 100644 src/powershell-native/coreclr_defs.cmake delete mode 100644 src/powershell-native/dsc_defs.cmake delete mode 100644 src/powershell-native/nano_defs.cmake delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/ClrHostWrapper.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/ConfigFileReader.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/IPwrshCommonOutput.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/NativeMsh.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/NativeMshConstants.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/SystemCallFacade.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.h delete mode 100644 src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshexe/CMakeLists.txt delete mode 100644 src/powershell-native/nativemsh/pwrshexe/CssMainEntry.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshexe/MainEntry.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshexe/Monad.ico delete mode 100644 src/powershell-native/nativemsh/pwrshexe/MshResources.rc delete mode 100644 src/powershell-native/nativemsh/pwrshexe/NativeMsh.mc delete mode 100644 src/powershell-native/nativemsh/pwrshexe/OutputWriter.h delete mode 100644 src/powershell-native/nativemsh/pwrshexe/PowerShell.exe.manifest delete mode 100644 src/powershell-native/nativemsh/pwrshexe/PowerShell_securitybadge.ico delete mode 100644 src/powershell-native/nativemsh/pwrshexe/version.rc delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/CMakeLists.txt delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/entrypoints.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/entrypoints.h delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.h delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshheaders.h delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.def delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.dll.manifest delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshpluginResources.rc delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshplugindefs.h delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/pwrshpluginerrorcodes.mc delete mode 100644 src/powershell-native/nativemsh/pwrshplugin/version.rc delete mode 100644 src/powershell-native/windows-compiler-override.txt diff --git a/.gitmodules b/.gitmodules index c677d18caff..e69de29bb2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "src/libpsl-native/test/googletest"] - path = src/libpsl-native/test/googletest - url = https://github.com/google/googletest.git - ignore = dirty diff --git a/build.psm1 b/build.psm1 index 9296d98b0ea..a59db9aef96 100644 --- a/build.psm1 +++ b/build.psm1 @@ -177,220 +177,6 @@ if ( -not $env:PSModulePath.Contains($TestModulePath) ) { $env:PSModulePath = $TestModulePath+$TestModulePathSeparator+$($env:PSModulePath) } -function Test-Win10SDK { - # The Windows 10 SDK is installed to "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64", - # but the directory may exist even if the SDK has not been installed. - # - # A slightly more robust check is for the mc.exe binary within that directory. - # It is only present if the SDK is installed. - return (Test-Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\mc.exe") -} - -function Start-BuildNativeWindowsBinaries { - param( - [ValidateSet('Debug', 'Release')] - [string]$Configuration = 'Release', - - # The `x64_arm` syntax is the build environment for VS2017, `x64` means the host is an x64 machine and will use - # the x64 built tool. The `arm` refers to the target architecture when doing cross compilation. - [ValidateSet('x64', 'x86', 'x64_arm64', 'x64_arm')] - [string]$Arch = 'x64', - - [switch]$Clean - ) - - if (-not $Environment.IsWindows) { - Write-Warning -Message "'Start-BuildNativeWindowsBinaries' is only supported on Windows platforms" - return - } - - # cmake is needed to build pwsh.exe - if (-not (precheck 'cmake' $null)) { - throw 'cmake not found. Run "Start-PSBootstrap -BuildWindowsNative". You can also install it from https://chocolatey.org/packages/cmake' - } - - Use-MSBuild - - # mc.exe is Message Compiler for native resources - if (-Not (Test-Win10SDK)) { - throw 'Win 10 SDK not found. Run "Start-PSBootstrap -BuildWindowsNative" or install Microsoft Windows 10 SDK from https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk' - } - - if ($env:VS140COMNTOOLS -ne $null) { - $vcPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName - } else { - $vcPath = (Get-ChildItem "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017" -Filter "VC" -Directory -Recurse | Select-Object -First 1).FullName - } - - $atlMfcIncludePath = Join-Path -Path $vcPath -ChildPath 'atlmfc/include' - if (!(Test-Path $atlMfcIncludePath)) { # for VS2017, need to search for it - $atlMfcIncludePath = (Get-ChildItem $vcPath -Filter AtlBase.h -Recurse -File | Select-Object -First 1).DirectoryName - } - - # atlbase.h is included in the pwrshplugin project - if ((Test-Path -Path $atlMfcIncludePath\atlbase.h) -eq $false) { - throw "Could not find Visual Studio include file atlbase.h at $atlMfcIncludePath. Please ensure the optional feature 'Microsoft Foundation Classes for C++' is installed." - } - - # vcvarsall.bat is used to setup environment variables - $vcvarsallbatPath = "$vcPath\vcvarsall.bat" - if (!(Test-Path -Path $vcvarsallbatPath)) { # for VS2017, need to search for it - $vcvarsallbatPath = (Get-ChildItem $vcPath -Filter vcvarsall.bat -Recurse -File | Select-Object -First 1).FullName - } - - if ([string]::IsNullOrEmpty($vcvarsallbatPath) -or (Test-Path -Path $vcvarsallbatPath) -eq $false) { - throw "Could not find Visual Studio vcvarsall.bat at $vcvarsallbatPath. Please ensure the optional feature 'Common Tools for Visual C++' is installed." - } - - Write-Log "Start building native Windows binaries" - - if ($Clean) { - git clean -fdx - Remove-Item $HOME\source\cmakecache.txt -ErrorAction SilentlyContinue - } - - try { - Push-Location "$PSScriptRoot\src\powershell-native" - - # setup cmakeGenerator - $cmakeGeneratorPlatform = "" - if ($Arch -eq 'x86') { - $cmakeGenerator = 'Visual Studio 15 2017' - $cmakeArch = 'x86' - } elseif ($Arch -eq 'x64_arm') { - $cmakeGenerator = 'Visual Studio 15 2017 ARM' - $cmakeArch = 'arm' - } elseif ($Arch -eq 'x64_arm64') { - $cmakeGenerator = 'Visual Studio 15 2017' - $cmakeArch = 'arm64' - $cmakeGeneratorPlatform = "-A ARM64" - } else { - $cmakeGenerator = 'Visual Studio 15 2017 Win64' - $cmakeArch = 'x64' - } - - # Compile native resources - $currentLocation = Get-Location - @("nativemsh\pwrshplugin") | ForEach-Object { - $nativeResourcesFolder = $_ - Get-ChildItem $nativeResourcesFolder -Filter "*.mc" | ForEach-Object { - $command = @" -cmd.exe /C cd /d "$currentLocation" "&" "$vcvarsallbatPath" "$Arch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$currentLocation\$nativeResourcesFolder" -r "$currentLocation\$nativeResourcesFolder" -"@ - Write-Log " Executing mc.exe Command: $command" - Start-NativeExecution { Invoke-Expression -Command:$command } - } - } - - # make sure we use version we installed and not from VS - $cmakePath = (Get-Command cmake).Source - # Disabling until I figure out if it is necessary - # $overrideFlags = "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$PSScriptRoot\src\powershell-native\windows-compiler-override.txt" - $overrideFlags = "" - $command = @" -cmd.exe /C cd /d "$currentLocation" "&" "$vcvarsallbatPath" "$Arch" "&" "$cmakePath" "$overrideFlags" -DBUILD_ONECORE=ON -DBUILD_TARGET_ARCH=$cmakeArch -G "$cmakeGenerator" $cmakeGeneratorPlatform "$currentLocation" "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$Configuration" -"@ - Write-Log " Executing Build Command: $command" - Start-NativeExecution { Invoke-Expression -Command:$command } - - # Copy the binaries from the local build directory to the packaging directory - $FilesToCopy = @('pwrshplugin.dll', 'pwrshplugin.pdb') - $dstPath = "$PSScriptRoot\src\powershell-win-core" - $FilesToCopy | ForEach-Object { - $srcPath = [IO.Path]::Combine($PWD.Path, "bin", $Configuration, "CoreClr/$_") - - Write-Log " Copying $srcPath to $dstPath" - Copy-Item $srcPath $dstPath - } - - # - # Build the ETW manifest resource-only binary - # - $location = "$PSScriptRoot\src\PowerShell.Core.Instrumentation" - Set-Location -Path $location - - Remove-Item $HOME\source\cmakecache.txt -ErrorAction SilentlyContinue - - $command = @" -cmd.exe /C cd /d "$location" "&" "$vcvarsallbatPath" "$Arch" "&" "$cmakePath" "$overrideFlags" -DBUILD_ONECORE=ON -DBUILD_TARGET_ARCH=$cmakeArch -G "$cmakeGenerator" $cmakeGeneratorPlatform "$location" "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$Configuration" -"@ - Write-Log " Executing Build Command for PowerShell.Core.Instrumentation: $command" - Start-NativeExecution { Invoke-Expression -Command:$command } - - # Copy the binary to the packaging directory - # NOTE: No PDB file; it's a resource-only DLL. - $srcPath = [IO.Path]::Combine($PWD.Path, $Configuration, 'PowerShell.Core.Instrumentation.dll') - Copy-Item -Path $srcPath -Destination $dstPath - - } finally { - Pop-Location - } -} - -function Start-BuildNativeUnixBinaries { - param ( - [switch] $BuildLinuxArm - ) - - if (-not $Environment.IsLinux -and -not $Environment.IsMacOS) { - Write-Warning -Message "'Start-BuildNativeUnixBinaries' is only supported on Linux/macOS platforms" - return - } - - if ($BuildLinuxArm -and -not $Environment.IsUbuntu) { - throw "Cross compiling for linux-arm is only supported on Ubuntu environment" - } - - # Verify we have all tools in place to do the build - $precheck = $true - foreach ($Dependency in 'cmake', 'make', 'g++') { - $precheck = $precheck -and (precheck $Dependency "Build dependency '$Dependency' not found. Run 'Start-PSBootstrap'.") - } - - if ($BuildLinuxArm) { - foreach ($Dependency in 'arm-linux-gnueabihf-gcc', 'arm-linux-gnueabihf-g++') { - $precheck = $precheck -and (precheck $Dependency "Build dependency '$Dependency' not found. Run 'Start-PSBootstrap'.") - } - } - - # Abort if any precheck failed - if (-not $precheck) { - return - } - - # Build native components - $Ext = if ($Environment.IsLinux) { - "so" - } elseif ($Environment.IsMacOS) { - "dylib" - } - - $Native = "$PSScriptRoot/src/libpsl-native" - $Lib = "$PSScriptRoot/src/powershell-unix/libpsl-native.$Ext" - Write-Log "Start building $Lib" - - git clean -qfdX $Native - - try { - Push-Location $Native - if ($BuildLinuxArm) { - Start-NativeExecution { cmake -DCMAKE_TOOLCHAIN_FILE="./arm.toolchain.cmake" . } - Start-NativeExecution { make -j } - } - else { - Start-NativeExecution { cmake -DCMAKE_BUILD_TYPE=Debug . } - Start-NativeExecution { make -j } - Start-NativeExecution { ctest --verbose } - } - } finally { - Pop-Location - } - - if (-not (Test-Path $Lib)) { - throw "Compilation of $Lib failed" - } -} - <# .Synopsis Tests if a version is preview @@ -1719,7 +1505,6 @@ function Start-PSBootstrap { [string]$Version = $dotnetCLIRequiredVersion, [switch]$Package, [switch]$NoSudo, - [switch]$BuildWindowsNative, [switch]$BuildLinuxArm, [switch]$Force ) @@ -1909,75 +1694,6 @@ function Start-PSBootstrap { Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl } - - if ($BuildWindowsNative) { - Write-Log "Install Windows dependencies for building PSRP plugin" - - $machinePath = [Environment]::GetEnvironmentVariable('Path', 'MACHINE') - $newMachineEnvironmentPath = $machinePath - - $cmakePresent = precheck 'cmake' $null - $sdkPresent = Test-Win10SDK - - # Install chocolatey - $chocolateyPath = "$env:AllUsersProfile\chocolatey\bin" - - if(precheck 'choco' $null) { - Write-Log "Chocolatey is already installed. Skipping installation." - } - elseif(($cmakePresent -eq $false) -or ($sdkPresent -eq $false)) { - Write-Log "Chocolatey not present. Installing chocolatey." - if ($Force -or $PSCmdlet.ShouldProcess("Install chocolatey via https://chocolatey.org/install.ps1")) { - Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) - if (-not ($machinePath.ToLower().Contains($chocolateyPath.ToLower()))) { - Write-Log "Adding $chocolateyPath to Path environment variable" - $env:Path += ";$chocolateyPath" - $newMachineEnvironmentPath += ";$chocolateyPath" - } else { - Write-Log "$chocolateyPath already present in Path environment variable" - } - } else { - Write-Error "Chocolatey is required to install missing dependencies. Please install it from https://chocolatey.org/ manually. Alternatively, install cmake and Windows 10 SDK." - return - } - } else { - Write-Log "Skipping installation of chocolatey, cause both cmake and Win 10 SDK are present." - } - - # Install cmake - $cmakePath = "${env:ProgramFiles}\CMake\bin" - if($cmakePresent -and !($force.IsPresent)) { - Write-Log "Cmake is already installed. Skipping installation." - } else { - Write-Log "Cmake not present or -Force used. Installing cmake." - Start-NativeExecution { choco install cmake -y --version 3.10.0 } - if (-not ($machinePath.ToLower().Contains($cmakePath.ToLower()))) { - Write-Log "Adding $cmakePath to Path environment variable" - $env:Path += ";$cmakePath" - $newMachineEnvironmentPath = "$cmakePath;$newMachineEnvironmentPath" - } else { - Write-Log "$cmakePath already present in Path environment variable" - } - } - - # Install Windows 10 SDK - $packageName = "windows-sdk-10.0" - - if (-not $sdkPresent) { - Write-Log "Windows 10 SDK not present. Installing $packageName." - Start-NativeExecution { choco install windows-sdk-10.0 -y } - } else { - Write-Log "Windows 10 SDK present. Skipping installation." - } - - # Update path machine environment variable - if ($newMachineEnvironmentPath -ne $machinePath) { - Write-Log "Updating Path machine environment variable" - if ($Force -or $PSCmdlet.ShouldProcess("Update Path machine environment variable to $newMachineEnvironmentPath")) { - [Environment]::SetEnvironmentVariable('Path', $newMachineEnvironmentPath, 'MACHINE') - } - } - } } } finally { Pop-Location diff --git a/src/PowerShell.Core.Instrumentation/CMakeLists.txt b/src/PowerShell.Core.Instrumentation/CMakeLists.txt deleted file mode 100644 index bfa5218b86c..00000000000 --- a/src/PowerShell.Core.Instrumentation/CMakeLists.txt +++ /dev/null @@ -1,75 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -# -# Builds PowerShell.Core.Instrumentation.dll resource-only DLL containing ETW event resources -# - -# The fully qualified path to the event manifest -SET(EVENTS_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/PowerShell.Core.Instrumentation.man") - -# User mode manifest resource-only dll -function(add_manifest_binary) - - add_definitions(-D_DLL=1) - add_library(${ARGV}) - - # NOTE: EVENTS_MANIFEST must be the fully qualified path to the manifest - SET(MC_MANIFEST_FULLNAME ${EVENTS_MANIFEST}) - - # get the ETW manifest's filename without the directory or extension - get_filename_component(MC_MANIFEST_BASENAME ${EVENTS_MANIFEST} NAME_WE) - - SET(MC_COMMAND "mc.exe") - SET(GeneratedManifestFiles) - - # The target directory for generated managed files - SET (MC_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}") - - # include the generated directory in the include path - include_directories("${MC_GENERATED_DIR}") - - SET (MC_GENERATED_FILES - ${MC_GENERATED_DIR}/${MC_MANIFEST_BASENAME}.rc - ${MC_GENERATED_DIR}/${MC_MANIFEST_BASENAME}TEMP.BIN - ${MC_GENERATED_DIR}/${MC_MANIFEST_BASENAME}_MSG00001.BIN - ) - - SET(MC_COMMAND "mc.exe -h ${MC_GENERATED_DIR} -r ${MC_GENERATED_DIR} ${MC_MANIFEST_FULLNAME}") - - add_custom_command( - COMMENT "Generating native event manifest files for ${EVENTS_MANIFEST}" - OUTPUT ${MC_GENERATED_FILES} - DEPENDS ${MC_MANIFEST_FULLNAME} - COMMAND cmd.exe /c ${MC_COMMAND} - WORKING_DIRECTORY ${MC_GENERATED_DIR} - VERBATIM - ) - - list (APPEND GeneratedManifestFiles ${MC_GENERATED_DIR}/${MC_MANIFEST_BASENAME}.rc) - - set_source_files_properties(${GeneratedManifestFiles} PROPERTIES GENERATED TRUE) - add_custom_target(GeneratedManifestFiles DEPENDS ${GeneratedManifestFiles}) - - # for a resource only dll, cmake can report an error - # if there is no linker language set. - # CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. - # Missing variable is: CMAKE_RC_CREATE_SHARED_LIBRARY - get_property(isSet TARGET ${ARGV0} PROPERTY LINKER_LANGUAGE SET) - if (NOT ${isSet}) - set_target_properties(${ARGV0} PROPERTIES LINKER_LANGUAGE "CXX") - endif() - - set_target_properties(${ARGV0} PROPERTIES LINK_FLAGS "/NODEFAULTLIB /NOENTRY") - - if (BUILD_ONECORE) - set_target_properties(${ARGV0} PROPERTIES COMPILE_DEFINITIONS "CORECLR") - endif (BUILD_ONECORE) - - # ensure the target is dependent on the generated files. - add_dependencies(${ARGV0} GeneratedManifestFiles) - -endfunction() - -file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/version.rc) - -add_manifest_binary(PowerShell.Core.Instrumentation SHARED ${SOURCES}) - diff --git a/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man b/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man deleted file mode 100644 index a058072272f..00000000000 --- a/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man +++ /dev/null @@ -1,5679 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - 15728640 - - - - - - true - - 1048985600 - - - - 64 - - - - - - true - - 1048985600 - - - - 64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -