Skip to content

Commit 75f5976

Browse files
tj-devel709TJ Lambert
andauthored
[Localization] Use a self checkout and revert the explicit lcl paths (#14843)
* Checkout self * Revert "[Localization] Update the Lcl paths (#14811)" This reverts commit 46a8971. * we no longer need the localize-directory Co-authored-by: TJ Lambert <[email protected]>
1 parent 8660f24 commit 75f5976

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

tools/devops/LocProject.json.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Languages": "",
99
"CopyOption": "LangIDOnName",
1010
"OutputPath": "@WORKING_DIRECTORY@/../../msbuild/Xamarin.Localization.MSBuild/TranslatedAssemblies",
11-
"LclFile": "@WORKING_DIRECTORY@/../../Localize/loc/{Lang}/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx.lcl",
11+
"LclFile": "",
1212
"LciFile": "",
1313
"Parser": "",
1414
"LssFiles": []
@@ -18,7 +18,7 @@
1818
"Languages": "",
1919
"CopyOption": "LangIDOnName",
2020
"OutputPath": "@WORKING_DIRECTORY@/../../tools/mtouch/TranslatedAssemblies",
21-
"LclFile": "@WORKING_DIRECTORY@/../../Localize/loc/{Lang}/tools/mtouch/Errors.resx.lcl",
21+
"LclFile": "",
2222
"LciFile": "",
2323
"Parser": "",
2424
"LssFiles": []

tools/devops/automation/scripts/update-locproject.ps1

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
param ($SourcesDirectory, $LocalizeDirectory, $LocProjectPath)
1+
param ($SourcesDirectory, $LocProjectPath)
22

33
$jsonFiles = @()
44
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
@@ -15,19 +15,10 @@ $projectObject = Get-Content $LocProjectPath | ConvertFrom-Json
1515
$jsonFiles | ForEach-Object {
1616
$sourceFile = $_.FullName
1717
$outputPath = "$($_.DirectoryName + "\")"
18-
$fullNameString = Convert-Path -Path $_.FullName
19-
$maciosPathArray = $fullNameString -split "xamarin-macios", 2
20-
$maciosPath = $maciosPathArray[1]
21-
if ($null -eq $maciosPath) {
22-
Write-Host "'fullNameString' could not be split at 'xamarin-macios'!"
23-
exit 1
24-
}
25-
$lclFile = Join-Path -Path $LocalizeDirectory -ChildPath "$($maciosPath).lcl"
2618
$projectObject.Projects[0].LocItems += (@{
2719
SourceFile = $sourceFile
2820
CopyOption = "LangIDOnName"
2921
OutputPath = $outputPath
30-
LclFile = $lclFile
3122
})
3223
}
3324
Pop-Location

tools/devops/automation/templates/loc-translations.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
11
steps:
22

3-
- template: ./common/checkout.yml
3+
- checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
4+
clean: true # Executes: git clean -ffdx && git reset --hard HEAD
5+
submodules: recursive
6+
path: s/xamarin-macios
7+
8+
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
9+
- pwsh: |
10+
git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*'
11+
git fetch origin
12+
$branch="$(Build.SourceBranch)".Replace("merge", "head")
13+
$branch=$branch.Replace("refs", "origin")
14+
Write-Host "Checking out branch $branch"
15+
git checkout $branch
16+
$hash = git rev-parse HEAD
17+
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
18+
name: fix_commit
19+
displayName: "Undo Github merge"
20+
workingDirectory: $(System.DefaultWorkingDirectory)
21+
- ${{ else }}:
22+
- pwsh: |
23+
$hash = git rev-parse HEAD
24+
Write-Host "##vso[task.setvariable variable=GIT_HASH;isOutput=true]$hash"
25+
name: fix_commit
26+
displayName: "Undo Github merge"
27+
workingDirectory: $(System.DefaultWorkingDirectory)
28+
429
530
- bash: |
631
make LocProject.json
732
displayName: 'Generate LocProject.json'
833
continueOnError: true
9-
workingDirectory: $(Build.SourcesDirectory)\\xamarin-macios\\tools\\devops
34+
workingDirectory: $(Build.SourcesDirectory)\\tools\\devops
1035

1136
- task: PowerShell@2
1237
displayName: "Update LocProject.json"
1338
inputs:
1439
targetType: 'filePath'
15-
filePath: $(Build.SourcesDirectory)\\xamarin-macios\\tools\\devops\\automation\\scripts\\update-locproject.ps1
16-
arguments: -SourcesDirectory "$(Build.SourcesDirectory)\\xamarin-macios" -LocalizeDirectory "$(Build.SourcesDirectory)\xamarin-macios\Localize\loc\{Lang}" -LocProjectPath "$(Build.SourcesDirectory)\\xamarin-macios\\Localize\\LocProject.json"
40+
filePath: $(Build.SourcesDirectory)\\tools\\devops\\automation\\scripts\\update-locproject.ps1
41+
arguments: -SourcesDirectory "$(Build.SourcesDirectory)" -LocProjectPath "$(Build.SourcesDirectory)\\Localize\\LocProject.json"
1742

1843
- pwsh: |
1944
git remote remove origin
@@ -29,14 +54,14 @@ steps:
2954
git checkout -b Localization
3055
git push origin Localization
3156
displayName: "Create a new Localization branch from main"
32-
workingDirectory: $(Build.SourcesDirectory)\\xamarin-macios
57+
workingDirectory: $(Build.SourcesDirectory)
3358

3459
- task: OneLocBuild@2
3560
continueOnError: true
3661
env:
3762
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
3863
inputs:
39-
locProj: '$(Build.SourcesDirectory)\\xamarin-macios\\Localize\\LocProject.json'
64+
locProj: '$(Build.SourcesDirectory)\\Localize\\LocProject.json'
4065
outDir: '$(Build.ArtifactStagingDirectory)'
4166
${{ if eq(variables['Build.Reason'], 'Schedule') }}:
4267
isCreatePrSelected: true

0 commit comments

Comments
 (0)