Cross-platform resource calling method and device and storage medium

By pre-setting scaffolding tools and capability mapping tables, the methods and devices for cross-platform resource invocation solve the problem of poor code reusability across different platforms, realize unified cross-platform invocation, reduce development costs, and improve code maintainability and user experience.

CN120994188APending Publication Date: 2025-11-21HANGZHOU TUYA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511014160.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-22
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In existing technologies, different codes need to be written for different mobile operating system platforms to achieve the same function, resulting in high development costs, long development cycles, and complex code maintenance.

Method used

By using pre-set scaffolding tools and capability mapping tables, the pre-set interfaces of the target platform are determined and converted into callable interfaces, enabling methods and devices for cross-platform resource invocation, including language definition modules and parsing modules, supporting a unified invocation method across platforms.

Benefits of technology

It reduces development costs and time, improves code reusability and maintainability, and especially enhances the user experience of mini programs on the HarmonyOS platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994188A_ABST
    Figure CN120994188A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-platform resource calling method and device and a storage medium. The method comprises the steps of determining a calling object of an application program on a target platform according to a received calling request of the application program; determining a preset interface, corresponding to the calling object, of the target platform according to the calling object; under the condition that the application program runs on the target platform, converting the preset interface into a callable interface; and executing the callable interface to enable the application program to run the calling object on the target platform.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software development, in particular to a cross-platform resource calling method and device and storage medium. BACKGROUND

[0002] Currently, mobile operating systems such as Android system platform, iOS system platform, and Hongmeng system platform, and fields such as small program front-end development and React Native (RN) front-end development have their own development specifications and technology stacks. Developers need to write code for different platforms to implement the same function. The present application found that writing code for different platforms to implement the same function not only increases development cost and development cycle, but also makes code maintenance complex.

[0003] The content of the part of the background is only the technology known by the discloser, and does not necessarily represent the prior art in the field. SUMMARY

[0004] According to an aspect of the present application, the present application provides a cross-platform resource calling method, which comprises: determining the calling object of an application on a target platform according to the calling request of the application received; determining the preset interface of the target platform corresponding to the calling object according to the calling object; converting the preset interface into a callable interface under the condition that the application runs on the target platform; and executing the callable interface to enable the application to run the calling object on the target platform.

[0005] According to some embodiments of the present application, the step of determining the preset interface of the target platform corresponding to the calling object according to the calling object comprises: determining the preset interface according to the preset scaffolding tool and the calling object.

[0006] According to some embodiments of the present application, the step of determining the preset interface according to the preset scaffolding tool and the calling object comprises: determining the code template of the target platform according to the user instruction through the preset scaffolding tool; performing parameter configuration on the code template according to the user instruction through the preset scaffolding tool to obtain the parameter-configured code template; and determining the preset interface according to the calling object and the parameter-configured code template through the preset scaffolding tool.

[0007] According to some embodiments of the present application, the step of executing the callable interface to enable the application to run the calling object on the target platform comprises: determining the application programming interface of the callable interface according to the preset capability mapping table and the callable interface; and executing the callable interface through the application programming interface to enable the application to run the calling object on the target platform.

[0008] According to some embodiments of the present application, the target platform comprises an Android system platform, an iOS system platform and a Harmony system platform.

[0009] According to some embodiments of the present application, the target platform further comprises a mini-program front end and a ReactNative front end.

[0010] According to another aspect of the present application, the present application provides a device for cross-platform calling of resources, the device comprising a language definition module and a language analysis module. The language definition module determines a calling object of an application on a target platform according to a calling request of the application received; the language analysis module determines a preset interface of the target platform corresponding to the calling object according to the calling object; in the case that the application runs on the target platform, the language analysis module further converts the preset interface into a callable interface; and the language analysis module further executes the callable interface so as to make the application run the calling object on the target platform.

[0011] According to some embodiments of the present application, the device further comprises a preset scaffolding tool module. The preset scaffolding tool module provides a preset scaffolding tool, and the language analysis module determines the preset interface according to the calling object through the preset scaffolding tool.

[0012] According to some embodiments of the present application, the device further comprises a code template library module. The code template library module stores a code template of the target platform; the language analysis module determines the code template of the target platform according to a user instruction through the preset scaffolding tool, the language analysis module performs parameter configuration on the code template according to the user instruction through the preset scaffolding tool to obtain a parameter-configured code template, and the language analysis module determines the preset interface according to the calling object and the parameter-configured code template through the preset scaffolding tool.

[0013] According to some embodiments of the present application, the device further comprises a capability mapping table module. The capability mapping table module stores a preset capability mapping table; the language analysis module further determines an application programming interface of the callable interface according to the preset capability mapping table and the callable interface, and the language analysis module further executes the callable interface through the application programming interface so as to make the application run the calling object on the target platform.

[0014] According to another aspect of the present application, the present application further provides a non-volatile computer readable storage medium having a computer program stored thereon, the computer program being executable by a processor to implement the method for cross-platform calling of resources as described above.

[0015] According to another aspect of the present application, the present application further provides an electronic device, comprising: one or more processors; a storage device configured to store one or more programs, which when executed by the one or more processors, enable the one or more processors to implement the method for cross-platform calling resource as described above.

[0016] According to another aspect of the present application, the present application further provides a computer program product, comprising: a computer program stored on a computer readable storage medium; the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method for cross-platform calling resource as described above. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort based on these drawings.

[0018] Figure 1 A flowchart of the method 1000 according to an embodiment of the present application is shown;

[0019] Figure 2 A flowchart of the step S200 according to an embodiment of the present application is shown;

[0020] Figure 3 A flowchart of the step S210 according to an embodiment of the present application is shown;

[0021] Figure 4 A flowchart of the step S400 according to an embodiment of the present application is shown;

[0022] Figure 5 A structural diagram of the device 200 according to an embodiment of the present application is shown;

[0023] Figure 6 Another structural diagram of the device 200 according to an embodiment of the present application is shown.

[0024] LEGEND OF THE FIGURES

[0025] Device 200; language definition module 210; language analysis module 220; preset scaffold tool module 230; code template library module 240; capability mapping table module 250. DETAILED DESCRIPTION

[0026] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings. Example embodiments, however, can be implemented in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example embodiments to those skilled in the art. Like reference numerals refer to like elements throughout the several views.

[0027] The described features, structures, or characteristics can be combined in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the technology can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In these instances, well-known structures, methods, devices, implementations, materials, and so forth can not be described in detail.

[0028] Furthermore, the term "comprising" and "including" and variants thereof as used herein are intended to be equivalent in meaning to the term "consisting of" and variants thereof, such that they are used interchangeably and have the same meaning. The terms "comprising" and "including" and variants thereof as used herein are intended to be open and permissive, and not to exclude or deny the inclusion of additional steps, elements, components, materials, features, steps, options, etc.

[0029] The terms "first", "second", and the like, herein do not necessarily denote any ordinal, chronological or spatial relationship, number or type, but are used to more distinctly identify different objects.

[0030] The technical solutions of the present application will be described clearly and completely in the following combined with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0031] The English and its English full name and corresponding Chinese interpretation involved in the present application are as follows:

[0032] UI, User Interface, user interface;

[0033] API, Application Programming Interface, application programming interface.

[0034] According to an aspect of the present application, the present application provides a method 1000 for cross-platform calling of resources. The method 1000 can be executed by a computer system.

[0035] Referring toFigure 1 The method 1000 can include steps S100-S500.

[0036] In step S100, the computer system determines, according to the received calling request of the application program, a calling object of the application program on a target platform.

[0037] According to an example embodiment, the application program can be a collection of running specific instructions, codes and data, for example, the application program can include a mini program, a native application, a web application and an enterprise application (such as a doodle mini program) and the like.

[0038] The target platform can be an operating platform for running the application program. The calling object can be a capability of the target platform that needs to be called in the running case of the application program. For example, the calling object can include camera calling, geographic location acquisition, mini program UI configuration and hardware device capability control and the like. The calling request can be a request of the application program to call the calling object of the target platform.

[0039] For example, the computer system can describe the calling object by a domain-specific language (DSL). The DSL has a concise and clear syntax structure, which is easy for developers to understand and use.

[0040] The computer system can determine the calling object of the target platform described by the DSL language according to the calling request.

[0041] In step S200, the computer system determines, according to the calling object, a preset interface of the target platform corresponding to the calling object.

[0042] According to an example embodiment, the preset interface can be a runnable code of the target platform. The preset interface can be a native code or an interface calling code.

[0043] For example, the computer system can parse the calling object into a native code or an interface calling code of the target platform through a preset scaffolding tool.

[0044] In step S300, the computer system converts the preset interface into a callable interface in the running case of the application program on the target platform.

[0045] According to an example embodiment, the callable interface can be a capability calling code, and the capability calling code can be a runtime code for implementing the calling of the calling object.

[0046] Optionally, step S300 can be specifically: the computer system converts the preset interface into the callable interface through a DSL parser in the running case of the application program on the target platform.

[0047] For example, the computer system can convert the native code or the interface calling code into the capability calling code according to the target platform through the DSL parser.

[0048] In step S400, the computer system executes the callable interface so that the application program runs the calling object on the target platform.

[0049] According to the example embodiment, the computer system can execute the callable interface, i.e., run the capability calling code, through the DSL parser so that the application program can perform the calling operation, i.e., the application program can call the calling object of the target platform.

[0050] Through the above-mentioned embodiment, the above-mentioned technical solution can determine the calling object of the application program on the target platform through the calling request received by the application program. The above-mentioned technical solution can determine the preset interface corresponding to the calling object of the target platform through the calling object. In the case that the application program runs on the target platform, the above-mentioned technical solution can be converted into the callable interface through the preset interface. The above-mentioned technical solution can execute the callable interface so that the application program runs the calling object on the target platform.

[0051] The inventors of the present application also found that in the prior art, the capability calling manner of the applet as a lightweight application form is different on different system platforms. The method of the present application can determine the preset interface and the callable interface, and realize the application program (such as the applet) calling the same function in a unified manner on different target platforms, thereby solving the technical problem that the capability calling manner of the applet is different on different system platforms.

[0052] Moreover, the method of the present application can reduce the development cost and the development cycle, and improve the code reusability and maintainability.

[0053] Optionally, the target platform includes an Android system platform, an iOS system platform, a Harmony system platform, an applet front end, and a ReactNative front end.

[0054] Optionally, referring to Figure 2 , step S200 can include step S210.

[0055] In step S210, the computer system determines the preset interface according to the preset scaffolding tool and the calling object.

[0056] According to an example embodiment, the preset scaffolding tool can be a tool for building an initial structure and a configuration environment of an application. The computer system can determine, by the preset scaffolding tool, a code template of a target platform according to a user instruction. The computer system can perform parameter configuration on the code template to obtain a parameter-configured code template according to the user instruction by the preset scaffolding tool. The computer system can determine a preset interface according to the calling object and the parameter-configured code template by the preset scaffolding tool.

[0057] Optionally, referring to Figure 3 , step S210 can include steps S211-S213.

[0058] In step S211, the computer system determines, by the preset scaffolding tool, a code template of a target platform according to a user instruction.

[0059] According to an example embodiment, the user instruction can be information of an application issued by a user. The user instruction can include information such as a project name, a functional requirement description of a capability to be developed (i.e., a functional requirement description of a calling object), and the like. The computer system can receive the user instruction by receiving the instruction or a graphical interface.

[0060] The code template can be a pre-defined code framework or structure of an application. The code template can include a basic code structure and a general functional module. The basic code structure can be a pre-defined code organization manner and file architecture for the target platform. The general functional module can be a functional code block that is repeatedly used in multiple target platforms.

[0061] The code template can be set in a built general code template library module. Each target platform corresponds to a code template.

[0062] The computer system can select, by the preset scaffolding tool, a code template of a target platform from the code template library according to a user instruction.

[0063] In step S212, the computer system performs parameter configuration on the code template to obtain a parameter-configured code template according to a user instruction by the preset scaffolding tool.

[0064] According to an example embodiment, the computer system can perform parameter configuration on the selected code template by the preset scaffolding tool. The parameter configuration can be to define and manage application configuration information in the form of parameters. The parameter-configured code template can include a parameter-configured basic code structure and a parameter-configured general functional module.

[0065] For example, the parameterized configuration can include that the computer system generates the function engineering code of the target platform (an iOS system platform, an Android system platform, or a Harmony system platform) based on the initial code framework of the target platform according to the module name, version, and related function API in the user instruction by using the preset scaffolding tool, and the function engineering code contains the function interface corresponding to the description of the calling object.

[0066] In step S213, the computer system determines the preset interface according to the calling object and the parameterized code template by using the preset scaffolding tool.

[0067] According to an example embodiment, the computer system can locate the calling object in the parameterized basic code structure and the parameterized general function module by using the preset scaffolding tool, and match the calling object with the function in the parameterized code template, so as to determine the preset interface.

[0068] According to an example embodiment, for the specific function module of different target platforms, the computer system can generate the native code and the interface calling code corresponding to the target platform automatically according to the characteristics of the target platform and the user demand by using the preset scaffolding tool.

[0069] Through the above-mentioned embodiments, the technical solution can determine the code template of the target platform according to the user instruction by using the preset scaffolding tool. The technical solution can perform parameter configuration on the code template according to the user instruction by using the preset scaffolding tool, so as to obtain the parameterized code template. The technical solution can determine the preset interface according to the calling object and the parameterized code template by using the preset scaffolding tool.

[0070] The method provided in the application can add the Harmony end code generated by the preset scaffolding tool, support the application program to call the same function in a unified manner on the Harmony system platform, and improve the reusability and maintainability of the code.

[0071] Optionally, referring to Figure 4 , the step S400 can include the step S410 and the step S420.

[0072] In step S410, the computer system determines the application programming interface of the callable interface according to the preset capability mapping table and the callable interface.

[0073] According to an example embodiment, the preset capability mapping table can be a mapping tool that accurately maps the general capability described in the DSL to the specific implementation on the target platform. The preset capability mapping table can be generated in the component construction stage, and the preset capability mapping table can ensure the consistency of the calling object on different target platforms.

[0074] An application programming interface (API) can be a set of pre-defined functions or rules, which can allow an application to interact with a target platform. The API defines the way of communication between the application and the target platform, including the format of request, data type, and operation method, etc.

[0075] For example, the computer system can match the API corresponding to the callable interface (i.e., the capability calling code) according to the preset capability mapping table and the callable interface.

[0076] In step S420, the computer system executes the callable interface through the application programming interface, so that the application runs the calling object on the target platform.

[0077] According to an example embodiment, the computer system can find the specific implementation through the API corresponding to the callable interface (i.e., the capability calling code) through the preset capability mapping table, map the capability described in the DSL to the specific implementation on different target platforms, and execute the callable interface, so that the application can run the calling object on the target platform.

[0078] Through the above-mentioned embodiments, the above-mentioned technical solutions can determine the application programming interface of the callable interface through the preset capability mapping table and the callable interface. The above-mentioned technical solutions can execute the callable interface through the application programming interface, so that the application runs the calling object on the target platform.

[0079] The method provided in the present application can enable the application to implement the calling object through the DSL, and can enable the applet to call the capability on the HarmonyOS platform through the DSL, thereby improving the user experience of the applet on the HarmonyOS platform.

[0080] Optionally, step S100 can also be specifically: the computer system determines the calling object according to the calling request and the preset function description file.

[0081] According to an example embodiment, the preset function description file can be a calling capability description file of the application developed by the business function provider according to the DSL.

[0082] The computer system can determine the calling object described in the DSL language according to the calling request and the preset function description file.

[0083] Step S200 can also be specifically: the computer system determines the first preset interface of the Android system platform, the iOS system platform, and the HarmonyOS platform through the preset scaffolding tool and the calling object, and the second preset interface of the applet front end and the ReactNative front end.

[0084] According to an example embodiment, the first preset interface can be a code framework of an Android system platform, an iOS system platform, and a Harmony system platform, and the second preset interface can be a wrapping code of a mini-program front end and a React Native front end.

[0085] The computer system can parse the calling object into the code framework of the Android system platform, the iOS system platform, and the Harmony system platform, and the wrapping code of the mini-program front end and the React Native front end through the preset scaffolding tool.

[0086] The step S300 can further specifically be that, in a case where the application runs on the target platform, the computer system converts the first preset interface into a first callable interface and converts the second preset interface into a second callable interface through a DSL parser.

[0087] According to an example embodiment, the first callable interface can be a capability calling code of the Android system platform, the iOS system platform, and the Harmony system platform, and the second callable interface can be a capability calling code of the mini-program front end and the React Native front end.

[0088] The computer system can convert the code framework or the wrapping code into the capability calling code according to the target platform through the DSL parser.

[0089] According to an example embodiment, the computer system can further integrate the callable interface into a target project corresponding to the target platform and run the callable interface, so that the application can run the calling object on the target platform.

[0090] For example, the computer system can integrate the capability calling code of the Harmony system platform into a project of the Harmony, run the capability calling code through the DSL parser, so that the application can perform the calling operation on the Harmony system platform. The computer system can run the capability calling code of the mini-program front end through the DSL parser, so that the application can call the calling operation of the calling object of the mini-program front end.

[0091] According to an aspect of the present application, the present application provides a device 200 for cross-platform calling of resources. Referring to Figure 5 The device 200 includes a language definition module 210 and a language parsing module 220.

[0092] According to an example embodiment, the language definition module 210 determines a calling object of an application on a target platform according to a calling request of the application received.

[0093] The application can be a collection of running specific instructions, codes, and data, for example, the application can include a mini-program, a native application, a Web application, and an enterprise application (such as a doodling mini-program), etc.

[0094] The target platform can be an operating platform on which the application program runs. The invocation object can be an object that the application program needs to invoke the capability of the target platform in a running state. For example, the invocation object can include a camera invocation, a geographic position acquisition, a small program UI configuration, and a hardware device capability control, etc. The invocation request can be a request of the application program to invoke the invocation object of the target platform.

[0095] For example, the language definition module 210 can describe the invocation object by a domain-specific language (DSL). The DSL has a concise and clear syntax structure, which is easy for developers to understand and use.

[0096] The language definition module 210 can determine the invocation object of the target platform described by the DSL according to the invocation request.

[0097] According to an example embodiment, the language parsing module 220 determines a preset interface of the target platform corresponding to the invocation object according to the invocation object. The preset interface can be a runnable code of the target platform. The preset interface can be a native code or an interface invocation code. The language parsing module 220 can parse the invocation object into the native code or the interface invocation code of the target platform by a preset scaffolding tool.

[0098] According to an example embodiment, the language parsing module 220 further converts the preset interface into a callable interface in a running state of the application program on the target platform. The callable interface can be a capability invocation code, and the capability invocation code can be a running state code for implementing the invocation of the invocation object. The language parsing module 220 can be a DSL parser.

[0099] The language parsing module 220 converts the preset interface into the callable interface by the DSL parser in a running state of the application program on the target platform. For example, the DSL parser can convert the native code or the interface invocation code into the capability invocation code according to the target platform.

[0100] According to an example embodiment, the language parsing module 220 further executes the callable interface to enable the application program to run the invocation object on the target platform. For example, the DSL parser executes the callable interface, i.e., runs the capability invocation code, so that the application program can perform the invocation operation, i.e., the application program can invoke the invocation object of the target platform.

[0101] Through the above embodiment, the technical solution can determine the calling object of the application program on the target platform through the received calling request of the application program. The technical solution can determine the preset interface corresponding to the calling object of the target platform through the calling object. In the case that the application program runs on the target platform, the technical solution can convert the preset interface into a callable interface. The technical solution can execute the callable interface to enable the application program to run the calling object on the target platform.

[0102] The technical solution can determine the preset interface and the callable interface, and implement the application program (such as a small program) to call the same function in a unified manner on different target platforms, thereby solving the technical problem that the calling manner of the small program on different system platforms is different. Moreover, the method of the present application can reduce development cost and development cycle, and improve code reusability and maintainability.

[0103] Optionally, the target platform includes an Android system platform, an iOS system platform, a Harmony system platform, a small program front end, and a ReactNative front end.

[0104] Optionally, the apparatus 200 further includes a preset scaffolding tool module 230. The preset scaffolding tool module 230 provides a preset scaffolding tool. The preset scaffolding tool is a tool for building an initial structure of an application program and configuring an environment.

[0105] The language analysis module 220 further determines the preset interface according to the calling object through the preset scaffolding tool. For example, the language analysis module 220 can determine a code template of the target platform according to the user instruction through the preset scaffolding tool. The language analysis module 220 can perform parameter configuration on the code template according to the user instruction through the preset scaffolding tool to obtain a parameter-configured code template. The language analysis module 220 can determine the preset interface according to the calling object and the parameter-configured code template through the preset scaffolding tool.

[0106] Optionally, the apparatus 200 further includes a code template library module 240. The code template library module 240 stores a code template of the target platform.

[0107] The code template can be a pre-defined code framework or structure of the application program. The code template can include a basic code structure and a general function module. The basic code structure can be a pre-defined code organization manner and file architecture for the target platform. The general function module can be a function code block that is repeatedly used in multiple target platforms. Each target platform corresponds to a code template.

[0108] According to an example embodiment, the language analysis module 220 can determine a code template of the target platform according to the user instruction through the preset scaffolding tool. For example, the language analysis module 220 can select a code template of the target platform from a code template library according to the user instruction through the preset scaffolding tool.

[0109] According to an example embodiment, the language analysis module 220 can perform parameter configuration on the code template according to the user instruction through the preset scaffolding tool to obtain a parameter-configured code template.

[0110] The language analysis module 220 can perform parameter configuration on the selected code template through the preset scaffolding tool. The parameter configuration can define and manage the application program configuration information in the form of parameters. The parameter-configured code template can include a parameter-configured basic code structure and a parameter-configured general function module.

[0111] For example, the parameter configuration can include that the language analysis module 220 generates function engineering code of the target platform (iOS system platform / Android system platform / Hongmeng system platform) based on the initial code framework of the target platform according to the module name, version and related function API in the user instruction through the preset scaffolding tool, and the function engineering code contains the function interface corresponding to the description of the calling object.

[0112] According to an example embodiment, the language analysis module 220 can determine a preset interface according to the calling object and the parameter-configured code template through the preset scaffolding tool.

[0113] The language analysis module 220 can locate the calling object in the parameter-configured basic code structure and the parameter-configured general function module through the preset scaffolding tool, and match the calling object with the function in the parameter-configured code template, so as to determine the preset interface.

[0114] According to an example embodiment, for a specific function module of different target platforms, the language analysis module 220 can automatically generate native code and interface calling code corresponding to the target platform according to the target platform characteristics and user requirements through the preset scaffolding tool.

[0115] Through the above embodiments, the above technical solutions can determine a code template of a target platform according to a user instruction through a preset scaffolding tool. The above technical solutions can perform parameter configuration on the code template according to the user instruction through the preset scaffolding tool to obtain a parameter-configured code template. The above technical solutions can determine a preset interface according to a calling object and a parameter-configured code template through the preset scaffolding tool.

[0116] The technical solution can add a preset scaffold tool to generate a Hongmeng terminal code, support an application program to call the same function in a unified manner on a Hongmeng system platform, and improve code reusability and maintainability.

[0117] Optionally, the apparatus 200 further includes a capability mapping table module 250. The capability mapping table module 250 stores a preset capability mapping table. The preset capability mapping table can be a mapping tool for accurately mapping the general capabilities described in the DSL to specific implementations on the target platform. The preset capability mapping table can be generated during the component construction phase, and the preset capability mapping table can ensure the consistency of the calling objects on different target platforms.

[0118] An application programming interface (API) can be a set of predefined functions or rules, which can allow the application program and the target platform to interact. The API defines the communication method between the application program and the target platform, including the format of the request, the data type, and the operation method.

[0119] According to an example embodiment, the language analysis module 220 further determines the application programming interface of the callable interface according to the preset capability mapping table and the callable interface. For example, the language analysis module 220 can match the API corresponding to the callable interface (i.e., the capability calling code) according to the preset capability mapping table and the callable interface.

[0120] According to an example embodiment, the language analysis module 220 further executes the callable interface through the application programming interface, so that the application program runs the calling object on the target platform.

[0121] The language analysis module 220 can find the specific implementation through the API corresponding to the callable interface (i.e., the capability calling code) through the preset capability mapping table, map the capabilities described in the DSL to the specific implementation on different target platforms, and thus execute the callable interface. The application program can run the calling object on the target platform.

[0122] Through the above-mentioned embodiments, the technical solution can determine the application programming interface of the callable interface through the preset capability mapping table and the callable interface. The technical solution can execute the callable interface through the application programming interface, so that the application program runs the calling object on the target platform.

[0123] The technical solution described above can enable the application program to implement the calling object through the DSL, and enable the applet to call the capability on the Hongmeng system platform through the DSL, thereby improving the user experience of the applet on the Hongmeng system platform.

[0124] Optionally, the language definition module 210 determines the calling object according to the calling request and the preset function description file.

[0125] According to an example embodiment, the preset function description file can be a calling capability description file of an application developed by a service function provider according to the DSL.

[0126] The language definition module 210 can determine the calling object described by the DSL language according to the calling request and the preset function description file.

[0127] The language parsing module 220 determines the first preset interface of the Android system platform, the iOS system platform, and the Harmony system platform, and the second preset interface of the applet front end and the ReactNative front end through the preset scaffolding tool and the calling object.

[0128] According to an example embodiment, the first preset interface can be a code framework of the Android system platform, the iOS system platform, and the Harmony system platform, and the second preset interface can be a wrapped code of the applet front end and the ReactNative front end.

[0129] The language parsing module 220 can parse the calling object into the code framework of the Android system platform, the iOS system platform, and the Harmony system platform, and the wrapped code of the applet front end and the ReactNative front end through the preset scaffolding tool.

[0130] In the case that the application runs on the target platform, the language parsing module 220 converts the first preset interface into the first callable interface and the second preset interface into the second callable interface through the DSL parser.

[0131] According to an example embodiment, the first callable interface can be a capability calling code of the Android system platform, the iOS system platform, and the Harmony system platform, and the second callable interface can be a capability calling code of the applet front end and the ReactNative front end.

[0132] The language parsing module 220 can convert the code framework or the wrapped code into the capability calling code according to the target platform through the DSL parser.

[0133] According to an example embodiment, the language parsing module 220 can also integrate the callable interface into a target project corresponding to the target platform and run the callable interface, and the application can run the calling object on the target platform.

[0134] For example, the language parsing module 220 can integrate the capability invocation code of the Hongmeng system platform into the project of Hongmeng, run the capability invocation code through the DSL parser, so that the application program can perform the invocation operation on the Hongmeng system platform. The language parsing module 220 can run the capability invocation code of the applet front end through the DSL parser, so that the application program can invoke the invocation operation of the invocation object of the applet front end.

[0135] According to another aspect of the present application, the present application also provides a non-volatile computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, is capable of implementing the method for cross-platform invocation of resources as described above.

[0136] According to another aspect of the present application, the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement the method for cross-platform invocation of resources as described above.

[0137] According to another aspect of the present application, the present application also provides a computer program product, comprising: a computer program stored on a computer readable storage medium; the computer program comprising program instructions, which, when executed by a computer, cause the computer to perform the method for cross-platform invocation of resources as described above.

[0138] Finally, it should be noted that the above only describes the preferred embodiments of the present application and is not intended to limit the present application. Although the foregoing embodiments of the present application are described in detail, those skilled in the art can still modify the technical solutions of the foregoing embodiments or make equivalent replacements to some technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method of cross-platform invocation of resources, characterized by, The method comprises: determining, according to a received calling request of an application program, a calling object of the application program on a target platform; determining, according to the calling object, a preset interface of the target platform corresponding to the calling object; in a case where the application program runs on the target platform, converting the preset interface into a callable interface; executing the callable interface to enable the application program to run the calling object on the target platform.

2. The method of claim 1, wherein, The determining, according to the calling object, of the preset interface of the target platform corresponding to the calling object comprises: determining, by a preset scaffolding tool and the calling object, the preset interface.

3. The method of claim 2, wherein, The determining, according to the preset scaffolding tool and the calling object, of the preset interface comprises: determining, by the preset scaffolding tool, a code template of the target platform according to a user instruction; performing parameter configuration on the code template according to the user instruction by the preset scaffolding tool to obtain a parameter-configured code template; determining, by the preset scaffolding tool, the preset interface according to the calling object and the parameter-configured code template.

4. The method of claim 1, wherein, The converting the preset interface into the callable interface comprises: converting, by a DSL parser, the preset interface into the callable interface.

5. The method of claim 1, wherein, The executing the callable interface to enable the application program to run the calling object on the target platform comprises: determining, according to a preset capability mapping table and the callable interface, an application programming interface of the callable interface; executing the callable interface by the application programming interface to enable the application program to run the calling object on the target platform.

6. The method of claim 1, wherein, The target platform comprises an Android system platform, an iOS system platform and a Hongmeng system platform.

7. The method of claim 6, wherein, The target platform further comprises a mini-program front end and a ReactNative front end.

8. The method of claim 7, wherein, The determining, according to a received calling request of an application program, of a calling object of the application program on a target platform comprises: determining, according to the calling request and a preset function description file, the calling object; The determining, according to the calling object, of a preset interface of the target platform corresponding to the calling object comprises: determining, by a preset scaffolding tool and the calling object, a first preset interface of the Android system platform, the iOS system platform and the Hongmeng system platform, and a second preset interface of the mini-program front end and the ReactNative front end; The converting the preset interface into the callable interface comprises: converting, by a DSL parser, the first preset interface into a first callable interface and the second preset interface into a second callable interface.

9. An apparatus for cross-platform invocation of resources, the apparatus comprising: The apparatus comprises: a language definition module configured to determine, according to a received calling request of an application program, a calling object of the application program on a target platform; a language parsing module configured to determine, according to the calling object, a preset interface of the target platform corresponding to the calling object; In a case that the application program runs on the target platform, the language analysis module further converts the preset interface into a callable interface; The language analysis module further executes the callable interface, so that the application program runs the calling object on the target platform.

10. A non-transitory computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the calling method for cross-platform calling of the application program according to any one of claims 1-8.