-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move main to allow other projects generate the plugin, and thus vendo…
…r it (#19)
- Loading branch information
Showing
2 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/pseudomuto/protokit" | ||
"github.com/solo-io/solo-kit/pkg/code-generator" | ||
) | ||
|
||
func main() { | ||
outputDescriptors := os.Getenv("OUTPUT_DESCRIPTORS") == "1" | ||
mergeOutputDescriptors := os.Getenv("OUTPUT_MERGED_DESCRIPTORS_FILE") | ||
plugin := &code_generator.Plugin{OutputDescriptors: outputDescriptors, MergeDescriptors: mergeOutputDescriptors} | ||
// use this to debug without running protoc | ||
if descriptorsFile := os.Getenv("USE_DESCRIPTORS"); descriptorsFile != "" { | ||
// descriptorsFile e.g.: "projects/supergloo/api/v1/project.json.descriptors" | ||
f, err := os.Open(descriptorsFile) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := protokit.RunPluginWithIO(plugin, f, os.Stdout); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
if err := protokit.RunPlugin(plugin); err != nil { | ||
log.Fatal(err) | ||
} | ||
code_generator.Main() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package code_generator | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/pseudomuto/protokit" | ||
) | ||
|
||
func Main() { | ||
outputDescriptors := os.Getenv("OUTPUT_DESCRIPTORS") == "1" | ||
mergeOutputDescriptors := os.Getenv("OUTPUT_MERGED_DESCRIPTORS_FILE") | ||
plugin := &Plugin{OutputDescriptors: outputDescriptors, MergeDescriptors: mergeOutputDescriptors} | ||
// use this to debug without running protoc | ||
if descriptorsFile := os.Getenv("USE_DESCRIPTORS"); descriptorsFile != "" { | ||
// descriptorsFile e.g.: "projects/supergloo/api/v1/project.json.descriptors" | ||
f, err := os.Open(descriptorsFile) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := protokit.RunPluginWithIO(plugin, f, os.Stdout); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
if err := protokit.RunPlugin(plugin); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |