Add resources mapping capability to New-MappingFile

This commit is contained in:
Sergei Vorobev
2016-03-29 16:56:57 -07:00
parent 562997beb2
commit 0ff62f7fc5
+22 -7
View File
@@ -432,7 +432,9 @@ function Copy-SubmoduleFiles {
function New-MappingFile
{
param(
[string]$mappingFilePath = "$PSScriptRoot/mapping.json"
[string]$mappingFilePath = "$PSScriptRoot/mapping.json",
[switch]$IgnoreCompileFiles,
[switch]$IgnoreResouce
)
function Get-MappingPath([string]$project, [string]$path)
@@ -460,12 +462,25 @@ function New-MappingFile
$projects | % {
$project = Split-Path $_.FullName
$json = cat -Raw -Path $_.FullName | ConvertFrom-Json
$json.compileFiles | % {
if ($_) {
if (-not $_.EndsWith('AssemblyInfo.cs'))
{
$fullPath = Join-Path $project (Get-MappingPath -project $project -path $_)
$mapping[$_.Replace('../', 'src/')] = ($fullPath.Replace("$($pwd.Path)\",'')).Replace('\', '/')
if (-not $IgnoreCompileFiles) {
$json.compileFiles | % {
if ($_) {
if (-not $_.EndsWith('AssemblyInfo.cs'))
{
$fullPath = Join-Path $project (Get-MappingPath -project $project -path $_)
$mapping[$_.Replace('../', 'src/')] = ($fullPath.Replace("$($pwd.Path)\",'')).Replace('\', '/')
}
}
}
}
if ((-not $IgnoreResouce) -and ($json.resource)) {
$json.resource | % {
if ($_) {
ls $_.Replace('../', 'src/') | % {
$fullPath = Join-Path $project (Join-Path 'resouces' $_.Name)
$mapping[$_.FullName.Replace("$($pwd.Path)\", '').Replace('\', '/')] = ($fullPath.Replace("$($pwd.Path)\",'')).Replace('\', '/')
}
}
}
}