autorest

AutoRest Versioning

AutoRest comes in three distinct parts:

The CLI

The CLI itself does not often change or require updates, as it doens’t hold much actual logic for AutoRest.

The AutoRest CLI is updated like any Node package, via NPM:

npm install -g autorest

Core Module

The AutoRest core module is the real processing hub for AutoRest.

The CLI can load any version of the AutoRest Core module by using the command line --version:[VERSION] where [VERSION] is one of:

An AutoRest configuration file can also specify a version: that requests a specific core module.
This can be overridden on the command line with --version:

V2 generators will have their core module version defaulting to the latest v2 core module (2.0.4413)

Technical details


AutoRest core modules are installed into the user’s $HOME/.autorest folder.
Multiple instances of the core module can be installed side-by-side

The core module runs in-process of the CLI (the module library is acquired and executed in the same process)

AutoRest v2 core modules are called @microsoft.azure/autorest-core
AutoRest v3 core modules are called @autorest/core

See the Managing Versions section below
>  

Extension Modules

AutoRest code generation is all handled in AutoRest extensions.
An individual extension can have one or more plugins that can plug into the AutoRest pipeline to participate in the code generation process.

You can request a well-known extension to be loaded by asking for it on the command line:

autorest --csharp – loads the c# plugin.

If you want to pin to a specific version of an extension or to load one that is not well-known specify --use:[PKGREF] on the command-line, where [PKGREF] is a NPM package reference like:

Technical details


AutoRest extension modules are installed into the user’s $HOME/.autorest folder.
Multiple instances of an extension module can be installed side-by-side

Extension modules are executed out-of-process (communicating via a JSON-RPC protocol over stdin/out).
They can be written in any language (still must be packaged with npm!)
We have plugins written in typescript, c#, python, java.

AutoRest v2 extension modules are generally called @microsoft.azure/autorest.[LANGUAGE]
AutoRest v3 extension modules are called @autorest/[LANGUAGE]

See the Managing Versions section below
>  

Managing Versions

AutoRest modules and extensions support concurrent installaton side-by-side of multiple versions.

You can use autorest --info to examine installed cores and extensions:

autorest --info

AutoRest code generation utility [version: 3.0.6161; node: v10.15.1, max-memory: 8192 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest


Showing All Installed Extensions

 Type       Extension Name                           Version      Location
 core       @autorest/core                           3.0.6197     C:\Users\gs\.autorest\@autorest_core@3.0.6197
 core       @autorest/core                           3.0.6198     C:\Users\gs\.autorest\@autorest_core@3.0.6198
 extension  @autorest/modelerfour                    4.3.144      C:\Users\gs\.autorest\@autorest_modelerfour@4.3.144

You can remove all the AutoRest core modules and extensions by using --reset:

autorest --reset

AutoRest code generation utility [version: 3.0.6161; node: v10.15.1, max-memory: 8192 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Clearing 25 autorest temp data folders...


Cleared the AutoRest extension folder.
On the next run, extensions will be reacquired from the repository.