@@ -44,7 +44,7 @@ function ZipFiles {
4444 $Cleanup = Remove-Item $TempZipFullPath - Recurse
4545}
4646
47-
47+ $VerbosePrefix = " buildmodule "
4848$ScriptPath = Split-Path $ ($MyInvocation.MyCommand ).Path
4949$ModuleName = Split-Path $ScriptPath - Leaf
5050
@@ -111,14 +111,16 @@ $CsOutput = ""
111111# Add C-Sharp
112112
113113$AssemblyRx = [regex ] ' ^using\ .+?;'
114- $NameSpaceStartRx = [regex ] " namespace $ModuleName { "
114+ $NameSpaceStartRx = [regex ] ' namespace (?<namespace>[^\ ]+?) { '
115115$NameSpaceStopRx = [regex ] ' ^}$'
116116
117+
117118$Assemblies = @ ()
118119$CSharpContent = @ ()
119120
120121$c = 0
121122foreach ($f in $ (ls $CsPath )) {
123+ Write-Verbose " $VerbosePrefix adding $ ( $f.Name ) "
122124 foreach ($l in (gc $f.FullName )) {
123125 $AssemblyMatch = $AssemblyRx.Match ($l )
124126 $NameSpaceStartMatch = $NameSpaceStartRx.Match ($l )
@@ -130,6 +132,7 @@ foreach ($f in $(ls $CsPath)) {
130132 }
131133
132134 if ($NameSpaceStartMatch.Success ) {
135+ $NameSpace = $NameSpaceStartMatch.Groups [' namespace' ].Value
133136 $AddContent = $true
134137 continue
135138 }
@@ -140,15 +143,14 @@ foreach ($f in $(ls $CsPath)) {
140143 }
141144
142145 if ($AddContent ) {
146+ Write-Verbose " $VerbosePrefix $l "
143147 $CSharpContent += $l
144148 }
145149 }
146150}
147151
148- # $Assemblies | Select -Unique | sort -Descending
149-
150152$CSharpOutput = $Assemblies | Select - Unique | sort - Descending
151- $CSharpOutput += " namespace $ModuleName {"
153+ $CSharpOutput += " namespace $NameSpace {"
152154$CSharpOutput += $CSharpContent
153155$CSharpOutput += ' }'
154156
@@ -168,6 +170,7 @@ Add-Type -ReferencedAssemblies @(
168170$Output = $CmdletHeader
169171
170172foreach ($l in $ (ls $CmdletPath )) {
173+ if ($l.Name -match " \.Tests\." ) { continue }
171174 $Contents = gc $l.FullName
172175 Write-Verbose $l.FullName
173176 $Output += $FunctionHeader
0 commit comments