-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.ps1
84 lines (69 loc) · 2.74 KB
/
init.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
80
81
82
83
84
[CmdletBinding()]
param (
[Parameter()]
[switch]
$SkipNAVEnlistment = $false
)
# Verify NAV repo enlistment dir is defined
if($null -eq $Env:NAV_REPO_PATH){
throw "Set the environment variable NAV_REPO_PATH with the absolute path to your NAV repo";
}
# Verify data dir is defined
if($null -eq $Env:MSC_DATA_PATH){
throw "Set the environment variable MSC_DATA_PATH with the absolute path to your data folder";
}
# To check if enlistment is initialized we check if the command `Start-NavServer` is defined
if(!(Get-Command Start-NavServer -ErrorAction Ignore) -and (-not $SkipNAVEnlistment)){
try {
.$Env:NAV_REPO_PATH\Eng\Core\Enlistment\start.ps1
}
catch {
throw "Failed to initialize NAV enlistment: $_"
}
}
# Import DME helpers if not available
if(!(Get-Command Get-DMEJob -ErrorAction Ignore) -and (-not $SkipNAVEnlistment)){
try{
.$Env:NAV_REPO_PATH\Eng\extensions\helpers\importdme.ps1
}
catch {
throw "Failed to import DME utils: $_"
}
}
if(-not $SkipNAVEnlistment){
Import-Module $Env:NAV_REPO_PATH\Eng\Core\Scripts\Infrastructure\Azure\AzureLogs.psm1
Import-Module $Env:PKGMicrosoft_BusinessCentral_InfrastructureDME_DMELibrary\lib\Azure\AzureJobStorage.psm1
Import-Module $Env:NAV_REPO_PATH\Eng\Core\Helpers\snaphelpers.psm1 -DisableNameChecking
. $Env:NAV_REPO_PATH\Eng\Core\Lib\Dependencies.ps1
}
$Global:NAV = $Env:NAV_REPO_PATH
$Global:MSCROOT = $PSScriptRoot
$Global:MSCDATA_DIR = $Env:MSC_DATA_PATH
$Global:SRCROOT = "$MSCROOT\src"
$Global:RESOURCES_DIR = "$MSCROOT\resources"
$Global:CISTATS_SRC = "$MSCROOT\src\ci-stats"
$Global:DATACOLLECTION_SRC = "$MSCROOT\src\dataset-collection"
$Global:THESIS_SRC = "$MSCROOT\thesis"
$Global:TMPDIR = "$MSCROOT\tmp"
if (-not (Test-Path -Path $Global:TMPDIR)){
New-Item -Path $Global:TMPDIR -ItemType Directory
}
# Import modules
## Utils
Import-Module $PSScriptRoot\src\common\JobStorage.psm1 -Force -Scope Global
Import-Module $PSScriptRoot\src\common\MetaModel.psm1 -Force -Scope Global
Import-Module $PSScriptRoot\src\common\Ranklib.psm1 -Force -Scope Global
Import-Module $MSCROOT\src\DataMigrations.psm1 -Force -Scope Global
## CI Stats
. $CISTATS_SRC\config.ps1
Import-Module $CISTATS_SRC\CIStats.psm1 -Force -Scope Global
## Dataset collection: CI History, coverage
Import-Module $SRCROOT\CIHistory.psm1 -Force -Scope Global
Import-Module $SRCROOT\CoverageCollection.psm1 -Force -Scope Global
## Ranklib training and evaluation
Import-Module $MSCROOT\src\Training.psm1 -Force -Scope Global
Import-Module $MSCROOT\src\Evaluation.psm1 -Force -Scope Global
## Thesis writing
Import-Module $THESIS_SRC\Thesis.psm1 -Force -Scope Global
Import-Module $PSScriptRoot\src\Meta.psm1 -Force -Scope Global
Set-Location -Path $MSCROOT