A data processing method, device, apparatus, and storage medium
By using middleware and pre-defined intermediary modules, component calls between different component management tools are enabled, solving the problem that component libraries cannot be directly called, improving the efficiency of calls and communication, and saving resources and manpower costs.
Patent Information
- Application Number
- CN202211014594.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-08-23
AI Technical Summary
The component libraries of different component management tools cannot directly call each other, resulting in a waste of resources and manpower, and low calling efficiency.
Middleware enables interactive management between different component management tools. By utilizing pre-defined intermediary modules and call link information, it executes component call instructions and sends operation execution results, thus solving the problem of indirect component calls.
It improves the efficiency of component library calls and communication between different component management tools, saving resources and manpower costs.
Smart Images

Figure CN117667068B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer development technology, and in particular to a data processing method, apparatus, device and storage medium. Background Technology
[0002] Component management tools can manage third-party component libraries during application development for iOS and other devices. However, different component management tools typically cannot directly call each other's components during project development. For example, if component A is only managed by CocoaPods and component B is only managed by SPM, and the user of component B wants to call related functions or pass related data to component A, the conventional approach is for the component publisher to publish both component A and component B to both management platforms, and the user to manually place component A in a local project where component B is already stored for calling.
[0003] However, publishing components across all platforms and manually importing components into projects not only consumes a lot of resources and manpower, but also results in low efficiency in component invocation. Summary of the Invention
[0004] This application provides a data processing method, apparatus, device, and storage medium, which can solve the problem that component libraries of different component management tools cannot directly call each other, and improve the efficiency of component calling and communication between different component management tools. The technical solution of this application is as follows:
[0005] On the one hand, a data processing method is provided, the method comprising:
[0006] In response to a component invocation instruction from the second component to the first component, determine the invocation type information corresponding to the component invocation instruction;
[0007] Based on the call type information, a preset intermediary module corresponding to the first component and the call link information corresponding to the preset intermediary module are determined from the middleware. The middleware is an interaction management tool between multiple component management tools.
[0008] Based on the call link information, the preset intermediary module is controlled to execute the call operation corresponding to the component call instruction;
[0009] The middleware is controlled to send the operation execution result corresponding to the invocation operation to the second component;
[0010] The first component and the second component are located in two different component management tools.
[0011] On the other hand, a data processing apparatus is provided, the method comprising:
[0012] The call type information determination module is used to determine the call type information corresponding to the component call instruction in response to the component call instruction of the second component to the first component;
[0013] The preset intermediary module determination module is used to determine, based on the call type information, the preset intermediary module corresponding to the first component and the call link information corresponding to the preset intermediary module from the middleware, wherein the middleware is an interaction management tool between multiple component management tools;
[0014] The call operation execution module is used to control the preset intermediary module to execute the call operation corresponding to the component call instruction based on the call link information;
[0015] The operation execution result sending module is used to control the middleware to send the operation execution result corresponding to the call operation to the second component;
[0016] The first component and the second component are located in two different component management tools.
[0017] On the other hand, a data processing apparatus is provided, the apparatus including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the data processing method as described in the first aspect.
[0018] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the data processing method as described in the first aspect.
[0019] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing method as described in the first aspect.
[0020] The data processing method, apparatus, device, and storage medium provided in this application have the following technical advantages:
[0021] In application scenarios involving component interaction across component management tools, this application responds to a component call instruction from a second component to a first component, determines the call type information corresponding to the component call instruction, where the first and second components reside in two different component management tools. Based on the call type information, it then determines a preset intermediary module corresponding to the first component and the call link information corresponding to the preset intermediary module from the middleware. The middleware is an interaction management tool between multiple component management tools. Based on the call link information, it controls the preset intermediary module to execute the call operation corresponding to the component call instruction, and then controls the middleware to send the operation execution result corresponding to the call operation to the second component. Since the preset intermediary module is located in the middleware, component calls are transformed from interactions between different component management tools to interactions between component management tools and the middleware. This solves the problem that component libraries of different component management tools cannot directly call each other, improves the calling and communication efficiency of component libraries of different component management tools, and avoids publishing components across the entire platform and manually importing components into the project, thus saving a significant amount of resources and manpower costs. Attached Figure Description
[0022] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;
[0024] Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0025] Figure 3 This is a flowchart illustrating a method for generating a preset intermediary module provided in an embodiment of this application;
[0026] Figure 4 This is a flowchart illustrating another method for generating a preset intermediary module provided in an embodiment of this application;
[0027] Figure 5 This is a schematic diagram of a process provided in this application embodiment of a control middleware that generates preset intermediary modules and call link information based on call type information and first component declaration information;
[0028] Figure 6 This is a schematic diagram of a process provided in this application embodiment, which controls a preset intermediary module based on call link information to execute the call operation corresponding to the component call instruction;
[0029] Figure 7 This is a flowchart illustrating another control middleware provided in this application embodiment that generates preset intermediary modules and call link information based on call type information and first component declaration information;
[0030] Figure 8 This is a flowchart illustrating a component deduplication method provided in an embodiment of this application;
[0031] Figure 9 This is a flowchart illustrating a method for determining repeating components provided in an embodiment of this application;
[0032] Figure 10 This is a schematic diagram of a multi-branch tree provided in an embodiment of this application;
[0033] Figure 11 This is a schematic diagram of a component deduplication logic provided in an embodiment of this application;
[0034] Figure 12 This is a block diagram of a data processing apparatus provided in an embodiment of this application;
[0035] Figure 13 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0037] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products or devices.
[0038] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0039] First, the relevant terms used in the embodiments of this application are explained as follows:
[0040] CocoaPods: Manage third-party component libraries during application development for devices such as iOS, macOS, iWatch, and iPod.
[0041] SPM stands for Swift Package Manager. It functions similarly to Pod and is used to manage third-party component libraries.
[0042] A component is a binary package that is compiled from multiple classes and has relatively independent functions. Applications can use the functions corresponding to the components by calling the integrated components.
[0043] An interface is a reference type that specifies a set of member functions without implementing them. Other types, such as classes and structs, can implement interfaces. Interfaces can include: public methods that can be called by the component, usable variables, and protocols that can be followed. Each interface has a clearly defined function, and specific functionalities can be implemented by calling the interface. For example, using a beautification function requires calling interfaces A, B, and C. Interface A's specific function is to request camera permission, interface B's specific function is to open the camera, and interface C's specific function is to load the beautification resource file.
[0044] A class is a user-defined reference data type, also known as a class type. Each class contains data descriptions and a set of functions for manipulating data or passing messages; these functions are called methods within the class. Each class can include at least one public interface and one unpublicized interface, and each interface can include multiple methods. For example, when using a beauty filter, interface A is called, but the function of interface A requesting camera permission needs to be implemented by calling the internal unpublicized methods A1, A2, and A3.
[0045] Runtime mechanism: This allows changes to program behavior at runtime, such as accessing all member variables of a class, dynamically adding member variables to a class, and dynamically modifying other variables. The technical solution in this application utilizes runtime to send messages to objects during program execution.
[0046] Inheritance refers to deriving a new class from an existing class. The new class is called a subclass or derived class, and the original class is called a parent class or superclass. The subclass inherits the data attributes and behaviors of the parent class and can extend it with new capabilities.
[0047] Derived class: A class derived from an existing class using the inheritance mechanism; it can also be called a subclass.
[0048] Encapsulation: This means hiding the properties and implementation details of an object, and only exposing the interface to the outside world.
[0049] Reflection: For any given class, it is possible to know all its attributes and methods; for any given object, it is possible to invoke any of its methods. This invocation mechanism is called reflection.
[0050] Static library: Functions are encapsulated in a static library. During the compilation and linking process, the static library functions are inherited into the binary file, ultimately generating an executable binary program.
[0051] Dynamic libraries: linking library functions is deferred until program execution. When the program executes a library function, it looks for the relevant function in the dynamic library. If the dynamic library does not exist in memory, it will be loaded into memory. If the dynamic library already exists in memory, it will be called directly.
[0052] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application. This application environment may include a client 10 and a server 20, which can be indirectly connected via wireless communication. The server 20 can initiate a data processing request to the client 10. Based on the data processing request, the client 10 controls a second component to initiate a component invocation instruction against the first component. The first and second components reside in two different component management tools. In response to the component invocation instruction, the client 10 determines the invocation type information corresponding to the instruction. Then, based on the invocation type information, it determines from the middleware the preset intermediary module corresponding to the first component and the invocation link information corresponding to the preset intermediary module. The middleware is an interaction management tool between multiple component management tools. Then, based on the invocation link information, it controls the preset intermediary module to execute the invocation operation corresponding to the component invocation instruction. Next, it controls the middleware to send the operation execution result corresponding to the invocation operation to the second component. Finally, it returns the operation execution result to the server 20. It should be noted that... Figure 1 This is just one example.
[0053] The client can be a physical device such as a smartphone, computer (e.g., desktop computer, tablet computer, laptop computer), digital assistant, smart voice interaction device (e.g., smart speaker), smart wearable device, in-vehicle terminal, etc., or it can be software running on the physical device, such as a computer program. The operating system corresponding to the first client can be Android, iOS (a mobile operating system developed by Apple), Linux, Microsoft Windows, etc.
[0054] The server side can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server may include network communication units, processors, and memory, etc. The server side can provide backend services to the corresponding clients.
[0055] The aforementioned client 10 and server 20 can be used to build a data processing system, which can be a distributed system. Taking a blockchain system as an example, the distributed system consists of multiple nodes (any form of computing device connected to the network, such as servers and user terminals) and clients. These nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a distributed system, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, a middleware layer, an operating system layer, and an application layer.
[0056] The functions of each node in the aforementioned blockchain system include:
[0057] 1) Routing: A basic function of nodes used to support communication between nodes.
[0058] In addition to routing capabilities, nodes can also have the following functions:
[0059] 2) Applications are deployed in the blockchain to implement specific business needs. They record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system. When other nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block.
[0060] 3) A blockchain consists of a series of blocks that are sequentially generated. Once a new block is added to the blockchain, it will not be removed. The blocks contain the data submitted by the nodes in the blockchain system.
[0061] It should be noted that the data processing method provided in this application can be applied to both the client and the server, and is not limited to the embodiments described above.
[0062] The following describes a specific embodiment of a data processing method provided in this application. Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. This application provides the operational steps of the method described in the embodiment or flowchart, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiment is merely one possible execution order among many steps and does not represent the only execution order. In actual systems or products, the methods can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiment or drawings. Specifically, as... Figure 2 As shown, the method may include:
[0063] S201, in response to the component call instruction from the second component to the first component, determine the call type information corresponding to the component call instruction, wherein the first component and the second component are located in two different component management tools.
[0064] In the embodiments described in this specification, the component management tool can be used to manage third-party component libraries during application software development. Specifically, the component management tool may include CocoaPods, SPM (Swift Package Manager), Carthage, and Maven, etc.
[0065] In the embodiments described in this specification, the first component is the called component, and the second component is the calling component. Specifically, the first component and the second component can reside in two different component management tools, for example, the first component resides in the CocoaPods platform, and the second component resides in the SPM platform.
[0066] In the embodiments of this specification, the call type information corresponding to the component call instruction can characterize the component call type of the component call instruction. Specifically, the call type information may include: class calls within the same component and interface calls between different components.
[0067] In the embodiments of this specification, the same component can represent components with the same component identification information. The component identification information may include: component name, component symbol, etc. For example, component A version 1.0 is in CocoaPods, and component A version 2.0 is in SPM. Component A version 1.0 and component A version 2.0 can be regarded as two identical components. Component A version 2.0 calling the interface / function / method / protocol of component A version 1.0 can be regarded as a call within the same component.
[0068] In the embodiments of this specification, different components can represent components with different component identification information. For example, component A in version 1.0 and component B in version 1.0 can be regarded as two different components.
[0069] In practical applications, class calls are typically used for calls within a component, while interface calls are typically used for calls between components.
[0070] S202, based on the call type information, determine the preset intermediary module corresponding to the first component and the call link information corresponding to the preset intermediary module from the middleware. The middleware is an interaction management tool between multiple component management tools.
[0071] In the embodiments of this specification, the preset intermediary module can be used to replace the first component to interact with the second component. In one specific embodiment, when the call type information is a class call within the same component, the preset intermediary module can be a derived class corresponding to the class to be called; in another specific embodiment, when the call type information is an interface call between different components, the preset intermediary module can be the encapsulated interface to be called corresponding to the interface to be called.
[0072] Specifically, derived classes can be used to unify the calling conventions within components, while encapsulating interfaces can unify the calling conventions between components, thereby improving the feasibility and efficiency of component calls.
[0073] In the embodiments of this specification, the call link information can represent the call address of the preset intermediary module.
[0074] S203, based on the call link information, controls the preset intermediary module to execute the call operation corresponding to the component call instruction.
[0075] S204, The control middleware sends the operation execution result corresponding to the call operation to the second component.
[0076] As can be seen from the above embodiments, since the preset intermediary module is located in the middleware, the component call is transformed from the interaction between different component management tools to the interaction between the component management tool and the middleware, thereby solving the problem that the component libraries of different component management tools cannot directly call each other, and improving the calling and communication efficiency of the component libraries of different component management tools.
[0077] In the embodiments described in this specification, such as Figure 3 As shown, the above method may further include:
[0078] S301, Obtain the target project file. The target project file includes two sub-project files, which are the corresponding sub-project files of the two component management tools.
[0079] S302 generates middleware based on preset plugins in the target project file.
[0080] In the embodiments described in this specification, the middleware can be an interaction management tool used between various component management tools.
[0081] Specifically, in the target project file, generating middleware based on preset plugins may include: determining the target memory region in the runtime space of the preset plugins, and generating middleware based on the target memory region.
[0082] Specifically, preset plugins can include: Xcode development plugins, TextMate plugins, etc. In practical applications, preset plugins can be pre-configured based on the current component management tool required for interaction. For example, when using components on the CocoaPods and SPM platforms, the Xcode development plugin can be selected as the preset plugin.
[0083] S303, Obtain the first component declaration information of the first component from the sub-project file corresponding to the first component.
[0084] Specifically, the first component declaration information can be used to declare the first component, and at compile time, the first component can be called through the component declaration information.
[0085] In one specific embodiment, the first component declaration information can be the component interface information of the first component. Specifically, the component interface information may include: class identifier information, method / function call information, constant reference information, enumeration reference information, macro definition information, protocol call information, etc.
[0086] S304, Store the first component declaration information in the middleware.
[0087] S305, the control middleware generates preset intermediary modules and call link information based on the call type information and the first component declaration information.
[0088] Specifically, the control middleware first determines the intermediary type based on the call type information, and then generates the preset intermediary module and call link information based on the intermediary type and the first component declaration information.
[0089] Specifically, the type of intermediary can include: derived classes or encapsulated interfaces.
[0090] As can be seen from the above embodiments, the preset plugin and the generated middleware can reduce the size of the project package; in addition, the control middleware generates a preset intermediary module and call link information based on the call type information and the first component declaration information, and realizes the indirect interaction between the first component and the second component through the preset intermediary module.
[0091] In practical applications, middleware can identify the programming language type used by a component based on its component identifier and version information. Specifically, the programming language type can include, but is not limited to, Swift and Objective-C.
[0092] In a specific embodiment, when the target project file and the two component management tools have different programming language types, such as Figure 4 As shown, before storing the first component declaration information in the middleware, the method may further include:
[0093] S306 generates the initial bridging file in the target project file.
[0094] Specifically, bridging files are used to connect class libraries of different programming languages, enabling different programming languages to call each other.
[0095] S307, Obtain the second component declaration information from the sub-project file corresponding to the second component.
[0096] Specifically, the second component declaration information can be used to declare a second component, which can be invoked at compile time through the component declaration information. In a specific embodiment, the second component declaration information can be represented as a header file.
[0097] In one specific embodiment, the second component declaration information can be the component interface information of the second component. Specifically, the component interface information may include: class identifier information, method / function call information, constant reference information, enumeration reference information, macro definition information, protocol call information, etc.
[0098] S308, import the first component declaration information and the second component declaration information into the initial bridging file to obtain the target bridging file.
[0099] S309, Control middleware, reads the first component declaration information and the second component declaration information from the target bridging file.
[0100] As can be seen from the above embodiments, bridging files enable different programming languages to call each other, thereby solving the compilation and calling problems of mixed-language projects caused by different programming languages of components.
[0101] Specifically, the middleware obtains the first component declaration information and the second component declaration information from the target bridging file by accessing the target bridging file.
[0102] Taking Objective-C as the programming language type for both component management tools and Swift as the programming language type for the target project file as an example, an initial bridging file can be generated in the target project file. The first component declaration information of the first component and the second component declaration information of the second component are imported into the initial bridging file to obtain the target bridging file. Then, the middleware is controlled to read the first component declaration information and the second component declaration information from the target bridging file and store the first component declaration information and the second component declaration information in the middleware's storage area, thereby solving the compilation and calling problem of mixed Swift and Objective-C projects.
[0103] In a specific embodiment, when the target project file and the two component management tools have the same programming language type, the component link information of the first component can be obtained from the sub-project file corresponding to the first component, and the component link information can be stored in the middleware. The middleware can obtain the component interface information of the first component by reading the component link information.
[0104] Specifically, component link information can represent the directly readable resource files corresponding to a component.
[0105] In one specific embodiment, the call type information includes: class calls within the same component, and the first component declaration information includes: multiple class information of the first component, such as... Figure 5 As shown, the aforementioned control middleware, based on the call type information and the first component declaration information, generates preset intermediary module and call link information, which may include:
[0106] S501, determine the class information of the first component to be invoked from multiple class information to correspond with the component invocation instruction.
[0107] Specifically, class information can include class identifier information, which can be the name of the class. Similarly, the class information to be called can include the identifier information of the class to be called, which can be the name of the class to be called.
[0108] In an optional embodiment, when the target project file and the two component management tools have different programming language types, the above-mentioned determination of the class information to be invoked for the first component corresponding to the component invocation instruction from multiple class information may include: traversing multiple class information of the first component in the target bridging file to determine the class information to be invoked.
[0109] S502, in the middleware, utilizes runtime and inheritance mechanisms to derive the derived class corresponding to the information of the class to be called.
[0110] Specifically, during program execution, the class corresponding to the information of the class to be called is derived based on the inheritance mechanism to obtain the derived class.
[0111] S503 utilizes runtime mechanisms to obtain the address of the method implementation in the derived class.
[0112] Specifically, the method implementation address can represent the implementation address of a method (function) in a derived class. In a specific embodiment, the method implementation address can be a pointer to the method implementation.
[0113] S504 uses derived classes as preset intermediary modules.
[0114] S505 uses the method implementation address as the call link information.
[0115] Correspondingly, such as Figure 6 As shown, the above-mentioned control of the preset intermediary module based on the call link information, and the execution of the call operation corresponding to the component call instruction, may include:
[0116] S601: Read the address of the method implementation corresponding to the derived class from the middleware.
[0117] S602, based on the method implementation address, forwards the component call instruction to the derived class so that the derived class can perform the call operation.
[0118] Accordingly, the operation execution result sent by the control middleware to the second component may include: the middleware control derived class sending the operation execution result to the second component, and sending the operation execution result to other components involved in the component call instruction through the responder chain.
[0119] Specifically, a responder chain is a sequence of connected responders where event or action messages are passed sequentially. It allows responders to delegate event handling responsibilities to higher-level objects. If a responder does not handle an event, the event is passed down the responder chain in order.
[0120] Taking a CocoaPods 2.0 component A calling a SPM 1.0 component A as an example, the class to be called in the 1.0 version of component A is determined. A derived class of the class to be called is generated using the runtime mechanism. The method list and method implementation addresses of the class to be called are stored in the derived class. The implementation address returned by the method is obtained through the methodForSelector function. The component call instruction of the 2.0 version of component A is forwarded to the derived class. The objc_msgSend function in the derived class sends the operation execution result to the 1.0 version of component A. The data in the call process is passed to other components involved in the component call instruction through the responder chain.
[0121] As can be seen from the above embodiments, when the call type information is a class call within the same component, the middleware generates a derived class corresponding to the class to be called at runtime, and the derived class is used to realize indirect interaction between components of different component management tools, thereby improving the efficiency of component calls and communication between different component management tools.
[0122] In one specific embodiment, the component call type includes: interface calls between different components; the first component declaration information includes: component interface information of the first component; and the preset intermediary module includes: the encapsulated interface to be called, such as... Figure 7 As shown, the aforementioned control middleware, based on the call type information and the first component declaration information, generates preset intermediary module and call link information, which may include:
[0123] S701, based on the component interface information, determine the interface to be called for the first component corresponding to the component call instruction.
[0124] S702, determine the first interface identification type of the middleware.
[0125] S703, based on the first interface identification type, controls the middleware to encapsulate the interface to be called, and obtains the encapsulated interface to be called.
[0126] Specifically, encapsulation can hide the implementation details and methods of the interface to be called, retaining the interface that the middleware can directly identify and call. This allows the middleware to send component call instructions to the encapsulated interface, improving the feasibility and security of cross-platform component interaction. For example, if the first component needs to implement a certain protocol method, the second component can dynamically generate the corresponding method at runtime during the encapsulation process.
[0127] S704 generates the call link information for the encapsulated interface to be called.
[0128] Specifically, the call link information of the encapsulated interface to be called can characterize the calling method of the encapsulated interface to be called.
[0129] Accordingly, the above-mentioned control of the preset intermediary module based on the call link information to execute the call operation corresponding to the component call instruction may include: controlling the encapsulated interface to be called to execute the call operation based on the call link information.
[0130] In a specific embodiment, before the control middleware generates the preset intermediary module and call link information based on the call type information and the first component declaration information, the above method may further include:
[0131] Based on the component interface information of the first component, the second interface identification type of the first component is determined. Based on the second interface identification type, the middleware is controlled to encapsulate the calling object in the second component to obtain the encapsulated object.
[0132] Specifically, the middleware encapsulates the calling object into an object that can be recognized by the encapsulated interface to be called corresponding to the first component.
[0133] Specifically, the calling object can include instance objects and class objects. The wrapper object corresponding to an instance object calls the instance method, and the wrapper object corresponding to a class object calls the class method. Therefore, when the calling object is an instance object, the interface to be called in the first component should be an instance method; when the calling object is a class object, the interface to be called in the first component should be a class method.
[0134] Accordingly, the operation execution result sent by the control middleware to the second component corresponding to the call operation may include:
[0135] The control middleware sends the operation execution result to the encapsulated interface corresponding to the first component in the middleware via reflection.
[0136] Taking a CocoaPods 2.0 component A calling a SPM 2.0 component B as an example, the middleware obtains the component interface information of component B, determines the object type of the calling object in component A, and encapsulates the calling object into an encapsulated object that the called component (i.e., component B) can recognize. In addition, based on the component interface information of component B, the middleware determines the interface to be called corresponding to the object type in component B, encapsulates the interface to be called into an encapsulated interface that the middleware can recognize, and sends messages between the encapsulated object and the encapsulated interface to be called through reflection.
[0137] As can be seen from the above embodiments, when the call type information is an interface call between different components, the control middleware encapsulates the interface to be called to obtain the encapsulated interface to be called. The encapsulated interface to be called is used to realize the indirect interaction between components of different component management tools, thereby improving the efficiency of component calls and communication between different component management tools.
[0138] In a specific embodiment, during the process of interface calls between different components, function call information generated during the call is captured. Specifically, the function call information may include intermediate verification data. The intermediate verification data is deleted and modified, for example, by deleting object verification and data encryption methods required during the call, so as to avoid frequent verification of middleware calls by the component protection mechanism of cross-platform component calls and improve the efficiency of component calls.
[0139] In the embodiments of this specification, if data callback is required after the call operation is completed (for example, after the scanning component is called, the scanning result needs to be sent back to the calling page for display), the second component can be registered as an observer in the middleware, and the second component can be reminded that the data has been sent back by sending a notification to the observer.
[0140] In the embodiments described in this specification, such as Figure 8 As shown, the above method may further include:
[0141] S801, from the two sub-project files, determine the component association information corresponding to multiple components of each of the two component management tools. The component association information includes component dependency information and component version information.
[0142] Specifically, component association information can be represented as information associated with the corresponding component. Component association information may include: component identification information, component version information, component description information, license information, supported systems, header files, resource paths, component dependency information, etc.
[0143] Specifically, component dependency information can characterize the component dependencies of a corresponding component. In a specific embodiment, component dependency information can be dependency libraries.
[0144] Specifically, component version information can represent the version status of the corresponding component. In a specific embodiment, component version information can be the component version number.
[0145] S802, based on component dependency information, identify at least one set of duplicate components in two component management tools, where any set of duplicate components consists of two identical components.
[0146] In the embodiments of this specification, a duplicate component can represent a component with the same component identification information located in different component management tools. The component identification information may include: component name, component symbol, etc. For example, component A version 1.0 is in CocoaPods, and component A version 2.0 is in SPM. Component A version 1.0 and component A version 2.0 can be regarded as a set of duplicate components.
[0147] In a specific embodiment, such as Figure 9 As shown, based on component dependency information, identifying at least one set of duplicate components in the two component management tools can include:
[0148] S901 performs message digest processing on multiple components of each of the two component management tools to obtain message digest data corresponding to multiple components.
[0149] Specifically, information summary data can represent summary data of the component association information of the corresponding component.
[0150] In one specific embodiment, the above-mentioned information digest processing of multiple components of the two component management tools to obtain information digest data corresponding to multiple components may include: performing information digest processing on multiple components of the two component management tools based on a preset information digest algorithm to obtain information digest data corresponding to multiple components.
[0151] In one specific embodiment, the aforementioned preset message digest algorithm may include the MD5 (Message-Digest Algorithm 5) message digest algorithm, and correspondingly, the message digest data may be MD5 data. Specifically, the MD5 message digest algorithm is a cryptographic hash function that can produce a 128-bit (16-byte) hash value after processing.
[0152] S902, Perform duplicate analysis on the message digest data to identify at least one set of duplicate message digest data corresponding to the two component management tools.
[0153] Specifically, iterate through the message digest data corresponding to multiple components, and identify at least one set of duplicate message digest data during the iteration process.
[0154] S903, the components corresponding to at least one set of repeated information summary data are regarded as at least one set of repeated components.
[0155] As can be seen from the above embodiments, components are stored in the form of binary files in actual component management tools. Converting binary files into strings through message digests can reduce file I / O operations, improve performance, and increase access speed.
[0156] S803, when all target duplicate components are static library components, the target duplicate components are deduplicated based on the component version information and component dependency information of the target duplicate components to obtain deduplicated components. The target duplicate components are any one of the duplicate components in at least one set of duplicate components.
[0157] In an optional embodiment, based on the component version information and component dependency information of the target duplicate component, the target duplicate component is deduplicated to obtain the deduplicated component, including:
[0158] If the component dependency information of the target duplicate component indicates that the target duplicate component is a basic component, remove the component with the lowest corresponding component version information in the target duplicate component to obtain the deduplicated component.
[0159] Specifically, a basic component can represent a component that is not depended upon by other components.
[0160] In practical applications, when duplicate components that are both basic components have the same component version information, the component that needs to be removed from the duplicate components can be selected according to the actual calling needs of the second component.
[0161] In another optional embodiment, based on the component version information and component dependency information of the target duplicate component, the target duplicate component is deduplicated to obtain the deduplicated component, including:
[0162] 1) If the component dependency information of the target duplicate component indicates that all target duplicate components are dependent components, modify the link of the component with the lowest corresponding component version information among the target duplicate components to obtain a dynamic library component.
[0163] Specifically, dynamic library components are linked using dynamic linking. Dynamic library components are only linked into memory and have an independent runtime environment when the program runs.
[0164] 2) Use dynamic library components as deduplication components.
[0165] In another optional embodiment, based on the component version information and component dependency information of the target duplicate component, the target duplicate component is deduplicated to obtain the deduplicated component, including:
[0166] 1) If the component dependency information of the target duplicate component indicates that the target duplicate component includes a base component and a dependent component, modify the linking of the component corresponding to the dependent component to obtain a dynamic library component.
[0167] 2) Use dynamic library components as deduplication components.
[0168] S804 updates the target project file based on the deduplication component.
[0169] As can be seen from the above embodiments, different deduplication processes are performed on the target duplicate components based on their component dependencies, which improves the flexibility of the deduplication process.
[0170] The deduplication component is compiled in the target project file, and the interfaces and calls of the called components in the deduplication component are checked. During the compilation process, the lower version of the called component is upgraded according to the component version information of the calling component. That is, when the version of the calling component is higher and the version of the called component is lower, the version of the called component is upgraded to be consistent with the version of the calling component. However, component upgrade may cause changes to the interface of the called component, resulting in compilation failure. Therefore, in the case of compilation failure, it is necessary to upgrade the interface of the calling component.
[0171] As can be seen from the above embodiments, the problem of symbol conflicts for the same component under different component management tools can be solved.
[0172] In one specific embodiment, determining at least one set of duplicate components in two component management tools based on component dependency information may include:
[0173] 1) Based on component dependency information, construct the component multi-branch trees corresponding to the two component management tools respectively;
[0174] 2) Perform message digest processing on multiple component nodes of the component multi-way tree to obtain message digest data corresponding to multiple component nodes;
[0175] 3) Perform duplicate analysis on the information summary data to identify at least one set of duplicate information summary data;
[0176] 4) The components represented by the component nodes corresponding to at least one set of repeated information summary data are regarded as at least one set of repeated components;
[0177] Accordingly, when all the target duplicate components are static library components, the duplicate components are deduplicated based on their version information and dependency information. The resulting deduplicated components may include:
[0178] When all component nodes corresponding to the target duplicate component are root nodes, remove the component with the lowest corresponding component version information in the target duplicate component to obtain the deduplicated component;
[0179] Alternatively, if all component nodes corresponding to the target duplicate component are non-root nodes, modify the link of the component with the lowest corresponding component version information in the target duplicate component to obtain a dynamic library component; use the dynamic library component as the deduplication component.
[0180] Alternatively, if the component nodes corresponding to the target duplicate component include both root nodes and non-root nodes, modify the links of the components corresponding to the non-root nodes to obtain dynamic library components; use the dynamic library components as deduplication components.
[0181] Taking the component management tools CocoaPods and SPM as examples, this application provides a specific embodiment of a component deduplication method. A detection script file is pre-installed in the target project file. This script file retrieves configuration items from the target project file to obtain component association information for multiple components in both CocoaPods and SPM. This association information includes component dependency fields and component version numbers. An MD5 hash is generated for each component based on the MD5 digest algorithm. Multi-branch trees are constructed for both CocoaPods and SPM based on the component dependency fields. Each node in the multi-branch tree corresponds to the MD5 hash of a component, and the parent-child relationship between nodes represents the dependency relationship between the corresponding components. The root node of the multi-branch tree is placed in sets M and N, where M corresponds to components managed by CocoaPods and N corresponds to components managed by SPM. See also... Figure 10 , Figure 10 This is a schematic diagram of a multi-branch tree provided in an embodiment of this application.
[0182] Iterate through sets M and N, marking identical MD5 values within the sets. See [link / reference] Figure 11 , Figure 11 This is a schematic diagram of a component deduplication logic provided in an embodiment of this application. According to... Figure 11 The component deduplication logic shown performs the following operations on the component corresponding to the marked node:
[0183] 1) If all the marked nodes are root nodes, it means that the components corresponding to the marked nodes are basic components directly called by the access party. Find the version number of the component based on the MD5 value and delete the component with the lower version number.
[0184] 2) If a marked node in set M is the root node and a marked node in set N is a non-root node, it means that the component corresponding to the marked node in N is a dependent component in SPM and will not be directly called. Therefore, the linking method of the component corresponding to the marked node in N should be changed to dynamic linking. Similarly, if a node in set N is the root node and a node in set M is a non-root node, the linking method of the component in M should be modified.
[0185] 3) If all the marked nodes are root nodes and all are non-root nodes, it means that neither component will be called directly. Modify the component linking method of the component with the lower version to dynamic linking.
[0186] As can be seen from the above embodiments, constructing a tree-like data structure can sort out the dependencies between components in the component management tool and solve the symbol conflict problem of the same component under different component management tools.
[0187] Taking an image component managed by SPM requesting a photo component managed by a pod as an example, this application illustrates the data processing method provided. Specifically, before the first call, a detection script checks whether the image and photo components have the same component in the pod and SPM, and performs deduplication using a multi-way tree data structure. Then, the interfaces of both components are upgraded. During the first call, the language types of the two components are determined in the preset middleware. If the language types of the two components are inconsistent, a bridging file is generated, and the component declaration information of both components is imported into the bridging file. Then, based on the bridging file, the component declaration information of the two components is written into the preset middleware. Since the image component calls the photo component, which is the same component... Internal class calls are handled by generating derived classes in a pre-defined middleware at runtime. When a class call occurs, the actual method address is captured and forwarded to the derived class for processing. This processing can be dynamically handled using interface information such as class name, method / function call, constant references, enumeration references, macro definitions, and protocol calls. For example, the image generated by the camera component is converted to an image type that the image component can recognize before being stored. After storage, the image component needs to send a success / failure notification back to the camera component. This is done through an observer, with the camera component pre-registered as an observer in the middleware to process the returned information in the notification. In subsequent calls, the image component simply forwards the call request directly to the derived class for processing and receives the response information from the derived class.
[0188] As can be seen from the technical solutions provided in the embodiments of this application above, in application scenarios where components interact across component management tools, this application can organize the dependency relationships of components in the component management tool by constructing a tree-like data structure, and solve the symbol conflict problem of components under different component management tools; by generating middleware through preset plugins, the package size of the project can be reduced, and the problem that component libraries of cross-component management tools cannot directly call each other can also be solved by bridging files to solve the compilation and calling problems of mixed-language projects; in addition, by using reflection and runtime calls, the secondary dependency of component header files can be reduced, and the component integration personnel do not need to perform secondary encapsulation.
[0189] This application also provides a data processing apparatus, such as... Figure 12 As shown, the data processing apparatus may include:
[0190] The call type information determination module 1210 is used to determine the call type information corresponding to the component call instruction in response to the component call instruction of the second component to the first component;
[0191] The preset intermediary module determination module 1220 is used to determine the preset intermediary module corresponding to the first component and the call link information corresponding to the preset intermediary module from the middleware based on the call type information. The middleware is an interaction management tool between multiple component management tools.
[0192] The call operation execution module 1230 is used to control the preset intermediary module to execute the call operation corresponding to the component call instruction based on the call link information;
[0193] The operation execution result sending module 1240 is used to control the middleware to send the operation execution result corresponding to the call operation to the second component;
[0194] The first component and the second component are located in two different component management tools.
[0195] In the embodiments described in this specification, the above-mentioned apparatus may further include:
[0196] The target project file acquisition module is used to acquire the target project file, which includes two sub-project files. The two sub-project files are the corresponding sub-project files of the two component management tools, respectively.
[0197] The middleware generation module is used to generate middleware from the target project file based on preset plugins;
[0198] The first component declaration information acquisition module is used to obtain the first component declaration information of the first component from the sub-project file corresponding to the first component.
[0199] The first component declaration information storage module is used to store the first component declaration information in the middleware;
[0200] The preset intermediary module generation module is used to control the middleware to generate preset intermediary modules and call link information based on call type information and first component declaration information.
[0201] In one specific embodiment, when the target project file and the two component management tools have different programming language types, the above-mentioned apparatus may further include:
[0202] The initial bridging file generation module is used to generate initial bridging files in the target project file;
[0203] The second component declaration information acquisition module is used to obtain the second component declaration information of the second component from the sub-project file corresponding to the second component.
[0204] The target bridging file module is used to import the first component declaration information and the second component declaration information into the initial bridging file to obtain the target bridging file;
[0205] The component declaration information reading module is used to control the middleware to read the first component declaration information and the second component declaration information from the target bridging file.
[0206] In a specific embodiment, the call type information may include: class calls within the same component; the first component declaration information may include: multiple class information of the first component; and the aforementioned preset intermediary module generation module may include:
[0207] The class information determination unit is used to determine the class information to be called of the first component corresponding to the component call instruction from multiple class information.
[0208] The derived class derivation unit is used in the middleware to derive the derived class corresponding to the class information to be called, using runtime and inheritance mechanisms.
[0209] The method implementation address acquisition unit is used to obtain the address of the method implementation of the derived class using the runtime mechanism;
[0210] The first preset intermediary module unit is used to use the derived class as the preset intermediary module;
[0211] The first call link information unit is used to use the method implementation address as call link information;
[0212] Accordingly, the above-mentioned call operation execution module 1230 may include:
[0213] The method implementation address reading unit is used to read the address of the method implementation corresponding to the derived class from the middleware;
[0214] The component call instruction forwarding unit is used to forward component call instructions to derived classes based on the method implementation address, so that the derived classes can perform the call operation.
[0215] In a specific embodiment, the component call type may include: interface call between different components; the first component declaration information may include: component interface information of the first component; the preset intermediary module may include: the encapsulated interface to be called; and the preset intermediary module generation module may include:
[0216] The interface to be invoked determination unit is used to determine the interface to be invoked of the first component corresponding to the component invocation instruction based on the component interface information;
[0217] The first interface identification type determination unit is used to determine the first interface identification type of the middleware.
[0218] The encapsulation processing unit is used to control the middleware to encapsulate the interface to be called based on the first interface identification type, so as to obtain the encapsulated interface to be called.
[0219] The call link information generation unit is used to generate call link information for the encapsulated interface to be called;
[0220] Accordingly, the above-mentioned call operation execution module 1230 may include:
[0221] The control unit for the encapsulated interface to be called is used to control the encapsulated interface to be called to perform the calling operation based on the calling link information.
[0222] In the embodiments described in this specification, the above-mentioned apparatus may further include:
[0223] The component association information determination module is used to determine the component association information corresponding to multiple components of each of the two component management tools from the two sub-project files. The component association information includes component dependency information and component version information.
[0224] The duplicate component identification module is used to identify at least one set of duplicate components in two component management tools based on component dependency information. Any set of duplicate components consists of two identical components.
[0225] The deduplication module is used to deduplicate the target duplicate components based on the component version information and component dependency information of the target duplicate components when all target duplicate components are static library components. The target duplicate components are any one of the duplicate components in at least one set of duplicate components.
[0226] The target project file update module is used to update the target project file based on the deduplication component.
[0227] In one specific embodiment, the above-mentioned repeating component determination module may include:
[0228] The information digest processing unit is used to perform information digest processing on multiple components of each of the two component management tools to obtain information digest data corresponding to multiple components.
[0229] The duplicate analysis unit is used to perform duplicate analysis on the message summary data and identify at least one set of duplicate message summary data corresponding to the two component management tools.
[0230] The repeating component determination unit is used to identify at least one set of components corresponding to repeating information digest data as at least one set of repeating components.
[0231] In an optional embodiment, the deduplication module described above may include:
[0232] The first deduplication processing unit is used to remove the component with the lowest corresponding component version information from the target duplicate components when the component dependency information of the target duplicate components indicates that the target duplicate components are all basic components, so as to obtain the deduplicated components.
[0233] In another optional embodiment, the deduplication module described above may include:
[0234] The first link modification unit is used to modify the link of the component with the lowest corresponding component version information among the target duplicate components when the component dependency information of the target duplicate components indicates that all target duplicate components are dependent components, so as to obtain a dynamic library component.
[0235] The second deduplication processing unit is used to use dynamic library components as deduplication components.
[0236] In another optional embodiment, the deduplication module described above may include:
[0237] The second link modification unit is used to modify the link of the component corresponding to the dependent component when the component dependency information of the target duplicate component indicates that the target duplicate component includes a base component and a dependent component, so as to obtain a dynamic library component.
[0238] The third deduplication processing unit is used to use dynamic library components as deduplication components.
[0239] It should be noted that the apparatus and method embodiments described above are based on the same inventive concept.
[0240] This application provides a data processing device, which includes a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the data processing method provided in the above method embodiments.
[0241] Furthermore, Figure 13 A schematic diagram of the hardware structure of a data processing device for implementing the data processing method provided in the embodiments of this application is shown. The data processing device may participate in or include the data processing apparatus provided in the embodiments of this application. Figure 13 As shown, the data processing device 130 may include one or more processors 1302 (shown as 1302a, 1302b, ..., 1302n in the figure) 1302 (processor 1302 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 1304 for storing data, and a transmission device 1306 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 13 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, the data processing device 130 may also include a... Figure 13 The more or fewer components shown, or having the same Figure 13 The different configurations shown.
[0242] It should be noted that the aforementioned one or more processors 1302 and / or other data processing circuitry are generally referred to herein as "data processing circuitry". This data processing circuitry may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be wholly or partially integrated into any other element within the data processing device 130 (or mobile device). As involved in the embodiments of this application, the data processing circuitry serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0243] The memory 1304 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the data processing method described in the embodiments of this application. The processor 1302 executes various functional applications and data processing by running the software programs and modules stored in the memory 1304, thereby implementing the aforementioned data processing method. The memory 1304 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1304 may further include memory remotely located relative to the processor 1302, and these remote memories can be connected to the data processing device 130 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0244] The transmission device 1306 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the data processing device 130. In one example, the transmission device 1306 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In one embodiment, the transmission device 1306 may be a radio frequency (RF) module for wireless communication with the Internet.
[0245] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the data processing device 130 (or mobile device).
[0246] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in a data processing device to store at least one instruction or at least one program related to implementing the data processing method in the method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the data processing method provided in the above method embodiment.
[0247] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0248] Embodiments of this application also provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing method provided in the method embodiments.
[0249] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0250] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and apparatus embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0251] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0252] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A data processing method, characterized in that, The method includes: In response to a component invocation instruction from the second component to the first component, the invocation type information corresponding to the component invocation instruction is determined; the first component is managed by a first component management tool among multiple component management tools, the second component is managed by a second component management tool among the multiple component management tools, and the multiple component management tools cannot directly invoke components among themselves; Based on the call type information, a preset intermediary module corresponding to the first component and call link information corresponding to the preset intermediary module are determined from the middleware. The middleware is an interaction management tool between the various component management tools. The middleware is generated in the target project file based on a preset plugin. The target project file includes a sub-project file corresponding to the first component management tool and a sub-project file corresponding to the second component management tool. The middleware stores first component declaration information obtained from the sub-project file corresponding to the first component, and generates the preset intermediary module and the call link information based on the call type information and the first component declaration information. Based on the call link information, the preset intermediary module is controlled to execute the call operation corresponding to the component call instruction; The middleware is controlled to send the operation execution result corresponding to the call operation to the second component.
2. The method according to claim 1, characterized in that, The method further includes: Obtain the target project file; In the target project file, the middleware is generated based on the preset plugin; Obtain the first component declaration information of the first component from the sub-project file corresponding to the first component; The middleware stores the declaration information of the first component; The middleware is controlled to generate the preset intermediary module and the call link information based on the call type information and the first component declaration information.
3. The method according to claim 2, characterized in that, If the programming language type of the target project file, the programming language type of the first component management tool, and the programming language type of the second component management tool are inconsistent, the method further includes the following steps before storing the first component declaration information in the middleware: Generate an initial bridging file in the target project file; Obtain the second component declaration information of the second component from the sub-project file corresponding to the second component; The first component declaration information and the second component declaration information are imported into the initial bridging file to obtain the target bridging file; The middleware is controlled to read the first component declaration information and the second component declaration information from the target bridging file.
4. The method according to claim 2, characterized in that, The call type information includes: class calls within the same component; the first component declaration information includes: multiple class information of the first component; the control of the middleware to generate the preset intermediary module and the call link information based on the call type information and the first component declaration information includes: From the plurality of class information, determine the class information to be invoked for the first component corresponding to the component invocation instruction; In the middleware, the derived class corresponding to the class information to be invoked is derived using runtime and inheritance mechanisms; Using the runtime mechanism, obtain the method implementation address of the derived class; The derived class is used as the preset intermediary module; The method implementation address is used as the call link information; Accordingly, controlling the preset intermediary module to execute the call operation corresponding to the component call instruction based on the call link information includes: Read the method implementation address corresponding to the derived class from the middleware; Based on the address provided by the method, the component invocation instruction is forwarded to the derived class so that the derived class can execute the invocation operation.
5. The method according to claim 2, characterized in that, The call type information includes: interface calls between different components; the first component declaration information includes: component interface information of the first component; the preset intermediary module includes: the encapsulated interface to be called; the control of the middleware to generate the preset intermediary module and the call link information based on the call type information and the first component declaration information includes: Based on the component interface information, determine the interface to be invoked for the first component corresponding to the component invocation instruction; Determine the first interface identification type of the middleware; Based on the first interface identification type, the middleware is controlled to encapsulate the interface to be called to obtain the encapsulated interface to be called. Generate the call link information for the encapsulated interface to be called; Accordingly, controlling the preset intermediary module to execute the call operation corresponding to the component call instruction based on the call link information includes: Based on the call link information, the call operation is executed by controlling the encapsulated interface to be called.
6. The method according to any one of claims 2 to 5, characterized in that, The method further includes: From the sub-project files corresponding to the two component management tools, the component association information corresponding to multiple components of each component management tool is determined. The component association information includes component dependency information and component version information. The two component management tools are the first component management tool and the second component management tool. Based on the component dependency information, at least one set of duplicate components is identified in the two component management tools, and any set of duplicate components consists of two identical components. When all target duplicate components are static library components, the target duplicate components are deduplicated based on the component version information and component dependency information of the target duplicate components to obtain deduplicated components. The target duplicate components are any one of the at least one set of duplicate components. The target project file is updated based on the deduplication component.
7. The method according to claim 6, characterized in that, The determination of at least one set of duplicate components in the two component management tools based on the component dependency information includes: Message digest processing is performed on multiple components of each of the two component management tools to obtain message digest data corresponding to the multiple components; Perform duplicate analysis on the information digest data to identify at least one set of duplicate information digest data corresponding to the two component management tools; The component corresponding to the at least one set of repeated information digest data is taken as the at least one set of repeated components.
8. A data processing apparatus, characterized in that, The device includes: The call type information determination module is used to determine the call type information corresponding to the component call instruction in response to the component call instruction from the second component to the first component; the first component is managed by a first component management tool among multiple component management tools, the second component is managed by a second component management tool among the multiple component management tools, and the multiple component management tools cannot directly call each other; A preset intermediary module determination module is used to determine, based on the call type information, a preset intermediary module corresponding to the first component and call link information corresponding to the preset intermediary module from the middleware. The middleware is an interaction management tool between the various component management tools. The middleware is generated in the target project file based on a preset plugin. The target project file includes a sub-project file corresponding to the first component management tool and a sub-project file corresponding to the second component management tool. The middleware stores first component declaration information obtained from the sub-project file corresponding to the first component, and generates the preset intermediary module and the call link information based on the call type information and the first component declaration information. The call operation execution module is used to control the preset intermediary module to execute the call operation corresponding to the component call instruction based on the call link information; The operation execution result sending module is used to control the middleware to send the operation execution result corresponding to the call operation to the second component.
9. The apparatus according to claim 8, characterized in that, The device further includes: The target project file acquisition module is used to acquire the target project file; A middleware generation module is used to generate the middleware based on the preset plugin in the target project file; The first component declaration information acquisition module is used to acquire the first component declaration information of the first component from the sub-project file corresponding to the first component. The first component declaration information storage module is used to store the first component declaration information in the middleware; A preset intermediary module generation module is used to control the middleware to generate the preset intermediary module and the call link information based on the call type information and the first component declaration information.
10. The apparatus according to claim 9, characterized in that, If the programming language type of the target project file, the programming language type of the first component management tool, and the programming language type of the second component management tool are inconsistent, the device further includes: An initial bridging file generation module is used to generate an initial bridging file in the target project file; The second component declaration information acquisition module is used to obtain the second component declaration information of the second component from the sub-project file corresponding to the second component. The target bridging file module is used to import the first component declaration information and the second component declaration information into the initial bridging file to obtain the target bridging file; The component declaration information reading module is used to control the middleware to read the first component declaration information and the second component declaration information from the target bridging file.
11. The apparatus according to claim 9, characterized in that, The call type information includes: class calls within the same component; the first component declaration information includes: multiple class information of the first component; the preset intermediary module generation module includes: The class information determination unit is used to determine the class information to be called of the first component corresponding to the component call instruction from the plurality of class information; A derived class derivation unit is used in the middleware to derive the derived class corresponding to the class information to be called by utilizing runtime and inheritance mechanisms. The method implementation address acquisition unit is used to acquire the method implementation address of the derived class using the runtime mechanism. The first preset intermediary module unit is used to use the derived class as the preset intermediary module; The first call link information unit is used to use the method implementation address as the call link information; Accordingly, the invocation operation execution module includes: The method implementation address reading unit is used to read the method implementation address corresponding to the derived class from the middleware; The component call instruction forwarding unit is used to forward the component call instruction to the derived class based on the method implementation address, so that the derived class can execute the call operation.
12. The apparatus according to claim 9, characterized in that, The call type information includes: interface calls between different components; the first component declaration information includes: component interface information of the first component; the preset intermediary module includes: the encapsulated interface to be called; and the preset intermediary module generation module includes: The interface to be invoked determination unit is used to determine the interface to be invoked of the first component corresponding to the component invocation instruction based on the component interface information; The first interface identification type determination unit is used to determine the first interface identification type of the middleware; The encapsulation processing unit is used to control the middleware to encapsulate the interface to be called according to the first interface identification type, so as to obtain the encapsulated interface to be called; The call link information generation unit is used to generate call link information for the encapsulated interface to be called; Accordingly, the invocation operation execution module includes: The control unit for the encapsulated interface to be called is used to control the encapsulated interface to be called to perform the calling operation based on the calling link information.
13. The apparatus according to any one of claims 9 to 12, characterized in that, The device further includes: The component association information determination module is used to determine the component association information corresponding to multiple components of each of the two component management tools from the sub-project files corresponding to each of the two component management tools. The component association information includes component dependency information and component version information. The two component management tools are the first component management tool and the second component management tool. The duplicate component determination module is used to determine at least one set of duplicate components in the two component management tools based on the component dependency information, wherein any set of duplicate components consists of two identical components; The deduplication module is used to perform deduplication on the target duplicate components based on the component version information and component dependency information of the target duplicate components when all target duplicate components are static library components, to obtain deduplicated components, wherein the target duplicate components are any one of the at least one group of duplicate components; The target project file update module is used to update the target project file based on the deduplication component.
14. The apparatus according to claim 13, characterized in that, The repeating component determination module includes: The information digest processing unit is used to perform information digest processing on multiple components of each of the two component management tools to obtain information digest data corresponding to the multiple components. A duplicate analysis unit is used to perform duplicate analysis on the information digest data and determine at least one set of duplicate information digest data corresponding to the two component management tools. A duplicate component determination unit is used to identify the components corresponding to the at least one set of duplicate information digest data as the at least one set of duplicate components.
15. A data processing device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the data processing method as described in any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the data processing method as described in any one of claims 1 to 7.
17. A computer program product, characterized in that, The computer program product includes at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the data processing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Componentization construction method of engineering project under IOS platform
CN107729061A
Cross-programming-language code calling method and device, medium and equipment
CN111176626A
Java file conflict management method and device, electronic equipment and medium
CN113885874A
SDK and access application compatible method and device, equipment and medium
CN114637525A
Method, device and system for calling main project code by component-based software project and storage medium
WO2019041668A1
