@@ -74,41 +74,53 @@ if (-not (Test-Path $slnPath)) {
74
74
if (-not (Test-Path $parentModulePath )) {
75
75
Write-Host " New module detected, creating parent module $parentModulePath ..." - ForegroundColor DarkGreen
76
76
New-Item - ItemType Directory - Force - Path $parentModulePath
77
- <#
78
- create csproj for parent module if not existed
79
- #>
80
- $parentModuleCsprojPath = Join-Path $parentModulePath " $parentModuleName .csproj"
77
+ }
78
+
79
+ <#
80
+ create csproj for parent module if not existed
81
+ #>
82
+ $parentModuleCsprojPath = Join-Path $parentModulePath " $parentModuleName .csproj"
83
+ if (-not (Test-Path $parentModuleCsprojPath )) {
81
84
Write-Host " Creating $parentModuleCsprojPath ..." - ForegroundColor DarkGreen
82
85
New-GeneratedFileFromTemplate - TemplateName ' HandcraftedModule.csproj' - GeneratedFileName " $parentModuleName .csproj" - GeneratedDirectory $parentModulePath - ModuleRootName $ModuleRootName - SubModuleName $parentModuleName
83
86
dotnet sln $slnPath add $parentModuleCsprojPath
84
- <#
85
- create AsemblyInfo.cs for parent module if not existed
86
- #>
87
- $propertiesPath = Join-Path $parentModulePath ' Properties'
87
+ }
88
+
89
+ <#
90
+ create AsemblyInfo.cs for parent module if not existed
91
+ #>
92
+ $propertiesPath = Join-Path $parentModulePath ' Properties'
93
+ if (-not (Test-Path $propertiesPath )) {
88
94
New-Item - ItemType Directory - Force - Path $propertiesPath
89
- Write-Host " Creating $propertiesPath /AssemblyInfo.cs ..." - ForegroundColor DarkGreen
90
- New-GeneratedFileFromTemplate - TemplateName ' AssemblyInfo.cs' - GeneratedFileName " AssemblyInfo.cs" - GeneratedDirectory $propertiesPath - ModuleRootName $ModuleRootName - SubModuleName $parentModuleName
91
- <#
92
- create psd1 for parent module if not existed
93
- #>
95
+ if (-not (Test-Path (Join-Path $propertiesPath ' AssemblyInfo.cs' ))) {
96
+ Write-Host " Creating $propertiesPath /AssemblyInfo.cs ..." - ForegroundColor DarkGreen
97
+ New-GeneratedFileFromTemplate - TemplateName ' AssemblyInfo.cs' - GeneratedFileName " AssemblyInfo.cs" - GeneratedDirectory $propertiesPath - ModuleRootName $ModuleRootName - SubModuleName $parentModuleName
98
+ }
99
+ }
100
+
101
+ <#
102
+ create psd1 for parent module if not existed
103
+ #>
104
+ if (-not (Test-Path (Join-Path $parentModulePath " Az.$ModuleRootName .psd1" ))) {
94
105
Write-Host " Creating $parentModulePath /Az.$ModuleRootName .psd1 ..." - ForegroundColor DarkGreen
95
106
New-GeneratedFileFromTemplate - TemplateName ' Module.psd1' - GeneratedFileName " Az.$ModuleRootName .psd1" - GeneratedDirectory $parentModulePath - ModuleRootName $ModuleRootName - SubModuleName $parentModuleName
96
- <#
97
- create ChangeLog.md for parent module if not existed
98
- #>
107
+ }
108
+
109
+ <#
110
+ create ChangeLog.md for parent module if not existed
111
+ #>
112
+ if (-not (Test-Path (Join-Path $parentModulePath " ChangeLog.md" ))) {
99
113
Write-Host " Creating $parentModulePath /ChangeLog.md ..." - ForegroundColor DarkGreen
100
114
New-GeneratedFileFromTemplate - TemplateName ' ChangeLog.md' - GeneratedFileName " ChangeLog.md" - GeneratedDirectory $parentModulePath - ModuleRootName $ModuleRootName - SubModuleName $parentModuleName
101
115
}
116
+
102
117
<#
103
118
merge sub module to parent module psd1
104
119
#>
105
- $parentModulePsd1Path = Join-Path $ParentModulePath " Az.$ModuleRootName .psd1"
120
+ $parentModulePsd1Path = Join-Path $parentModulePath " Az.$ModuleRootName .psd1"
106
121
Write-Host " Merging metadata of $SubModulePath /Az.$subModuleNameTrimmed .psd1 to $parentModulePsd1Path ..." - ForegroundColor DarkGreen
107
- if (Test-Path $parentModulePsd1Path ) {
108
- $parentModuleMetadata = Import-LocalizedData - BaseDirectory $ParentModulePath - FileName " Az.$ModuleRootName .psd1"
109
- } else {
110
- $parentModuleMetadata = Import-LocalizedData - BaseDirectory $TemplatePath - FileName ' Module.psd1'
111
- }
122
+ $parentModuleMetadata = Import-LocalizedData - BaseDirectory $ParentModulePath - FileName " Az.$ModuleRootName .psd1"
123
+
112
124
$parentModuleMetadata.RequiredAssemblies = (@ ($parentModuleMetadata.RequiredAssemblies ) + " $SubModuleName /bin/Az.$subModuleNameTrimmed .private.dll" ) | Select-Object - Unique
113
125
$parentModuleMetadata.FormatsToProcess = (@ ($parentModuleMetadata.FormatsToProcess ) + " $SubModuleName /Az.$subModuleNameTrimmed .format.ps1xml" ) | Select-Object - Unique
114
126
$parentModuleMetadata.NestedModules = (@ ($parentModuleMetadata.NestedModules ) + " $SubModuleName /Az.$subModuleNameTrimmed .psm1" ) | Select-Object - Unique
0 commit comments