1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/ohos/notice/notice.gni")
16
17typescript_sources = [
18  "lib/.gitattributes",
19  "lib/README.md",
20  "lib/cancellationToken.js",
21  "lib/cs/diagnosticMessages.generated.json",
22  "lib/de/diagnosticMessages.generated.json",
23  "lib/dynamicImportCompat.js",
24  "lib/es/diagnosticMessages.generated.json",
25  "lib/fr/diagnosticMessages.generated.json",
26  "lib/it/diagnosticMessages.generated.json",
27  "lib/ja/diagnosticMessages.generated.json",
28  "lib/ko/diagnosticMessages.generated.json",
29  "lib/lib.d.ts",
30  "lib/lib.dom.d.ts",
31  "lib/lib.dom.iterable.d.ts",
32  "lib/lib.es2015.collection.d.ts",
33  "lib/lib.es2015.core.d.ts",
34  "lib/lib.es2015.d.ts",
35  "lib/lib.es2015.generator.d.ts",
36  "lib/lib.es2015.iterable.d.ts",
37  "lib/lib.es2015.promise.d.ts",
38  "lib/lib.es2015.proxy.d.ts",
39  "lib/lib.es2015.reflect.d.ts",
40  "lib/lib.es2015.symbol.d.ts",
41  "lib/lib.es2015.symbol.wellknown.d.ts",
42  "lib/lib.es2016.array.include.d.ts",
43  "lib/lib.es2016.d.ts",
44  "lib/lib.es2016.full.d.ts",
45  "lib/lib.es2017.d.ts",
46  "lib/lib.es2017.full.d.ts",
47  "lib/lib.es2017.intl.d.ts",
48  "lib/lib.es2017.object.d.ts",
49  "lib/lib.es2017.sharedmemory.d.ts",
50  "lib/lib.es2017.string.d.ts",
51  "lib/lib.es2017.typedarrays.d.ts",
52  "lib/lib.es2018.asyncgenerator.d.ts",
53  "lib/lib.es2018.asynciterable.d.ts",
54  "lib/lib.es2018.d.ts",
55  "lib/lib.es2018.full.d.ts",
56  "lib/lib.es2018.intl.d.ts",
57  "lib/lib.es2018.promise.d.ts",
58  "lib/lib.es2018.regexp.d.ts",
59  "lib/lib.es2019.array.d.ts",
60  "lib/lib.es2019.d.ts",
61  "lib/lib.es2019.full.d.ts",
62  "lib/lib.es2019.intl.d.ts",
63  "lib/lib.es2019.object.d.ts",
64  "lib/lib.es2019.string.d.ts",
65  "lib/lib.es2019.symbol.d.ts",
66  "lib/lib.es2020.bigint.d.ts",
67  "lib/lib.es2020.d.ts",
68  "lib/lib.es2020.date.d.ts",
69  "lib/lib.es2020.full.d.ts",
70  "lib/lib.es2020.intl.d.ts",
71  "lib/lib.es2020.number.d.ts",
72  "lib/lib.es2020.promise.d.ts",
73  "lib/lib.es2020.sharedmemory.d.ts",
74  "lib/lib.es2020.string.d.ts",
75  "lib/lib.es2020.symbol.wellknown.d.ts",
76  "lib/lib.es2021.d.ts",
77  "lib/lib.es2021.full.d.ts",
78  "lib/lib.es2021.intl.d.ts",
79  "lib/lib.es2021.promise.d.ts",
80  "lib/lib.es2021.string.d.ts",
81  "lib/lib.es2021.weakref.d.ts",
82  "lib/lib.es2022.array.d.ts",
83  "lib/lib.es2022.d.ts",
84  "lib/lib.es2022.error.d.ts",
85  "lib/lib.es2022.full.d.ts",
86  "lib/lib.es2022.intl.d.ts",
87  "lib/lib.es2022.object.d.ts",
88  "lib/lib.es2022.sharedmemory.d.ts",
89  "lib/lib.es2022.string.d.ts",
90  "lib/lib.es5.d.ts",
91  "lib/lib.es6.d.ts",
92  "lib/lib.esnext.d.ts",
93  "lib/lib.esnext.full.d.ts",
94  "lib/lib.esnext.intl.d.ts",
95  "lib/lib.esnext.promise.d.ts",
96  "lib/lib.esnext.string.d.ts",
97  "lib/lib.esnext.weakref.d.ts",
98  "lib/lib.scripthost.d.ts",
99  "lib/lib.webworker.d.ts",
100  "lib/lib.webworker.importscripts.d.ts",
101  "lib/lib.webworker.iterable.d.ts",
102  "lib/pl/diagnosticMessages.generated.json",
103  "lib/protocol.d.ts",
104  "lib/pt-br/diagnosticMessages.generated.json",
105  "lib/ru/diagnosticMessages.generated.json",
106  "lib/tr/diagnosticMessages.generated.json",
107  "lib/tsc.js",
108  "lib/tsserver.js",
109  "lib/tsserverlibrary.d.ts",
110  "lib/tsserverlibrary.js",
111  "lib/typesMap.json",
112  "lib/typescript.d.ts",
113  "lib/typescript.js",
114  "lib/typescriptServices.d.ts",
115  "lib/typescriptServices.js",
116  "lib/typingsInstaller.js",
117  "lib/watchGuard.js",
118  "lib/zh-cn/diagnosticMessages.generated.json",
119  "lib/zh-tw/diagnosticMessages.generated.json",
120]
121
122group("build_typescript") {
123  deps = [
124    "//third_party/typescript:build_typescript_pack",
125    "//third_party/typescript:typescript_notice",
126  ]
127}
128
129action("build_typescript_pack") {
130  sources = typescript_sources
131  script = "compile_typescript.py"
132  args = [
133    rebase_path(get_path_info("./", "abspath")),
134    rebase_path("${target_out_dir}"),
135  ]
136  outputs = [ "${target_out_dir}/ohos-typescript-4.9.5-r4.tgz" ]
137}
138
139collect_notice("typescript_notice") {
140  license_file = "LICENSE"
141  module_source_dir = get_label_info(":${target_name}", "dir")
142  outputs = [
143    "${sdk_notice_dir}/ets/build-tools/ets-loader/node_modules/typescript.txt",
144  ]
145}
146