Skip to content

Commit

Permalink
support git tags/refs
Browse files Browse the repository at this point in the history
  • Loading branch information
PearCoding committed Jun 19, 2024
1 parent ed10786 commit aee4228
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
9 changes: 1 addition & 8 deletions scripts/setup/setup_artic.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
$CURRENT = Get-Location

# Clone or update if necessary
If (!(Test-Path -Path "artic")) {
& $GIT_BIN clone --depth 1 --branch $Config.ARTIC.BRANCH $Config.ARTIC.GIT artic
Set-Location "artic/"
}
else {
Set-Location "artic/"
& $GIT_BIN pull
}
HandleGIT "artic" $Config.ARTIC.BRANCH $Config.ARTIC.GIT

$THORIN = "$DEPS_ROOT\thorin".Replace("\", "/").Replace(" ", "` ")

Expand Down
9 changes: 1 addition & 8 deletions scripts/setup/setup_runtime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ function CompileRuntime {
}

# Clone or update if necessary
If (!(Test-Path -Path $runtime_name)) {
& $GIT_BIN clone --depth 1 --branch $Config.RUNTIME.BRANCH $Config.RUNTIME.GIT $runtime_name
Set-Location $runtime_name
}
else {
Set-Location $runtime_name
& $GIT_BIN pull
}
HandleGIT $runtime_name $Config.RUNTIME.BRANCH $Config.RUNTIME.GIT

# Setup cmake
$CMAKE_Args = @()
Expand Down
9 changes: 1 addition & 8 deletions scripts/setup/setup_thorin.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
$CURRENT = Get-Location

# Clone or update if necessary
If (!(Test-Path -Path "thorin")) {
& $GIT_BIN clone --depth 1 --branch $Config.THORIN.BRANCH $Config.THORIN.GIT thorin
Set-Location "thorin/"
}
else {
Set-Location "thorin/"
& $GIT_BIN pull
}
HandleGIT "thorin" $Config.THORIN.BRANCH $Config.THORIN.GIT

$HALF = "$DEPS_ROOT\half".Replace("\", "/").Replace(" ", "` ")
$LLVM = "$DEPS_ROOT\llvm-install".Replace("\", "/").Replace(" ", "` ")
Expand Down
24 changes: 24 additions & 0 deletions scripts/setup/utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ function GetPD {
return ($null -ne $object) ? $object : $default
}

function HandleGIT {
param(
[Parameter(Mandatory)] [string] $Directory,
[Parameter(Mandatory)] [string] $Branch,
[Parameter(Mandatory)] [string] $URL
)

If (!(Test-Path -Path $Directory)) {
& $GIT_BIN clone --depth 1 --branch $Branch $URL thorin
Set-Location $Directory
}
else {
Set-Location $Directory
& $GIT_BIN fetch --quiet
& $GIT_BIN checkout --quiet $Branch

# Check if it is a named ref and can be pulled
$ref = (& $GIT_BIN show-ref refs/remotes/origin/$Branch)
if (!([string]::IsNullOrEmpty($ref))) {
& $GIT_BIN pull origin
}
}
}

function RenameDLL {
param(
[Parameter(Mandatory)] [string] $InputDLL,
Expand Down

0 comments on commit aee4228

Please sign in to comment.