OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "flag" | 8 "flag" |
9 "fmt" | 9 "fmt" |
10 "go/build" | 10 "go/build" |
(...skipping 26 matching lines...) Expand all Loading... |
37 "desc", | 37 "desc", |
38 "", | 38 "", |
39 "Writes a FileDescriptorSet file containing all the the .proto f
iles and their transitive dependencies", | 39 "Writes a FileDescriptorSet file containing all the the .proto f
iles and their transitive dependencies", |
40 ) | 40 ) |
41 ) | 41 ) |
42 | 42 |
43 func resolveGoogleProtobufPackages(c context.Context) (map[string]string, error)
{ | 43 func resolveGoogleProtobufPackages(c context.Context) (map[string]string, error)
{ |
44 const ( | 44 const ( |
45 protoPrefix = "google/protobuf/" | 45 protoPrefix = "google/protobuf/" |
46 pkgPath = "github.com/luci/luci-go/common/proto/google" | 46 pkgPath = "github.com/luci/luci-go/common/proto/google" |
| 47 descPkgPath = "google.golang.org/genproto/protobuf" |
47 ) | 48 ) |
48 var result = map[string]string{ | 49 var result = map[string]string{ |
49 » » protoPrefix + "descriptor.proto": pkgPath + "/descriptor", //sno
wflake | 50 » » protoPrefix + "descriptor.proto": descPkgPath, //snowflake |
50 } | 51 } |
51 | 52 |
52 pkg, err := build.Import(pkgPath, "", build.FindOnly) | 53 pkg, err := build.Import(pkgPath, "", build.FindOnly) |
53 if err != nil { | 54 if err != nil { |
54 return nil, err | 55 return nil, err |
55 } | 56 } |
56 protoFiles, err := findProtoFiles(pkg.Dir) | 57 protoFiles, err := findProtoFiles(pkg.Dir) |
57 if err != nil { | 58 if err != nil { |
58 return nil, err | 59 return nil, err |
59 } | 60 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 src := strings.TrimSuffix(dir, pkg) | 282 src := strings.TrimSuffix(dir, pkg) |
282 src = path.Clean(src) | 283 src = path.Clean(src) |
283 goPaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSepara
tor)) | 284 goPaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSepara
tor)) |
284 for _, goPath := range goPaths { | 285 for _, goPath := range goPaths { |
285 if filepath.Join(goPath, "src") == src { | 286 if filepath.Join(goPath, "src") == src { |
286 return true, nil | 287 return true, nil |
287 } | 288 } |
288 } | 289 } |
289 return false, nil | 290 return false, nil |
290 } | 291 } |
OLD | NEW |