-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-sdk.ps1
79 lines (60 loc) · 1.95 KB
/
build-sdk.ps1
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
try {
Push-Location "$PSScriptRoot\sdk"
& flutter pub get
if ($LASTEXITCODE -ne 0) {
throw "flutter pub get sdk failed"
}
try {
Push-Location "$PSScriptRoot\sdk\testbed"
& flutter pub get
if ($LASTEXITCODE -ne 0) {
throw "flutter pub get testbed failed"
}
}
finally {
Pop-Location
}
$version = &"$PSScriptRoot\..\get-version.ps1" -versionName "flutterUIVersion"
Write-Host "Setting version to $version"
$fileContent = Get-Content -Path "pubspec.yaml"
$fileContent = $fileContent -replace "^version: [\d\.]+$", "version: $version"
$fileContent | Set-Content -Path "pubspec.yaml"
Write-Host "Ensuring CHANGELOG.md starts with version $version"
$changelogContent = Get-Content -Path "CHANGELOG.md"
if ($changelogContent -notmatch "## $version") {
Write-Host "CHANGELOG.md needs patching -- doing so"
$changelogContent = "## $version`n`n- Auto-Generated changelog -- please visit https://github.com/trinsic-id/sdk for info`n`n$changelogContent"
$changelogContent | Set-Content -Path "CHANGELOG.md"
}
Write-Host "Copying README.md to sdk folder so publish command works"
Copy-Item -Path "..\README.md" -Destination "README.md"
& flutter analyze
if ($LASTEXITCODE -ne 0) {
throw "flutter analyze failed"
}
& flutter test
if ($LASTEXITCODE -ne 0) {
throw "flutter test failed"
}
& flutter pub publish --dry-run
if ($LASTEXITCODE -ne 0) {
throw "flutter publish dry run failed"
}
try {
Push-Location "$PSScriptRoot\sdk\testbed"
& flutter analyze
if ($LASTEXITCODE -ne 0) {
throw "flutter analyze testbed failed"
}
& flutter test
if ($LASTEXITCODE -ne 0) {
throw "flutter test testbed failed"
}
}
finally {
Pop-Location
}
}
finally {
Pop-Location
}