diff --git a/eng/mgmt/gulpfile.js b/eng/mgmt/gulpfile.js index 8b7cbdf8977a..273cb544497d 100644 --- a/eng/mgmt/gulpfile.js +++ b/eng/mgmt/gulpfile.js @@ -39,9 +39,10 @@ gulp.task('default', function() { console.log("\tThe version of AutoRest. E.g. 2.0.9, or the location of AutoRest repo, e.g. E:\\repo\\autorest"); console.log("--autorest-java"); - console.log("\tPath to an autorest.java generator to pass as a --use argument to AutoRest."); + console.log("\tOption#1: Path to an autorest.java generator to pass as a --use argument to AutoRest."); + console.log("\tOption#2: The version of AutoRest.Java. E.g. 2.0.9. You can also pass latest or preview."); console.log("\tUsually you'll only need to provide this and not a --autorest argument in order to work on Java code generation."); - console.log("\tSee https://github.com/Azure/autorest/blob/master/docs/developer/autorest-extension.md"); + console.log("\tSee https://github.com/Azure/autorest/blob/master/.attic/developer/autorest-extension.md"); console.log("--debug"); console.log("\tFlag that allows you to attach a debugger to the autorest.java generator."); @@ -62,6 +63,10 @@ var autoRestVersion = 'preview'; // default if (args['autorest'] !== undefined) { autoRestVersion = args['autorest']; } +var autoRestJavaVersion = ''; // default +if (args['autorest-java'] !== undefined) { + autoRestJavaVersion = args['autorest-java']; +} var debug = args['debug']; var autoRestArgs = args['autorest-args'] || ''; var autoRestExe; @@ -69,8 +74,8 @@ const mgmtPomFilename = 'pom.mgmt.xml' gulp.task('codegen', function(cb) { if (autoRestVersion.match(/[0-9]+\.[0-9]+\.[0-9]+.*/) || - autoRestVersion == 'preview') { - autoRestExe = 'autorest ---version=' + autoRestVersion; + autoRestVersion == 'preview' || autoRestVersion == 'latest') { + autoRestExe = 'autorest --version=' + autoRestVersion; handleInput(projects, cb); } else { autoRestExe = "node " + path.join(autoRestVersion, "src/autorest-core/dist/app.js"); @@ -107,9 +112,10 @@ var codegen = function(project, cb) { console.log('Generating "' + project + '" from spec file ' + specRoot + '/' + mappings[project].source); - const generatorPath = args['autorest-java'] - ? `--use=${path.resolve(args['autorest-java'])} ` - : ''; + const generatorPath = autoRestJavaVersion == 'preview' || autoRestJavaVersion == 'latest' + || autoRestJavaVersion.match(/^[0-9]+\.[0-9]+\.[0-9a-zA-Z]+$/) + ? `--use=@microsoft.azure/autorest.java@` + autoRestJavaVersion +` ` + : (autoRestJavaVersion == '' ? '' : `--use=${path.resolve(args['autorest-java'])} `); const regenManager = args['regenerate-manager'] ? ' --regenerate-manager=true ' : '';