Build fixes for new build pipeline (#75)
- Include correct SourceLink package depending on repo URL - Support custom VersionSuffix - Fix output directory for psd1 - Rename psd1 to Microsoft.FactoryOrchestrator.Client.psd1 - Fixed GitHub PR build - Improved docs logging
This commit is contained in:
Родитель
2f295acca5
Коммит
67b15a2318
|
@ -21,6 +21,7 @@ $versionSuffix = $env:VERSIONSUFFIX
|
|||
if ([string]::IsNullOrEmpty($versionSuffix))
|
||||
{
|
||||
$productVersion = $assemblyVersion
|
||||
$versionSuffix = ""
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -113,7 +114,15 @@ ForEach ($psd in $psds)
|
|||
{
|
||||
if ($versionStr -match $assemblyVersion)
|
||||
{
|
||||
Write-Host "$psd version is up-to-date"
|
||||
Write-Host "$psd ModuleVersion is up-to-date"
|
||||
}
|
||||
}
|
||||
$preStr = $currentFileContent | Where-Object {$_ -like "*Prerelease =*"}
|
||||
if ($null -ne $preStr)
|
||||
{
|
||||
if ((-not [string]::IsNullOrEmpty($versionSuffix)) -and ($preStr -match $versionSuffix))
|
||||
{
|
||||
Write-Host "$psd Prerelease version is up-to-date"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +133,7 @@ ForEach ($psd in $psds)
|
|||
|
||||
$psdContents = 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"
|
||||
|
@ -153,4 +163,4 @@ ForEach ($appx in $appxs)
|
|||
|
||||
Write-Host "Moving $tempFile to $appx"
|
||||
Move-Item $tempFile $appx -force
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
|
|||
|
||||
trigger:
|
||||
- main
|
||||
pr:
|
||||
- none
|
||||
|
||||
variables:
|
||||
FORepoRoot: '$(Build.SourcesDirectory)'
|
||||
|
|
|
@ -27,15 +27,11 @@ variables:
|
|||
BuildConfiguration: 'Release'
|
||||
VPACKVERSIONBUILDIDSUFFIX: ''
|
||||
${{ if or(startsWith(variables['Build.SourceBranchName'], 'OSBuild'), eq(variables['Build.SourceBranchName'], 'main')) }}:
|
||||
VERSIONSUFFIX: ''
|
||||
VERSIONSUFFIXVPACK: ''
|
||||
VERSIONSUFFIXDOTNET: ' '
|
||||
TEMPVERSIONSUFFIX: ''
|
||||
SKIPSIGNING: 'false'
|
||||
SKIPPUSH: 'false'
|
||||
${{ if not(or(startsWith(variables['Build.SourceBranchName'], 'OSBuild'), eq(variables['Build.SourceBranchName'], 'main'))) }}:
|
||||
VERSIONSUFFIX: '$(Build.SourceBranchName)'
|
||||
VERSIONSUFFIXVPACK: '-$(Build.SourceBranchName)'
|
||||
VERSIONSUFFIXDOTNET: '--version-suffix $(Build.SourceBranchName)'
|
||||
TEMPVERSIONSUFFIX: '$(Build.SourceBranchName)'
|
||||
SKIPSIGNING: 'true'
|
||||
SKIPPUSH: 'true'
|
||||
|
||||
|
|
|
@ -9,4 +9,44 @@ steps:
|
|||
$vstsCommandString = "vso[task.setvariable variable=VERSIONPREFIX]$fullVersion"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
displayName: 'Get build version from common.props'
|
||||
displayName: 'Set VERSIONPREFIX using common.props'
|
||||
|
||||
- pwsh: |
|
||||
if ($env:CUSTOMVERSIONSUFFIX -ne $null)
|
||||
{
|
||||
Write-Host "CUSTOMVERSIONSUFFIX is $env:CUSTOMVERSIONSUFFIX"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIX]$env:CUSTOMVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXVPACK]-$(CUSTOMVERSIONSUFFIX)"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXDOTNET]--version-suffix $env:CUSTOMVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
}
|
||||
elseif ([string]::IsNullOrEmpty($env:TEMPVERSIONSUFFIX))
|
||||
{
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIX]$env:TEMPVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXVPACK]"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXDOTNET] "
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
}
|
||||
else
|
||||
{
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIX]$env:TEMPVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXVPACK]-$env:TEMPVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
$vstsCommandString = "vso[task.setvariable variable=VERSIONSUFFIXDOTNET]--version-suffix $env:TEMPVERSIONSUFFIX"
|
||||
Write-Host "sending " + $vstsCommandString
|
||||
Write-Host "##$vstsCommandString"
|
||||
}
|
||||
displayName: 'Set VERSIONSUFFIX variables'
|
||||
|
|
|
@ -19,16 +19,16 @@ await Client.RunExecutable(@"%windir%\system32\ping.exe");
|
|||
```
|
||||
|
||||
## Using FactoryOrchestratorClient in PowerShell
|
||||
The FactoryOrchestratorClient PowerShell module is available in FactoryOrchestratorClient.psd1.
|
||||
The FactoryOrchestratorClient PowerShell module is available in Microsoft.FactoryOrchestrator.Client.psd1.
|
||||
|
||||
To use the PowerShell module, import FactoryOrchestratorClient.psd1 and then use the New-FactoryOrchestratorClient cmdlet to create a FactoryOrchestratorClient instance. The PowerShell FactoryOrchestratorClient instance exposes the exact same APIs as the C# FactoryOrchestratorClient class. However, unlike FactoryOrchestratorClient and FactoryOrchestratorUWPClient C# classes, all calls are synchronous.
|
||||
To use the PowerShell module, import Microsoft.FactoryOrchestrator.Client.psd1 and then use the New-FactoryOrchestratorClient cmdlet to create a FactoryOrchestratorClient instance. The PowerShell FactoryOrchestratorClient instance exposes the exact same APIs as the C# FactoryOrchestratorClient class. However, unlike FactoryOrchestratorClient and FactoryOrchestratorUWPClient C# classes, all calls are synchronous.
|
||||
|
||||
Other supported cmdlets are: New-FactoryOrchestratorTask, New-FactoryOrchestratorTaskList, and New-FactoryOrchestratorServerPoller. They return new TaskBase, TaskList, and ServerPoller objects respectively.
|
||||
|
||||
Below is a sample PowerShell script showing how you can use these cmdlets:
|
||||
```powershell
|
||||
# Import client module
|
||||
Import-Module FactoryOrchestratorClient.psd1
|
||||
Import-Module Microsoft.FactoryOrchestrator.Client.psd1
|
||||
|
||||
# Create client instance targeting service at desired IP Address (127.0.0.1 == loopback)
|
||||
$client = New-FactoryOrchestratorClient -IpAddress "127.0.0.1"
|
||||
|
|
|
@ -8,8 +8,11 @@
|
|||
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(BUILD_REPOSITORY_URI.Contains(`dev.azure.com`))' == 'true' Or '$(BUILD_REPOSITORY_URI.Contains(`visualstudio.com`))' == 'true'">
|
||||
<!-- Release builds use an ADO fork of the GitHub code, so use the AzureRepos version of SourceLink. -->
|
||||
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(BUILD_REPOSITORY_URI.Contains(`github.com`))' == 'true' Or '$(GITHUB_ACTIONS)' == 'true'">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -23,10 +23,13 @@
|
|||
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(BUILD_REPOSITORY_URI.Contains(`dev.azure.com`))' == 'true' Or '$(BUILD_REPOSITORY_URI.Contains(`visualstudio.com`))' == 'true'">
|
||||
<!-- Release builds use an ADO fork of the GitHub code, so use the AzureRepos version of SourceLink. -->
|
||||
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(BUILD_REPOSITORY_URI.Contains(`github.com`))' == 'true' Or '$(GITHUB_ACTIONS)' == 'true'">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DisableDynamicCodeGeneration>true</DisableDynamicCodeGeneration>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
#
|
||||
# Module manifest for module 'FactoryOrchestratorClient'
|
||||
#
|
||||
# Generated by: Microsoft Corporation
|
||||
#
|
||||
# Generated on: 11/13/2020
|
||||
# Module manifest for module 'Microsoft.FactoryOrchestrator.Client'
|
||||
#
|
||||
|
||||
@{
|
||||
|
@ -95,7 +91,7 @@ PrivateData = @{
|
|||
PSData = @{
|
||||
|
||||
# Tags applied to this module. These help with module discovery in online galleries.
|
||||
Tags = @("FactoryOrchestrator", "Factory Orchestrator", "FactoryOrchestratorClient", "IPC")
|
||||
Tags = @("FactoryOrchestrator", "Factory Orchestrator", "FactoryOrchestratorClient", "IPC", "PSEdition_Core", "Windows", "Linux", "Automation", "Test", "GitHub", "Network", "Monitoring")
|
||||
|
||||
# A URL to the license for this module.
|
||||
LicenseUri = 'https://github.com/microsoft/FactoryOrchestrator/blob/main/LICENSE'
|
||||
|
@ -110,10 +106,10 @@ PrivateData = @{
|
|||
# ReleaseNotes = ''
|
||||
|
||||
# Prerelease string of this module
|
||||
# Prerelease = ''
|
||||
Prerelease = '$VersionSuffix$'
|
||||
|
||||
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
|
||||
# RequireLicenseAcceptance = $false
|
||||
RequireLicenseAcceptance = $true
|
||||
|
||||
# External dependent modules of this module
|
||||
# ExternalModuleDependencies = @()
|
|
@ -14,7 +14,7 @@
|
|||
<DocumentationFile>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\bin\$(Configuration)\$(Platform)\$(TargetName)\$(TargetName).xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.7"/>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.7" />
|
||||
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
@ -24,7 +24,8 @@
|
|||
<!-- Created by AutoGenerateInterfaceHelper in CoreLibrary -->
|
||||
<Compile Include="obj\FactoryOrchestratorClientSyncAutogenerated.cs" />
|
||||
<!-- Created by SetSourceVersion -->
|
||||
<None Include="obj\FactoryOrchestratorClient.psd1" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" />
|
||||
<None Include="obj\Microsoft.FactoryOrchestrator.Client.psd1" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" />
|
||||
<None Include="license.txt" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -40,4 +41,14 @@
|
|||
<Target Name="BeforeBuildPS_Local" BeforeTargets="Build;CoreCompile" Condition="'$(AGENT_ID)' == '' And '$(Configuration)' == 'Debug'">
|
||||
<Exec Command="Powershell.exe $(ProjectDir)..\..\build\SetSourceVersion.ps1 -SrcPath $(ProjectDir) -MajorMinorOnly" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Move SourceFiles="$(OutputPath)\obj\Microsoft.FactoryOrchestrator.Client.psd1"
|
||||
DestinationFolder="$(OutputPath)\" />
|
||||
<RemoveDir Directories="$(OutputPath)\obj" />
|
||||
</Target>
|
||||
<Target Name="PostBuildPub" AfterTargets="Publish">
|
||||
<Move SourceFiles="$(PublishDir)\obj\Microsoft.FactoryOrchestrator.Client.psd1"
|
||||
DestinationFolder="$(PublishDir)\" />
|
||||
<RemoveDir Directories="$(PublishDir)\obj" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
Microsoft.FactoryOrchestrator
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
|
@ -62,19 +62,35 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="('$(BUILD_REPOSITORY_URI.Contains(`dev.azure.com`))' == 'true' Or '$(BUILD_REPOSITORY_URI.Contains(`visualstudio.com`))' == 'true') And ('$(TargetPlatformIdentifier)' != '')">
|
||||
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git">
|
||||
<Version>1.0.0</Version>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="('$(BUILD_REPOSITORY_URI.Contains(`github.com`))' == 'true' Or '$(GITHUB_ACTIONS)' == 'true') And ('$(TargetPlatformIdentifier)' != '')">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub">
|
||||
<Version>1.0.0</Version>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- .NET Core package references -->
|
||||
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == ''">
|
||||
<!-- Release builds use an ADO fork of the GitHub code, so use the AzureRepos version of SourceLink. -->
|
||||
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="('$(BUILD_REPOSITORY_URI.Contains(`dev.azure.com`))' == 'true' Or '$(BUILD_REPOSITORY_URI.Contains(`visualstudio.com`))' == 'true') And ('$(TargetPlatformIdentifier)' == '')">
|
||||
<!-- Release builds use an ADO fork of the GitHub code, so use the AzureRepos version of SourceLink. -->
|
||||
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="('$(BUILD_REPOSITORY_URI.Contains(`github.com`))' == 'true' Or '$(GITHUB_ACTIONS)' == 'true') And ('$(TargetPlatformIdentifier)' != '')">
|
||||
<!-- Use the GitHub version of SourceLink for all other builds. -->
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче