diff --git a/BUILD.gn b/BUILD.gn index 48f56d32b880f502015541ac49aafc833aa9422c..64547508c5fc043576f01c2b75192f2ebd106888 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -21,6 +21,10 @@ group("arkcompiler_params") { deps = [ "libpandafile:arkcompiler_params" ] } +group("ark_device_tools") { + deps = [ "$ark_root/verifier:ark_verifier" ] +} + group("ark_packages") { deps = [] if (host_os != "mac") { diff --git a/bundle.json b/bundle.json index 62049bcc946432042aace27719a33bc1d1310174..663822a1c59b0c73283254bc7de896e81837d4a7 100644 --- a/bundle.json +++ b/bundle.json @@ -36,7 +36,8 @@ "sub_component": [ "//arkcompiler/runtime_core:arkcompiler_params", "//arkcompiler/runtime_core/arkplatform:arkplatform_packages", - "//arkcompiler/runtime_core/static_core:ark_packages" + "//arkcompiler/runtime_core/static_core:ark_packages", + "//arkcompiler/runtime_core:ark_device_tools" ], "inner_kits": [ { diff --git a/verifier/BUILD.gn b/verifier/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a46016d1df0e07c8a54d18a555c572f144e4cafe --- /dev/null +++ b/verifier/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2023 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("//arkcompiler/runtime_core/ark_config.gni") + +ohos_executable("ark_verifier") { + sources = [ "verify.cpp" ] + + include_dirs = [ + "$target_gen_dir", + "$root_gen_dir/libpandabase", + ] + + configs = [ + "$ark_root:ark_config", + "$ark_root/libpandabase:arkbase_public_config", + ] + + install_enable = true + part_name = "runtime_core" + subsystem_name = "arkcompiler" +} diff --git a/verifier/verifier.cpp b/verifier/verifier.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b508fdfb57b28401caf479e4f62b817583676758 --- /dev/null +++ b/verifier/verifier.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023 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. + */ + +namespace panda::verifier { + +} // namespace panda::verifier \ No newline at end of file diff --git a/verifier/verifier.h b/verifier/verifier.h new file mode 100644 index 0000000000000000000000000000000000000000..80ffd7ae5683562e1f60baba909e53965a3abc3e --- /dev/null +++ b/verifier/verifier.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 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. + */ + + +namespace panda::verifier { +class Verifier { + +}; +} // namespace name diff --git a/verifier/verify.cpp b/verifier/verify.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c4897f17642af7ad809e1dad50a73f201cc9890 --- /dev/null +++ b/verifier/verify.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023 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. + */ + +#include "utils/pandargs.h" + +void PrintHelp(panda::PandArgParser &pa_parser) +{ + std::cerr << "Usage:" << std::endl; + std::cerr << "ark_disasm [options] input_file output_file" << std::endl << std::endl; + std::cerr << "Supported options:" << std::endl << std::endl; + std::cerr << pa_parser.GetHelpString() << std::endl; +} + +bool Verify([[maybe_unused]] const std::string &input_file) +{ + return true; +} + +bool PorcessArgs(panda::PandArgParser &pa_parser, const panda::PandArg &input_file, int argc, + const char **argv) +{ + if (!pa_parser.Parse(argc, argv)) { + PrintHelp(pa_parser); + return false; + } + + if (input_file.GetValue().empty()) { + PrintHelp(pa_parser); + return false; + } + + return true; +} + +int main(int argc, const char **argv) +{ + panda::PandArg help("help", false, "Print this message and exit"); + panda::PandArg input_file("input_file", "", "Path to the abc file"); + + panda::PandArgParser pa_parser; + pa_parser.Add(&help); + pa_parser.Add(&input_file); + + if (!PorcessArgs(pa_parser, input_file, argc, argv)) { + return 1; + } + + return Verify(input_file.GetValue()) ? 0 : 1; +} \ No newline at end of file