forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_utils.ps1
50 lines (44 loc) · 1.25 KB
/
build_utils.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
function Get-File-Exists-On-Path
{
param(
[string]$file
)
$results = ($Env:Path).Split(";") | Get-ChildItem -filter $file -erroraction silentlycontinue
$found = ($results -ne $null)
return $found
}
function Get-Git-Commit
{
if ((Get-File-Exists-On-Path "git.exe")){
$gitLog = git log --oneline -1
return $gitLog.Split(' ')[0]
}
else {
return "0000000"
}
}
function Get-Git-Commit-Full
{
if ((Get-File-Exists-On-Path "git.exe")){
$gitLog = git log -1 --format="%H"
return $gitLog;
}
else {
return "0000000000000000000000000000000000000000"
}
}
function Get-DependencyPackageFiles
{
param([string]$packageName, [string]$frameworkVersion = "net45")
$fullPackageName = Get-ChildItem "$base_dir\packages\$packageName.*" |
Sort-Object Name -Descending |
Select-Object -First 1
Return "$fullPackageName\lib\$frameworkVersion\*"
}
Function Get-PackagePath {
Param([string]$packageName)
$packagePath = Get-ChildItem "$packages_dir\$packageName.*" |
Sort-Object Name -Descending |
Select-Object -First 1
Return "$packagePath"
}