-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines-build-steps-template.yml
88 lines (81 loc) · 3.37 KB
/
azure-pipelines-build-steps-template.yml
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
85
86
87
88
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace version in packages.config'
inputs:
targetFiles: packages.config
- bash: cat packages.config
displayName: 'List packages.config'
- task: NuGetInstaller@0
displayName: 'NuGet install Packages'
inputs:
solution: '$(NugetConfigsPath)\packages.config'
nugetConfigPath: '$(NugetConfigsPath)\nuget.config'
restoreMode: install
nuGetRestoreArgs: '-ExcludeVersion -OutputDirectory "$(NugetsPath)"'
verbosity: Detailed
nuGetVersion: 4.0.0.2283
- task: CopyFiles@2
displayName: 'Copy Binary Dependencies to: $(Build.BinariesDirectory)'
inputs:
SourceFolder: '$(MetadataPath)'
Contents: '**/bin/**'
TargetFolder: '$(Build.BinariesDirectory)'
- task: VSBuild@1
displayName: 'Build solution $(Build.SourcesDirectory)\**\*.sln'
inputs:
solution: '$(Build.SourcesDirectory)\**\*.sln'
vsVersion: 15.0
msbuildArgs: '/p:BuildTasksDirectory="$(NugetsPath)\$(ToolsPackage)\DevAlm" /p:MetadataDirectory="$(MetadataPath)" /p:FrameworkDirectory="$(NuGetsPath)\$(ToolsPackage)" /p:ReferenceFolder="$(NuGetsPath)\$(PlatPackage)\ref\net40;$(NuGetsPath)\$(AppPackage)\ref\net40;$(MetadataPath);$(Build.BinariesDirectory);$(NuGetsPath)\$(AppSuitePackage)\ref\net40" /p:ReferencePath="$(NuGetsPath)\$(ToolsPackage)" /p:OutputDirectory="$(Build.BinariesDirectory)"'
msbuildArchitecture: x64
- task: CopyFiles@2
displayName: 'Copy X++ Compile Log Files to: $(Build.ArtifactStagingDirectory)\Logs'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**\Dynamics.AX.*.xppc.*
**\Dynamics.AX.*.labelc.*
**\Dynamics.AX.*.reportsc.*
**\Dynamics.AX.*.xppbp.*
TargetFolder: '$(Build.ArtifactStagingDirectory)\Logs'
condition: succeededOrFailed()
- powershell: |
$applFolder = "$(Build.ArtifactStagingDirectory)\Logs"
$pattern = '*xppbp.xml'
$issuesFound = 0;
Write-Output 'Counting best practice violations:'
$logFiles = Get-ChildItem -Path $applFolder -Include $pattern -Recurse
foreach ($logFile in $logFiles) {
Write-Host "##[group] File name: $logFile"
[xml]$XmlDocument = Get-Content -Path $logFile.FullName
$items = $XmlDocument.SelectSingleNode("Diagnostics").SelectSingleNode("Items") #Diagnostics->Items
if ($items) {
foreach ($item in $items.ChildNodes) {
if ($item) {
$message = $item.SelectSingleNode("Message").InnerText
$path = $item.SelectSingleNode("Path").InnerText
$moniker = $item.SelectSingleNode("Moniker").InnerText
if ($moniker -eq "BPFrameworkFatalException") {
Write-Host "##[warning]$moniker : $message $path"
}
else {
Write-Host "##vso[task.LogIssue type=error;]$moniker : $message $path"
$issuesFound = 1;
}
}
}
}
Write-Host ""
Write-Host "##[endgroup]"
}
if ($issuesFound -eq 1) {
Write-Host "##vso[task.LogIssue type=error;]BP issues found"
exit 0;
}
failOnStderr: true
displayName: 'Check BP'
enabled: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()