Skip to content

Commit

Permalink
Server Generation (#38)
Browse files Browse the repository at this point in the history
Experimental and subject to change
  • Loading branch information
bmoylan authored Mar 18, 2019
1 parent 3170dab commit d51828d
Show file tree
Hide file tree
Showing 572 changed files with 228,680 additions and 372 deletions.
173 changes: 150 additions & 23 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
# go-tests = true
# unused-packages = true

[[constraint]]
name = "github.com/palantir/conjure-go-runtime"
version = "0.2.4"

[[constraint]]
name = "github.com/palantir/pkg"
version = ">=0.10.0"
Expand Down
9 changes: 8 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import (

const (
outputDirFlagName = "output"
serverFlagName = "server"
)

var (
version = "unspecified"
debug bool
outputDirFlagVar string
serverFlagVar bool
)

var rootCmd = &cobra.Command{
Expand All @@ -50,6 +52,7 @@ func Execute() int {
func init() {
rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "print debug output")
rootCmd.Flags().StringVar(&outputDirFlagVar, outputDirFlagName, ".", "base directory into which generated Conjure is written")
rootCmd.Flags().BoolVar(&serverFlagVar, serverFlagName, false, "enable witchcraft-go server generation")
}

func Generate(irFile, outDir string) error {
Expand All @@ -60,7 +63,11 @@ func Generate(irFile, outDir string) error {
if err != nil {
return err
}
if err := conjure.Generate(conjureDefinition, outDir); err != nil {
output := conjure.OutputConfiguration{OutputDir: outDir}
if serverFlagVar {
output.GenerateServer = true
}
if err := conjure.Generate(conjureDefinition, output); err != nil {
return errors.Wrapf(err, "failed to generate Conjure")
}
return nil
Expand Down
Loading

0 comments on commit d51828d

Please sign in to comment.