1#!/bin/bash 2# Copyright (C) 2021 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14set -e 15gn_path="$1" 16if [ ! -d "prebuilts/$gn_path" ];then 17 mkdir prebuilts/$gn_path 18fi 19if [ ! -f "prebuilts/$gn_path/gn" ] || [ ! -f "prebuilts/$gn_path/ninja" ];then 20 if [ "$gn_path" == "linux" ];then 21 curl https://repo.huaweicloud.com/openharmony/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz --output gn.tar.gz 22 tar -xvf gn.tar.gz --directory=prebuilts/$gn_path/ 23 curl https://repo.huaweicloud.com/openharmony/compiler/ninja/1.11.0/linux/ninja-linux-x86-1.11.0.tar.gz --output ninja.tar.gz 24 tar -xvf ninja.tar.gz --directory=prebuilts/$gn_path/ 25 elif [ "$gn_path" == "macx" ];then 26 curl https://repo.huaweicloud.com/openharmony/compiler/gn/2024/darwin/gn-darwin-x86-20230425.tar.gz --output gn.tar.gz 27 tar -xvf gn.tar.gz --directory=prebuilts/$gn_path/ 28 curl https://repo.huaweicloud.com/openharmony/compiler/ninja/1.11.0/darwin/ninja-darwin-x86-1.11.0.tar.gz --output ninja.tar.gz 29 tar -xvf ninja.tar.gz --directory=prebuilts/$gn_path/ 30 elif [ "$gn_path" == "windows" ];then 31 curl https://repo.huaweicloud.com/openharmony/compiler/gn/1744/windows/gn-windows-amd64.zip --output gn.zip 32 unzip gn.zip -d prebuilts/$gn_path/ 33 curl https://repo.huaweicloud.com/openharmony/compiler/ninja/1.9.0/windows/ninja-win.zip --output ninja.zip 34 unzip ninja.zip -d prebuilts/$gn_path/ 35 fi 36fi 37