Ensure that you've setup your developer environment
# clone the repository
git clone https://github.com/azure/autorest
# install node modules
cd autorest
npm install
The AutoRest build system has standardized on gulp
for the following reasons:
- it works very well cross-platform
- excellent support for parallelism
- using
IcedCoffeeScript
+ShellJS
keeps the scripts very readable.
The main gulpfile
is the file in the root of the folder called gulpfile.iced
. You'll also find support modules for that in the ./src/gulp_modules
folder (see the .iced
files there)
You can get a quick list of the available gulp commands by running gulp
without arguments:
# list what gulp commands are available
gulp
If you pull new code, and the package.json
file has been updated, you will see a warning when you call gulp
:
[13:50:53] Requiring external module iced-coffee-script/register
WARNING: package.json is newer than 'node_modules' - you might want to do an 'npm install'
[13:50:54] Using gulpfile C:\work\github\autorest\gulpfile.iced
gulp
is smart enough to find it's gulpfile.iced
regardless where you are in the project hierarchy:
cd ./src/core/autorest
gulp clean
[13:55:16] Requiring external module iced-coffee-script/register
[13:55:16] Working directory changed to C:\work\github\autorest
[13:55:17] Using gulpfile C:\work\github\autorest\gulpfile.iced
[13:55:17] Starting 'clean/typescript'...
[13:55:17] Starting 'clean/dotnet'...
C:\work\github\autorest :: dotnet clean C:\work\github\autorest/AutoRest.sln /nologo
[13:55:18] Finished 'clean/typescript' after 813 ms
[13:55:21] Finished 'clean/dotnet' after 3.95 s
[13:55:21] Starting 'clean'...
[13:55:21] Finished 'clean' after 19 μs
gulp build
- ensures that the dotnet-cli packages are restored, then compiles the typescript and c# projects in parallel.
gulp clean
- cleans the build artifacts
gulp code
- launches vscode
gulp fix-line-endings
- ensures that .ts files are LF not CRLF. Will be expanded in the future.
gulp reset-dotnet-cache
- removes installed dotnet-packages so restore is from a perfectly clean state. WARNING: This will remove the files in ~/.nuget/*
gulp restore
- restores the dotnet packages for all the projects
gulp npm-install
- restores packages for the typescript projects
Build autorest and install it in the user's home folder (~/.autorest/plugins/autorest/<VERSION>-<DATE>-<TIME>-private
) as a private build so you can run it with the autorest
command anywhere.
gulp install
- build and install the dev version of autorest
gulp autorest
- runs the autorest binary directly. You can pass regular command line parameters to it.
gulp autorest-cli
- Runs AutoRest (via the node
front-end. This will soon be the default.)
gulp regenerate
- regenerate all expected code for tests (There are many fine-grained rengenerate-*
tasks, find them with gulp -T
if you need them. )
gulp test
- runs all tests
gulp test-dotnet
- runs dotnet tests
gulp test-go
- runs Go tests
gulp test-java
- runs Java tests
gulp test-node
- runs NodeJS tests
gulp test-python
- runs Python tests
gulp test-ruby
- runs Ruby tests
--force
specify when you want to force an action (restore, etc)
--configuration
'debug' or 'release'
--release
same as --configuration=release
--verbose
enable verbose output
--threshold=nn
set parallelism threshold - default = (# of cpus in system-1)