diff --git a/.nuspec/Xamarin.Forms.nuspec b/.nuspec/Xamarin.Forms.nuspec index bea1e8f0c..9dea2f518 100644 --- a/.nuspec/Xamarin.Forms.nuspec +++ b/.nuspec/Xamarin.Forms.nuspec @@ -105,10 +105,12 @@ + + + - @@ -140,7 +142,6 @@ - @@ -165,9 +166,11 @@ + + + - @@ -178,9 +181,11 @@ + + + - @@ -191,10 +196,12 @@ + + + - diff --git a/Xamarin.Forms.Build b/Xamarin.Forms.Build index c5be7a66d..e68bdfcc0 160000 --- a/Xamarin.Forms.Build +++ b/Xamarin.Forms.Build @@ -1 +1 @@ -Subproject commit c5be7a66d068c26e8334202deda3a5fafc03a4b1 +Subproject commit e68bdfcc0ecd267e6677f30ceccc11dc36f9af5b diff --git a/build/scripts/generate-docs.ps1 b/build/scripts/generate-docs.ps1 index a9d540ef7..900fefbf5 100644 --- a/build/scripts/generate-docs.ps1 +++ b/build/scripts/generate-docs.ps1 @@ -1,51 +1,127 @@ param( - [string]$branch = "master", + [string]$branch = "live", [string]$token ) +# Yes, this is ignoring the parameter passed in by VSTS; we don't need the +# parameter, but we can't remove it until all the active branches don't need it +$branch = "live" + +$mdoc = '..\..\tools\mdoc\mdoc.exe' $docsUri = "https://$token@github.com/xamarin/Xamarin.Forms-api-docs.git" -if($branch.StartsWith("refs/pull")) { - $branch = "master" -} else { +function StripNodes { + Param($file, $xpaths) - $docBranches = git ls-remote --heads $docsUri - $matched = $false - foreach ($db in $docBranches) { + [xml]$xml = Get-Content $file -Encoding UTF8 - if($db.EndsWith($branch)) { - # $branch corresponds to an actual branch in docs, so use it - $matched = $true - break; + $xpaths | % { + + $node = $xml.SelectSingleNode($_) + + while ($node -ne $null) { + $x = $node.ParentNode.RemoveChild($node) + $node = $xml.SelectSingleNode($_) } + } - if(-not $matched) { - $branch = "master" - } - - $branch = $branch.Replace("refs/heads/", "") + $utf8WithoutBom = New-Object System.Text.UTF8Encoding($false) + $streamWriter = New-Object System.IO.StreamWriter($file, $false, $utf8WithoutBom) + + $xml.Save($streamWriter) + $streamWriter.Close() } -# API docs maintains its copy of master in `eng-master` -if ($branch -eq "master") {$branch = "eng-master"} - pushd ..\.. mkdir docstemp pushd docstemp -git clone -b $branch --single-branch $docsUri +# Default Language Stuff +# Clone Xamarin.Forms-api-docs in docstemp\Xamarin.Forms-api-docs +git clone -b $branch --single-branch $docsUri pushd .\Xamarin.Forms-api-docs -$mdoc = '..\..\tools\mdoc\mdoc.exe' - +# Run mdoc & $mdoc export-msxdoc .\docs +# Put the results in the docs folder (where NuGet will find it) mv Xamarin.Forms.*.xml ..\..\docs -Force +# Return from the default language folder popd + +# Translations stuff + +$translations = +@{"lang" = "de-de"; "target" = "de"}, +@{"lang" = "es-es"; "target" = "es"}, +@{"lang" = "fr-fr"; "target" = "fr"}, +@{"lang" = "it-it"; "target" = "it"}, +@{"lang" = "ja-jp"; "target" = "ja"}, +@{"lang" = "ko-kr"; "target" = "ko"}, +@{"lang" = "pt-br"; "target" = "pt-br"}, +@{"lang" = "ru-ru"; "target" = "ru"}, +@{"lang" = "zh-cn"; "target" = "zh-Hans"}, +@{"lang" = "zh-tw"; "target" = "zh-Hant"} +#@{"lang" = "cs-cz"; "target" = "cs"}, +#@{"lang" = "pl-pl"; "target" = "pl"}, +#@{"lang" = "tr-tr"; "target" = "tr"}, + + +$branch = "live" + +$translations | % { + # Generate the URI for each translated version + $translationUri = "https://$token@github.com/xamarin/Xamarin.Forms-api-docs.$($_.lang).git" + $translationFolder = ".\Xamarin.Forms-api-docs.$($_.lang)" + + # Clone the translation repo + git clone -b $branch --single-branch $translationUri + + # Go into the language-specific folder + pushd $translationFolder\docs + + # Copy everything over the stuff in the default language folder + # (So untranslated bits still remain in the default language) + copy-item -Path . -Destination ..\..\Xamarin.Forms-api-docs -Recurse -Force + + # Return from the language-specific folder + popd + + # Go into the default language folder + pushd .\Xamarin.Forms-api-docs + + Write-Host "Stripping out unused XML for $($_.lang)" + + dir .\docs -R *.xml | Select -ExpandProperty FullName | % { + + $xpaths = "//remarks", + "//summary[text()='To be added.']", + "//param[text()='To be added.']", + "//returns[text()='To be added.']", + "//typeparam[text()='To be added.']", + "//value[text()='To be added.']", + "//related", + "//example" + + StripNodes $_ $xpaths + } + + # Run mdoc + & $mdoc export-msxdoc .\docs + + # And put the results in the language specific folder under docs + $dest = "..\..\docs\$($_.target)" + mkdir $dest + mv Xamarin.Forms.*.xml $dest -Force + + # Return from the default language folder + popd +} + popd del docstemp -R -Force