forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build.ps1] Add support for converting _meta.json to autorest.md duri…
…ng build (Azure#15111)
- Loading branch information
1 parent
c9502ef
commit a2f75a9
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function ShouldGenerate-AutorestConfig([string]$autorestPath) { | ||
$metaPath = $autorestPath.Replace("autorest.md", "_meta.json") | ||
return !(Test-Path $autorestPath -PathType Leaf) -and (Test-Path $metaPath -PathType Leaf) | ||
} | ||
|
||
function Generate-AutorestConfig([string]$autorestPath) { | ||
$metaPath = $autorestPath.Replace("autorest.md", "_meta.json") | ||
$meta = Get-Content $metaPath | ConvertFrom-Json | ||
$readme = "https://github.com/Azure/azure-rest-api-specs/blob/" + $meta.commit + $meta.readme.Split("/azure-rest-api-specs")[1]; | ||
|
||
$contents = @' | ||
### AutoRest Configuration | ||
> see https://aka.ms/autorest | ||
``` yaml | ||
tag: {0} | ||
require: | ||
- {1} | ||
``` | ||
'@; | ||
$contents -f $meta.tag, $readme | Out-File -FilePath $autorestPath | ||
} |