1#!/bin/bash
2set -e
3
4cd "$(dirname $0)/../../"
5SCRIPT_DIR="$(pwd)"
6echo "Script running from $(pwd)"
7
8# resolve DIST_DIR
9if [ -z "$DIST_DIR" ]; then
10  DIST_DIR="$SCRIPT_DIR/out/dist"
11fi
12mkdir -p "$DIST_DIR"
13
14export OUT_DIR=out
15export DIST_DIR="$DIST_DIR"
16
17JAVA_HOME="$(pwd)/prebuilts/studio/jdk/jdk17/linux" tools/gradlew -p tools/ publishLocal --stacktrace
18
19# Depend on the generated version.properties file, as the version depends on
20# the release flag
21versionProperties="$OUT_DIR/build/base/builder-model/build/resources/main/com/android/builder/model/version.properties"
22# Mac grep doesn't support -P, so use perl version of `grep -oP "(?<=buildVersion = ).*"`
23export LINT_VERSION=`perl -nle'print $& while m{(?<=baseVersion=).*}g' $versionProperties`
24export LINT_REPO="$(pwd)/out/repo"
25
26JAVA_HOME="$(pwd)/prebuilts/jdk/jdk17/linux-x86/" tools/gradlew -p tools/metalava \
27  --no-daemon \
28  --stacktrace \
29   --dependency-verification=off
30