Component compilation method, apparatus, device, and medium

CN117632131BActive Publication Date: 2026-09-08TENCENT CLOUD COMPUTING (BEIJING) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210980129.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2026-09-08
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

[0005]本申请提供了一种组件编译方法、装置、设备及介质,解决了工程组件化中的组件接口冲突问题

Benefits of technology

[0016] According to another aspect of this application, a computer program product is provided, the computer program product including 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 the processor executes the computer instructions, causing the computer device to perform the component compilation method provided in the above aspect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117632131B_ABST
    Figure CN117632131B_ABST
Patent Text Reader

Abstract

The application discloses a component compilation method and device, equipment and medium, and belongs to the technical field of computers. The method is executed by a compilation plug-in, and the method comprises the following steps: acquiring a plurality of dependency items of a plurality of components, wherein the dependency items are used for representing dependency relationships among the plurality of components; in the case that an interface conflict is generated in a lexical analysis process of a first component in the plurality of components, determining a first dependency relationship corresponding to the interface conflict, and rolling back a trial linking operation corresponding to the first dependency relationship; and in the case that a cached operation rule in a syntax analysis process of the first component is different from an operation rule corresponding to a dependency item of the first component, updating the cached operation rule to an operation rule of the first component. The above-mentioned compilation method solves the component interface conflict problem in engineering componentization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a component compilation method, apparatus, device, and medium. Background Technology

[0002] Before running a program, it needs to be compiled. The purpose of compilation is to translate source code written in a high-level computer language into machine language that the computer can interpret and run. The compilation process includes lexical analysis, syntax analysis, intermediate code generation, optimization, and machine language generation. Among these, lexical analysis is the process of converting the character sequence of the source code into lexical units, and syntax analysis is the process of analyzing the semantic structure of the lexical units.

[0003] In related technologies, after extracting the source code of the client main project to be compiled into a pod project, interface conflicts may occur during compilation of multiple components within the pod project, which is used to manage multiple components. For example, the "scan" component in the pod project depends on a component that performs camera-related operations, and the OCR (Optical Character Recognition) component in the pod project also depends on a component that performs camera-related operations. That is, both component A and component B depend on component C. However, component C may have two versions: version 1.0 and version 2.0 of component C have the same interface name, but the interface functions of the two versions are different (e.g., the number of parameters or parameter types are different). In this case, the compiler cannot identify which version of component C will be compiled.

[0004] The interface conflict issues that arise during the compilation process caused by the aforementioned componentization of engineering (using multiple components to form the complete functionality of the client) are technical problems that urgently need to be solved. Summary of the Invention

[0005] This application provides a component compilation method, apparatus, device, and medium, which solves the component interface conflict problem in engineering componentization. The technical solution is as follows:

[0006] According to one aspect of this application, a component compilation method is provided, executed by a compilation plugin, the method comprising:

[0007] Retrieve multiple dependencies of multiple components; these dependencies are used to represent the dependency relationships between multiple components.

[0008] For the first component among multiple components, if an interface conflict occurs during the lexical analysis of the first component, determine the first dependency corresponding to the interface conflict, and the attempted link operation corresponding to the rollback of the first dependency;

[0009] For the first component among multiple components, if there is a difference between the operation rules cached during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component, the cached operation rules will be updated to the operation rules of the first component.

[0010] According to another aspect of this application, a component compilation apparatus is provided, the apparatus comprising:

[0011] The acquisition module is used to acquire multiple dependencies of multiple components. Dependencies are used to represent the dependency relationships between multiple components.

[0012] The rollback module is used to determine the first dependency relationship corresponding to the interface conflict and roll back the attempted link operation corresponding to the first dependency relationship when an interface conflict occurs during the lexical analysis of the first component among multiple components.

[0013] The update module is used to update the cached operation rules to the operation rules of the first component when there is a difference between the operation rules cached during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component.

[0014] According to one aspect of this application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the component compilation method as described above.

[0015] According to another aspect of this application, a computer-readable storage medium is provided, the storage medium storing a computer program that is loaded and executed by a processor to implement the component compilation method described above.

[0016] According to another aspect of this application, a computer program product is provided, the computer program product including 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 the processor executes the computer instructions, causing the computer device to perform the component compilation method provided in the above aspect.

[0017] The beneficial effects of the technical solutions provided in this application include at least the following:

[0018] By identifying the primary dependencies corresponding to interface conflicts during the compilation process, and then rolling back the attempted linking operations corresponding to the primary dependencies between multiple components, the component interface conflict problem in component-based engineering (using multiple components to construct a complete client function) was resolved without reducing dependencies and while preserving complete component functionality. Furthermore, after determining that the computation rules corresponding to the dependencies of the first component differed from the cached computation rules of the first component, the cached computation rules were updated to match the computation rules of the first component, thus resolving the component interface change issue. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0020] Figure 1 A schematic diagram illustrating a component interface conflict provided by an exemplary embodiment is shown;

[0021] Figure 2 A schematic diagram illustrating a component interface change provided by an exemplary embodiment is shown;

[0022] Figure 3 A flowchart of a component compilation method provided by an exemplary embodiment is shown;

[0023] Figure 4 A flowchart of a lexical analysis process provided by an exemplary embodiment is shown;

[0024] Figure 5 This illustration shows a schematic diagram of obtaining multiple dependencies of multiple components according to an exemplary embodiment;

[0025] Figure 6 A structural block diagram of a component compilation apparatus provided in an exemplary embodiment is shown;

[0026] Figure 7 A structural block diagram of a computer device provided in an exemplary embodiment is shown. Detailed Implementation

[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0028] It should be understood that "several" in this article refers to one or more, and "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0029] First, a brief introduction to the terms used in the embodiments of this application:

[0030] The Clang (C language family frontend) compiler is a lightweight compiler in the LLVM compiler toolset for compiling C, C++, and Objective-C languages. The Clang compiler features fast compilation and low memory consumption; diagnostic capabilities; and compatibility with the GCC compiler. This application provides a compiler plugin developed based on the Clang compiler, which is built into the LLVM compiler toolset.

[0031] Compilation: The process of using a compiler to obtain a target program (machine language) from a source program written in a source language (high-level computer language). Generally, the compilation process can be divided into five stages: lexical analysis, syntax analysis, semantic checking and intermediate code generation, code optimization, and target program generation.

[0032] Lexical analysis is the process of converting a sequence of characters in a source program into a sequence of tokens during compilation. The program or function that performs lexical analysis in the compiler is called a lexical analyzer (or simply lexer), also known as a scanner. Lexical analyzers typically exist as functions that are called by the parser. This application constructs a lexical analyzer to resolve interface conflicts during component linking. Component linking can be understood as recursively linking components with dependencies.

[0033] Syntax analysis is the process of analyzing the grammatical structure of a sequence of words during compilation. Syntax analysis generates a syntax tree, which is a graphical representation of sentence structure and represents the derivation result of the sentence. Syntax trees are helpful for understanding the grammatical structure of sentences. Simply put, a syntax tree is a tree formed when derivation is performed according to a certain rule. In this application, a syntax tree will be constructed to fix compilation errors caused by changes in component interfaces.

[0034] To better explain the technical problem solved by this application, the relevant technologies will be introduced below:

[0035] In related technologies, to achieve client-side componentization, a main client project needs to be created first. From this main project, the source code of multiple business logic components that need to be componentized are selected; these components are the source code of the componentized parts. A pod project is then created within the main project, and the source code of the multiple components is extracted into this pod project. The pod project manages these components. Next, a Category Pod project is created within the main project. This Category Pod project enables communication between the components within the pod project. Finally, a Target-action operation is added to the pod project; this Target-action operation is used to invoke the underlying operations of the components.

[0036] However, when a client-side componentized project applies components developed by multiple teams, it introduces multiple Category Pod projects provided by these teams. When managing inter-component calls between these Category Pod projects, interface conflicts may arise. Common interface conflicts include: class name references, method / function calls, constant references, enumeration references, macro references, protocol calls or implementations, header file references, and transitive dependencies.

[0037] For example, a client application to be modularized needs to use Team A's "Scan" component and Team B's OCR recognition component. Both the "Scan" and OCR components depend on Team C's component that performs camera-related operations. The "Scan" component can be abstracted as component A, the OCR component as component B, and the component performing camera-related operations as component C. (Refer to the reference.) Figure 1 Part (A) shows that both component A and component B depend on component C. Figure 1 Section (B) shows that component C is built into components A and B at compile time. An interface conflict occurs when components A and B use inconsistent interface functions of component C.

[0038] In addition, when a component being called on the client changes, interface conflicts may arise during the compilation process of that component. Common interface changes include: deleting an interface, modifying an interface, moving the storage location of an interface, and adding a new interface.

[0039] Taking interface modification as an example, when a client-side component undergoes a version upgrade, an interface conflict will occur during the compilation process. The interface name used by the called component remains unchanged before and after the version upgrade, but the interface function changes. Please refer to [reference needed]. Figure 2 This shows that before and after the change, the interface name of the function interface initID of the called component C did not change, but the functions within the function interface initID changed.

[0040] The interface conflict issues that may occur during the component-based compilation process of the client have been described in detail above. This application provides a solution to the above interface conflict scenarios based on compilation principles.

[0041] Figure 3 A flowchart of a component compilation method provided in an exemplary embodiment of this application is shown, illustrated by the method being applied to a compilation plugin. The method includes:

[0042] Step 320: Obtain multiple dependencies of multiple components. Dependencies are used to represent the dependency relationships between multiple components.

[0043] In one embodiment, the multiple components are multiple components after client-side componentization, and the multiple components are used to support the complete functionality of the client. Optionally, the multiple components are multiple components provided by different teams. Optionally, there are dependencies between the multiple components. For example, the multiple components include component A, component B, component C, and component D. If both component A and component B call the first function interface of component C, and both component A and component C call the second function interface of component D, then it is considered that there are two dependencies among components A, B, C, and D. In this application, a dependency has recursively exhausted the reference relationships in multiple components. For example, if both component A and component B call the first function interface of component C, and the function corresponding to the first function interface of component C calls the third function interface of component D, then it is not considered that there are two dependencies among components A, B, C, and D, but that there is only one dependency among components A, B, C, and D.

[0044] In one embodiment, a dependency refers to a code field in the source code that has a reference relationship.

[0045] Optionally, dependencies may include at least one of the following:

[0046] • Code fields in the component's source code that involve macro definitions;

[0047] • Code fields in the component's source code that involve header files;

[0048] • Conditional expressions in the component's source code.

[0049] Optionally, code fields involving macro definitions include macros with function calls and macros with parameters. Since macro definitions are simply string replacements, when retrieving code fields involving macro definitions, it is necessary to expand the macros and then recursively search across multiple components to obtain the macros from multiple components.

[0050] Optionally, the code field involving header files refers to the "xxx.h" field in the component's source code. In one embodiment, this is done when writing the program by including "#include<xxx.h> "and / or "#import<xxx.h> The operation refers to the operation that references header files. Optionally, when retrieving code fields involving header files, it is necessary to recursively search across multiple components to retrieve "xxx.h" from multiple components.

[0051] Optionally, a conditional expression refers to the logical expression used when the component's source code is conditionally compiled. For example, in the code "#if compile=10; Program segment; #end if", "compile=10" is the conditional expression. The code segment between "#if" and "#end if" will only be compiled if and only if compile is configured to 10.

[0052] In one embodiment, the functions in the component's functional interface include code fields involving macro definitions.

[0053] In one embodiment, the functions in the component's functional interface include conditional expressions.

[0054] In one embodiment, the component containing the function interface uses a header file.

[0055] Step 340: For the first component among multiple components, if an interface conflict occurs during the lexical analysis of the first component, determine the first dependency relationship corresponding to the interface conflict, and the attempted link operation corresponding to the rollback of the first dependency relationship;

[0056] In one embodiment, the first dependency refers to the dependency relationship between multiple components related to a first component. Rolling back the attempted linking operation corresponding to the first dependency refers to rolling back the linking operation between multiple components. For example, if component A depends on component C, and component C depends on component D, then the rollback operation is used to remove the dependency relationship between components A, C, and D. Since the source code of multiple components has already been attempted to be linked during compilation, the linking operation between multiple components cannot be directly interrupted. Therefore, the rollback operation is used to undo linking operations with interface conflicts.

[0057] Step 360: For the first component among multiple components, if there is a difference between the cached operation rules during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component, update the cached operation rules to the operation rules of the first component.

[0058] In one embodiment, the first component interface requires different logical and arithmetic operations to be performed internally. The rules for these operations can be obtained through syntax analysis. Changes in the operation rules can be checked through the syntax tree output by the syntax analysis process.

[0059] In one embodiment, the syntax tree caches the computation rules and corresponding hook scripts from the last compilation. During the current compilation, the cached first computation rule for the first component can be retrieved by keyword matching and scope determination of the computation rules. After obtaining the dependencies of the first component, the second computation rule can be generated based on the dependencies of the first component. Optionally, the dependencies of the first component can be used as parameters in the computation process to generate the second computation rule. If there is a difference between the first and second computation rules, the first computation rule is added to the first component via a hook function.

[0060] In another embodiment, the first computation rule of the cached first component is obtained by keyword matching and scope determination of the computation rule. The first computation rule is generated from the computation parameters. Then, the dependencies of the first component are obtained, and these dependencies can be used as computation parameters. If the dependencies of the first component do not match the corresponding computation parameters in the first computation rule, the first computation rule is added to the first component via a hook function.

[0061] For illustration purposes, the first operation rule is the new version of the operation rule of the first component, and the second operation rule is the old version of the operation rule of the first component. When it is detected that the operation rule of the first component has changed, the first operation rule is added to the first component through a hook function.

[0062] Optionally, after adding the first operation rule to the first component, the component interface of the first component is also obfuscated, so that the component interface name of the first component can be used in multiple versions of the first component. That is, the obfuscated component interface of the first component supports backward compatibility.

[0063] In summary, by identifying the primary dependencies corresponding to interface conflicts during the compilation process, and then rolling back the attempted linking operations corresponding to the primary dependencies between multiple components, the component interface conflict problem in project componentization was resolved without reducing dependencies and while preserving complete component functionality. Furthermore, after determining that the computation rules corresponding to the dependencies of the first component differed from the cached computation rules of the first component, the cached computation rules were updated to match the computation rules of the first component, thus resolving the component interface change issue.

[0064] Furthermore, when integrating new components into a modular engineering system, it can effectively avoid problems such as interface conflicts, symbol redefinition, and duplicate class names with existing components.

[0065] Furthermore, the compilation plugin provided in this application can automatically resolve various interface errors during the compilation process, thereby reducing the time cost for developers to analyze and modify each component.

[0066] based on Figure 3 In the optional embodiment shown, step 340 can be replaced by the following steps:

[0067] 1. Store the source data of the first component in the state diagram to obtain at least one function interface of the first component;

[0068] The source data of the first component includes at least the characters, pointers, and stack of the first component.

[0069] A state diagram is a data structure. After storing the source data of the first component into the state diagram, the state diagram outputs the internal file information of the first component. This internal file information includes the corresponding class name and the function interfaces under that class. In other words, storing the source data of the first component into the state diagram yields at least one function interface for the first component.

[0070] 2. Obtain the temporary files generated by the first component during lexical analysis;

[0071] In one embodiment, an intermediate temporary file with the .o extension generated by the first component during lexical analysis is obtained. The intermediate temporary file with the .o extension includes a symbol table. The first component attempts to link based on the symbol table. If the linking fails due to interface conflicts, the intermediate temporary file with the .o extension also generates interface conflict symbols.

[0072] 3. If there are interface conflict symbols in the temporary file, determine the first function interface corresponding to the interface conflict symbol from at least one function interface;

[0073] In one embodiment, if an interface conflict symbol exists in an intermediate temporary file with the .o suffix, the first function interface corresponding to the interface conflict symbol is determined from at least one function interface output from the state diagram. That is, the interface conflict symbol output from the temporary file is used to reverse-search for the symbol information corresponding to the interface conflict symbol in the state diagram. Optionally, the English names for interface conflict symbols include duplicate symbol and unresolved symbol.

[0074] 4. Determine the first dependency relationship corresponding to the first function interface;

[0075] In one embodiment, a recursive operation is performed among multiple components to find the first dependency relationship between the components corresponding to the first function interface. For example, if component A calls the first function interface of component C, and component B also calls the first function interface of component C, then there is a first dependency relationship between components A, B, and C corresponding to the first function interface.

[0076] In one embodiment, steps 3 and 4 above can be implemented by first determining the first character of the stack in the current state, identifying the function interface pointed to by the pointer as the first function interface, and then determining the first dependency relationship corresponding to the first function interface from multiple dependencies of multiple components. The first dependency relationship is determined based on at least one of the macro definitions, conditional expressions in the functions of the first function interface, and the header file of the first component.

[0077] 5. Undo the attempted linking operation corresponding to the first dependency by performing a rollback operation.

[0078] In one embodiment, a rollback operation is used to undo the attempted linking operation corresponding to the first dependency.

[0079] In summary, a lexical analyzer is provided that does not interrupt the original dependencies within the first component, but only rolls back the linking operations corresponding to the original dependencies, thus greatly ensuring the integrity of the first component's functionality.

[0080] Figure 4 A flowchart of a lexical analysis process provided in an exemplary embodiment of this application is shown. The lexical analysis process includes:

[0081] Step 401, compile the components;

[0082] Start compiling the first component.

[0083] Step 402: Create a buffer zone;

[0084] In one embodiment, the source data of the first component is stored in a state diagram. The source data of the first component includes information such as characters, pointers, and stacks. The state diagram outputs the internal file information of the first component, which includes the corresponding class name and the function interfaces under the class.

[0085] Step 403, attempt a link;

[0086] Search for the symbol table corresponding to the first component in the generated .o intermediate product and attempt to link it.

[0087] Step 404: Was the connection successful?

[0088] If the connection attempt fails, proceed to step 405; if the connection attempt succeeds, proceed to step 409.

[0089] Step 405, generating symbols;

[0090] If the linking fails, the intermediate artifacts of the .o file will generate interface conflict symbols, which include duplicate class name symbols and unresolved symbols.

[0091] Step 406: Search for symbol information;

[0092] The interface conflict symbols generated from the intermediate products of .o files are used to reverse-search the corresponding function interfaces in the state graph.

[0093] Step 407: Retrieve the dependencies from set M;

[0094] Set M stores multiple dependencies of multiple components. Retrieve from set M the dependencies associated with the function interfaces corresponding to the interface conflict symbols.

[0095] The construction process of set M is as follows Figure 5 As shown.

[0096] The process of obtaining macro definitions in set M includes: for a component, determining the macro definitions of the component, scanning the locations where macro definitions are used in the component, expanding macros with function calls and macros with parameters, and then recursively searching for macro definitions in multiple components to mark macros in function calls and parameter sources in multiple components.

[0097] The process of obtaining header files in set M 502 includes: for a header file, recursively searching and marking all header files in multiple components that have a dependency relationship with the header file, and performing the same operation on all header files.

[0098] The process of obtaining the conditional expression in set M 503 includes: for a component, checking the conditional compilation in the component, retrieving the configuration of conditional compilation (conditional expression of conditional compilation), and marking all variable fields in the conditional expression.

[0099] The macros, header files, and conditional expressions marked above constitute set M.

[0100] Step 408: Perform a rollback;

[0101] After retrieving the dependencies associated with the function interfaces corresponding to the interface conflict symbols from set M, rollback operations are performed on the dependencies corresponding to the dependencies.

[0102] Step 409, recursive operation;

[0103] In the event of a link failure, a recursive operation refers to recursively executing the rollback operation corresponding to the link operation of that dependency in multiple components.

[0104] If the link is successful, a recursive operation refers to recursively performing the link operation across multiple components.

[0105] Step 410: Compile the next component.

[0106] Compile the next component.

[0107] In summary, the above methods enable the automatic resolution of various interface errors during the compilation process after the project is modularized, thereby reducing the time cost for developers to analyze and modify each component.

[0108] The above method also enables the calling modules to be modified in conjunction with the component when the interface is upgraded or modified, without reducing dependencies and ensuring the integrity of the component's functionality.

[0109] The above method also enables the effective avoidance of problems such as interface conflicts, symbol redefinition, and class name duplication with existing components after integrating new components.

[0110] Figure 6 This application shows a structural block diagram of a component compilation apparatus provided in an exemplary embodiment, the apparatus comprising:

[0111] The acquisition module 601 is used to acquire multiple dependencies of multiple components. The dependencies are used to represent the dependency relationships between multiple components.

[0112] The rollback module 602 is used to determine the first dependency relationship corresponding to the interface conflict and roll back the attempted link operation corresponding to the first dependency relationship when an interface conflict occurs during the lexical analysis of the first component among multiple components.

[0113] Update module 603 is used to update the cached operation rules to the operation rules of the first component when there is a difference between the operation rules cached during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component.

[0114] In an optional embodiment, the rollback module 602 is further configured to obtain a temporary file generated by the first component during lexical analysis; if there is an interface conflict symbol in the temporary file, determine the first dependency corresponding to the interface conflict symbol; and cancel the attempted linking operation corresponding to the first dependency through a rollback operation.

[0115] In an optional embodiment, the rollback module 602 is further configured to store the source data of the first component into a state diagram to obtain at least one function interface of the first component, wherein the source data includes at least the characters, pointers and stack of the first component; determine the first function interface corresponding to the interface conflict symbol from the at least one function interface; and determine the first dependency relationship corresponding to the first function interface.

[0116] In an optional embodiment, the update module 603 is further configured to obtain the cached first operation rule corresponding to the component interface of the first component during the syntax analysis process; generate a second operation rule based on the dependencies of the first component; and add the first operation rule to the first component through a hook function if there is a difference between the first operation rule and the second operation rule.

[0117] In an optional embodiment, the update module 603 is further configured to use the dependencies of the first component as parameters in the operation process to generate a second operation rule.

[0118] In an optional embodiment, the update module 603 is further configured to obfuscate the component interface name of the first component, such that the component interface name of the first component is used simultaneously in multiple versions of the first component.

[0119] In an optional embodiment, a dependency refers to a code field in the component's source code that has a reference relationship.

[0120] In an optional embodiment, the dependencies include at least one of the following:

[0121] The component's source code contains code fields that involve macro definitions;

[0122] The component's source code includes code fields that reference header files;

[0123] Conditional expressions in the component's source code.

[0124] In summary, by identifying the primary dependencies corresponding to interface conflicts during the compilation process and then rolling back the attempted linking operations corresponding to the primary dependencies between multiple components, the component interface conflict problem in project componentization is resolved without reducing dependencies and while preserving complete component functionality. Furthermore, after determining that the computation rules corresponding to the dependencies of the first component differ from the cached computation rules of the first component, the cached computation rules are updated to match the computation rules of the first component, thus resolving the component interface change issue through the compilation plugin.

[0125] Figure 7A structural block diagram of a computer device 700 provided in an exemplary embodiment of this application is shown. The computer device 700 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The computer device 700 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.

[0126] Typically, computer device 700 includes a processor 701 and a memory 702.

[0127] Processor 701 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 701 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 701 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 701 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 701 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0128] Memory 702 may include one or more computer-readable storage media, which may be non-transitory. Memory 702 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 702 is used to store at least one instruction, which is executed by processor 701 to implement the component compilation method provided in the method embodiments of this application.

[0129] In some embodiments, the computer device 700 may also optionally include a peripheral device interface 703 and at least one peripheral device. The processor 701, memory 702, and peripheral device interface 703 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 703 via a bus, signal line, or circuit board. For example, the peripheral device may include at least one of the following: a radio frequency circuit 704, a display screen 705, a camera assembly 706, an audio circuit 707, and a power supply 708.

[0130] Peripheral device interface 703 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 701 and memory 702. In some embodiments, processor 701, memory 702 and peripheral device interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 701, memory 702 and peripheral device interface 703 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0131] The radio frequency (RF) circuit 704 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 704 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 704 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 704 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 704 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 7G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 704 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.

[0132] Display screen 705 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 705 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 701 for processing. In this case, display screen 705 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, display screen 705 may be a single screen, disposed on the front panel of computer device 700; in other embodiments, display screen 705 may be at least two screens, disposed on different surfaces of computer device 700 or in a folded design; in still other embodiments, display screen 705 may be a flexible display screen, disposed on a curved or folded surface of computer device 700. Furthermore, display screen 705 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 705 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0133] The camera assembly 706 is used to acquire images or videos. Optionally, the camera assembly 706 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 706 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.

[0134] The audio circuit 707 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 701 for processing, or input to the radio frequency circuit 704 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located in a different part of the computer device 700. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 701 or the radio frequency circuit 704 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 707 may also include a headphone jack.

[0135] Power supply 708 is used to supply power to the various components in computer device 700. Power supply 708 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 708 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0136] In some embodiments, the computer device 700 further includes one or more sensors 709. The one or more sensors 709 include, but are not limited to, an accelerometer 710, a gyroscope 711, a pressure sensor 712, an optical sensor 713, and a proximity sensor 714.

[0137] Accelerometer 710 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by computer device 700. For example, accelerometer 710 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 701 can control display screen 705 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 710. Accelerometer 710 can also be used for games or for acquiring user motion data.

[0138] The gyroscope sensor 711 can detect the orientation and rotation angle of the computer device 700. The gyroscope sensor 711, in conjunction with the accelerometer sensor 710, can collect 3D motion data from the user on the computer device 700. Based on the data collected by the gyroscope sensor 711, the processor 701 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.

[0139] The pressure sensor 712 can be disposed on the side bezel of the computer device 700 and / or on the lower layer of the display screen 705. When the pressure sensor 712 is disposed on the side bezel of the computer device 700, it can detect the user's grip signal on the computer device 700, and the processor 701 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 712. When the pressure sensor 712 is disposed on the lower layer of the display screen 705, the processor 701 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 705. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0140] An optical sensor 713 is used to collect ambient light intensity. In one embodiment, the processor 701 can control the display brightness of the display screen 705 based on the ambient light intensity collected by the optical sensor 713. For example, when the ambient light intensity is high, the display brightness of the display screen 705 is increased; when the ambient light intensity is low, the display brightness of the display screen 705 is decreased. In another embodiment, the processor 701 can also dynamically adjust the shooting parameters of the camera assembly 706 based on the ambient light intensity collected by the optical sensor 713.

[0141] A proximity sensor 714, also known as a distance sensor, is typically located on the front panel of a computer device 700. The proximity sensor 714 is used to detect the distance between the user and the front of the computer device 700. In one embodiment, when the proximity sensor 714 detects that the distance between the user and the front of the computer device 700 is gradually decreasing, the processor 701 controls the display screen 705 to switch from a screen-on state to a screen-off state; when the proximity sensor 714 detects that the distance between the user and the front of the computer device 700 is gradually increasing, the processor 701 controls the display screen 705 to switch from a screen-off state to a screen-on state.

[0142] Those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on the computer device 700, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0143] This application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the component compilation method provided in the above method embodiments.

[0144] This application provides 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 component compilation method provided in the above-described method embodiments.

[0145] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0146] 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.

[0147] The above description is merely an optional 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 component compilation method, characterized in that, Executed by the compilation plugin, the method includes: Obtain multiple dependencies of multiple components, wherein the dependencies are used to characterize the dependency relationships between the multiple components; For the first component among the plurality of components, obtain the temporary file generated by the first component during lexical analysis; if there is an interface conflict symbol in the temporary file, determine the first dependency corresponding to the interface conflict symbol; and cancel the attempted linking operation corresponding to the first dependency through a rollback operation. For the first component among the plurality of components, if there is a difference between the operation rules cached during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component, the cached operation rules shall be updated to the operation rules of the first component.

2. The method according to claim 1, characterized in that, The method further includes: The source data of the first component is stored in the state diagram to obtain at least one function interface of the first component. The source data includes at least the characters, pointers and stack of the first component. Determining the first dependency relationship corresponding to the interface conflict symbol includes: Determine the first function interface corresponding to the interface conflict symbol from the at least one function interface; Determine the first dependency relationship corresponding to the first function interface.

3. The method according to claim 1 or 2, characterized in that, When the cached operation rules during the syntax analysis of the first component differ from the operation rules corresponding to the dependencies of the first component, updating the cached operation rules to the operation rules of the first component includes: During the syntax analysis process, obtain the cached first operation rule corresponding to the component interface of the first component; Based on the dependencies of the first component, a second operation rule is generated; If there is a difference between the first operation rule and the second operation rule, the first operation rule is added to the first component through a hook function.

4. The method according to claim 3, characterized in that, The generation of the second operation rule based on the code fields with reference relationships in the first component includes: The dependencies of the first component are used as parameters in the calculation process to generate the second calculation rule.

5. The method according to claim 3, characterized in that, The method further includes: The component interface name of the first component is obfuscated so that the component interface name of the first component is used in multiple versions of the first component.

6. The method according to claim 1 or 2, characterized in that, The dependency refers to a code field in the source code of the component that has a reference relationship; the dependency includes at least one of the following: The component's source code contains code fields that involve macro definitions; The source code of the component involves code fields in header files; The conditional expression in the source code of the component.

7. A component compilation apparatus, characterized in that, The device includes: The acquisition module is used to acquire multiple dependencies of multiple components, wherein the dependencies are used to characterize the dependency relationships between the multiple components; The rollback module is used to, for the first component among the plurality of components, obtain the temporary file generated by the first component during the lexical analysis process; if there is an interface conflict symbol in the temporary file, determine the first dependency corresponding to the interface conflict symbol; and cancel the attempted linking operation corresponding to the first dependency through a rollback operation. An update module is used to update the cached operation rules of the first component to the operation rules of the first component when there is a difference between the operation rules cached during the syntax analysis of the first component and the operation rules corresponding to the dependencies of the first component.

8. The component compilation apparatus according to claim 7, characterized in that, The rollback module is further configured to store the source data of the first component into a state diagram to obtain at least one function interface of the first component, wherein the source data includes at least the characters, pointers, and stack of the first component; determine the first function interface corresponding to the interface conflict symbol from the at least one function interface; and determine the first dependency relationship corresponding to the first function interface.

9. The component compilation apparatus according to claim 7 or 8, characterized in that, The update module is also used to obtain the cached first operation rule corresponding to the component interface of the first component during the syntax analysis process; generate a second operation rule based on the dependencies of the first component; and add the first operation rule to the first component through a hook function if there is a difference between the first operation rule and the second operation rule.

10. The component compilation apparatus according to claim 9, characterized in that, The update module is also used to use the dependencies of the first component as parameters in the calculation process to generate a second calculation rule.

11. The component compilation apparatus according to claim 9, characterized in that, The update module is also used to obfuscate the component interface name of the first component, so that the component interface name of the first component is used in multiple versions of the first component at the same time.

12. The component compilation apparatus according to claim 7 or 8, characterized in that, The dependency refers to a code field in the source code of the component that has a reference relationship; the dependency includes at least one of the following: The component's source code contains code fields that involve macro definitions; The source code of the component involves code fields in header files; The conditional expression in the source code of the component.

13. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the component compilation method as described in any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is loaded and executed by a processor to implement the component compilation method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data processing system capable of maintaining dependency relationship in advanced language program data flow diagram extraction

    CN102508689A

  • Method for automatically detecting dependency conflict problem in Maven project based on GitHub

    CN112799937A

  • Invalid dependency detection method and related equipment

    CN114721658A