• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# This script requires depot_tools to be on path.
4
5print_usage () {
6  echo "Usage: create_ndk_cipd_package.sh <PACKAGE_TYPE> <PATH_TO_ASSETS> <PLATFORM_NAME> <VERSION_TAG>"
7  echo "  where:"
8  echo "    - PACKAGE_TYPE is one of build-tools, platform-tools, platforms, or tools"
9  echo "    - PATH_TO_ASSETS is the path to the unzipped asset folder"
10  echo "    - PLATFORM_NAME is one of linux-amd64, mac-amd64, or windows-amd64"
11  echo "    - VERSION_TAG is the version of the package, e.g. 28r6 or 28.0.3"
12}
13
14if [[ $4 == "" ]]; then
15  print_usage
16  exit 1
17fi
18
19if [[ $1 != "build-tools" && $1 != "platform-tools" && $1 != "platforms" && $1 != "tools" ]]; then
20  echo "Unrecognized paackage type $1."
21  print_usage
22  exit 1
23fi
24
25if [[ ! -d "$2" ]]; then
26  echo "Directory $1 not found."
27  print_usage
28  exit 1
29fi
30
31if [[ $1 != "platforms" && $3 != "linux-amd64" && $3 != "mac-amd64" && $3 != "windows-amd64" ]]; then
32  echo "Unsupported platform $3."
33  echo "Valid options are linux-amd64, mac-amd64, windows-amd64."
34  print_usage
35  exit 1
36fi
37
38if [[ $1 == "platforms" ]]; then
39  echo "Ignoring PLATFORM_NAME - this package is cross-platform."
40  cipd create -in $2 -name flutter/android/sdk/$1 -install-mode copy -tag version:$4
41else
42  cipd create -in $2 -name flutter/android/sdk/$1/$3 -install-mode copy -tag version:$4
43fi
44