Merge pull request #1121 from PowerShell/vors/bits

Fixes for local-account and process
This commit is contained in:
Sergei Vorobev authored and GitHub committed 2016-06-16 09:19:06 -07:00
commit c60c749290
9 files changed
+82 -29

No files matched your search

+2
View File
@@ -12,6 +12,8 @@ dotnet-install.ps1
# VS auto-generated solution files for project.json solutions
*.xproj
*.xproj.user
*.suo
# Ignore executables
*.exe
+29 -24
View File
@@ -670,7 +670,8 @@ function Copy-MappedFiles {
[string[]]$Path = "$PSScriptRoot",
[Parameter(Mandatory=$true)]
[string]$PslMonadRoot,
[switch]$Force
[switch]$Force,
[switch]$WhatIf
)
begin
@@ -683,6 +684,10 @@ function Copy-MappedFiles {
{
Write-Warning "$Message : ignoring (-Force)"
}
elseif ($WhatIf)
{
Write-Warning "$Message : ignoring (-WhatIf)"
}
else
{
throw "$Message : use -Force to ignore"
@@ -745,14 +750,7 @@ function Copy-MappedFiles {
$map.GetEnumerator() | % {
New-Item -ItemType Directory (Split-Path $_.Value) -ErrorAction SilentlyContinue > $null
if ($PSBoundParameters['Verbose'])
{
Copy-Item $_.Key $_.Value -Verbose
}
else
{
Copy-Item $_.Key $_.Value
}
Copy-Item $_.Key $_.Value -Verbose:([bool]$PSBoundParameters['Verbose']) -WhatIf:$WhatIf
}
}
}
@@ -886,21 +884,12 @@ function Start-ResGen
"Microsoft.PowerShell.Security",
"System.Management.Automation") | % {
$module = $_
Get-ChildItem "$PSScriptRoot/src/$module/resources" | % {
Get-ChildItem "$PSScriptRoot/src/$module/resources" -Filter '*.resx' | % {
$className = $_.Name.Replace('.resx', '')
$xml = [xml](Get-Content -raw $_.FullName)
$fileName = $className
$namespace = ''
$lastIndexOfDot = $className.LastIndexOf(".")
if ($lastIndexOfDot -ne -1)
{
$namespace = $className.Substring(0, $lastIndexOfDot)
$className = $className.Substring($lastIndexOfDot + 1)
}
$genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className -NamespaceName $namespace
$genSource = Get-StronglyTypeCsFileForResx -xml $xml -ModuleName $module -ClassName $className
$outPath = "$PSScriptRoot/src/$module/gen/$fileName.cs"
Write-Verbose "ResGen for $outPath"
New-Item -Type Directory -ErrorAction SilentlyContinue (Split-Path $outPath) > $null
@@ -998,7 +987,23 @@ function script:Start-NativeExecution([scriptblock]$sb)
function script:Get-StronglyTypeCsFileForResx
{
param($xml, $ModuleName, $ClassName, $NamespaceName = '')
param($xml, $ModuleName, $ClassName)
# Example
#
# $ClassName = Full.Name.Of.The.ClassFoo
# $shortClassName = ClassFoo
# $namespaceName = Full.Name.Of.The
$shortClassName = $ClassName
$namespaceName = $null
$lastIndexOfDot = $className.LastIndexOf(".")
if ($lastIndexOfDot -ne -1)
{
$namespaceName = $className.Substring(0, $lastIndexOfDot)
$shortClassName = $className.Substring($lastIndexOfDot + 1)
}
$banner = @'
//------------------------------------------------------------------------------
@@ -1048,7 +1053,7 @@ internal class {0} {{
internal static global::System.Resources.ResourceManager ResourceManager {{
get {{
if (object.ReferenceEquals(resourceMan, null)) {{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("{1}.resources.{0}", typeof({0}).GetTypeInfo().Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("{1}.resources.{3}", typeof({0}).GetTypeInfo().Assembly);
resourceMan = temp;
}}
return resourceMan;
@@ -1091,9 +1096,9 @@ internal class {0} {{
}
} | Out-String
$bodyCode = $body -f $ClassName,$ModuleName,$entries
$bodyCode = $body -f $shortClassName,$ModuleName,$entries,$ClassName
if ($NamespaceName -ne '')
if ($NamespaceName)
{
$bodyCode = $namespace -f $NamespaceName, $bodyCode
}
+45
View File
@@ -0,0 +1,45 @@
Internals of build process
=========================================
The purpose of this document is to explain build process **internals** with subtle nuances.
This document is not by any means complete.
The ultimate source of truth is the code in `.\build.psm1` that's getting executed on the corresponding CI system.
This document assumes, that you can successfully build PowerShell from sources for your platform.
Top directory
-----------
We are calling `dotnet` tool build for `$Top` directory
- `src\powershell` for CoreCLR builds (all platforms)
- `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`,
but in reality, there is no build dependency.
Dummy dependencies allows us to build just `$Top` folder, instead of building several folders.
### Dummy dependencies rules
* If assembly is part of FullCLR build,
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)
Modules
----------
There are 3 modules directories with the same purpose: they have **content** files (i.e. `*.psm1`, `*.psd1`)
which would be binplaced by `dotnet`
- `src\Modules` shared between all flavours
- `src\Microsoft.PowerShell.ConsoleHost\Modules` FullCLR (Windows)
- `src\powershell\Modules` CoreCLR (all platforms)
@@ -28,7 +28,7 @@
"dependencies": {
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"Microsoft.PowerShell.Commands.Diagnostics": "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-*"
+3 -1
View File
@@ -15,5 +15,7 @@
"monad/miscfiles/modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1": "Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1",
"monad/miscfiles/modules/AppxProvider/AppxProvider.Resource.psd1": "AppxProvider/AppxProvider.Resource.psd1",
"monad/miscfiles/modules/AppxProvider/AppxProvider.psd1": "AppxProvider/AppxProvider.psd1",
"monad/miscfiles/modules/PSGet/PSGet.Resource.psd1": "PSGet/PSGet.Resource.psd1"
"monad/miscfiles/modules/PSGet/PSGet.Resource.psd1": "PSGet/PSGet.Resource.psd1",
"monad/src/LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1": "Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1",
"monad/src/LocalAccounts/LocalAccounts.format.ps1xml": "Microsoft.PowerShell.LocalAccounts/LocalAccounts.format.ps1xml"
}
+1
View File
@@ -4,6 +4,7 @@ CMakeCache.txt
CMakeFiles/
PowerShell.sln
Win32/
x64/
ZERO_CHECK.vcxproj
ZERO_CHECK.vcxproj.filters
cmake_install.cmake
+1 -3
View File
@@ -1,6 +1,4 @@
{
"monad/miscfiles/modules/Microsoft.PowerShell.Diagnostics/CoreClr/Microsoft.PowerShell.Diagnostics.psd1": "Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1",
"monad/src/LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1": "Modules/Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1",
"monad/src/LocalAccounts/LocalAccounts.format.ps1xml": "Modules/Microsoft.PowerShell.LocalAccounts/LocalAccounts.format.ps1xml"
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/CoreClr/Microsoft.PowerShell.Utility.psd1": "Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1"
}