Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gen.go update #547

Merged
merged 3 commits into from
Feb 16, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 41 additions & 23 deletions Gododir/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"

do "gopkg.in/godo.v2"
Expand Down Expand Up @@ -280,29 +281,39 @@ var (
{
// Plane: "dataplane",
// InputPrefix: "",
// Services: []Service{
// Services: []service{
// {
// Name: "batch",
// Version: "2016-07-01.3.1",
// Swagger: "BatchService",
// },
// {
// Name: "insights",
// // composite swagger
// },
// {
// Name: "keyvault",
// Version: "2015-06-01",
// },
// {
// Name: "search",'
// Version: "2015-02-28"
// // There are 2 files, but no composite swagger...
// },
// {
// Name: "servicefabric",
// Version: "2016-01-28",
// },
// {
// Name: "insights",
// // composite swagger
// },
// {
// Name: "keyvault",
// Version: "2015-06-01",
// },
// {
// Name: "search",
// SubServices: []service{
// {
// Name: "searchindex",
// Version: "2015-02-28",
// Input: "search",
// },
// {
// Name: "searchservice",
// Version: "2015-02-28",
// Input: "search",
// },
// },
// },
// {
// Name: "servicefabric",
// Version: "2016-01-28",
// },
// },
},
{
Expand All @@ -320,14 +331,14 @@ var (
},
// {
// Name: "datalake-analytics",
// SubServices: []Service{
// SubServices: []service{
// {
// Name: "catalog",
// Version: "2016-06-01-preview",
// Version: "2016-11-01",
// },
// {
// Name: "job",
// Version: "2016-03-20-preview",
// Version: "2016-11-01",
// },
// },
// },
Expand Down Expand Up @@ -404,15 +415,22 @@ func generate(service *service) {
fmt.Printf("Generating %s...\n\n", service.Fullname)
delete(service)

autorest := exec.Command(fmt.Sprintf("%s/autorest/src/core/AutoRest/bin/Debug/net451/win7-x64/autorest", autorestDir),
_, err := exec.LookPath("gulp")
if err != nil {
panic("You need gulp (and some other tools) to run AutoRest. See https://github.com/Azure/autorest/pull/1827")
}

autorest := exec.Command("gulp",
Copy link
Member

@marstr marstr Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is pretty new stuff, and some of our computers (okay, well mine) haven't had gulp setup yet, we may want to add in some guard rails like this:
exec.LookPath(string)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

"autorest",
"-Input", fmt.Sprintf("%s/azure-rest-api-specs/%s.json", swaggersDir, service.Input),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another candidate for filepath.Join.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (and used filepath.Join in some other places too)

"-CodeGenerator", "Go",
"-Header", "MICROSOFT_APACHE",
"-Namespace", service.Name,
"-OutputDirectory", service.Output,
"-Modeler", "Swagger",
"-pv", sdkVersion)
err := runner(autorest)
autorest.Dir = filepath.Join(autorestDir, "autorest")
err = runner(autorest)
if err != nil {
panic(fmt.Errorf("Autorest error: %s", err))
}
Expand Down