1fd4e5da5Sopenharmony_ci#!/usr/bin/env bash
2fd4e5da5Sopenharmony_ci# Copyright (c) 2019 Google Inc.
3fd4e5da5Sopenharmony_ci#
4fd4e5da5Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5fd4e5da5Sopenharmony_ci# you may not use this file except in compliance with the License.
6fd4e5da5Sopenharmony_ci# You may obtain a copy of the License at
7fd4e5da5Sopenharmony_ci#
8fd4e5da5Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
9fd4e5da5Sopenharmony_ci#
10fd4e5da5Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11fd4e5da5Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12fd4e5da5Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13fd4e5da5Sopenharmony_ci# See the License for the specific language governing permissions and
14fd4e5da5Sopenharmony_ci# limitations under the License.
15fd4e5da5Sopenharmony_ci
16fd4e5da5Sopenharmony_ciset -e # Fail on any error.
17fd4e5da5Sopenharmony_ci
18fd4e5da5Sopenharmony_ciEXT_PATH=~/.vscode/extensions/google.spirvls-0.0.1
19fd4e5da5Sopenharmony_ciROOT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
20fd4e5da5Sopenharmony_ci
21fd4e5da5Sopenharmony_cipushd ${ROOT_PATH}
22fd4e5da5Sopenharmony_ci    go run ./src/tools/gen-grammar.go --cache ./cache --template ./spirv.json.tmpl --out ./spirv.json
23fd4e5da5Sopenharmony_ci    go run ./src/tools/gen-grammar.go --cache ./cache --template ./src/schema/schema.go.tmpl --out ./src/schema/schema.go
24fd4e5da5Sopenharmony_ci
25fd4e5da5Sopenharmony_ci    mkdir -p ${EXT_PATH}
26fd4e5da5Sopenharmony_ci    cp ./extension.js ${EXT_PATH}
27fd4e5da5Sopenharmony_ci    cp ./package.json ${EXT_PATH}
28fd4e5da5Sopenharmony_ci    cp ./spirv.json ${EXT_PATH}
29fd4e5da5Sopenharmony_ci
30fd4e5da5Sopenharmony_ci    go build -o ${EXT_PATH}/langsvr ./src/langsvr.go
31fd4e5da5Sopenharmony_cipopd
32fd4e5da5Sopenharmony_ci
33fd4e5da5Sopenharmony_cicd ${EXT_PATH}
34fd4e5da5Sopenharmony_cinpm install
35