xref: /aosp_15_r20/external/ktfmt/online_formatter/build_and_deploy.sh (revision 5be3f65c8cf0e6db0a7e312df5006e8e93cdf9ec)
1#!/bin/bash
2# Copyright (c) Meta Platforms, Inc. and affiliates.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -eo pipefail
17./gradlew -q packageLibs
18mv build/distributions/lambda.zip build/lambda-lib.zip
19
20./gradlew build
21
22ARTIFACT_BUCKET=ktfmt-online-formatter-lambda
23TEMPLATE=format.yaml
24aws cloudformation package --template-file $TEMPLATE --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml
25aws cloudformation deploy --template-file out.yml --stack-name ktfmt --capabilities CAPABILITY_NAMED_IAM --region=us-east-2
26