Skip to content

Commit e5c8ce0

Browse files
authored
OneBranch Build (#1406)
1 parent 9e68643 commit e5c8ce0

File tree

55 files changed

+2957
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2957
-110
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version:
2+
major: 0
3+
minor: 0
4+
tag: 'SNAPSHOT'
5+
name: 'ApplicationInsights-Java'
6+
system: 'custom'
7+
build:
8+
commands:
9+
- !!buildcommand
10+
name: 'Assemble Perf Counters DLL'
11+
command: '.scripts/gradle.cmd'
12+
arguments: ':core:windowsSharedLibrary'
13+
artifacts:
14+
- from: 'core/build/libs/windows/shared'
15+
include:
16+
- '**/*'
17+
exclude:
18+
- '**/*.pdb'
19+
signing_options:
20+
profile: external_distribution
21+
sign_inline: true
22+
logs:
23+
- to: 'PerfCounters DLL Build Logs'
24+
from: 'core/build/tmp'
25+
include:
26+
- '*WindowsCpp/*'
27+
- !!buildcommand
28+
name: 'Assemble ApplicationInsights-Java JARs'
29+
command: '.scripts/gradle.cmd'
30+
arguments: 'assemble -Pcore.native.artifacts.prebuilt=true'
31+
artifacts:
32+
- to: 'Artifacts'
33+
include:
34+
- '**/build/libs/*.jar'
35+
exclude:
36+
- '**/build/libs/*-sources.jar'
37+
- '**/build/libs/*-javadoc.jar'
38+
- 'buildSrc/**/*'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version:
2+
major: 0
3+
minor: 0
4+
name: 'ApplicationInsights-Java'
5+
system: 'custom'
6+
build:
7+
commands:
8+
- !!buildcommand
9+
name: 'Assemble Perf Counters DLL'
10+
command: '.scripts/gradle.cmd'
11+
arguments: ':core:windowsSharedLibrary'
12+
artifacts:
13+
- from: 'core/build/libs/windows/shared'
14+
include:
15+
- '**/*'
16+
exclude:
17+
- '**/*.pdb'
18+
signing_options:
19+
profile: external_distribution
20+
sign_inline: true
21+
logs:
22+
- to: 'PerfCounters DLL Build Logs'
23+
from: 'core/build/tmp'
24+
include:
25+
- '*WindowsCpp/*'
26+
- !!buildcommand
27+
name: 'Assemble ApplicationInsights-Java JARs'
28+
command: '.scripts/gradle.cmd'
29+
arguments: 'assemble -Pcore.native.artifacts.prebuilt=true -DisRelease=true -Pai.etw.native.build=release'
30+
artifacts:
31+
- to: 'Artifacts'
32+
include:
33+
- '**/build/libs/*.jar'
34+
exclude:
35+
- '**/build/libs/*-sources.jar'
36+
- '**/build/libs/*-javadoc.jar'
37+
- 'buildSrc/**/*'
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
environment:
2+
host:
3+
os: 'windows'
4+
flavor: 'server'
5+
version: '2019'
6+
runtime:
7+
provider: 'appcontainer'
8+
image: 'cdpxwin1809.azurecr.io/global/vse2019:latest'
9+
source_mode: 'link'
10+
versioning:
11+
commands:
12+
- !!defaultcommand
13+
name: 'Generate Version'
14+
command: '.scripts/version.cmd'
15+
signing_options:
16+
profile: '170'
17+
static_analysis_options:
18+
policheck_options:
19+
disable_tool_scan: false
20+
fail_on_error: true
21+
restore:
22+
commands:
23+
- !!defaultcommand
24+
name: 'Install Windows 8.1 SDK'
25+
command: '.scripts/installWindows81Sdk.cmd'
26+
logs:
27+
- from: 'WinSdkInstall'
28+
to: 'WinSdkInstall'
29+
include:
30+
- '**/*.log'
31+
- !!defaultcommand
32+
name: 'Install Windows 10 SDK'
33+
command: '.scripts/installWindows10Sdk.cmd'
34+
logs:
35+
- from: 'WinSdkInstall'
36+
to: 'WinSdkInstall'
37+
include:
38+
- '**/*.log'
39+
- !!defaultcommand
40+
name: 'Install Java 11 JDK'
41+
command: '.scripts/installJava11jdk.cmd'
42+
- !!defaultcommand
43+
name: 'Add OpenTelemetry to MavenLocal'
44+
command: '.scripts/ot-gradle.cmd'
45+
arguments: 'publishToMavenLocal --refresh-dependencies'
46+
- !!defaultcommand
47+
name: 'Clean and Resolve Dependencies'
48+
command: '.scripts/gradle.cmd'
49+
arguments: 'clean resolveDependencies --refresh-dependencies'
50+
- !!defaultcommand
51+
name: 'List Installation Information'
52+
command: '.scripts/dumpInstallationInfo.cmd'
53+
test:
54+
commands:
55+
# - !!defaultcommand
56+
# name: 'Gradle Static Analysis'
57+
# command: '.scripts/gradle.cmd'
58+
# arguments: 'check -x test'
59+
# logs:
60+
# - to: 'Checks Reports'
61+
# include:
62+
# - '**/build/reports/**/*'
63+
# exclude:
64+
# - '**/build/reports/tests/**/*'
65+
- !!testcommand
66+
name: 'ApplicationInsights-Java Unit Tests'
67+
command: '.scripts/gradle.cmd'
68+
arguments: 'test'
69+
fail_on_stderr: false
70+
testresults:
71+
- title: ':Unit Test Results'
72+
type: 'junit'
73+
include:
74+
- '**/build/test-results/test/**/*'
75+
logs:
76+
- to: 'Test Logs'
77+
include:
78+
- '**/build/reports/tests/**/*'

.pipelines/pipeline.user.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
artifact_publish_options:
2+
publish_to_legacy_artifacts: false
3+
publish_to_pipeline_artifacts: true
4+
publish_to_cloudvault_artifacts: false

.scripts/copyBitsToAzureBlob.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
param (
2+
[Parameter(Mandatory=$true, HelpMessage="azuresdkpartnerdrops service principal key")]
3+
[ValidateNotNullOrEmpty()]
4+
[string]$ServicePrincipalKey,
5+
6+
[Parameter(Mandatory=$true, HelpMessage="azuresdkpartnerdrops Service principal client ID")]
7+
[ValidateNotNullOrEmpty()]
8+
[string]$ServicePrincipleClientId,
9+
10+
[Parameter(Mandatory=$true, HelpMessage="applicationinsights-java version")]
11+
[ValidateNotNullOrEmpty()]
12+
[string]$SDKVersionNumber
13+
)
14+
15+
$Env:AZCOPY_SPA_CLIENT_SECRET=$ServicePrincipalKey
16+
azcopy login --service-principal --application-id $ServicePrincipleClientId
17+
azcopy copy "$(System.DefaultWorkingDirectory)/_applicationinsights-java-Windows-Official-master/drop/outputs/build/Artifacts/agent/agent/build/libs/applicationinsights-agent-$SDKVersionNumber.jar" "https://azuresdkpartnerdrops.blob.core.windows.net/drops/applicationinsights-sdk/java/$SDKVersionNumber/"
18+
Remove-Item Env:AZCOPY_SPA_CLIENT_SECRET

.scripts/dumpInstallationInfo.cmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
3+
echo "Listing installed software..."
4+
powershell -NoProfile -ExecutionPolicy Unrestricted -File "%~dp0List-Programs.ps1" || exit /B 1
5+
echo "Finished listing installed software."

.scripts/generateVersion.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To generate a custom version with "M.m.p.yyyymmdd<build_count_of_day>"
2+
$path = "core\build\src\generated\main\resources\sdk-version.properties"
3+
if (-Not (Test-Path -Path $path -PathType Leaf)) {
4+
Write-Error -Message "'$path' does not exist" -Category ObjectNotFound
5+
exit 2
6+
}
7+
$versionProps = ConvertFrom-StringData (Get-Content $path -Raw)
8+
Write-Host "Read from sdk-version.properties: " $versionProps.version
9+
$matchObj = ($versionProps.version | Select-String -Pattern "^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?:-(?<tag>.*))?")
10+
$major, $minor, $patch, $tag = $matchObj.Matches[0].Groups['major', 'minor','patch','tag'].Value
11+
$date = Get-Date -UFormat "%Y%m%d"
12+
$revision = "$date$env:CDP_DEFINITION_BUILD_COUNT_DAY"
13+
$buildNumber = "$major.$minor.$patch.$revision"
14+
[Environment]::SetEnvironmentVariable("CustomBuildNumber", $buildNumber, "User") # This will allow you to use it from env var in later steps of the same phase
15+
Write-Host "##vso[build.updatebuildnumber]${buildNumber}"

.scripts/gradle.cmd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@echo off
2+
setlocal
3+
4+
pushd %~dp0
5+
set SCRIPT_ROOT=%CD%
6+
popd
7+
8+
pushd %~dp0..
9+
set PROJECT_ROOT=%CD%
10+
11+
set DEFAULT_OPTIONS=--info --stacktrace -DisBuildServer=true --warning-mode=all
12+
set GRADLE_CMD=gradlew.bat %DEFAULT_OPTIONS% %*
13+
echo Running '%GRADLE_CMD%' in '%PROJECT_ROOT%'
14+
call %GRADLE_CMD%
15+
if errorlevel 1 (
16+
echo Error running '%GRADLE_CMD%' in '%PROJECT_ROOT%'
17+
exit /b 1
18+
)
19+
popd
20+
endlocal

.scripts/install-azcopy.ps1

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
param (
2+
[Parameter(Mandatory=$true, HelpMessage="Url to download. Must point to a zip file. Assumes filename is last path element. Assumes zip contains top level directory with same name as zip file.")]
3+
[ValidateNotNullOrEmpty()]
4+
[string]$Url,
5+
6+
[Parameter(Mandatory=$true, HelpMessage="Destination directory to unzip downloaded file.")]
7+
[ValidateNotNullOrEmpty()]
8+
[System.IO.FileInfo]$Destination,
9+
10+
[Parameter(HelpMessage="When used, adds bin directory to PATH.")]
11+
[switch]$UpdatePath = $false,
12+
13+
[Parameter(HelpMessage="When used, downloads directory will be cleaned and temp directories cleaned.")]
14+
[switch]$CleanOnFinish = $false,
15+
16+
[Parameter(Mandatory=$false, HelpMessage="7Zip location. Should point to 7z.exe.")]
17+
[ValidateNotNullOrEmpty()]
18+
[System.IO.FileInfo]$PathTo7Zip,
19+
20+
[Parameter(Mandatory=$false, HelpMessage="Skips download step.")]
21+
[switch]$SkipDownload = $false,
22+
23+
[Parameter(Mandatory=$false, HelpMessage="Skips unzip.")]
24+
[switch]$SkipUnzip = $false
25+
)
26+
27+
$fileName, $dirName = ($Url | Select-String -Pattern ".+/(?<filename>(?<dirname>[^/]+)\..+)$").Matches[0].Groups['filename', 'dirname'].Value
28+
$Source = [System.IO.Path]::Combine("C:\Downloads", $fileName)
29+
30+
$ErrorActionPreference = "Stop"
31+
Import-Module "$PSScriptRoot\win-installer-helper.psm1" -DisableNameChecking
32+
33+
Start-Setup
34+
35+
$PathNodes=@()
36+
try
37+
{
38+
if (-not $SkipDownload) {
39+
Write-Host "Downloading '$fileName' from '$Url' to '$Source'"
40+
Get-File -Url $url -FileName $fileName
41+
Write-Host "Download finished: $Source"
42+
}
43+
else
44+
{
45+
Write-Host "Skipping download."
46+
if (-not (Test-Path $Source)) {
47+
Write-Error "$Source does not exist"
48+
exit
49+
}
50+
}
51+
52+
if ($SkipUnzip)
53+
{
54+
if($Destination.ToString() -eq "C:\7-Zip") {
55+
Start-Process -Wait -FilePath "$Source" -ArgumentList "/S"
56+
}
57+
}
58+
else
59+
{
60+
if ($PathTo7Zip)
61+
{
62+
Write-Host "***"
63+
Write-Host $PathTo7Zip.ToString()
64+
Write-Host "***"
65+
if (-not (Test-Path $PathTo7Zip))
66+
{
67+
Write-Error "7zip location still does not exist $PathTo7Zip"
68+
exit
69+
}
70+
Expand-ArchiveWith7Zip -Source $Source -Destination $destination -ToolPath $PathTo7Zip
71+
}
72+
else
73+
{
74+
Write-Host "$PathTo7Zip does not exist"
75+
Expand-ArchiveWith7Zip -Source $Source -Destination $destination
76+
}
77+
Write-Host "Finished unzipping to $destination"
78+
}
79+
}
80+
finally
81+
{
82+
if (!$PathNodes -eq "")
83+
{
84+
Write-Host "Appending to PATH: '$PathNodes'"
85+
Update-Path -PathNodes $PathNodes
86+
}
87+
if ($CleanOnFinish)
88+
{
89+
Stop-Setup
90+
}
91+
else
92+
{
93+
Stop-Setup -PreserveTemp -PreserveDownloads
94+
}
95+
}

0 commit comments

Comments
 (0)