Skip to content

Commit 07f5cc0

Browse files
authored
Fix WinGet releasing process (#144)
This release marks the adoption of .NET Source Generators as a core part of the TfsCmdlets development process. Although it is entirely opaque (and mostly irrelevant) to the end-user, we expect that they will allow us to have shorter and more stable releases in the future. Now, back to the release notes :-) We have new cmdlets, a bunch of improvements and bug fixes, and a few minor _breaking changes_. ## New cmdlets * **Extension Management** * `Enable-TfsExtension` * `Disable-TfsExtension` * `Get-TfsExtension` * `Install-TfsExtension` * `Uninstall-TfsExtension` * **Git** * `Get-TfsGitItem` * **Identities, Users and Groups** * `Get-TfsGroup` * `New-TfsGroup` * `Remove-TfsGroup` * `Get-TfsUser` * **Pipeline** * `Get-TfsBuildDefinition` * `Enable-TfsBuildDefinition` * `Disable-TfsBuildDefinition` * `Suspend-TfsBuildDefinition` * `Resume-TfsBuildDefinition` * **Organization** * `Connect-TfsOrganization` * `Disconnect-TfsOrganization` * `Get-TfsOrganization` * **Team project** * `Import-TfsTeamProjectAvatar` * `Export-TfsTeamProjectAvatar` * `Remove-TfsTeamProjectAvatar` * **Work Items** * `Enable-TfsWorkItemTag` * `Disable-TfsWorkItemTag` * `Undo-TfsWorkItemRemoval` ## Improvements * `Import-TfsWorkItemType` and `Export-TfsWorkItemType` now support importing from / exporting to files (and not only to the console) * Add -NoProfile to Enter-TfsShell ([#145](#145)) * Most Get-* cmdlets now support retrieving multiple items at once by supplying a list of IDs/names/etc. (e.g. `Get-TfsTeamProject Proj1, Proj2`). That, by consequence, fixes issue [#155](#155) * Remove trailing slash from org name in prompt ([#148](#148)) * Filter team project by process template ([#104](#104)) * `Get-TfsWorkItem` now makes batch API calls to improve performance. The gains are expressive - an order of magnitude in many cases. * `Invoke-TfsRestApi` can now save the response to a file, via its `-Destination` argument. Besides, binary content (such as 'application/octet-stream') is returned as a byte array (instead of a string) when outputting the results to the console. * `Set-TfsTeam` has new arguments `-OverwriteAreaPaths` and `-OverwriteIterationPaths` to control its behavior when setting default areas and sprint iterations, respectively. Additionally, both -AreaPaths and -IterationPaths now support wildcards to simplify the addition of multiple items at once. ## Fixes * Fixes a bug in `Set-TfsTeam` where the -IterationPaths argument was ignored, and the sprint iterations were not set. Now sprint iterations are set as expected. * Get-TfsGroupMember does not work with PS Core and Azure DevOps Services ([#149](#149)) * New-TfsWorkItem fails when specifying area and iteration without prefixing team project ([#147](#147)) * Fixes a bug in `Get-TfsWorkItem` where when using the `-Description` an error is thrown. * And many other under-the-hood fixes caught during the development of this release ## BREAKING CHANGES ### Removed cmdlets Some legacy cmdlets (primarily those that rely on the old TFS Client Object Model) have been temporarily removed. They _may_ return in a future release when we determine the best course of action to support legacy cmdlets moving forward. In the meantime, please consider using a previous release if you need them. The removed cmdlets are: * **Administration** cmdlets * `Start-TfsIdentitySync` * **Configuration Server** cmdlets * `Connect-TfsConfigurationServer` * `Disconnect-TfsConfigurationServer` * `Get-TfsConfigurationServer` * `Get-TfsRegisteredConfigurationServer` * **Global List** cmdlets * `Export-TfsGlobalList` * `Get-TfsGlobalList` * `Import-TfsGlobalList` * `New-TfsGlobalList` * `Remove-TfsGlobalList` * `Rename-TfsGlobalList` * `Set-TfsGlobalList` * **Pipeline** cmdlets * `Start-TfsXamlBuild` * **Team Project Collection** cmdlets * `Dismount-TfsTeamProjectCollection` * `Mount-TfsTeamProjectCollection` * `Start-TfsTeamProjectCollection` * `Stop-TfsTeamProjectCollection` * **Work Item** cmdlets * `Copy-TfsWorkItem` ### Get-TfsTeamProject -IncludeDetails Every team project returned by `Get-TfsTeamProject` used to make a second API call to retrieve the details of the team project, such as its process template. That additional roundtrip meant that the command would take longer to complete. However, those details are rarely needed in most scenarios. Therefore, to improve performance for the most common situations, `Get-TfsTeamProject` no longer includes project details by default. When needed - the most common scenario is to get the process template name of a given project - you must include the `-IncludeDetails` switch. ### Get-TfsWorkItem and max work items per call The change in `Get-TfsWorkItem` to use batch calls greatly improved performance, but the downside is that now you're limited to up to 200 work items returned in a single call. That limit is imposed by the backend REST API and can't be circumvented. We're exploring alternatives for those scenarios when one needs to retrieve more than 200 work items (e.g., when doing an export). +semver: minor
1 parent 4fa2342 commit 07f5cc0

File tree

597 files changed

+19187
-13729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

597 files changed

+19187
-13729
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*.cs]
4+
5+
dotnet_diagnostic.IDE0056.severity = none
6+
dotnet_diagnostic.IDE0057.severity = none

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
Build:
1717

1818
runs-on: windows-latest
19+
env:
20+
TFSCMDLETS_ACCESS_TOKEN: ${{ secrets.TFSCMDLETS_TOKEN }}
21+
TFSCMDLETS_COLLECTION_URL: 'https://dev.azure.com/tfscmdlets'
1922
steps:
2023
- name: Checkout code
2124
uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,4 @@ CSharp/.idea/**
217217

218218
# Miscellaneous files
219219

220-
.testtemplate.cs
220+
CSharp/*/Generated/**

.vscode/tasks.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"kind": "build",
1010
"isDefault": true
1111
},
12-
"problemMatcher": "$msCompile",
1312
"presentation": {
1413
"echo": true,
1514
"reveal": "always",
@@ -27,7 +26,11 @@
2726
"-Configuration",
2827
"Debug",
2928
"-Targets",
30-
"Build"
29+
"Build",
30+
"-SkipTests"
31+
],
32+
"problemMatcher": [
33+
"$msCompile"
3134
]
3235
},
3336
{
@@ -48,7 +51,11 @@
4851
"-File",
4952
"${workspaceRoot}/build.ps1",
5053
"-Targets",
51-
"Rebuild"
54+
"Rebuild",
55+
"-SkipTests"
56+
],
57+
"problemMatcher": [
58+
"$msCompile"
5259
]
5360
},
5461
{

Build.ps1

Lines changed: 43 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Param
1515
[switch] $Incremental
1616
)
1717

18-
Function Install-Dependencies
19-
{
18+
Function Install-Dependencies {
2019
$NugetPackages = @('GitVersion.CommandLine')
2120
$PsModules = @('psake', 'PsScriptAnalyzer', 'VSSetup', 'powershell-yaml', 'ps1xmlgen', 'PlatyPS')
2221

@@ -28,90 +27,74 @@ Function Install-Dependencies
2827

2928
Write-Verbose "Restoring NuGet package(s) ($($NugetPackages -join ', '))"
3029

31-
foreach($pkg in $NugetPackages)
32-
{
30+
foreach ($pkg in $NugetPackages) {
3331
Install-NugetPackage $pkg
3432
}
3533

3634
Write-Verbose "Restoring PowerShell module(s) ($($PsModules -join ', '))"
3735

38-
foreach($mod in $PsModules)
39-
{
36+
foreach ($mod in $PsModules) {
4037
Install-PsModule $mod
4138
}
4239
}
4340

44-
Function Install-Nuget
45-
{
41+
Function Install-Nuget {
4642
Write-Verbose "Restoring Nuget client"
4743

4844
$BuildToolsDir = Join-Path $RootProjectDir 'BuildTools'
4945
$script:NugetExePath = Join-Path $BuildToolsDir 'nuget.exe'
5046

51-
if (-not (Test-Path $PackagesDir -PathType Container))
52-
{
47+
if (-not (Test-Path $PackagesDir -PathType Container)) {
5348
mkdir $PackagesDir -Force | Write-Verbose
5449
}
5550

56-
if (-not (Test-Path $BuildToolsDir -PathType Container))
57-
{
51+
if (-not (Test-Path $BuildToolsDir -PathType Container)) {
5852
mkdir $BuildToolsDir -Force | Write-Verbose
5953
}
6054

61-
if (-not (Test-Path $NugetExePath -PathType Leaf))
62-
{
55+
if (-not (Test-Path $NugetExePath -PathType Leaf)) {
6356
Write-Verbose "Nuget.exe not found. Downloading from https://dist.nuget.org"
6457
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NugetExePath | Write-Verbose
6558
}
66-
else
67-
{
59+
else {
6860
Write-Verbose "NuGet client found; Skipping..."
6961
}
7062

7163
Write-Verbose "NugetExePath: $NugetExePath"
7264
}
7365

74-
Function Install-NugetPackage($Package)
75-
{
66+
Function Install-NugetPackage($Package) {
7667
Write-Verbose "Restoring NuGet package $Package"
7768

7869
$modulePath = Join-Path $RootProjectDir "packages/$Package"
7970

80-
if (-not (Test-Path "$modulePath/*" -PathType Leaf))
81-
{
71+
if (-not (Test-Path "$modulePath/*" -PathType Leaf)) {
8272
Write-Verbose "Package not found. Downloading from Nuget.org"
8373
& $NugetExePath Install $Package -ExcludeVersion -OutputDirectory packages *>&1 | Write-Verbose
8474
}
85-
else
86-
{
75+
else {
8776
Write-Verbose "NuGet package $Package found; Skipping..."
8877
}
8978
}
9079

91-
Function Install-PsModule($Module)
92-
{
80+
Function Install-PsModule($Module) {
9381
Write-Verbose "Restoring module $Module"
9482

95-
if (-not (Get-Module $Module -ListAvailable))
96-
{
97-
if (-not (Get-PackageProvider -Name Nuget -ListAvailable -ErrorAction SilentlyContinue))
98-
{
83+
if (-not (Get-Module $Module -ListAvailable)) {
84+
if (-not (Get-PackageProvider -Name Nuget -ListAvailable -ErrorAction SilentlyContinue)) {
9985
Write-Verbose "Installing required Nuget package provider in order to install modules from PowerShell Gallery"
10086
Install-PackageProvider Nuget -Force -Scope CurrentUser | Write-Verbose
10187
}
10288

10389
Install-Module $Module -Scope CurrentUser -Force | Write-Verbose
10490
}
105-
else
106-
{
91+
else {
10792
Write-Verbose "PowerShell module $Module found; Skipping..."
10893
}
10994
}
11095

111-
try
112-
{
113-
if (-not $RootProjectDir)
114-
{
96+
try {
97+
if (-not $RootProjectDir) {
11598
$RootProjectDir = $PSScriptRoot
11699
}
117100

@@ -143,13 +126,11 @@ try
143126

144127
$isCI = $false
145128

146-
if ($env:BUILD_BUILDURI)
147-
{
129+
if ($env:BUILD_BUILDURI) {
148130
Write-Output "##vso[build.updatebuildnumber]$BuildName"
149131
$isCI = $true
150132
}
151-
elseif ($env:GITHUB_ACTIONS)
152-
{
133+
elseif ($env:GITHUB_ACTIONS) {
153134
Write-Output "::set-output name=BUILD_NAME::$BuildName"
154135
$isCI = $true
155136
}
@@ -162,38 +143,39 @@ try
162143
Write-Verbose "=== BEGIN PSAKE ==="
163144
Write-Verbose "Invoking Psake script $psakeScript"
164145

165-
Invoke-Psake -Nologo -BuildFile $psakeScript -TaskList $Targets -Verbose:$IsVerbose `
166-
-Parameters @{
167-
RootProjectDir = $RootProjectDir
168-
Configuration = $Configuration
169-
ModuleName = $ModuleName
170-
ModuleAuthor = $ModuleAuthor
146+
Invoke-Psake -Nologo -BuildFile $psakeScript -TaskList $Targets -Verbose:$IsVerbose -ErrorAction SilentlyContinue `
147+
-Parameters @{
148+
RootProjectDir = $RootProjectDir
149+
Configuration = $Configuration
150+
ModuleName = $ModuleName
151+
ModuleAuthor = $ModuleAuthor
171152
ModuleDescription = $ModuleDescription
172-
BuildName = $BuildName
173-
BuildNumber = $ProjectBuildNumber
174-
VersionMetadata = $VersionMetadata
175-
SkipTests = $SkipTests.IsPresent
176-
Incremental = $Incremental.IsPresent
177-
IsCI = $isCI
153+
BuildName = $BuildName
154+
BuildNumber = $ProjectBuildNumber
155+
VersionMetadata = $VersionMetadata
156+
SkipTests = $SkipTests.IsPresent
157+
Incremental = $Incremental.IsPresent
158+
IsCI = $isCI
178159
}
179160

180161
Write-Verbose "=== END PSAKE ==="
181-
182162
}
183-
finally
184-
{
163+
finally {
185164
Pop-Location
186165
}
187166

188-
if (-not $psake.build_success)
189-
{
190-
$msbuildLog = (Join-Path $RootProjectDir 'out/MSBuild.log')
191-
192-
if (Test-Path $msbuildLog)
167+
if (-not $psake.build_success) {
168+
foreach($logFile in (Get-ChildItem (Join-Path $RootProjectDir 'out/*.log')))
193169
{
194-
Write-Host '========== MSBUILD LOG ===========' -ForegroundColor Red
195-
Get-Content $msbuildLog | Write-Host -ForegroundColor Red
196-
Write-Host '======== END MSBUILD LOG =========' -ForegroundColor Red
170+
Write-Host -ForegroundColor Red @"
171+
172+
========== MSBUILD LOG ===========
173+
174+
$(Get-Content $logFile -Raw)
175+
176+
======== END MSBUILD LOG =========
177+
178+
"@
197179
}
198180

199181
throw "Build failed. See log above for details."
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace TfsCmdlets
2+
{
3+
[AttributeUsage(System.AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
4+
public class CmdletControllerAttribute: ExportAttribute
5+
{
6+
public Type DataType { get; }
7+
8+
public string CustomCmdletName { get; set; }
9+
10+
public string[] CustomVerbs { get; set; }
11+
12+
public string[] CustomNouns { get; set; }
13+
14+
public Type CustomBaseClass { get; set; }
15+
16+
public CmdletControllerAttribute() : base(typeof(IController))
17+
{
18+
}
19+
20+
public CmdletControllerAttribute(Type dataType) : base(typeof(IController))
21+
{
22+
DataType = dataType;
23+
}
24+
}
25+
26+
// [AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
27+
// public sealed class DesktopOnlyAttribute : Attribute
28+
// {
29+
// }
30+
31+
// [AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
32+
// public sealed class RequiresVersionAttribute : Attribute
33+
// {
34+
// public int Version { get; set; }
35+
36+
// public decimal Update { get; set; }
37+
38+
// public RequiresVersionAttribute(int version) => Version = version;
39+
40+
// public RequiresVersionAttribute(int version, int update) : this(version) => Update = update;
41+
// }
42+
}

0 commit comments

Comments
 (0)