Skip to content

Commit

Permalink
Merge 80b0bbc into 59e39cf
Browse files Browse the repository at this point in the history
  • Loading branch information
cl1337 committed Oct 8, 2018
2 parents 59e39cf + 80b0bbc commit fe8a98a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion codegen/runner/pre-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ for config_file in ${config_files}; do
sed "s|$ABS_IDL_DIR\/\(.*\)\/.*.thrift|$ABS_GENCODE_DIR/\1|" | \
sort | uniq | xargs
)
"$RESOLVE_I64_BINARY" "$thrift_file"
"$RESOLVE_I64_BINARY" "$thrift_file" "/idl/" "json.type"
target_dirs+=" $gen_code_dir"
done
done
Expand Down
10 changes: 6 additions & 4 deletions scripts/resolve_i64/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ func getDirName() string {

func main() {
thriftFile := os.Args[1]
stripPath := os.Args[2]
annotationJSType := os.Args[3]

module, err := compile.Compile(thriftFile)
if err != nil {
panic(fmt.Sprintf("Failed to parse thrift file: %s", thriftFile))
}
meta := &Meta{}

s := strings.TrimSuffix(thriftFile, ".thrift")
// TODO use os.Args[2] instead of hard-coded path
s = strings.Replace(s, "/idl/", "/build/gen-code/", 1)
s = strings.Replace(s, stripPath, "/build/gen-code/", 1)
meta.PackageName = filepath.Base(s)

for _, typeDef := range module.Types {
Expand All @@ -114,10 +116,10 @@ func main() {
}

i64Struct.TypedefType = refType[1:]
if typThriftAnnotation["json.type"] == "Long" {
if typThriftAnnotation[annotationJSType] == "Long" {
i64Struct.IsLong = true
}
if typThriftAnnotation["json.type"] == "Date" {
if typThriftAnnotation[annotationJSType] == "Date" {
i64Struct.IsTimestamp = true
}
}
Expand Down

0 comments on commit fe8a98a

Please sign in to comment.