AppxManifest is autogenerated as obj file (#103)

This commit is contained in:
Jake Friedman 2021-03-29 15:26:40 -07:00 коммит произвёл GitHub
Родитель 4840844ac2
Коммит 8303503357
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 86 добавлений и 77 удалений

Просмотреть файл

@ -25,7 +25,7 @@ if ([string]::IsNullOrEmpty($versionSuffix))
}
else
{
$productVersion = "$assemblyVersion-$env:VersionSuffix"
$productVersion = "$assemblyVersion-$env:VersionSuffix"
}
Write-Host "ProductVersion/AssemblyInformationalVersion is $productVersion"
@ -36,7 +36,7 @@ if (Test-Path -Path "$SrcPath/Properties/AssemblyInfo.cs")
$file = Get-Item -Path "$SrcPath/Properties/AssemblyInfo.cs"
[string]$randString = Get-Random
$tempFile = [System.IO.Path]::GetTempPath() + "/" + $file.Name + $randString + ".tmp"
$tempFile = [System.IO.Path]::GetTempPath() + $file.Name + $randString + ".tmp"
Write-Host "Using temp file $tempFile"
Write-Host "Creating assembly info file for:" $file.FullName " version:" $assemblyVersion
@ -105,6 +105,7 @@ ForEach ($psd in $psds)
$destDir = $psd.DirectoryName + "/obj/"
$null = New-Item -Path $destDir -ItemType Directory -Force
$destFile = $destDir + $psd.Name
$needsUpdate = @($true, $true)
if (Test-Path $destFile -PathType Leaf)
{
@ -114,7 +115,8 @@ ForEach ($psd in $psds)
{
if ($versionStr -match $assemblyVersion)
{
Write-Host "$psd ModuleVersion is up-to-date"
Write-Host "$destFile ModuleVersion is up-to-date"
$needsUpdate[0] = $false
}
}
$preStr = $currentFileContent | Where-Object {$_ -like "*Prerelease =*"}
@ -122,45 +124,98 @@ ForEach ($psd in $psds)
{
if ((-not [string]::IsNullOrEmpty($versionSuffix)) -and ($preStr -match $versionSuffix))
{
Write-Host "$psd Prerelease version is up-to-date"
continue
Write-Host "$destFile Prerelease version is up-to-date"
$needsUpdate[1] = $false
}
}
}
[string]$randString = Get-Random
$tempFile = [System.IO.Path]::GetTempPath() + "/" + $file.Name + $randString + ".tmp"
if ($needsUpdate.Where({ $_ -eq $true }, 'First').Count -gt 0)
{
[string]$randString = Get-Random
$tempFile = [System.IO.Path]::GetTempPath() + $psd.Name + $randString + ".tmp"
$psdContents = Get-Content $psd.FullName |
ForEach-Object{$_ -replace 'ModuleVersion.+', "ModuleVersion = '$assemblyVersion'"} |
ForEach-Object{$_ -replace 'Prerelease =.+', "Prerelease = '$versionSuffix'"} |
Set-Content $tempFile
$null = Get-Content $psd.FullName |
ForEach-Object{$_ -replace 'ModuleVersion.+', "ModuleVersion = '$assemblyVersion'"} |
ForEach-Object{$_ -replace 'Prerelease =.+', "Prerelease = '$versionSuffix'"} |
Set-Content $tempFile
Write-Host "Moving $tempFile to $destFile"
Move-Item $tempFile $destFile -force
Write-Host "Moving $tempFile to $destFile"
Move-Item $tempFile $destFile -force
}
}
$appxs = Get-ChildItem -Path $SrcPath -Filter "*.appxmanifest"
ForEach ($appx in $appxs)
{
$currentFileContent = Get-Content $appx
$versionStr = $currentFileContent | Where-Object {$_ -like "*Identity Version=*"}
if ($null -ne $versionStr)
$destDir = $appx.DirectoryName + "/obj/"
$null = New-Item -Path $destDir -ItemType Directory -Force
$destFile = $destDir + $appx.Name
$needsUpdate = @($true, $true, $true)
if ($null -eq $env:AGENT_MACHINENAME)
{
if ($versionStr -match $assemblyVersion)
$appName = "Factory Orchestrator (DEV)"
$identityName = "Microsoft.FactoryOrchestratorApp.DEV"
}
else
{
$appName = "Factory Orchestrator"
$identityName = "Microsoft.FactoryOrchestratorApp"
}
if (-not [string]::IsNullOrEmpty($versionSuffix))
{
$appName += " Prerelease-$versionSuffix"
$identityName += ".Prerelease-$versionSuffix"
}
if (Test-Path $destFile -PathType Leaf)
{
$currentFileContent = Get-Content $destFile
$versionStr = $currentFileContent | Where-Object {$_ -like "*Identity Version=*"}
if ($null -ne $versionStr)
{
continue
if ($versionStr -match $assemblyVersion)
{
Write-Host "$destFile Identity Version is up-to-date"
$needsUpdate[0] = $false
}
}
$indentStr = $currentFileContent | Where-Object {$_ -match "<Identity.+ Name="}
if ($null -ne $indentStr)
{
if ($indentStr -match "`"$identityName`"")
{
Write-Host "$destFile Identity Name is up-to-date"
$needsUpdate[1] = $false
}
}
$appStr = $currentFileContent | Where-Object {$_ -like "*<uap:VisualElements DisplayName=*"}
if ($null -ne $appStr)
{
if ($appStr -match "`"$appName`"")
{
Write-Host "$destFile Display Name is up-to-date"
$needsUpdate[2] = $false
}
}
}
[string]$randString = Get-Random
$tempFile = [System.IO.Path]::GetTempPath() + "/" + $file.Name + $randString + ".tmp"
if ($needsUpdate.Where({ $_ -eq $true }, 'First').Count -gt 0)
{
[string]$randString = Get-Random
$tempFile = [System.IO.Path]::GetTempPath() + $appx.Name + $randString + ".tmp"
$appxContents = $currentFileContent |
ForEach-Object{$_ -replace 'Identity Version="[0-9,.]+?"', "Identity Version=`"$assemblyVersion.0`"" } |
Set-Content -Path $tempFile
$null = Get-Content $appx.FullName |
ForEach-Object{$_ -replace 'Identity Version="\$Version\$"', "Identity Version=`"$assemblyVersion.0`"" } |
ForEach-Object{$_ -replace '\$AppName\$', $appName } |
ForEach-Object{$_ -replace '\$IdentityName\$', $identityName } |
Set-Content $tempFile
Write-Host "Moving $tempFile to $appx"
Move-Item $tempFile $appx -force
}
Write-Host "Moving $tempFile to $destFile"
Move-Item $tempFile $destFile -force
}
}

Просмотреть файл

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap mp rescap">
<Identity Version="9.1.0.0" Name="Microsoft.FactoryOrchestratorApp.DEV" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<mp:PhoneIdentity PhoneProductId="598c7e0f-acaf-4866-90a5-de8ad458aa53" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Factory Orchestrator (DEV)</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Microsoft.FactoryOrchestrator.App.App">
<uap:VisualElements DisplayName="Factory Orchestrator (DEV)" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Factory Orchestrator UWP (DEV)" BackgroundColor="#000000">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#000000" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol" >
<uap:Protocol Name="fo" DesiredView="default">
<uap:DisplayName>fo</uap:DisplayName>
</uap:Protocol>
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<Capability Name="internetClientServer" />
<Capability Name="privateNetworkClientServer" />
<rescap:Capability Name="packageQuery"/>
<rescap:Capability Name="extendedExecutionUnconstrained"/>
<rescap:Capability Name="broadFileSystemAccess"/>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>

Просмотреть файл

@ -147,13 +147,8 @@
<DependentUpon>WdpPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(AGENT_ID)' != ''">
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup Condition="'$(AGENT_ID)' == ''">
<AppxManifest Include="DevPackage.appxmanifest">
<ItemGroup>
<AppxManifest Include="obj\Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>

Просмотреть файл

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap mp rescap">
<Identity Version="9.1.0.0" Name="Microsoft.FactoryOrchestratorApp" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<Identity Version="$Version$" Name="$IdentityName$" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
<mp:PhoneIdentity PhoneProductId="598c7e0f-acaf-4866-90a5-de8ad458aa53" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Factory Orchestrator</DisplayName>
<DisplayName>$AppName$</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
@ -15,7 +15,7 @@
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Microsoft.FactoryOrchestrator.App.App">
<uap:VisualElements DisplayName="Factory Orchestrator" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Factory Orchestrator UWP" BackgroundColor="#000000">
<uap:VisualElements DisplayName="$AppName$" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="$AppName$ UWP" BackgroundColor="#000000">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#000000" />