-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-mo2-dependencies.ps1
70 lines (56 loc) · 1.82 KB
/
build-mo2-dependencies.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
param(
[Parameter(Mandatory=$true)][String]$Owner,
[Parameter(Mandatory=$true)][String]$Branch,
[Parameter(Mandatory=$true)][String]$DependenciesS
)
function Switch-Branch {
param (
[System.IO.FileSystemInfo]$Folder
)
Push-Location $Folder
$name = $Folder.Name
$remote = "origin"
if ($Owner -ne "ModOrganizer2") {
$remote = $Owner
$url = (git remote -v | Select-String -Raw "ModOrganizer2")[1].Split()[1].Replace("ModOrganizer2", $Owner)
if (git remote -v | Select-String "$Owner/") {
git remote set-url $remote $url
}
else {
git remote add $remote $url
}
# try to fetch
git fetch --depth 1 $Owner 2>&1 | Out-Null
if ($LASTEXITCODE) {
Write-Output ("No remote $remote for $name found, falling back to ModOrganizer2.")
$Owner = "ModOrganizer2"
$remote = "origin"
}
}
git checkout "$remote/$Branch" 2>&1 | Out-Null
if ($LASTEXITCODE) {
Write-Output "No branch $Owner/$Branch found for $name, staying on current branch."
}
else {
Write-Output "Switch to branch $Owner/$Branch for $name."
}
Pop-Location
}
$Dependencies = $DependenciesS.Split()
Write-Host "Initializing repositories with mob... "
mob -l 4 -d . build `
--ignore-uncommitted-changes `
--redownload --reextract --no-build-task `
@Dependencies
# handle USVFS (not in modorganizer_super)
if (Test-Path "build\usvfs") {
Switch-Branch -Folder (Get-Item "build\usvfs")
}
Get-ChildItem "build/modorganizer_super" -Directory -Exclude ".git" | ForEach-Object {
Switch-Branch -Folder $_
}
Write-Output "Building dependencies with mob... "
mob -l 4 -d . build `
--ignore-uncommitted-changes `
--no-pull --reconfigure --rebuild `
@Dependencies