From 5cbfc3476c21665b412449e9e5f9be26199e40e2 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Tue, 19 Oct 2021 17:14:55 +0800 Subject: [PATCH] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. --- convertxml/build_ts_js.py | 21 +++++++++++++++++---- convertxml/src/js_convertxml.ts | 4 ++-- uri/build_ts_js.py | 27 +++++++++++++++++++++------ uri/src/js_uri.ts | 2 +- url/build_ts_js.py | 22 ++++++++++++++++++---- 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py index a5bad68b..4c4993e0 100755 --- a/convertxml/build_ts_js.py +++ b/convertxml/build_ts_js.py @@ -15,6 +15,12 @@ import os import platform import argparse +import subprocess + +def run_command(cmd): + print(" ".join(cmd)) + proc = subprocess.Popen(cmd) + proc.wait() if __name__ == '__main__': @@ -26,7 +32,14 @@ if __name__ == '__main__': help='the converted target file') input_arguments = parser.parse_args() - os.system('../../../../prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node ' - '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc') - os.system('cp -r ./out/js_convertxml.js ' + input_arguments.dst_file) - os.system('rm -rf ./out') \ No newline at end of file + node = '../../../../prebuilts/build-tools/common/nodejs/\ +node-v12.18.4-linux-x64/bin/node' + tsc = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc' + cmd = [node, tsc] + run_command(cmd) + + cmd = ['cp', "-r", './out/js_convertxml.js', input_arguments.dst_file] + run_command(cmd) + + cmd = ['rm', "-rf", './out'] + run_command(cmd) \ No newline at end of file diff --git a/convertxml/src/js_convertxml.ts b/convertxml/src/js_convertxml.ts index 3e9b4c03..33dadea6 100644 --- a/convertxml/src/js_convertxml.ts +++ b/convertxml/src/js_convertxml.ts @@ -16,7 +16,7 @@ declare function requireInternal(s : string) : any; const convertXml = requireInternal("ConvertXML"); class ConvertXml { - convertxmlclass; + convertxmlclass : any; constructor() { this.convertxmlclass = new convertXml.ConvertXml(); } @@ -107,7 +107,7 @@ function DealPriorReplace(strXml : string, idx : any, idxThir : any) return strXml; } -function DealLaterReplace(strXml, idx, idxThir) +function DealLaterReplace(strXml : string, idx : any, idxThir : any) { var i = idx + 1; for (; i < idxThir ; i++) { diff --git a/uri/build_ts_js.py b/uri/build_ts_js.py index 6aec6835..f4484ff7 100755 --- a/uri/build_ts_js.py +++ b/uri/build_ts_js.py @@ -12,21 +12,36 @@ # 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 os import platform import argparse +import subprocess + +def run_command(cmd): + print(" ".join(cmd)) + proc = subprocess.Popen(cmd) + proc.wait() if __name__ == '__main__': build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) os.chdir("%s/base/compileruntime/js_api_module/uri" % build_path) - + parser = argparse.ArgumentParser() parser.add_argument('--dst-file', help='the converted target file') input_arguments = parser.parse_args() - - os.system('../../../../prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node ' - '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc') - os.system('cp -r ./out/js_uri.js ' + input_arguments.dst_file) - os.system('rm -rf ./out') \ No newline at end of file + + node = '../../../../prebuilts/build-tools/common/nodejs/\ +node-v12.18.4-linux-x64/bin/node' + tsc = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc' + cmd = [node, tsc] + run_command(cmd) + + cmd = ['cp', "-r", './out/js_uri.js', input_arguments.dst_file] + run_command(cmd) + + cmd = ['rm', "-rf", './out'] + run_command(cmd) \ No newline at end of file diff --git a/uri/src/js_uri.ts b/uri/src/js_uri.ts index a8ce10e8..2e53e1dd 100644 --- a/uri/src/js_uri.ts +++ b/uri/src/js_uri.ts @@ -96,7 +96,7 @@ function toAscllString(uriStr:any) { } } -function createNewUri(uriStr) { +function createNewUri(uriStr:string) { return new URI(uriStr); } diff --git a/url/build_ts_js.py b/url/build_ts_js.py index 5edfb67a..79591be1 100755 --- a/url/build_ts_js.py +++ b/url/build_ts_js.py @@ -12,9 +12,16 @@ # 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 os import platform import argparse +import subprocess + +def run_command(cmd): + print(" ".join(cmd)) + proc = subprocess.Popen(cmd) + proc.wait() if __name__ == '__main__': @@ -26,7 +33,14 @@ if __name__ == '__main__': help='the converted target file') input_arguments = parser.parse_args() - os.system('../../../../prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node ' - '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc') - os.system('cp -r ./out/js_url.js ' + input_arguments.dst_file) - os.system('rm -rf ./out') \ No newline at end of file + node = '../../../../prebuilts/build-tools/common/nodejs/\ +node-v12.18.4-linux-x64/bin/node' + tsc = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc' + cmd = [node, tsc] + run_command(cmd) + + cmd = ['cp', "-r", './out/js_url.js', input_arguments.dst_file] + run_command(cmd) + + cmd = ['rm', "-rf", './out'] + run_command(cmd) \ No newline at end of file -- Gitee