| #!/usr/bin/env bash |
| |
| # TODO(pascallouis): better automate this. |
| |
| set -euxo pipefail |
| |
| cd $FUCHSIA_DIR |
| |
| ./scripts/fx build garnet/go/src/fidl |
| |
| # use this command to find out which files this script touches: |
| # git -C third_party/go grep -F 'generated by fidlgen' |
| |
| out/x64/host_x64/fidlc --json out.json --files third_party/go/src/syscall/zx/fidl/bindingstest/*.fidl |
| out/x64/host_x64/fidlgen --json out.json --generators go --include-base notused --output-base out/regengofidl |
| mv out/regengofidl/impl.go third_party/go/src/syscall/zx/fidl/bindingstest |
| |
| out/x64/host_x64/fidlc --json out.json --files zircon/system/fidl/fuchsia-net/*.fidl |
| out/x64/host_x64/fidlgen --json out.json --generators go --include-base notused --output-base out/regengofidl |
| mv out/regengofidl/impl.go third_party/go/src/syscall/zx/net |
| |
| out/x64/host_x64/fidlc --json out.json --files zircon/system/fidl/fuchsia-io/*.fidl |
| out/x64/host_x64/fidlgen --json out.json --generators go --include-base notused --output-base out/regengofidl |
| mv out/regengofidl/impl.go third_party/go/src/syscall/zx/io |
| |
| rm out.json |
| rm -r out/regengofidl |
| |
| cd third_party/go |
| FILES=$(git ls-files -- 'src/syscall/*/impl.go') |
| |
| # Use Perl instead of sed due to consistent cross-platform behavior. (BSD sed, |
| # which is the default sed on Darwin/macOS, doesn't support newlines in the |
| # substitution, has different extended regular expression behavior vs GNU sed, |
| # different command-line argument passing for in-place editing, etc.) |
| echo $FILES | xargs perl -pi -e 's/(\b[sS]\s+|\)\s+\()int32/\1_zx.Status/' |
| echo $FILES | xargs perl -pi -e 's,^// WARNING: This file is machine generated by fidlgen.$,// Copyright 2018 The Fuchsia Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n//\n// WARNING: This file is machine generated by fidlgen.\n\n// +build fuchsia,' |
| |
| ../../out/x64/tools/goroot/bin/gofmt -s -w $FILES |