Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: Iad9f14789671ea6615d6d937e8ff97f384c5d456
This commit is contained in:
houhaoyu
2021-10-15 09:34:26 +08:00
7 changed files with 96 additions and 20 deletions
+57 -12
View File
@@ -1,4 +1,15 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("//build/ohos/ace/ace.gni")
@@ -13,9 +24,11 @@ ets_loader_declarations_dir = get_label_info(":build_ets_loader_library",
ets_loader_component_config_file =
get_label_info(":build_ets_loader_library", "target_out_dir") +
"/component_config.json"
ets_sysResource = get_label_info(":build_ets_sysResource", "target_out_dir") +
"/sysResource.js"
action("build_ets_loader_library") {
script = "//developtools/ace-ets2bundle/build_ets_loader_library.py"
script = "build_ets_loader_library.py"
depfile = "$target_gen_dir/$target_name.d"
outputs = [
ets_loader_lib_dir,
@@ -24,14 +37,18 @@ action("build_ets_loader_library") {
ets_loader_component_config_file,
]
_ets_loader_dir = "//developtools/ace-ets2bundle/compiler"
_ets_loader_dir = "compiler"
if (is_standard_system) {
_ace_config_dir = "compiler"
} else {
_ace_config_dir = "//prebuilts/ace-toolkit/ets-loader/compiler"
}
_declarations_file_dir = "//interface/sdk-js/api/@internal/component/ets"
_babel_js = _ets_loader_dir + "/node_modules/@babel/cli/bin/babel.js"
_babel_config_js = _ets_loader_dir + "/babel.config.js"
_uglify_source_js = _ets_loader_dir + "/uglify-source.js"
_build_peg_js = _ets_loader_dir + "/build_peg.js"
_build_declarations_file_js = _ets_loader_dir + "/build_declarations_file.js"
_babel_js = _ace_config_dir + "/node_modules/@babel/cli/bin/babel.js"
_babel_config_js = _ace_config_dir + "/babel.config.js"
_uglify_source_js = _ace_config_dir + "/uglify-source.js"
_build_declarations_file_js = _ace_config_dir + "/build_declarations_file.js"
inputs = [
_babel_config_js,
@@ -43,11 +60,19 @@ action("build_ets_loader_library") {
# different host platform nodejs tool directory
if (host_os == "linux") {
nodejs_path =
"//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node"
if (is_standard_system) {
nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node"
} else {
nodejs_path =
"//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/node"
}
} else if (host_os == "mac") {
nodejs_path =
"//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64/bin/node"
if (is_standard_system) {
nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64/bin/node"
} else {
nodejs_path =
"//prebuilts/ace-toolkit/nodejs/node-v12.18.4-darwin-x64/bin/node"
}
} else {
assert(false, "Unsupported host_os: $host_os")
}
@@ -84,6 +109,22 @@ action("build_ets_loader_library") {
]
}
action("build_ets_sysResource") {
script = "//foundation/ace/huawei_proprietary/tools/ets-loader/generateSysResource.py"
outputs = [ ets_sysResource ]
_id_defined_json =
"//utils/resources/systemres/main/resources/base/element/id_defined.json"
inputs = [ _id_defined_json ]
args = [
"--input-json",
rebase_path(_id_defined_json, root_build_dir),
"--output-js",
rebase_path(ets_sysResource, root_build_dir),
]
}
ohos_copy("ets_loader") {
deps = [ ":build_ets_loader_library" ]
sources = [
@@ -95,6 +136,10 @@ ohos_copy("ets_loader") {
"compiler/webpack.config.js",
ets_loader_component_config_file,
]
if (!is_standard_system) {
deps += [ ":build_ets_sysResource" ]
sources += [ ets_sysResource ]
}
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
+11 -3
View File
@@ -18,9 +18,17 @@ import sys
import subprocess
import argparse
sys.path.append(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'build'))
from scripts.util import build_utils # noqa: E402
standard_system_build_dir = os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir, 'build', 'scripts', 'util')
build_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, 'build', 'maple', 'java', 'util')
if os.path.exists(standard_system_build_dir):
sys.path.append(
os.path.join(standard_system_build_dir, os.pardir, os.pardir))
from scripts.util import build_utils # noqa: E402
if os.path.exists(build_dir):
sys.path.append(os.path.join(build_dir, os.pardir, os.pardir, os.pardir))
from maple.java.util import build_utils # noqa: E402
def parse_args():
+1 -1
View File
@@ -35,7 +35,7 @@
"dependencies": {
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^8.1.0",
"deccjsunit": "latest",
"deccjsunit": "1.0.3",
"log4js": "^6.3.0",
"pegjs": "^0.10.0",
"ts-loader": "^8.0.12",
+11
View File
@@ -64,6 +64,17 @@ export class ResultStates {
private reset: string = '\u001b[39m';
public apply(compiler: Compiler): void {
compiler.hooks.compilation.tap("SourcemapFixer", compilation => {
compilation.hooks.afterProcessAssets.tap("SourcemapFixer", assets => {
Reflect.ownKeys(assets).forEach(key => {
if (/\.map/.test(key.toString())) {
assets[key]._value = assets[key]._value.toString().replace('.ets?entry', '.ets');
}
});
}
);
});
compiler.hooks.done.tap('Result States', (stats: Stats) => {
this.mStats = stats;
this.warningCount = 0;
+8 -4
View File
@@ -203,7 +203,7 @@ export const COMPONENT_MAP: any = {
Progress: {
atomic: true,
attrs: [
'value', 'color', 'cricularStyle'
'value', 'color', 'cricularStyle', 'circularStyle'
]
},
Rect: {
@@ -249,7 +249,7 @@ export const COMPONENT_MAP: any = {
},
Blank: {
parents: ['Row', 'Column'],
automic: true,
atomic: true,
attrs: ['color']
},
RowSplit: {
@@ -287,6 +287,10 @@ export const COMPONENT_MAP: any = {
atomic: true,
attrs: ['checked', 'onChange']
},
Web: {
atomic: true,
attrs: ['pagestart', 'pagefinish', 'error','message', 'reload']
},
GeometryView: {
atomic: true
},
@@ -335,11 +339,11 @@ export const COMPONENT_MAP: any = {
},
Menu: {
children: ['Option'],
attrs: ['show', 'showPosition'],
attrs: ['show', 'showPosition', 'fontColor', 'fontSize', 'fontWeight', 'fontFamily'],
},
Option: {
parents: ['Menu'],
attrs: [],
attrs: ['fontColor', 'fontSize', 'fontWeight', 'fontFamily'],
},
};
+7
View File
@@ -65,6 +65,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function {
pagesDir = path.resolve(path.dirname(node.fileName));
if (process.env.compiler === BUILD_ON) {
if (!ut && (path.basename(node.fileName) === 'app.ets.ts' || !/\.ets\.ts$/.test(node.fileName))) {
node = ts.visitEachChild(node, processResourceNode, context);
return node;
}
collectComponents(node);
@@ -102,6 +103,12 @@ export function processUISyntax(program: ts.Program, ut = false): Function {
}
return ts.visitEachChild(node, processAllNodes, context);
}
function processResourceNode(node: ts.Node): ts.Node {
if (isResource(node)) {
node = processResourceData(node as ts.CallExpression);
}
return ts.visitEachChild(node, processResourceNode, context);
}
function validateSourceFileNode(node: ts.SourceFile): void {
if (program) {
node = ts.visitEachChild(node, validateAllNodes, context);
+1
View File
@@ -4,6 +4,7 @@
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"importsNotUsedAsValues": "preserve",
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,