blob: 5168fd771f61fbbbf48da942ba7f8f5225df510a [file] [log] [blame]
#!/usr/bin/env bash
# TODO(pascallouis): better automate this.
set -euxo pipefail
cd $FUCHSIA_DIR
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')
echo $FILES | xargs sed -i -E 's/(\b[sS]\s+|\)\s+\()int32/\1_zx.Status/'
echo $FILES | xargs sed -i -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