Skip to content

Commit

Permalink
initial structure
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanMaron committed Jun 20, 2021
0 parents commit 626b032
Show file tree
Hide file tree
Showing 9 changed files with 474 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### AL ###
#Template for AL projects for Dynamics 365 Business Central
#launch.json folder
.vscode/
#Cache folder
.alcache/
#Symbols folder
.alpackages/
#Snapshots folder
.snapshots/
#Testing Output folder
.output/
#Extension App-file
*.app
#Rapid Application Development File
rad.json
#Translation Base-file
*.g.xlf
#License-file
*.flf
#Test results file
TestResults.xml
80 changes: 80 additions & 0 deletions Misc-apps.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"folders": [
{
"name": "API V1 App",
"path": "APIV1/source"
},
{
"name": "API V1 Tests",
"path": "APIV1/test"
},
{
"name": "API V2 App",
"path": "APIV2/source"
},
{
"name": "API V2 Tests",
"path": "APIV2/test"
},
{
"name": "Client AddIns",
"path": "ClientAddIns/source"
},
{
"name": "Company Hub",
"path": "CompanyHub/source"
},
{
"name": "Headlines App",
"path": "EssentialBusinessHeadlines/source"
},
{
"name": "Headlines Tests",
"path": "EssentialBusinessHeadlines/test"
},
{
"name": "Late Payment Predictor App",
"path": "LatePaymentPredictor/source"
},
{
"name": "Late Payment Predictor Tests",
"path": "LatePaymentPredictor/test"
},
{
"name": "PayPal App",
"path": "paypalpaymentsstandard/source"
},
{
"name": "PayPal Tests",
"path": "paypalpaymentsstandard/test"
},
{
"name": "Sales/Inventory Forecast App",
"path": "salesandinventoryforecast/source"
},
{
"name": "Sales/Inventory Forecast Tests",
"path": "salesandinventoryforecast/test"
},
{
"name": "Send to Email Printer",
"path": "sendtoemailprinter/source"
},
{
"name": "UK send remittance advice",
"path": "uksendremittanceadvice/source"
},
{
"name": "Test Framework",
"path": "TestFramework"
},
],
"settings": {
"allint.enabled": false,
"al.enableCodeActions": false,
"al.enableCodeAnalysis": false,
"search.exclude": {
"**.xlf": true
}
}
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Business Central Code History Repository

This repository holds all versions of the Buisness Central Apps. The purpose is to quickly be able to compare every version to find changes.

There is one separate branch per country-major version.


## Disclaimer

All code is owned by Microsoft. You can not do any pull request on this repository.
21 changes: 21 additions & 0 deletions base-app.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"folders": [
{
"name": "Base App",
"path": "BaseApp/Source/Base Application"
},
{
"name": "Base App Tests",
"path": "BaseApp/Test"
}
],
"settings": {
"allint.enabled": false,
"al.enableCodeActions": false,
"al.enableCodeAnalysis": false,
"al.backgroundCodeAnalysis": false,
"search.exclude": {
"**.xlf": true
}
}
}
86 changes: 86 additions & 0 deletions scripts/Auto_load_versions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
$ErrorActionPreference = "SilentlyContinue"

Set-Alias sz "C:\Program Files\7-Zip\7z.exe"

[System.Collections.ArrayList]$Versions = @()
Get-BCArtifactUrl -select All -Type OnPrem | % {
$Url = $_
$TempString = $Url.Substring(41)
[version]$Version = $TempString.Substring(0, $TempString.IndexOf('/'))
$country = $TempString.Substring($TempString.IndexOf('/') + 1)

[hashtable]$objectProperty = @{}
$objectProperty.Add('Version', $Version)
$objectProperty.Add('Country', $country)
$objectProperty.Add('URL', $Url)
$ourObject = New-Object -TypeName psobject -Property $objectProperty

if ($Version -ge [version]::Parse('15.0.0.0')) {
$Versions.Add($ourObject)
}
}

$Versions | Sort-Object -Property Country, Version | % {
[version]$Version = $_.Version
$country = $_.Country

$CommitDoesNotExist = (git log --all --grep="$($country)-$($version.ToString())") -eq $null

if ($CommitDoesNotExist) {
Write-Host "###############################################"
Write-Host "Processing $($country) - $($Version.ToString())"
Write-Host "###############################################"


$LatestCommitIDOfBranchEmpty = git log -n 1 --pretty=format:"%h" "empty"
if ($LatestCommitIDOfBranchEmpty -eq $null) {
$LatestCommitIDOfBranchEmpty = git log -n 1 --pretty=format:"%h" "origin/empty"
}

if ($Version.Major -gt 15 -and $Version.Build -gt 5) {
$CommitIDLastCUFromPreviousMajor = git log --all --grep="$($country)-$($version.Major - 1).5" --pretty=format:"%h"
}
else {
$CommitIDLastCUFromPreviousMajor = $null
}

$BranchAlreadyExists = ((git branch --list -r "*$($country)-$($Version.Major)*") -ne $null) -or ((git branch --list "*$($country)-$($Version.Major)*") -ne $null)

if ($BranchAlreadyExists) {
git checkout "$($country)-$($Version.Major)"
}
else {
if ($CommitIDLastCUFromPreviousMajor -ne $null) {
git checkout -b "$($country)-$($Version.Major)" $CommitIDLastCUFromPreviousMajor
}
else {
git checkout -b "$($country)-$($Version.Major)" $LatestCommitIDOfBranchEmpty
}
}

$Paths = Download-Artifacts -artifactUrl $_.URL -includePlatform
$TargetPathOfVersion = $Paths[0]

if (-not (Test-Path (Join-Path $TargetPathOfVersion 'Applications'))) {
$TargetPathOfVersion = $Paths[1]
}

& "$PSScriptRoot\UpdateALRepo.ps1" -SourcePath (Join-Path $TargetPathOfVersion Applications) -RepoPath (Split-Path $PSScriptRoot -Parent)
& "$PSScriptRoot\BuildTestsWorkSpace.ps1"

git add -A | out-null
git commit -a -m "$($country)-$($version.ToString())" | out-null
git gc | out-null

Remove-Item $Paths[0] -Recurse

Write-Host "$($country)-$($version.ToString())"
}
else {
Write-Host "###############################################"
Write-Host "Skipped version $($country) - $($version.ToString())"
Write-Host "###############################################"
}
}


24 changes: 24 additions & 0 deletions scripts/BuildTestsWorkSpace.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$Directories = Get-ChildItem -Directory -Filter "*test*" -Recurse

$workspace = @{}
$workspace["folders"] = @()

$Directories | % {
$Childs = Get-ChildItem -Path $_.FullName -Directory -Filter "*test*"
if ($Childs.Count -eq 0 ) {
$path = @{}
$path["path"] = (Get-Item $_.FullName | Resolve-Path -Relative)

$workspace["folders"] += $path
}
}

$workspace["settings"] = @{}

$workspace["settings"]["allint.enabled"] = $false
$workspace["settings"]["al.enableCodeActions"] = $false
$workspace["settings"]["al.enableCodeAnalysis"] = $false
$workspace["settings"]["search.exclude"] = @{"**.xlf" = $true }

$workspace | ConvertTo-Json | Out-File "test-apps.code-workspace" -Encoding utf8

26 changes: 26 additions & 0 deletions scripts/UpdateALRepo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
param(
$Localization = '',
$Version = '',
$BuildFolder = '',
$SourcePath,
$RepoPath = '',
$7zipExe = 'C:\Program Files\7-Zip\7z.exe'
)

if (-not $SourcePath) {
$SourcePath = "C:\bcartifacts.cache\onprem\$Version\$Localization\Applications"
}

Set-Alias sz $7zipExe
$zips = Get-ChildItem -Path $SourcePath -Filter *.zip -Recurse
Get-ChildItem -Path $RepoPath -Directory -Exclude scripts, .git | Remove-Item -Recurse -Force

foreach ($zip in $zips) {
$RelativePath = $zip.FullName -ireplace [regex]::Escape($SourcePath + '\'), ''
$ZipTargetPath = Join-Path $RepoPath (Split-Path -Path $RelativePath)
$ZipNameForTarget = (Split-Path -Path $RelativePath -Leaf).Replace('.zip', '').Replace('..Source', '').Replace('.Source', '')
$ZipTargetPath = (Join-Path $ZipTargetPath $ZipNameForTarget)
sz x $zip.FullName -o"$ZipTargetPath" -r -y | out-null
}


21 changes: 21 additions & 0 deletions system-app.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"folders": [
{
"name": "System App",
"path": "system application/source"
},
{
"name": "System App Tests",
"path": "system application/test"
}
],
"settings": {
"allint.enabled": false,
"al.enableCodeActions": false,
"al.enableCodeAnalysis": false,
"al.backgroundCodeAnalysis": false,
"search.exclude": {
"**.xlf": true
}
}
}
Loading

0 comments on commit 626b032

Please sign in to comment.