• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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")
15
16linter_version = "1.0.0"
17npm_path = "//prebuilts/build-tools/common/nodejs/current/bin/npm"
18typescript_dir = get_label_info("//third_party/typescript:build_typescript",
19                                "target_out_dir")
20
21action("build_linter") {
22  sources = [
23    "./package.json",
24    "./src/cli/CommandLineParser.ts",
25    "./src/cli/ConsoleLogger.ts",
26    "./src/cli/LinterCLI.ts",
27    "./src/cli/LoggerImpl.ts",
28    "./src/cli/main.ts",
29    "./src/lib/BaseTypeScriptLinter.ts",
30    "./src/lib/CommandLineOptions.ts",
31    "./src/lib/CookBookMsg.ts",
32    "./src/lib/FaultAttrs.ts",
33    "./src/lib/FaultDesc.ts",
34    "./src/lib/IncrementalLintInfo.ts",
35    "./src/lib/InteropTypescriptLinter.ts",
36    "./src/lib/IsEtsFileCallback.ts",
37    "./src/lib/IsFileFromModuleCallback.ts",
38    "./src/lib/LintRunResult.ts",
39    "./src/lib/LinterConfig.ts",
40    "./src/lib/LinterOptions.ts",
41    "./src/lib/LinterRunner.ts",
42    "./src/lib/Logger.ts",
43    "./src/lib/ProblemInfo.ts",
44    "./src/lib/ProblemSeverity.ts",
45    "./src/lib/Problems.ts",
46    "./src/lib/TypeScriptLinter.ts",
47    "./src/lib/TypeScriptLinterConfig.ts",
48    "./src/lib/autofixes/AutofixTitles.ts",
49    "./src/lib/autofixes/Autofixer.ts",
50    "./src/lib/autofixes/QuasiEditor.ts",
51    "./src/lib/autofixes/ReportAutofixCallback.ts",
52    "./src/lib/autofixes/SymbolCache.ts",
53    "./src/lib/statistics/FileProblemStatistics.ts",
54    "./src/lib/statistics/FileStatistics.ts",
55    "./src/lib/statistics/ProjectStatistics.ts",
56    "./src/lib/statistics/StatisticsLogger.ts",
57    "./src/lib/ts-compiler/Compiler.ts",
58    "./src/lib/ts-compiler/FormTscOptions.ts",
59    "./src/lib/ts-compiler/ResolveSdks.ts",
60    "./src/lib/ts-diagnostics/GetTscDiagnostics.ts",
61    "./src/lib/ts-diagnostics/TSCCompiledProgram.ts",
62    "./src/lib/ts-diagnostics/TransformTscDiagnostics.ts",
63    "./src/lib/ts-diagnostics/TypeScriptDiagnosticsExtractor.ts",
64    "./src/lib/utils/TsUtils.ts",
65    "./src/lib/utils/consts/ArkTS2Rules.ts",
66    "./src/lib/utils/consts/ArktsIgnorePaths.ts",
67    "./src/lib/utils/consts/BuiltinGenericConstructor.ts",
68    "./src/lib/utils/consts/DefaultDecoratorWhitelist.ts",
69    "./src/lib/utils/consts/ESObject.ts",
70    "./src/lib/utils/consts/ExtendedBaseTypes.ts",
71    "./src/lib/utils/consts/ExtensionName.ts",
72    "./src/lib/utils/consts/FunctionHasNoReturnErrorCode.ts",
73    "./src/lib/utils/consts/InValidIndentifierKeywords.ts",
74    "./src/lib/utils/consts/LikeFunction.ts",
75    "./src/lib/utils/consts/LimitedStandardUtilityTypes.ts",
76    "./src/lib/utils/consts/LimitedStdAPI.ts",
77    "./src/lib/utils/consts/NonInitializablePropertyDecorators.ts",
78    "./src/lib/utils/consts/NonReturnFunctionDecorators.ts",
79    "./src/lib/utils/consts/PropertyHasNoInitializerErrorCode.ts",
80    "./src/lib/utils/consts/SendableAPI.ts",
81    "./src/lib/utils/consts/SharedModuleAPI.ts",
82    "./src/lib/utils/consts/StandardLibraries.ts",
83    "./src/lib/utils/consts/StdClassVariableDeclarations.ts",
84    "./src/lib/utils/consts/SupportedDetsIndexableTypes.ts",
85    "./src/lib/utils/consts/TsSuffix.ts",
86    "./src/lib/utils/consts/TypedArrays.ts",
87    "./src/lib/utils/consts/VersionInfo.ts",
88    "./src/lib/utils/functions/ContainsThis.ts",
89    "./src/lib/utils/functions/DiagnosticChecker.ts",
90    "./src/lib/utils/functions/ForEachNodeInSubtree.ts",
91    "./src/lib/utils/functions/GetScriptKind.ts",
92    "./src/lib/utils/functions/HasPredecessor.ts",
93    "./src/lib/utils/functions/IsStdLibrary.ts",
94    "./src/lib/utils/functions/IsStruct.ts",
95    "./src/lib/utils/functions/LibraryTypeCallDiagnosticChecker.ts",
96    "./src/lib/utils/functions/LogTscDiagnostic.ts",
97    "./src/lib/utils/functions/MergeArrayMaps.ts",
98    "./src/lib/utils/functions/NameGenerator.ts",
99    "./src/lib/utils/functions/PathHelper.ts",
100    "./src/lib/utils/functions/SupportedStdCallAPI.ts",
101    "./src/lib/utils/functions/identiferUseInValueContext.ts",
102    "./src/lib/utils/functions/isAssignmentOperator.ts",
103    "./src/lib/utils/functions/isIntrinsicObjectType.ts",
104  ]
105  script = "build_linter.py"
106  deps = [ "../../arkguard:build_arkguard" ]
107
108  args = [
109    "--source-path",
110    rebase_path(get_path_info(".", "abspath")),
111    "--output-path",
112    rebase_path("$target_gen_dir"),
113    "--npm",
114    rebase_path(npm_path),
115    "--typescript",
116    rebase_path("${typescript_dir}/ohos-typescript-4.9.5-r4.tgz"),
117    "--version",
118    linter_version,
119  ]
120
121  outputs = [ "$target_gen_dir" ]
122}
123
124ohos_copy("ets2panda_build_linter") {
125  deps = [ ":build_linter" ]
126  sources = [ rebase_path("$target_gen_dir") ]
127  outputs = [ target_out_dir + "/$target_name" ]
128  module_source_dir = target_out_dir + "/$target_name"
129  module_install_name = ""
130  part_name = "ets_frontend"
131  subsystem_name = "arkcompiler"
132}
133