-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathBuildtSQLtZip.ps1
More file actions
56 lines (45 loc) · 2.27 KB
/
BuildtSQLtZip.ps1
File metadata and controls
56 lines (45 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$scriptpath = $MyInvocation.MyCommand.Path;
$dir = Split-Path $scriptpath;
.($dir+"\CommonFunctionsAndMethods.ps1");
$OutputPath = $dir + "/output/tSQLt/";
$TempPath = $dir + "/temp/tSQLt/";
$PublicOutputPath = $OutputPath + "public/";
$PublicTempPath = $TempPath + "public/";
$ValidationOutputPath = $OutputPath + "validation/";
$FacadeDacpacPath = $PublicTempPath + "/FacadeDacpacs/";
$tSQLtDacpacPath = $PublicTempPath + "/tSQLtDacpacs/";
$tSQLtFilesZipPath = $dir + "/output/tSQLtBuild/tSQLtFiles.zip";
$PublicOutputFiles = @(
($dir + "/output/tSQLtBuild/ReadMe.txt"),
($dir + "/output/tSQLtBuild/tSQLtSnippets(SQLPrompt).zip")
);
$ValidationOutputFiles = @(
($dir + "/output/tSQLtBuild/Version.txt"),
($dir + "/output/tSQLtBuild/CommitId.txt"),
($dir + "/output/tSQLtBuild/tSQLt.tests.zip"),
($dir + "/output/tSQLtBuild/tSQLtFacade.zip"),
($dir + "/output/tSQLtBuild/CreateBuildLog.sql"),
($dir + "/output/tSQLtBuild/GetFriendlySQLServerVersion.sql")
);
<# Clean #>
Remove-DirectoryQuietly -Path $TempPath;
Remove-DirectoryQuietly -Path $OutputPath;
<# Init directories, capturing the return values in a variable so that they don't print. #>
$eatPublicOutputDir = New-Item -ItemType "directory" -Path $PublicOutputPath;
$eatFacadeDacpacsDir = New-Item -ItemType "directory" -Path $FacadeDacpacPath;
$eattSQLtDacpacsDir = New-Item -ItemType "directory" -Path $tSQLtDacpacPath;
$eatValidationOutputDir = New-Item -ItemType "directory" -Path $ValidationOutputPath;
<# Copy files to temp path #>
Expand-Archive -Path ($tSQLtFilesZipPath) -DestinationPath $PublicTempPath;
Get-ChildItem -Path ($dir + "/output/DacpacBuild/tSQLtFacade.*.dacpac") | Copy-Item -Destination $FacadeDacpacPath;
Get-ChildItem -Path ($dir + "/output/DacpacBuild/tSQLt.*.dacpac") | Copy-Item -Destination $tSQLtDacpacPath;
<# Create the tSQLt.zip in the public output path #>
$compress = @{
CompressionLevel = "Optimal"
DestinationPath = $PublicOutputPath + "/tSQLt.zip"
}
Get-ChildItem -Path $PublicTempPath | Compress-Archive @compress
<# Copy all public files into public output path #>
Copy-Item -Path $PublicOutputFiles -Destination $PublicOutputPath
<# Copy all validation files into validation output path #>
Copy-Item -Path $ValidationOutputFiles -Destination $ValidationOutputPath