From fbfba2af6cdc857d51799643386649ee0caad01f Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Fri, 26 Aug 2016 13:39:19 -0700 Subject: [PATCH 1/3] Added support to specify modeler for code generation. Required to use Composite Swagger modeler for Graph.Rbac client generation. --- gulpfile.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index df1d0172c9698..12a47939fb7b1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -91,7 +91,7 @@ var mappings = { }; gulp.task('default', function() { - console.log("Usage: gulp codegen [--spec-root ] [--projects ] [--autorest ]\n"); + console.log("Usage: gulp codegen [--spec-root ] [--projects ] [--autorest ] [--modeler ]\n"); console.log("--spec-root"); console.log("\tRoot location of Swagger API specs, default value is \"https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master\""); console.log("--projects\n\tComma separated projects to regenerate, default is all. List of available project names:"); @@ -99,6 +99,7 @@ gulp.task('default', function() { console.log('\t' + i.magenta); }); console.log("--autorest\n\tThe version of AutoRest. E.g. 0.15.0, or the location of AutoRest repo, E.g. E:\\repo\\autorest"); + console.log("--modeler\n\tSpecifies which modeler to use. Default is 'Swagger'"); }); var isWindows = (process.platform.lastIndexOf('win') === 0); @@ -111,6 +112,10 @@ var autoRestVersion = '0.17.0-Nightly20160706'; // default if (args['autorest'] !== undefined) { autoRestVersion = args['autorest']; } +var modeler = 'Swagger'; // default +if (args['modeler'] !== undefined) { + modeler = args['modeler']; +} var autoRestExe; gulp.task('codegen', function(cb) { @@ -157,8 +162,12 @@ var codegen = function(project, cb) { if (mappings[project].fluent !== null && mappings[project].fluent === false) { generator = 'Azure.Java'; } - cmd = autoRestExe + ' -Modeler Swagger -CodeGenerator ' + generator + ' -Namespace ' + mappings[project].package + ' -Input ' + specRoot + '/' + mappings[project].source + - ' -outputDirectory ' + mappings[project].dir + '/src/main/java/' + mappings[project].package.replace(/\./g, '/') + ' -Header MICROSOFT_MIT_NO_CODEGEN'; + cmd = autoRestExe + ' -Modeler ' + modeler + + ' -CodeGenerator ' + generator + + ' -Namespace ' + mappings[project].package + + ' -Input ' + specRoot + '/' + mappings[project].source + + ' -outputDirectory ' + mappings[project].dir + '/src/main/java/' + mappings[project].package.replace(/\./g, '/') + + ' -Header MICROSOFT_MIT_NO_CODEGEN'; if (mappings[project].args !== undefined) { cmd = cmd + ' ' + mappings[project].args; } From 03ac53e4ad62128544d50bbafa52cfd9a644cdb3 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Fri, 26 Aug 2016 14:49:10 -0700 Subject: [PATCH 2/3] Added graph mapping and ability to pass custom arguments to AutoRest generator cmd line --- gulpfile.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 12a47939fb7b1..78649dd9f608d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -87,11 +87,18 @@ var mappings = { 'package': 'com.microsoft.azure.keyvault', 'fluent': false, 'args': '-FT 1' + }, + 'graph.rbac': { + 'dir': 'azure-mgmt-graph-rbac', + 'source': 'arm-graphrbac/compositeGraphRbacManagementClient.json', + 'package': 'com.microsoft.azure.graph.rbac', + 'fluent': false, + 'args': '-FT 1' } }; gulp.task('default', function() { - console.log("Usage: gulp codegen [--spec-root ] [--projects ] [--autorest ] [--modeler ]\n"); + console.log("Usage: gulp codegen [--spec-root ] [--projects ] [--autorest ] [--modeler ] [--autorest-args ]\n"); console.log("--spec-root"); console.log("\tRoot location of Swagger API specs, default value is \"https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master\""); console.log("--projects\n\tComma separated projects to regenerate, default is all. List of available project names:"); @@ -100,6 +107,7 @@ gulp.task('default', function() { }); console.log("--autorest\n\tThe version of AutoRest. E.g. 0.15.0, or the location of AutoRest repo, E.g. E:\\repo\\autorest"); console.log("--modeler\n\tSpecifies which modeler to use. Default is 'Swagger'"); + console.log("--autorest-args\n\tPasses additional argument to AutoRest generator"); }); var isWindows = (process.platform.lastIndexOf('win') === 0); @@ -116,6 +124,7 @@ var modeler = 'Swagger'; // default if (args['modeler'] !== undefined) { modeler = args['modeler']; } +var autoRestArgs = args['autorest-args']; var autoRestExe; gulp.task('codegen', function(cb) { @@ -167,7 +176,8 @@ var codegen = function(project, cb) { ' -Namespace ' + mappings[project].package + ' -Input ' + specRoot + '/' + mappings[project].source + ' -outputDirectory ' + mappings[project].dir + '/src/main/java/' + mappings[project].package.replace(/\./g, '/') + - ' -Header MICROSOFT_MIT_NO_CODEGEN'; + ' -Header MICROSOFT_MIT_NO_CODEGEN' + + ' -' + autoRestArgs; if (mappings[project].args !== undefined) { cmd = cmd + ' ' + mappings[project].args; } From d7beaf451baffb5ab132aa0c6c15d5712311ee22 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Fri, 26 Aug 2016 16:22:52 -0700 Subject: [PATCH 3/3] Added Redis Cache project to gulpfile.js --- gulpfile.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 78649dd9f608d..dac718ca09c08 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -44,6 +44,18 @@ var mappings = { 'package': 'com.microsoft.azure.management.website', 'args': '-FT 1' }, + 'graph.rbac': { + 'dir': 'azure-mgmt-graph-rbac', + 'source': 'arm-graphrbac/compositeGraphRbacManagementClient.json', + 'package': 'com.microsoft.azure.management.graph.rbac', + 'args': '-FT 1' + }, + 'redis': { + 'dir': 'azure-mgmt-redis', + 'source': 'arm-redis/2015-08-01/swagger/redis.json', + 'package': 'com.microsoft.azure.management.redis', + 'args': '-FT 1' + }, 'datalake.store.filesystem': { 'dir': 'azure-mgmt-datalake-store', 'source': 'arm-datalake-store/filesystem/2015-10-01-preview/swagger/filesystem.json', @@ -87,13 +99,6 @@ var mappings = { 'package': 'com.microsoft.azure.keyvault', 'fluent': false, 'args': '-FT 1' - }, - 'graph.rbac': { - 'dir': 'azure-mgmt-graph-rbac', - 'source': 'arm-graphrbac/compositeGraphRbacManagementClient.json', - 'package': 'com.microsoft.azure.graph.rbac', - 'fluent': false, - 'args': '-FT 1' } };