Skip to content

Commit 1b8ef91

Browse files
authored
Introduce AzDev module (#26953)
* Introduce AzDev module * Delete tools/AzDev/LICENSE * license and companyname * Connect-DevCommonRepo * clean up gitignore * Address comments
1 parent 7d1b5c3 commit 1b8ef91

Some content is hidden

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

56 files changed

+2956
-116
lines changed

tools/AzDev/AzDev/AzDev.format.ps1xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Configuration>
3+
<ViewDefinitions>
4+
<View>
5+
<Name>PSProject</Name>
6+
<ViewSelectedBy>
7+
<TypeName>AzDev.Models.PSModels.PSProject</TypeName>
8+
</ViewSelectedBy>
9+
<TableControl>
10+
<TableRowEntries>
11+
<TableRowEntry>
12+
<TableColumnItems>
13+
<TableColumnItem>
14+
<PropertyName>Name</PropertyName>
15+
</TableColumnItem>
16+
<TableColumnItem>
17+
<PropertyName>Type</PropertyName>
18+
</TableColumnItem>
19+
<TableColumnItem>
20+
<PropertyName>Path</PropertyName>
21+
</TableColumnItem>
22+
</TableColumnItems>
23+
</TableRowEntry>
24+
</TableRowEntries>
25+
</TableControl>
26+
</View>
27+
<View>
28+
<Name>PSModule</Name>
29+
<ViewSelectedBy>
30+
<TypeName>AzDev.Models.PSModels.PSModule</TypeName>
31+
</ViewSelectedBy>
32+
<TableControl>
33+
<TableRowEntries>
34+
<TableRowEntry>
35+
<TableColumnItems>
36+
<TableColumnItem>
37+
<PropertyName>Name</PropertyName>
38+
</TableColumnItem>
39+
<TableColumnItem>
40+
<PropertyName>Type</PropertyName>
41+
</TableColumnItem>
42+
<TableColumnItem>
43+
<PropertyName>Path</PropertyName>
44+
</TableColumnItem>
45+
</TableColumnItems>
46+
</TableRowEntry>
47+
</TableRowEntries>
48+
</TableControl>
49+
</View>
50+
</ViewDefinitions>
51+
</Configuration>

tools/AzDev/AzDev/AzDev.psd1

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#
2+
# Module manifest for module 'AzDev'
3+
#
4+
# Generated by: Yeming Liu
5+
#
6+
# Generated on: 7/5/2024
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'AzDev.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '0.0.1'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = 'e989d571-a6ed-4912-bf5c-7b0c55261607'
22+
23+
# Author of this module
24+
Author = 'Microsoft Corporation'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Microsoft Corporation'
28+
29+
# Copyright statement for this module
30+
Copyright = 'Microsoft Corporation. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
# Description = ''
34+
35+
# Minimum version of the PowerShell engine required by this module
36+
# PowerShellVersion = ''
37+
38+
# Name of the PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# ClrVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
# RequiredModules = @()
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
FormatsToProcess = @('AzDev.format.ps1xml')
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
NestedModules = @('bin/AzDev.dll',
70+
'CommonRepo.psm1')
71+
72+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
73+
FunctionsToExport = 'Connect-DevCommonRepo', 'Disconnect-DevCommonRepo'
74+
75+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
76+
CmdletsToExport = 'Get-DevContext', 'Set-DevContext',
77+
'Get-DevModule', 'Get-DevProject',
78+
'Open-DevSwagger'
79+
80+
# Variables to export from this module
81+
VariablesToExport = '*'
82+
83+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
84+
AliasesToExport = '*'
85+
86+
# DSC resources to export from this module
87+
# DscResourcesToExport = @()
88+
89+
# List of all modules packaged with this module
90+
# ModuleList = @()
91+
92+
# List of all files packaged with this module
93+
# FileList = @()
94+
95+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
96+
PrivateData = @{
97+
98+
PSData = @{
99+
100+
# Tags applied to this module. These help with module discovery in online galleries.
101+
# Tags = @()
102+
103+
# A URL to the license for this module.
104+
# LicenseUri = ''
105+
106+
# A URL to the main website for this project.
107+
# ProjectUri = ''
108+
109+
# A URL to an icon representing this module.
110+
# IconUri = ''
111+
112+
# ReleaseNotes of this module
113+
# ReleaseNotes = ''
114+
115+
# Prerelease string of this module
116+
# Prerelease = ''
117+
118+
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
119+
# RequireLicenseAcceptance = $false
120+
121+
# External dependent modules of this module
122+
# ExternalModuleDependencies = @()
123+
124+
} # End of PSData hashtable
125+
126+
} # End of PrivateData hashtable
127+
128+
# HelpInfo URI of this module
129+
# HelpInfoURI = ''
130+
131+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
132+
# DefaultCommandPrefix = ''
133+
134+
}
135+

tools/AzDev/AzDev/AzDev.psm1

Whitespace-only changes.

tools/AzDev/AzDev/CommonRepo.psm1

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# ----------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
13+
# is regenerated.
14+
# ----------------------------------------------------------------------------------
15+
16+
<#
17+
.Synopsis
18+
Connects azure-powershell repo to azure-powershell-common repo for debugging.
19+
20+
.Description
21+
Connects azure-powershell repo to azure-powershell-common repo for debugging.
22+
23+
.Parameter CommonRepoPath
24+
Path to the common repo. Relative or absolute.
25+
26+
.Example
27+
Connect-CommonRepo -CommonRepoPath ../azure-powershell-common
28+
#>
29+
function Connect-DevCommonRepo {
30+
[CmdletBinding()]
31+
param()
32+
33+
$context = Get-DevContext
34+
35+
Write-Host "1/2 Adding common projects to sln and csproj"
36+
37+
$CommonRepoPath = $context.AzurePowerShellCommonRepositoryRoot
38+
$CommonProjects = Get-ChildItem -Path "$CommonRepoPath/src/" -Include *.csproj -Exclude *.test.* -Recurse
39+
$CommonProjects = $CommonProjects.FullName
40+
41+
42+
$RepoRoot = $Context.AzurePowerShellRepositoryRoot
43+
44+
Push-Location "$RepoRoot/src/Accounts"
45+
try {
46+
foreach ($csproj in $CommonProjects) {
47+
$csproj = [System.IO.Path]::GetFullPath($csproj)
48+
dotnet sln add $csproj
49+
if ($LASTEXITCODE -ne 0) {
50+
throw "Failed to add $csproj to Accounts.sln"
51+
}
52+
<#
53+
known common project references:
54+
Authentication.csproj -> Authentication.Abstractions, ResourceManager
55+
Accounts.csproj -> Authentication.Abstractions, ResourceManager, Common
56+
Accounts.Test.csproj -> Authentication.Abstractions, ResourceManager, Common
57+
TestFx.csproj -> Graph.Rbac.csproj
58+
AssemblyLoading.csproj -> Common
59+
#>
60+
# add all common projects to Authentication.csproj because it will be referenced by most Az projects
61+
dotnet add ./Authentication/Authentication.csproj reference $csproj
62+
if ($LASTEXITCODE -ne 0) {
63+
throw "Failed to add $csproj to Authentication.csproj"
64+
}
65+
}
66+
67+
# AssemblyLoading.csproj references Common.csproj and does not reference Authentication.csproj
68+
dotnet add ./AssemblyLoading/AssemblyLoading.csproj reference "$CommonRepoPath/src/Common/Common.csproj"
69+
if ($LASTEXITCODE -ne 0) {
70+
throw "Failed to add Common.csproj to AssemblyLoading.csproj"
71+
}
72+
73+
# add common project references below for csproj which does not reference Authentication.csproj
74+
}
75+
finally {
76+
Pop-Location
77+
}
78+
79+
80+
Write-Host "2/2: Remove the dependency of those common projects from .targets file"
81+
82+
$Patterns = @(
83+
'<PackageReference Include="Microsoft.Azure.PowerShell'
84+
)
85+
$TargetsFile = (Resolve-Path "$RepoRoot/tools/Common.Netcore.Dependencies.targets").Path
86+
(Get-Content $TargetsFile) | ForEach-Object { # https://stackoverflow.com/questions/10480673/find-and-replace-in-files-fails
87+
[string]$line = $_
88+
$IsMatch = $false
89+
foreach ($pattern in $patterns) {
90+
if ($line.IndexOf($pattern) -ne -1) {
91+
$IsMatch = $true
92+
break
93+
}
94+
}
95+
if ($IsMatch -and -not $line.StartsWith('<!--')) {
96+
return "<!--$line-->"
97+
}
98+
else {
99+
return $line
100+
}
101+
} | Set-Content $TargetsFile
102+
103+
Write-Host "Done connecting both repositories."
104+
}
105+
106+
function Disconnect-DevCommonRepo {
107+
Write-Host "Please run the following commands to undo Connect-CommonRepo. Double check those files do not have wanted changes.
108+
git checkout -- ./src/Accounts/Accounts.sln
109+
git checkout -- ./src/Accounts/AssemblyLoading/AssemblyLoading.csproj
110+
git checkout -- ./src/Accounts/Authentication/Authentication.csproj
111+
git checkout -- ./tools/Common.Netcore.Dependencies.targets
112+
"
113+
}
114+
115+
Export-ModuleMember -Function Connect-DevCommonRepo, Disconnect-DevCommonRepo

tools/AzDev/CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Next
2+
- Feature: further distinguish track 1/2 SDKs, data/management plane, package/project.
3+
- Local static analysis (Invoke-AzStaticAnalyzer)
4+
- New-TestEnvironment and other existing tools
5+
- Scripts to help deploy compliant resources
6+
- Look into tools/, what else can be ported here?
7+
- Install daily build
8+
- Check what CLI's az dev support?
9+
- Wildcard of project and module names - need to implement by hand? Can leverage `DirectoryInfo.GetFiles`? It supports kind of wildcard.
10+
- Quick start templates
11+
- Versioning and publishing AzDev module
12+
13+
## 2025/1/2
14+
- Misc: moved to azure-powershell repo
15+
- Feature: Connect common repo and ps repo
16+
17+
## 2024/12/30
18+
- Fix: path issue on Windows
19+
- Misc: Better error message when no context
20+
21+
## 2024/12/27
22+
- Feature: Distinguish SDK-based projects, wrapper projects and other projects.
23+
- Feature: Distinguish modules types: SdkBased, autorestBased, Hybrid.
24+
25+
## 2024/12/25
26+
- Fix: Inventory cmdlets ignore live tests
27+
28+
## 2024/10/15
29+
- Feature: Add reason for deducing project type
30+
31+
## 2024/9/11
32+
- Feature: Open swagger link
33+
- Rename SDK-based project type to "Other" because there's no accurate way to distinguish between SDK and wrapper projects
34+
35+
## Older
36+
- Fix: Two misidentified projects because of live tests: ContainerRegistry and Resources
37+
- Feature: Get-DevProject: Add support for `-Type` parameter
38+
- Feature: Add new ProjectType: Test, LegacyHelper, Track1Sdk
39+
- Renamed "Submodule" to "Project"
40+
- Feature: Added "Get-DevProject" cmdlet

0 commit comments

Comments
 (0)