Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ dotnet-uninstall-debian-packages.sh
*.msi
*.appx

# Ignore binaries and symbols
*.pdb
*.dll

# Ignore packages
*.deb
*.zip
Expand Down
39 changes: 28 additions & 11 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,18 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
# Copy the executable binary from the local build directory to the expected destination to enable Start-DevPowerShell to work
#
# TODO: This should be updated to handle per-architecture builds gracefully.
$srcPath = Join-Path (Join-Path (Join-Path (Get-Location) "bin") $msbuildConfiguration) "FullCLR/powershell.exe"

$dstPath = ($script:Options).Top
log " Copying $srcPath to $dstPath"
Copy-Item $srcPath $dstPath
@(
'powershell.exe',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we building the CoreCLR version native powershell.exe and pwrshplugin.dll for powershell-windows?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't build native powershell.exe, we do build pwrshplugin.
I asked Mike add it to the package in #1490 (comment)

'powershell.pdb',
'pwrshplugin.dll',
'pwrshplugin.pdb'
) | % {
$srcPath = Join-Path (Join-Path (Join-Path (Get-Location) "bin") $msbuildConfiguration) "FullCLR/$_"
log " Copying $srcPath to $dstPath"
Copy-Item $srcPath $dstPath
}
} finally {
Pop-Location
}
Expand Down Expand Up @@ -346,13 +354,6 @@ function New-PSOptions {
# Add .NET CLI tools to PATH
Find-Dotnet

if ($FullCLR) {
$Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost"
} else {
$Top = "$PSScriptRoot/src/powershell"
}
Write-Verbose "Top project directory is $Top"

if (-not $Configuration) {
$Configuration = if ($IsLinux -or $IsOSX) {
"Linux"
Expand All @@ -362,6 +363,21 @@ function New-PSOptions {
Write-Verbose "Using configuration '$Configuration'"
}

if ($FullCLR) {
$Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost"
} else {
if ($Configuration -eq 'Linux')
{
$Top = "$PSScriptRoot/src/powershell-unix"
}
else
{
$Top = "$PSScriptRoot/src/powershell-windows"
}
}
Write-Verbose "Top project directory is $Top"


if (-not $Framework) {
$Framework = if ($FullCLR) {
"net451"
Expand Down Expand Up @@ -1072,7 +1088,8 @@ function Start-TypeGen
Push-Location "$PSScriptRoot/src/TypeCatalogParser"
try
{
dotnet run
$topPath = if ($IsWindows) {'../powershell-windows'} else {'../powershell-unix'}
dotnet run $topPath
}
finally
{
Expand Down
8 changes: 4 additions & 4 deletions docs/building/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Top directory

We are calling `dotnet` tool build for `$Top` directory

- `src\powershell` for CoreCLR builds (all platforms)
- `src\powershell-windows` for CoreCLR on Windows.
- `src\powershell-unix` for CoreCLR on Linux and OS X.
- `src\Microsoft.PowerShell.ConsoleHost` for FullCLR builds (Windows only)


### Dummy dependencies

We use dummy dependencies between project.json files to leverage `dotnet` build functionality.
For example, `src\Microsoft.PowerShell.ConsoleHost\project.json` has dependency on `Microsoft.PowerShell.PSReadLine`,
For example, `src\powershell-windows\project.json` has dependency on `Microsoft.PowerShell.PSReadLine`,
but in reality, there is no build dependency.

Dummy dependencies allows us to build just `$Top` folder, instead of building several folders.
Expand All @@ -31,4 +31,4 @@ Dummy dependencies allows us to build just `$Top` folder, instead of building se
it should be listed as a dependency for FullCLR $Top folder (src\Microsoft.PowerShell.ConsoleHost)

* If assembly is part of CoreCLR build,
it should be listed as a dependency for CoreCLR $Top folder (src\powershell)
it should be listed as a dependency for $Top folder (src\powershell-unix or src\powershell-windows)
34 changes: 21 additions & 13 deletions src/Microsoft.PowerShell.ConsoleHost/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"mappings": {
"Modules/" : {
"include": [
"../Modules/Full",
"../Modules/Windows-Full",
"../Modules/Windows-Core+Full",
"../Modules/Shared"
],
"exclude": [
Expand All @@ -25,6 +26,9 @@
},
"include" : [
"powershell.exe",
"powershell.pdb",
"pwrshplugin.dll",
"pwrshplugin.pdb",
"../../powershell.version"
]
}
Expand All @@ -34,7 +38,8 @@
"mappings": {
"Modules/" : {
"include": [
"../Modules/Full",
"../Modules/Windows-Full",
"../Modules/Windows-Core+Full",
"../Modules/Shared"
],
"exclude": [
Expand All @@ -44,6 +49,9 @@
},
"include" : [
"powershell.exe",
"powershell.pdb",
"pwrshplugin.dll",
"pwrshplugin.pdb",
"../../powershell.version"
]
},
Expand All @@ -56,15 +64,8 @@
}
},


"dependencies": {
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*",
"Microsoft.PowerShell.Commands.Management": "1.0.0-*",
"Microsoft.PowerShell.Commands.Utility": "1.0.0-*",
"Microsoft.PowerShell.LocalAccounts": "1.0.0-*",
"Microsoft.PowerShell.PackageManagement": "1.0.0-*",
"Microsoft.Management.Infrastructure.CimCmdlets": "1.0.0-*"
"System.Management.Automation": "1.0.0-*"
},

"frameworks": {
Expand Down Expand Up @@ -94,15 +95,22 @@
},
"net451": {
"dependencies": {
"Microsoft.PowerShell.ScheduledJob": "1.0.0-*",
"Microsoft.PowerShell.Workflow.ServiceCore": "1.0.0-*",
"Microsoft.PowerShell.GraphicalHost": "1.0.0-*",
"Microsoft.Management.Infrastructure.CimCmdlets": "1.0.0-*",
"Microsoft.PowerShell.Activities": "1.0.0-*",
"Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*",
"Microsoft.PowerShell.Commands.Management": "1.0.0-*",
"Microsoft.PowerShell.Commands.Utility": "1.0.0-*",
"Microsoft.PowerShell.Core.Activities": "1.0.0-*",
"Microsoft.PowerShell.Diagnostics.Activities": "1.0.0-*",
"Microsoft.PowerShell.GraphicalHost": "1.0.0-*",
"Microsoft.PowerShell.LocalAccounts": "1.0.0-*",
"Microsoft.PowerShell.Management.Activities": "1.0.0-*",
"Microsoft.PowerShell.PackageManagement": "1.0.0-*",
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"Microsoft.PowerShell.ScheduledJob": "1.0.0-*",
"Microsoft.PowerShell.Security.Activities": "1.0.0-*",
"Microsoft.PowerShell.Utility.Activities": "1.0.0-*",
"Microsoft.PowerShell.Workflow.ServiceCore": "1.0.0-*",
"Microsoft.WSMan.Management.Activities": "1.0.0-*"
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/Modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ Content files includes:

These files are copied as-is by `dotnet`

- **Shared** is shared between all flavours
- **Full** for FullCLR (Windows)
- **Core** for CoreCLR (all platforms)
- Shared (shared between all variations)
- Windows+Unix-Core

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reading this as Windows Plus Unix Minus Core, which I don't think is what it means.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are mirroring nuget framework notation here

- Windows-Core
- Windows-Core+Full
- Windows-Full

Notes
-----------

* We have files with the same names in "Full" and "Core" folders.
We have files with the same names in different folders.
That means that the contents of these two files are different.
I.e. if it's .psd1 file, it could be because `CmdletsToExport` are different for different platforms.

* Also, we should never have files with the same names under "Full" and "Shared" (or "Core" and "Shared").
I.e. if it's .psd1 file, it could be because `CmdletsToExport`
are different for different runtimes (platforms) or frameworks.
54 changes: 28 additions & 26 deletions src/Modules/map.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"monad/miscfiles/modules/PSDiagnostics/PSDiagnostics.psd1": "Shared/PSDiagnostics/PSDiagnostics.psd1",
"monad/miscfiles/modules/PSDiagnostics/PSDiagnostics.psm1": "Shared/PSDiagnostics/PSDiagnostics.psm1",
"monad/miscfiles/modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1": "Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1",
"monad/miscfiles/modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1": "Shared/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1",
"monad/miscfiles/display/WSMan.format.ps1xml": "Shared/Microsoft.WSMan.Management/WSMan.format.ps1xml",
"monad/miscfiles/modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1": "Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1": "Shared/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1",
"monad/miscfiles/modules/Microsoft.PowerShell.Archive/ArchiveResources.psd1": "Shared/Microsoft.PowerShell.Archive/ArchiveResources.psd1",
Expand All @@ -12,8 +8,6 @@
"monad/miscfiles/modules/PSGet/PSGet.Format.ps1xml": "Shared/PowerShellGet/PSGet.Format.ps1xml",
"monad/miscfiles/modules/PSGet/PSGet.Resource.psd1": "Shared/PowerShellGet/PSGet.Resource.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1": "Shared/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1",
"monad/src/LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1": "Shared/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1",
"monad/src/LocalAccounts/LocalAccounts.format.ps1xml": "Shared/Microsoft.PowerShell.LocalAccounts/LocalAccounts.format.ps1xml",
"monad/src/oneget/PowerShell.Module/PackageManagement.psd1": "Shared/PackageManagement/PackageManagement.psd1",
"monad/src/oneget/PowerShell.Module/PackageManagement.format.ps1xml": "Shared/PackageManagement/PackageManagement.format.ps1xml",
"monad/src/oneget/providers/inbox/powershell.metaprovider/PackageProviderFunctions.psm1": "Shared/PackageManagement/PackageProviderFunctions.psm1",
Expand All @@ -23,25 +17,33 @@
"wmi/psws/PSODataUtils/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1": "Shared/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1",
"wmi/psws/PSODataUtils/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1": "Shared/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1",
"wmi/psws/PSODataUtils/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsStrings.psd1": "Shared/Microsoft.PowerShell.ODataUtils/en-US/Microsoft.PowerShell.ODataUtilsStrings.psd1",
"wmi/WMIv2/Client/CIMCmdlets/CimCmdlets.psd1": "Shared/CimCmdlets/CimCmdlets.psd1",

"monad/miscfiles/modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1": "Full/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1": "Full/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1": "Full/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"monad/miscfiles/types/getevent.types.ps1xml": "Full/Microsoft.PowerShell.Diagnostics/GetEvent.types.ps1xml",
"monad/miscfiles/display/Event.format.ps1xml": "Full/Microsoft.PowerShell.Diagnostics/Event.format.ps1xml",
"monad/miscfiles/display/Diagnostics.format.ps1xml": "Full/Microsoft.PowerShell.Diagnostics/Diagnostics.format.ps1xml",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1": "Full/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"monad/src/ScheduledJob/PSScheduledJob.Format.ps1xml": "Full/PSScheduledJob/PSScheduledJob.Format.ps1xml",
"monad/src/ScheduledJob/PSScheduledJob.psd1": "Full/PSScheduledJob/PSScheduledJob.psd1",
"monad/src/ScheduledJob/PSScheduledJob.types.ps1xml": "Full/PSScheduledJob/PSScheduledJob.types.ps1xml",
"monad/src/m3p/product/PSWorkflow.psd1": "Full/PSWorkflow/PSWorkflow.psd1",
"monad/src/m3p/product/PSWorkflow.psm1": "Full/PSWorkflow/PSWorkflow.psm1",
"monad/src/m3p/product/PSWorkflow.types.ps1xml": "Full/PSWorkflow/PSWorkflow.types.ps1xml",
"monad/src/m3p/product/PSWorkflowUtility.psd1": "Full/PSWorkflowUtility/PSWorkflowUtility.psd1",
"monad/src/m3p/product/PSWorkflowUtility.psm1": "Full/PSWorkflowUtility/PSWorkflowUtility.psm1",

"monad/miscfiles/modules/Microsoft.PowerShell.Security/CoreClr/Microsoft.PowerShell.Security.psd1": "Core/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/CoreClr/Microsoft.PowerShell.Diagnostics.psd1": "Core/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "Core/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1"
"wmi/WMIv2/Client/CIMCmdlets/CimCmdlets.psd1": "Windows-Core+Full/CimCmdlets/CimCmdlets.psd1",
"monad/miscfiles/modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1": "Windows-Core+Full/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1",
"monad/miscfiles/display/WSMan.format.ps1xml": "Windows-Core+Full/Microsoft.WSMan.Management/WSMan.format.ps1xml",
"monad/src/LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1": "Windows-Core+Full/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1",
"monad/src/LocalAccounts/LocalAccounts.format.ps1xml": "Windows-Core+Full/Microsoft.PowerShell.LocalAccounts/LocalAccounts.format.ps1xml",
"monad/miscfiles/modules/PSDiagnostics/PSDiagnostics.psd1": "Windows-Core+Full/PSDiagnostics/PSDiagnostics.psd1",
"monad/miscfiles/modules/PSDiagnostics/PSDiagnostics.psm1": "Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1",

"monad/miscfiles/modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1": "Windows-Full/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1": "Windows-Full/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1": "Windows-Full/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"monad/miscfiles/types/getevent.types.ps1xml": "Windows-Full/Microsoft.PowerShell.Diagnostics/GetEvent.types.ps1xml",
"monad/miscfiles/display/Event.format.ps1xml": "Windows-Full/Microsoft.PowerShell.Diagnostics/Event.format.ps1xml",
"monad/miscfiles/display/Diagnostics.format.ps1xml": "Windows-Full/Microsoft.PowerShell.Diagnostics/Diagnostics.format.ps1xml",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1": "Windows-Full/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"monad/src/ScheduledJob/PSScheduledJob.Format.ps1xml": "Windows-Full/PSScheduledJob/PSScheduledJob.Format.ps1xml",
"monad/src/ScheduledJob/PSScheduledJob.psd1": "Windows-Full/PSScheduledJob/PSScheduledJob.psd1",
"monad/src/ScheduledJob/PSScheduledJob.types.ps1xml": "Windows-Full/PSScheduledJob/PSScheduledJob.types.ps1xml",
"monad/src/m3p/product/PSWorkflow.psd1": "Windows-Full/PSWorkflow/PSWorkflow.psd1",
"monad/src/m3p/product/PSWorkflow.psm1": "Windows-Full/PSWorkflow/PSWorkflow.psm1",
"monad/src/m3p/product/PSWorkflow.types.ps1xml": "Windows-Full/PSWorkflow/PSWorkflow.types.ps1xml",
"monad/src/m3p/product/PSWorkflowUtility.psd1": "Windows-Full/PSWorkflowUtility/PSWorkflowUtility.psd1",
"monad/src/m3p/product/PSWorkflowUtility.psm1": "Windows-Full/PSWorkflowUtility/PSWorkflowUtility.psm1",

"monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/CoreClr/Microsoft.PowerShell.Diagnostics.psd1": "Windows-Core/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",

"monad/miscfiles/modules/Microsoft.PowerShell.Security/CoreClr/Microsoft.PowerShell.Security.psd1": "Windows+Unix-Core/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "Windows+Unix-Core/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1"
}
9 changes: 8 additions & 1 deletion src/TypeCatalogParser/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public class Program
{
public static void Main(string[] args)
{
if (args.Length != 1)
{
throw new ArgumentException(
"Usage: ./TypeCatalogParser <path-to-top-level-powershell-project>\n" +
"Valid options are '../powershell-unix' and '../powershell-windows'");
}

// These are packages that are not part of .NET Core and must be excluded
string[] excludedPackages = {
"Microsoft.Management.Infrastructure",
Expand All @@ -25,7 +32,7 @@ public static void Main(string[] args)
var outputPath = "../TypeCatalogGen/powershell.inc";

// Get a context for our top level project
var context = ProjectContext.Create("../powershell", NuGetFramework.Parse("netcoreapp1.0"));
var context = ProjectContext.Create(args[0], NuGetFramework.Parse("netcoreapp1.0"));

System.IO.File.WriteAllLines(outputPath,
// Get the target for the current runtime
Expand Down
2 changes: 1 addition & 1 deletion src/libpsl-native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(PSL-NATIVE)

# Can't use add_compile_options with 2.8.11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/../powershell")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/../powershell-unix")

# test in BUILD_DIR
enable_testing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"mappings": {
"Modules/" : {
"include": [
"../Modules/Core",
"../Modules/Windows+Unix-Core",
"../Modules/Shared"
],
"exclude": [
Expand All @@ -25,14 +25,17 @@
"*.dylib",
"../../powershell.version"
]
}
},
"compile": [
"../powershell/Program.cs"
]
},

"publishOptions": {
"mappings": {
"Modules/" : {
"include": [
"../Modules/Core",
"../Modules/Windows+Unix-Core",
"../Modules/Shared"
],
"exclude": [
Expand All @@ -48,7 +51,11 @@
},

"dependencies": {
"Microsoft.PowerShell.ConsoleHost": "1.0.0-*"
"Microsoft.PowerShell.ConsoleHost": "1.0.0-*",
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"Microsoft.PowerShell.Commands.Management": "1.0.0-*",
"Microsoft.PowerShell.Commands.Utility": "1.0.0-*",
"Microsoft.PowerShell.PackageManagement": "1.0.0-*"
},

"frameworks": {
Expand All @@ -67,9 +74,6 @@
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"win7-x64": { },
"win81-x64": { },
"win10-x64": { },
"osx.10.11-x64": { }
}
}
Loading