blob: 98d6e9719f03aa0af676a9e1e9f508ec64e43f86 [file] [log] [blame] [edit]
#!/usr/bin/env bash
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -euxo pipefail
if [ ! -x "$FUCHSIA_BUILD_DIR" ]; then
echo "error: did you fx exec? missing \$FUCHSIA_BUILD_DIR" 1>&2
exit 1
fi
ZX_IR="$(mktemp /tmp/zx.XXXX.fidl.json)"
function cleanup {
rm -f "$ZX_IR"
}
trap cleanup EXIT
FIDLC=$(fx list-build-artifacts --expect-one --name fidlc tools)
GOFMT=$(fx list-build-artifacts --expect-one --name gofmt tools)
ZITHER=$(fx list-build-artifacts --expect-one --name zither tools)
fx ninja -C "$FUCHSIA_BUILD_DIR" "$FIDLC" "$ZITHER"
"$FUCHSIA_BUILD_DIR/$FIDLC" \
--available fuchsia:HEAD \
--experimental zx_c_types \
--json "$ZX_IR" \
--files "$FUCHSIA_DIR/zircon/vdso/"*.fidl
"$FUCHSIA_BUILD_DIR/$ZITHER" \
-backend go_runtime \
-ir "$ZX_IR" \
-source-dir "$FUCHSIA_DIR" \
-output-dir . \
-formatter "$FUCHSIA_BUILD_DIR/$GOFMT"