@@ -11,7 +11,7 @@ $resourceScript = Join-Path $BuildRoot "New-StronglyTypedCsFileForResx.ps1"
11
11
function Get-BuildInputs ($project ) {
12
12
pushd $buildRoot / $project
13
13
gci - Filter * .cs
14
- gci - Directory - Exclude obj, bin | gci - Filter * .cs - Recurse
14
+ gci - Directory - Exclude obj, bin | gci - Filter * .cs - Recurse
15
15
popd
16
16
}
17
17
@@ -28,7 +28,7 @@ function Get-BuildOutputs($project) {
28
28
29
29
function Get-BuildTaskParams ($project ) {
30
30
$taskParams = @ {
31
- Jobs = {dotnet build -- framework $Framework -- configuration $Configuration }
31
+ Jobs = {dotnet build -- framework $Framework -- configuration $Configuration }
32
32
}
33
33
34
34
$outputs = (Get-BuildOutputs $project )
@@ -43,9 +43,9 @@ function Get-BuildTaskParams($project) {
43
43
44
44
function Get-RestoreTaskParams ($project ) {
45
45
@ {
46
- Inputs = " $BuildRoot /$project /project.json"
46
+ Inputs = " $BuildRoot /$project /project.json"
47
47
Outputs = " $BuildRoot /$project /project.lock.json"
48
- Jobs = {dotnet restore}
48
+ Jobs = {dotnet restore}
49
49
}
50
50
}
51
51
@@ -73,15 +73,15 @@ function Get-TestTaskParam($project) {
73
73
74
74
function Get-ResourceTaskParam ($project ) {
75
75
@ {
76
- Inputs = " $project /Strings.resx"
76
+ Inputs = " $project /Strings.resx"
77
77
Outputs = " $project /Strings.cs"
78
- Jobs = {& " $resourceScript $project " }
79
- Before = " $project /build"
78
+ Jobs = {& " $resourceScript $project " }
79
+ Before = " $project /build"
80
80
}
81
81
}
82
82
83
83
function Add-ProjectTask ([string ]$project , [string ]$taskName , [hashtable ]$taskParams , [string ]$pathPrefix = $buildRoot ) {
84
- $jobs = [scriptblock ]::Create(@"
84
+ $jobs = [scriptblock ]::Create(@"
85
85
pushd $pathPrefix /$project
86
86
$ ( $taskParams.Jobs )
87
87
popd
@@ -108,6 +108,45 @@ task clean "engine/clean", "rules/clean"
108
108
$projects | % {Add-ProjectTask $_ test (Get-TestTaskParam $_ ) " $BuildRoot /tests" }
109
109
task test " engine/test" , " rules/test"
110
110
111
- task createModule {
111
+ task makeModule {
112
+ $solutionDir = $BuildRoot
113
+ $itemsToCopyBinaries = @ (" $solutionDir \Engine\bin\$Configuration \$Framework \Microsoft.Windows.PowerShell.ScriptAnalyzer.dll" ,
114
+ " $solutionDir \Rules\bin\$Configuration \$Framework \Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll" )
115
+
116
+ $itemsToCopyCommon = @ (" $solutionDir \Engine\PSScriptAnalyzer.psd1" ,
117
+ " $solutionDir \Engine\PSScriptAnalyzer.psm1" ,
118
+ " $solutionDir \Engine\ScriptAnalyzer.format.ps1xml" ,
119
+ " $solutionDir \Engine\ScriptAnalyzer.types.ps1xml" )
120
+
121
+ $destinationDir = " $solutionDir \out\PSScriptAnalyzer"
122
+ $destinationDirBinaries = $destinationDir
123
+ if ($Framework -eq " netstandard1.6" ) {
124
+ $destinationDirBinaries = " $destinationDir \coreclr"
125
+ } elseif ($Configuration -match ' PSv3' ) {
126
+ $destinationDirBinaries = " $destinationDir \PSv3"
127
+ }
128
+
129
+ Function CopyToDestinationDir ($itemsToCopy , $destination ) {
130
+ if (-not (Test-Path $destination )) {
131
+ New-Item - ItemType Directory $destination - Force
132
+ }
133
+ foreach ($file in $itemsToCopy ) {
134
+ Copy-Item - Path $file - Destination (Join-Path $destination (Split-Path $file - Leaf)) - Force
135
+ }
136
+ }
137
+
138
+ CopyToDestinationDir $itemsToCopyCommon $destinationDir
139
+ CopyToDestinationDir $itemsToCopyBinaries $destinationDirBinaries
140
+
141
+ # Copy Settings File
142
+ Copy-Item - Path " $solutionDir \Engine\Settings" - Destination $destinationDir - Force - Recurse
143
+
144
+ # copy newtonsoft dll if net451 framework
145
+ if ($Framework -eq " net451" ) {
146
+ copy-item - path " $solutionDir \Rules\bin\$Configuration \$Framework \Newtonsoft.Json.dll" - Destination $destinationDirBinaries
147
+ }
148
+ }
112
149
150
+ task cleanModule {
151
+ Remove-Item - Path out/ - Recurse - Force
113
152
}
0 commit comments