Merge pull request #31 from Azure/pipeline-connect

Pipeline connect
This commit is contained in:
Zim Kalinowski 2020-01-02 07:08:48 +08:00 коммит произвёл GitHub
Родитель 19533d21d1 500e4dd639
Коммит b2f7de368e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 114 добавлений и 2 удалений

Просмотреть файл

@ -5,21 +5,32 @@ See documentation [here](doc/00-overview.md)
``` yaml
use-extension:
"@autorest/cli.common": "latest"
"@autorest/fakesdk": "/home/qiaozha/code/fakesdk"
"az": "$(this-folder)"
pipeline-model: v3
clicommon: true
fakesdk123: true
pipeline:
az:
input: fakesdk
output-artifact: source-file-fakesdk-inaz
az/aznamer:
plugin: fakenamer
input: cli.common
output-artifact: source-file-cli
az/renamer:
input: az/aznamer
output-artifact: source-file-cli
az/emitter:
input: az
input:
- az
- az/renamer
scope: scope-here
scope-here:
is-object: false
output-artifact:
- source-file-cli
- source-file-fakesdk-inaz
```

Просмотреть файл

@ -5,6 +5,20 @@ variables:
NodeVersion: '10.x'
jobs:
- job: Linter
pool:
vmImage: 'vs2017-win2016'
steps:
- task: TSLint@1
inputs:
RuleLibrary: 'tslint'
Ruleset: 'tsrecommended'
FileSelectionType: 'fileGlob'
Files: '**\*.ts'
OutputFormat: 'json'
ToolVersion: 'latest'
TypeScriptVersion: 'latest'
- job: 'Build'
pool:

Просмотреть файл

@ -39,6 +39,7 @@
"dependencies": {
"@autorest/modelerfour": "^4.1.60",
"@azure-tools/autorest-extension-base": "~3.1.0",
"@microsoft.azure/autorest.python": "^3.0.52",
"node-yaml": "^3.2.0"
},
"files": [

Просмотреть файл

@ -6,6 +6,92 @@ export type FileCallback = (path: string, rows: string[]) => void;
const extension = new AutoRestExtension();
extension.Add("aznamer", async autoRestApi => {
try
{
// read files offered to this plugin
const inputFileUris = await autoRestApi.ListInputs();
const inputFiles: string[] = await Promise.all(inputFileUris.map(uri => autoRestApi.ReadFile(uri)));
// read a setting
const isDebugFlagSet = await autoRestApi.GetValue("debug");
let azSettings = await autoRestApi.GetValue("az");
// emit messages
autoRestApi.Message({
Channel: Channel.Warning,
Text: "Hello World az namer ! The `debug` flag is " + (isDebugFlagSet ? "set" : "not set"),
});
autoRestApi.Message({
Channel: Channel.Warning,
Text: "az namer settings " + JSON.stringify(azSettings)
});
autoRestApi.Message({
Channel: Channel.Information,
Text: "AutoRest offers the following input files: " + inputFileUris.join(", "),
});
// emit a file (all input files concatenated)
autoRestApi.WriteFile("myfolder/az-namer.txt", inputFiles.join("\n---\n"));
}
catch (e)
{
Error(e.message + " -- " + JSON.stringify(e.stack));
}
});
extension.Add("renamer", async autoRestApi => {
try
{
// read files offered to this plugin
const inputFileUris = await autoRestApi.ListInputs();
const inputFiles: string[] = await Promise.all(inputFileUris.map(uri => autoRestApi.ReadFile(uri)));
// read a setting
const isDebugFlagSet = await autoRestApi.GetValue("debug");
let azSettings = await autoRestApi.GetValue("az");
// emit messages
autoRestApi.Message({
Channel: Channel.Warning,
Text: "Hello World az renamer ! The `debug` flag is " + (isDebugFlagSet ? "set" : "not set"),
});
autoRestApi.Message({
Channel: Channel.Warning,
Text: "az renamer settings " + JSON.stringify(azSettings)
});
autoRestApi.Message({
Channel: Channel.Information,
Text: "AutoRest offers the following input files: " + inputFileUris.join(", "),
});
// emit a file (all input files concatenated)
autoRestApi.WriteFile("myfolder/az-renamer.txt", inputFiles.join("\n---\n"));
}
catch (e)
{
Error(e.message + " -- " + JSON.stringify(e.stack));
}
});
extension.Add("az", async autoRestApi => {