Correlation compiling method and device, computer readable storage medium, and terminal

CN115390851BActive Publication Date: 2026-10-27SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211029907.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2026-10-27
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

[0004]由上,现有技术中普遍采用人工预配置的关联编译信息进行代码入库的编译测试,编译测试的准确性、完备性和有效性均无法得到保障

Benefits of technology

[0022]在本发明实施例中,确定待提交代码的目标代码仓库信息;基于所述待提交代码的目标代码仓库信息确定所述待提交代码关联的各个第一关联项目分支,其中,每个第一关联项目分支包含一个或多个工程;对于每个第一关联项目分支,基于所述目标代码仓库信息关联的关联组件,对该第一关联项目分支的各个工程进行筛选,以确定该第一关联项目分支的第一关联工程;基于该第一关联项目分支的第一关联工程确定该第一关联项目分支的关联编译工程,并分别对各个第一关联项目分支的关联编译工程的代码进行关联编译。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115390851B_ABST
    Figure CN115390851B_ABST
Patent Text Reader

Abstract

An association compiling method and device, a computer readable storage medium and a terminal, the method comprises: determining target code repository information of to-be-submitted code; determining each first associated project branch associated with the to-be-submitted code based on the target code repository information of the to-be-submitted code, wherein each first associated project branch contains one or more projects; for each first associated project branch, screening each project of the first associated project branch based on an associated component associated with the target code repository information to determine a first associated project of the first associated project branch; determining an associated compiling project of the first associated project branch based on the first associated project of the first associated project branch, and respectively compiling the code of the associated compiling project of each first associated project branch. The above scheme can improve the accuracy and completeness of the association compilation and reduce the probability of code introduction problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to an associative compilation method and apparatus, a computer-readable storage medium, and a terminal. Background Technology

[0002] In the field of computer technology, after developers complete a piece of code, the process of submitting that code to a target code repository often requires submitting a verification task. This task involves identifying all project branches and projects that the code submission might affect, and then compiling and testing them. Specifically, when submitting code to the repository, developers can provide a commit identifier (GerritID) corresponding to the code submission. The submission system uses the GerritID to obtain the corresponding target code repository information, and then uses that information to find configuration association information, ultimately synthesizing the code associated with the project branches and projects to be submitted and performing associated compilation.

[0003] In existing technologies, the associated project branches and projects for code submission are almost always determined by searching manually pre-configured association information. However, relying solely on manual methods to determine the associated project branches and projects for code submission is extremely difficult. This is limited, firstly, by the fact that developers themselves may not have a clear enough understanding of the overall development process or the associated compilation. Secondly, there are many factors that actually influence associated compilation information. For example, the code may use macros whose on / off states differ in different project branches or projects; the same parameter or variable may have different values ​​in different branches or projects; and a certain piece of code may be differentiated based on different component delivery types, which are closely related to the project.

[0004] As stated above, current technologies commonly use manually pre-configured associated compilation information for code inclusion and compilation testing, which fails to guarantee the accuracy, completeness, and effectiveness of the compilation tests. While directly selecting all branches and projects within the project for compilation can solve the problem of missing parts due to incomplete associated information, this approach of compiling everything clearly leads to a waste of build resources and a significant increase in compilation time. Summary of the Invention

[0005] One of the objectives of this invention is to provide an associative compilation method that finds a balance between omissions and overcompilation, thereby improving the accuracy and completeness of associative compilation, reducing the probability of code being introduced into the library and improving code quality.

[0006] To achieve the above objectives, embodiments of the present invention provide an associated compilation method, comprising the following steps: determining target code repository information for the code to be submitted; determining each first associated project branch associated with the code to be submitted based on the target code repository information, wherein each first associated project branch contains one or more projects; for each first associated project branch, filtering each project of the first associated project branch based on the associated components associated with the target code repository information to determine the first associated project of the first associated project branch; determining the associated compilation project of the first associated project branch based on the first associated project of the first associated project branch, and performing associated compilation on the code of the associated compilation project of each first associated project branch respectively.

[0007] Optionally, determining each first associated project branch of the code to be committed based on the target code repository information of the code to be committed includes: determining each first associated project branch of the code to be committed based on the target code repository information of the code to be committed and a first mapping relationship; wherein, the first mapping relationship is used to indicate the mapping relationship between the code repository information and the project branch information.

[0008] Optionally, the first mapping relationship is determined based on a project information management file, which contains code repository information and project branch information, and includes a mapping relationship between the repository information and the project branch information. Determining each first associated project branch of the code to be submitted based on the target code repository information and the first mapping relationship includes: traversing multiple preset project information management files to find the target code repository information of the code to be submitted; whenever the target code repository information is found to be present in each code repository information in the project information management file, obtaining one or more project branch information corresponding to the target code repository information; and using the project branch to which each project branch information corresponding to the target code repository information belongs as the first associated project branch of the code to be submitted.

[0009] Optionally, before filtering each project of the first associated project branch based on the associated components associated with the target code repository information, the method further includes: determining each component generated by code compilation in the target code repository to which the target code repository information belongs, as the associated components associated with the target code repository information.

[0010] Optionally, for each first associated project branch, the step of filtering each project of the first associated project branch based on the associated components associated with the target code repository information to determine the first associated project of the first associated project branch includes: determining all component delivery types of each associated component, wherein each associated component has one or more component delivery types, and each component delivery type has one or more delivery options; selecting one delivery option in each component delivery type and forming a delivery option combination using the selected delivery option, and then determining some or all of all non-repeating delivery option combinations; for each determined delivery option combination, determining whether the project information of each project of the first associated project branch contains the delivery option combination; selecting a preset number of projects from the projects containing the delivery option combination; and taking the set of selected projects as the first associated project of the first associated project branch.

[0011] Optionally, the component delivery type for each associated component can be selected from one or more of the following: chip type, board type, system permission type, and software service type.

[0012] Optionally, before determining the associated compilation project of the first associated project branch based on the first associated project branch, the method further includes: determining the second associated project of the first associated project branch based on the target code repository information, the project branch information of the first associated project branch, and a preset associated project project database table; wherein the associated project project database table contains code repository information, project branch information, and project information, and contains the mapping relationship between the code repository information and the project branch information, and also contains the mapping relationship between the project branch information and the project information.

[0013] Optionally, determining the associated compilation project of the first associated project branch based on the first associated project branch includes: determining the union of each first associated project and each second associated project of the first associated project branch as the associated compilation project of the first associated project branch.

[0014] Optionally, before filtering each project of the first associated project branch based on the associated components associated with the target code repository information for each first associated project branch, the method further includes: performing a preliminary screening of each first associated project branch using a preset project branch importance level threshold.

[0015] Optionally, the initial screening of the first associated project branches using a preset project branch importance level threshold includes: selecting each of the first associated project branches whose importance level value is greater than or equal to the project branch importance level threshold; wherein, the higher the importance, the larger the importance level value.

[0016] Optionally, before performing associated compilation on the code of the associated compilation project of each first associated project branch, the method further includes: performing a secondary screening on the associated compilation project of each first associated project branch using a preset project importance level threshold.

[0017] Optionally, a secondary screening of the associated compilation projects of each first associated project branch is performed using a preset project importance level threshold. This includes: for each first associated project branch, selecting projects among the associated compilation projects of that first associated project branch whose importance level value is greater than or equal to the project importance level threshold; wherein, the higher the importance level, the larger the importance level value.

[0018] This invention also provides an associated compilation apparatus, comprising: a target code repository information determination module, configured to determine the target code repository information of the code to be submitted based on the submission identifier of the code to be submitted; a first associated project branch determination module, configured to determine each first associated project branch associated with the code to be submitted based on the target code repository information of the code to be submitted, wherein each first associated project branch contains one or more projects; a project filtering module, configured to filter each project of the first associated project branch based on the associated components associated with the target code repository information for each first associated project branch, thereby determining the first associated project of the first associated project branch; and an associated compilation project determination module, configured to determine the associated compilation project of the first associated project branch based on the first associated project of the first associated project branch, and to perform associated compilation on the code of the associated compilation project of each first associated project branch respectively.

[0019] This invention also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program is executed by a processor to perform the steps of the aforementioned associative compilation method.

[0020] This invention also provides a terminal, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the steps of the above-described associative compilation method when running the computer program.

[0021] Compared with the prior art, the technical solution of the embodiments of the present invention has the following beneficial effects:

[0022] In this embodiment of the invention, the target code repository information of the code to be submitted is determined; based on the target code repository information of the code to be submitted, each first associated project branch associated with the code to be submitted is determined, wherein each first associated project branch contains one or more projects; for each first associated project branch, based on the associated components associated with the target code repository information, each project of the first associated project branch is filtered to determine the first associated project of the first associated project branch; based on the first associated project of the first associated project branch, the associated compilation project of the first associated project branch is determined, and the code of the associated compilation project of each first associated project branch is associated and compiled.

[0023] Compared to existing technologies that rely on manually pre-configured associative compilation information to determine associated project branches and projects for pre-warehouse compilation testing, this method is limited by the developer's understanding of the entire business logic or associative compilation process. Furthermore, due to differences in macros, variables, and component delivery types across different project branches or projects, the accuracy and effectiveness of manually pre-configured associative compilation information cannot be guaranteed. Directly selecting all branches and projects of a project would obviously lead to a waste of build resources and compilation time. The solution disclosed in this invention determines the first associated project branch of the code to be submitted based on the target repository information. Then, based on the associated components associated with the target repository information, it filters each project of the first associated project branch before determining the associated compilation project. This improves the accuracy of the determined associated compilation project, helps reduce the probability of missed or excessive compilation, and simultaneously balances the efficient use of build resources and associative compilation efficiency, thereby improving the quality of the code to be warehoused.

[0024] Furthermore, the target code repository information of the code to be submitted is found by traversing multiple preset project information management files. Whenever the target code repository information is found to be present in any of the code repository information within the project information management file, one or more project branch information corresponding to the target code repository information is obtained. The project branch to which each project branch information corresponding to the target code repository information belongs is used as the first associated project branch associated with the code to be submitted. In this embodiment of the invention, the project information management file (e.g., the Manifest.xml file) contains a relatively accurate and complete mapping relationship between code repository information and project branch information pre-established / built for the entire R&D project. Therefore, by searching the project information management file, the complete and accurate first associated project branches (set) associated with the code to be submitted can be determined as the initially determined associated project branches, thereby helping to improve the completeness, accuracy, and effectiveness of the subsequently determined associated compilation projects.

[0025] Furthermore, in this embodiment of the invention, component association rules are used to filter the projects of the first associated project branch. Specifically: first, it is determined which components (i.e., the associated components) were generated by the code in the target code repository; then, delivery option combinations are formed based on the delivery options contained in all component delivery types (the union of component delivery types) of each associated component; for each delivery option combination, a preset number of projects containing that delivery option combination are selected from the projects of the first associated project branch; the set of selected projects is taken as the first associated project of the first associated project branch. Thus, effective projects can be selected from the projects of each first associated project branch as the first associated project, improving the effectiveness and accuracy of associated compilation.

[0026] Furthermore, project association rules are used to determine the second associated projects of the first associated project branch. Specifically, the target code repository information, the project branch information of the first associated project branch, and a pre-configured associated project project database table can be used to obtain the association relationship between the target code repository and the projects, thus obtaining the second associated projects (set) of the first associated project branch. In this embodiment of the invention, on the one hand, considering that some project branches do not support component association rules and cannot filter the projects of the first associated project branch through associated components, it is necessary to rely on the associated project project database table to determine the second associated projects of the first associated project branch; on the other hand, the second associated projects determined by the above-mentioned project association rules can serve as a supplement to the first associated projects determined by the component association rules. Therefore, by adopting project association rules, the accuracy and completeness of the determined associated compilation projects can be further enhanced.

[0027] Furthermore, determining the associated compilation project of the first associated project branch based on the first associated project branch includes: for each first associated project branch, determining the union of each first associated project and each second associated project of the first associated project branch as the associated compilation project of the first associated project branch. In this embodiment of the invention, various factors affecting associated compilation are comprehensively considered, and multiple association rules and association / mapping relationships are combined, specifically including: determining each first associated project branch based on the project information management file (Manifest branch association rule); for each first associated project branch, filtering each project of the first associated project branch based on the associated components generated by the code participation in the compilation of the target code repository to determine the first associated project (component association rule); determining the second associated project of the first associated project branch based on a preset associated project project database table (project association rule); and finally, using the union of the first associated project and the second associated project as the associated compilation project of the first associated project branch and performing associated compilation. Compared to considering only a single factor or a single association relationship, the scheme combining multiple factors and multiple association relationships adopted in this embodiment of the invention can improve the completeness, accuracy, and effectiveness of associated compilation.

[0028] Furthermore, before filtering each project of each first associated project branch based on the associated components associated with the target code repository information, the method further includes: performing an initial screening of each first associated project branch using a preset project branch importance level threshold. In this embodiment of the invention, before filtering each project of each first associated project branch in subsequent steps, the first associated project branches are first screened using the project branch importance level threshold to remove invalid project branches that are under development or whose lifecycle has ended. This reduces the amount of subsequent computational data and overhead while ensuring the validity of the determined associated project branches and projects, and improves the efficiency of subsequent associated compilation.

[0029] Furthermore, before performing the associated compilation of the code for each first associated project branch, the method further includes: using a preset project importance level threshold to perform a secondary screening of the associated compilation projects for each first associated project branch. In this embodiment of the invention, after determining the associated compilation projects for each first associated project branch, a secondary screening is performed on each associated compilation project using the project importance level threshold, which can eliminate invalid projects whose lifecycle has ended. This further improves the effectiveness of the determined associated compilation projects and increases the efficiency of subsequent associated compilation. Attached Figure Description

[0030] Figure 1This is a flowchart of an associated compilation method in an embodiment of the present invention;

[0031] Figure 2 yes Figure 1 A flowchart of a specific implementation of step S12;

[0032] Figure 3 yes Figure 1 A flowchart of a specific implementation of step S13;

[0033] Figure 4 This is a flowchart of another associated compilation method in an embodiment of the present invention;

[0034] Figure 5 This is a schematic diagram of the structure of an associated compilation device in an embodiment of the present invention. Detailed Implementation

[0035] As described in the background section, when developers submit a piece of code to the target code repository after completing the code, they often need to submit a verification task to find all project branches and projects that may be affected by the code submission and compile and test them.

[0036] Currently, the associated project branches and projects for code submissions are almost always determined by manually pre-configured relationships. However, relying solely on manual determination of the associated project branches and projects for code submissions is quite difficult, and the accuracy, completeness, and effectiveness of the associated compilation cannot be guaranteed. On the other hand, directly selecting all branches and projects included in the project for compilation would obviously lead to a waste of build resources and a significant increase in compilation time.

[0037] To address the aforementioned technical problems, embodiments of the present invention provide an associated compilation method, specifically comprising: determining target code repository information for the code to be submitted; determining, based on the target code repository information, each first associated project branch associated with the code to be submitted, wherein each first associated project branch contains one or more projects; for each first associated project branch, filtering each project of the first associated project branch based on the associated components associated with the target code repository information to determine the first associated project of the first associated project branch; determining the associated compilation project of the first associated project branch based on the first associated project of the first associated project branch, and performing associated compilation on the code of the associated compilation project of each first associated project branch respectively.

[0038] As described above, the solution disclosed in this embodiment of the invention determines the first associated project branch of the code to be submitted based on the target repository information. Then, based on the associated components associated with the target code repository information, it filters each project of the first associated project branch and determines the associated compilation project. This improves the accuracy of the determined associated compilation project, helps reduce the probability of missed or excessive compilation, and simultaneously balances the reasonable utilization of build resources and associated compilation efficiency, thereby improving the quality of the code entering the repository.

[0039] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0040] Reference Figure 1 , Figure 1 This is a flowchart of an associated compilation method according to an embodiment of the present invention. The method may include steps S11 to S14:

[0041] Step S11: Determine the target code repository information for the code to be submitted;

[0042] Step S12: Based on the target code repository information of the code to be submitted, determine each first associated project branch associated with the code to be submitted, wherein each first associated project branch contains one or more projects;

[0043] Step S13: For each first associated project branch, based on the associated components associated with the target code repository information, filter each project of the first associated project branch to determine the first associated project of the first associated project branch;

[0044] Step S14: Determine the associated compilation project of the first associated project branch based on the first associated project branch, and perform associated compilation on the code of the associated compilation project of each first associated project branch respectively.

[0045] It is understandable that, in specific implementation, the above-mentioned associative compilation method can be implemented by means of a software program, which runs in the processor integrated inside the chip or chip module; or, the associative compilation method can be implemented by means of hardware or a combination of hardware and software.

[0046] In the specific implementation of step S11, the target code repository information of the code to be submitted can be determined based on the code submission identifier GerritID. Specifically, after a developer completes a piece of code and submits it to the target code repository, they can provide the submission identifier GerritID. The submission system can then obtain the target code repository information of the code to be submitted based on the GerritID.

[0047] The code repository, also known as a storage repository, resource repository, version repository, code repository, or storage repository, refers to a data structure on disk storage in a version control system, which includes files, directories, and metadata. A code repository is a public or private location where a large amount of source code is stored. Most code repositories are used for backup and version control, and in multi-developer projects, they help handle various code version issues, such as conflicts caused by developers modifying the source code simultaneously. Code repositories typically include configuration files and property files, as these files are essential data during the build process.

[0048] The target code repository information may include information such as the repository name and repository branch name of the target code repository to be submitted, which can be used to uniquely identify the specific target code repository.

[0049] In the specific implementation of step S12, the step of determining each first associated project branch associated with the code to be submitted can be implemented in the following way: each first associated project branch associated with the code to be submitted can be determined based on the target code repository information of the code to be submitted and the first mapping relationship; wherein, the first mapping relationship is used to indicate the mapping relationship between the code repository information and the project branch information.

[0050] In this context, a project branch can refer to a part of a software or system development project, used to implement a specific functional module; it can also be called a sub-project. Each project can contain one or more project branches. Each project branch can have its own branch name.

[0051] The basic relationship between project branches, code repositories, and projects is as follows: Each project branch can contain one or more code repositories, and some code repositories can belong to multiple project branches. Each project branch can contain one or more projects. Therefore, each first-related project branch also contains one or more projects.

[0052] Here, different projects represent a combination scenario under different component delivery types (also known as delivery forms), such as different chips and different software service types. The same set of code will produce different software artifacts when compiled from different projects. These differences can be reflected in function switches, code execution logic, and compatible hardware.

[0053] Reference Figure 2 , Figure 2 yes Figure 1 A flowchart of a specific implementation of step S12 is provided. Step S12 may include steps S21 to S23, and each step is described below.

[0054] In step S21, multiple preset project information management files are traversed to find the target code repository information of the code to be submitted.

[0055] The project information management file can be considered as a non-limiting embodiment of the first mapping relationship. This file includes code repository information and project branch information, and contains the mapping relationship between the code repository information and the project branch information. In practice, the project information management file can be determined by the developers during the initial stages of project setup / architecting.

[0056] As a non-limiting embodiment, the project information management file can be a Manifest.xml file. Manifest.xml is an XML-formatted description file primarily used for managing project information. This file contains relatively complete information about project branches, code repositories, and their mapping relationships, as well as information such as binary files (which can be considered a mapping file between code repositories and project branches). Using this file, the project code can be downloaded and compiled to generate an executable software version of the project.

[0057] In step S22, whenever the target code repository information is found to be contained in the code repository information in the project information management file, one or more project branch information corresponding to the target code repository information is obtained.

[0058] In step S23, the project branches to which the project branch information corresponding to the target code repository information belongs are used as the first associated project branches of the code to be submitted.

[0059] Specifically, obtaining one or more project branch information corresponding to the target code repository information means obtaining one or more project branches to which the target code repository belongs.

[0060] It should be noted that the project information management files and related methods provided in steps S21 to S23 above are only non-limiting examples. In specific implementations, other mapping relationship files / association relationship files or methods can also be used to determine the various first associated project branches associated with the code to be submitted. This embodiment of the invention does not impose any restrictions on this.

[0061] In this embodiment of the invention, the project information management file (e.g., the Manifest.xml file) contains code repository information, project branch information, and a relatively accurate and complete mapping relationship between the two involved in the entire R&D project setup / architecture process. Therefore, by searching the project information management file, a complete and accurate first associated project branch (or set of first associated project branches) associated with the code to be submitted can be determined as the initially determined associated project branch, thereby helping to improve the completeness and accuracy of the subsequently determined associated compilation project.

[0062] Continue to refer to Figure 1 In the specific implementation of step S13, the associated component can be a binary file that can be directly executed by a computer, generated by compiling code from one or more code repositories.

[0063] Furthermore, before filtering each project of the first associated project branch based on the associated components associated with the target code repository information in step S13, the method further includes: determining each component generated by code compilation in the target code repository to which the target code repository information belongs, as the associated components associated with the target code repository information.

[0064] Specifically, it can be determined which components the code in the target code repository participated in compiling and generating, i.e., the associated components.

[0065] The basic relationship between code repositories, components, and projects is as follows: each component can be compiled from code in one or more code repositories; code in each code repository can participate in the compilation to generate one or more components; and each component has one or more component delivery types. Each component delivery type has one or more delivery options, and the project information (e.g., project name) of each project within each project branch can contain combinations of different delivery options.

[0066] Among them, one or more component delivery types of each component can also be referred to as one or more delivery forms affected by that component.

[0067] In some non-limiting embodiments, the component delivery type or delivery form of each associated component may be selected from one or more of the following: chip type, circuit board type, system permission type, and software service type. In specific implementations, other component delivery types or delivery forms may also exist, and this embodiment of the invention does not impose limitations on them.

[0068] In practical implementation, taking a specific project command as an example: ums512_1h10_Natv-userdebug-native, this project contains four delivery options from four component delivery types, namely:

[0069] The delivery option for chip type is ums512, the delivery option for board type is 1h10_Natv, the delivery option for system permission type is userdebug, and the delivery option for software service type is native.

[0070] If a code repository is not differentiated by chip type, then components (binary files) compiled from the code in that repository can be used in projects with different chips. The understanding of other delivery types is similar. Therefore, by identifying the associated components generated from the compilation of code from a particular code repository, and then determining the combinations of delivery options in the component delivery types of each associated component, we can obtain the projects affected by that code repository.

[0071] Reference Figure 3 , Figure 3 yes Figure 1 A flowchart illustrating a specific implementation of step S13. Step S13 may include steps S31 to S35, which are described below.

[0072] In step S31, all component delivery types for each associated component are determined, wherein each associated component has one or more component delivery types, and each component delivery type has one or more delivery options.

[0073] In step S32, a delivery option is selected for each component delivery type, and a delivery option combination is formed using the selected delivery options. Then, some or all of the non-repeating delivery option combinations are determined.

[0074] In step S33, for each determined combination of delivery options, it is determined whether the project information of each project in the first associated project branch contains the combination of delivery options.

[0075] In step S34, a preset number of projects are selected from the projects that include the combination of delivery options.

[0076] In specific implementation, a preset number of projects can be selected from the projects containing the delivery option combination by random selection, or selection can be based on preset conditions. This embodiment of the invention does not limit this.

[0077] In some non-limiting embodiments, the preset quantity can be 1. In specific implementations, the value of the preset quantity can also be reasonably set between 1 and the total number of projects including the delivery option combination, depending on the specific application scenario.

[0078] In step S35, the set of selected projects is taken as the first associated project of the first associated project branch.

[0079] As a non-limiting example, the target code repository for a certain piece of code to be committed is A. By searching the Manifest.xml file, the first associated project branch of this piece of code to be committed contains the following 16 projects:

[0080] s9863a_1h10_-userdebug-gms, s9863a_1h10_-user-gms, s9863a_1h10_-userdebug-native, s9863a_1h10_-user-native, ums512_1h10_Na tv-userdebug-gms, ums512_1h10_Natv-user-gms, ums512_2h10_Natv-userdebug-native, ums512_2h10_Natv-user-native, ums9620_2h10_ native-userdebug-gms, ums9620_2h10_native-user-gms, ums9620_2h10_native-userdebug-native, ums9620_2h10_native-user-native , ums9230_1h10_Natv-userdebug-gms, ums9230_1h10_Natv-user-gms, ums9230_2h10_Natv-userdebug-gms, ums9230_2h10_Natv-user-gms;

[0081] A's associated component is X, and X's component delivery types are system permission type and software service type. The system permission type has delivery options of "user" and "userdebug," while the software service type has delivery options of "native" and "gms." Therefore, the total number of non-duplicate delivery option combinations affected by this pending submission is 2 × 2 = 4: userdebug-gms, userdebug-native, user-gms, and user-native.

[0082] Taking the delivery option combination "userdebug-gms" as an example, among the 16 projects mentioned above, 5 projects contain this delivery option combination: s9863a_1h10_-userdebug-gms, ums512_1h10_Natv-userdebug-gms, ums9620_2h10_native-userdebug-gms, ums9230_1h10_Natv-userdebug-gms, and ums9230_2h10_Natv-userdebug-gms. Therefore, for the "userdebug-gms" delivery option combination, only one of these 5 projects needs to be selected. The method for selecting projects corresponding to other delivery option combinations is the same. Finally, the set of selected projects is used as the first associated projects of this first associated project branch.

[0083] In this embodiment of the invention, component association rules are used to filter the projects of the first associated project branch. Specifically: first, it is determined which components (i.e., the associated components) were generated by the code in the target code repository; then, delivery option combinations are formed based on the delivery options contained in all component delivery types (the union of component delivery types) of each associated component; for each delivery option combination, a preset number of projects containing that delivery option combination are selected from the projects of the first associated project branch; the set of selected projects is taken as the first associated project of the first associated project branch. Thus, effective projects can be selected from the projects of each first associated project branch as the first associated project, improving the effectiveness and accuracy of associated compilation.

[0084] Furthermore, prior to step S13, the method may further include: performing a preliminary screening of each first associated project branch using a preset project branch importance level threshold.

[0085] Furthermore, the method for initial screening may include: selecting each of the first associated project branches whose importance level value is greater than or equal to the importance level threshold of the project branch; wherein, the higher the importance, the larger the importance level value.

[0086] In one specific embodiment, the importance levels of each project branch can be numerically categorized as importance level 1, importance level 2, importance level 3, importance level 4... importance level n (n is a positive integer). The higher the importance level value, the greater the importance; conversely, the lower the importance level value, the greater the importance.

[0087] In another specific embodiment, the importance levels of each project branch can be divided into low, medium, high, etc., where low level means lower importance and high level means higher importance.

[0088] In practical implementation, the threshold for the importance level of the project branch can be reasonably set according to the specific application scenario. For example, in the first specific embodiment above, the average value of all levels, rounded down, can be taken as the threshold for the importance level of the project branch. As another example, in the second embodiment, a level of medium or higher can be taken as the threshold for the importance level of the project branch. Other methods can also be used to determine this threshold, and this embodiment of the invention does not limit this approach.

[0089] In this embodiment of the invention, before filtering each project in each first associated project branch in subsequent steps, the first associated project branches are first filtered using a project branch importance level threshold to eliminate invalid project branches that are under development or whose lifecycle has ended. This reduces the amount of computational data and overhead in subsequent steps while ensuring the validity of the identified associated project branches and projects, and improves the efficiency of subsequent associated compilation.

[0090] Continue to refer to Figure 1 In the specific implementation of step S14, the first associated project determined after screening each project contained in the first associated project branch can be directly used as the associated compilation project of the first associated project branch.

[0091] It should be noted that since the same project may exist in different first associated project branches, and even so, the functionality of the same project will not be the same in different first associated project branches. Therefore, when performing associated compilation, each first associated project branch and its contained first associated projects need to be compiled as a whole.

[0092] As a non-limiting embodiment, after filtering each project of the first associated project branch based on the associated component associated with the target code repository information, the associated compilation projects of the first associated project branch A are {project 2, project 3}; the associated compilation projects of the first associated project branch B are {project 3, project 6, project 7}; and the associated compilation projects of the first associated project branch C are {project 7, project 8}.

[0093] In this embodiment of the invention, a first associated project branch is determined based on the target repository information of the code to be submitted. Then, based on the associated components associated with the target code repository information, each project of the first associated project branch is filtered before the associated compilation project is determined. This improves the accuracy of the determined associated compilation project, helps reduce the probability of missed or excessive compilation, and also balances the efficient use of build resources and the efficiency of associated compilation, thereby improving the quality of the code being submitted to the repository.

[0094] Furthermore, before performing associated compilation on the code of the associated compilation project of each first associated project branch in step S14, the method further includes: performing secondary screening on the associated compilation project of each first associated project branch using a preset project importance level threshold.

[0095] Furthermore, the method for secondary screening may include: for each first associated project branch, selecting projects in each associated compilation project of the first associated project branch whose importance level value is greater than or equal to the project importance level threshold; wherein, the higher the importance, the greater the importance level value.

[0096] In specific implementation, the method for setting the threshold for the importance level of the project is described above in the relevant description of the method for setting the threshold for the importance level of the project branch, and will not be repeated here.

[0097] In this embodiment of the invention, after determining the associated compilation projects for each first associated project branch, a secondary screening is performed on each associated compilation project using a project importance level threshold. This removes invalid projects whose lifecycles have ended. This further improves the effectiveness of the determined associated compilation projects and increases the efficiency of subsequent associated compilation.

[0098] Reference Figure 4 , Figure 4 This is a flowchart of another associated compilation method in an embodiment of the present invention. The other associated compilation method may include the above-described method. Figure 1 Steps S11 to S13 shown may further include steps S41 to S42. Steps S41 and S13 may be executed in any order. The following discussion focuses on... Figure 1 The different contents in the text will be explained.

[0099] In step S41, based on the target code repository information, the project branch information of the first associated project branch, and the preset associated project engineering database table, the second associated project of the first associated project branch is determined.

[0100] The associated project engineering database table contains code repository information, project branch information, and project information, and includes the mapping relationship between the code repository information and the project branch information, as well as the mapping relationship between the project branch information and the project information.

[0101] In practice, the associated project database table can be a pre-configured database by programmers. Besides containing the information mentioned above, it can also include project branch importance level information and project importance level information. The data source for the associated project database table can be configuration information generated / released daily during the compilation, code scanning, and testing of a specific project branch version, or it can be manually entered configuration information.

[0102] In this embodiment of the invention, on the one hand, considering that some project branches do not support component association rules and cannot filter the various projects of the first associated project branch through associated components, it is necessary to rely on the associated project project database table to determine the second associated project of the first associated project branch; on the other hand, the various second associated projects determined by the above-mentioned project association rules can serve as a supplement to the various first associated projects determined by the component association rules. Therefore, by adopting the above-mentioned project association rules and associated project project database table, the accuracy and completeness of the determined associated compilation projects can be further enhanced.

[0103] In step S42, the union of each first associated project and each second associated project of the first associated project branch is determined as the associated compilation project of the first associated project branch, and the code of the associated compilation project of each first associated project branch is associated and compiled.

[0104] In this embodiment of the invention, various factors affecting associative compilation are comprehensively considered, and a combination of multiple association rules and association / mapping relationships is adopted. Specifically, this includes: determining each first associated project branch based on the project information management file (Manifest branch association rule); for each first associated project branch, selecting the first associated project based on the associated components generated by the code participation in the target code repository (component association rule); determining the second associated project of the first associated project branch based on a preset associated project project database table (project association rule); and finally, using the union of the first and second associated projects as the associated compilation project of the first associated project branch and performing associative compilation. Compared to considering only a single factor or a single association relationship, the scheme combining multiple factors and multiple association relationships adopted in this embodiment of the invention can improve the completeness, accuracy, and effectiveness of associative compilation.

[0105] In practical implementation, more detailed information regarding the other associative compilation method can be found in the preceding text and... Figures 1 to 3 The relevant descriptions in the document will be executed, and will not be repeated here.

[0106] Reference Figure 5 , Figure 5 This is a schematic diagram of the structure of an associated compilation device according to an embodiment of the present invention. The associated compilation device may include:

[0107] The target code repository information determination module 51 is used to determine the target code repository information of the code to be submitted based on the submission identifier of the code to be submitted;

[0108] The first associated project branch determination module 52 is used to determine each first associated project branch associated with the code to be submitted based on the target code repository information of the code to be submitted, wherein each first associated project branch contains one or more projects;

[0109] The project filtering module 53 is used to filter each project of the first associated project branch based on the associated components associated with the target code repository information for each first associated project branch, so as to determine the first associated project of the first associated project branch.

[0110] The associated compilation project determination module 54 is used to determine the associated compilation project of the first associated project branch based on the first associated project branch, and to perform associated compilation on the code of the associated compilation project of each first associated project branch respectively.

[0111] For details regarding the principles, implementation, and beneficial effects of this associated compiler device, please refer to the preceding text. Figures 1 to 4 The descriptions of the associated compilation methods shown are not repeated here.

[0112] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs the above-described... Figures 1 to 4 The steps of the associated compilation method are shown. The computer-readable storage medium may include non-volatile or non-transitory memory, and may also include optical discs, hard disk drives, solid-state drives, etc.

[0113] Specifically, in this embodiment of the invention, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0114] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0115] This invention also provides a terminal, including a memory and a processor. The memory stores a computer program that can run on the processor, and when the processor runs the computer program, it performs the above-described... Figures 1 to 4The steps of the associated compilation method are shown. The terminal may include, but are not limited to, mobile phones, computers, tablets, and other terminal devices, and may also be servers, cloud platforms, etc. Alternatively, the terminal may include the aforementioned... Figure 5 The associated compilation device is shown.

[0116] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means.

[0117] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatus, and systems can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0118] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically included separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or in a combination of hardware and software functional units. For example, for various devices or products applied to or integrated into a chip, each module / unit can be implemented using hardware such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware such as circuits; for various devices or products applied to or integrated into a chip module, each module / unit can be implemented using hardware such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.

[0119] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.

[0120] In the embodiments of this application, "multiple" refers to two or more.

[0121] The descriptions of "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They have no order and do not indicate any special limitation on the number of devices in the embodiments of this application, nor do they constitute any limitation on the embodiments of this application.

[0122] It should be noted that the sequence number of each step in this embodiment does not represent a limitation on the execution order of each step.

[0123] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. An associative compilation method, characterized in that, include: Determine the target code repository information for the code to be committed; Based on the target code repository information of the code to be submitted, determine each first associated project branch associated with the code to be submitted, wherein each first associated project branch contains one or more projects; For each first associated project branch, based on the associated components associated with the target code repository information, each project of the first associated project branch is filtered to determine the first associated project of the first associated project branch. The associated components are binary files generated by compiling code from one or more code repositories. Based on the first associated project of the first associated project branch, the associated compilation project of the first associated project branch is determined, and the code of the associated compilation project of each first associated project branch is associated and compiled.

2. The method according to claim 1, characterized in that, The step of determining the first associated project branches associated with the code to be committed based on the target code repository information includes: Based on the target code repository information and the first mapping relationship of the code to be submitted, determine each first associated project branch associated with the code to be submitted; The first mapping relationship is used to indicate the mapping relationship between code repository information and project branch information.

3. The method according to claim 2, characterized in that, The first mapping relationship is determined based on the project information management file, which contains code repository information and project branch information, and contains the mapping relationship between the code repository information and the project branch information; The determination of each first associated project branch associated with the code to be committed, based on the target code repository information and the first mapping relationship, includes: Traverse multiple preset project information management files to find the target code repository information for the code to be submitted; Whenever the target code repository information is found to be contained in the code repository information in the project information management file, one or more project branch information corresponding to the target code repository information is obtained. The project branches to which the target code repository information belongs are used as the first associated project branches associated with the code to be submitted.

4. The method according to claim 1, characterized in that, Before filtering the various projects of the first associated project branch based on the associated component associated with the target code repository information, the method further includes: Each component generated by compiling the code in the target code repository to which the target code repository information belongs is identified as an associated component of the target code repository information.

5. The method according to claim 1, characterized in that, For each first associated project branch, based on the associated components associated with the target code repository information, the various projects of the first associated project branch are filtered to determine the first associated projects of the first associated project branch, including: Determine all component delivery types for each associated component, where each associated component has one or more component delivery types, and each component delivery type has one or more delivery options; In each component delivery type, select one delivery option and use the selected delivery options to form a delivery option combination. Then determine some or all of the non-repeating delivery option combinations. For each determined combination of delivery options, determine whether the project information of each project in the first associated project branch contains that combination of delivery options. Select a preset number of projects from the projects that include this delivery option combination; The selected set of projects is taken as the first associated project of the first associated project branch.

6. The method according to claim 5, characterized in that, The component delivery type for each associated component is selected from one or more of the following: Chip type, circuit board type, system permission type, and software service type.

7. The method according to claim 1, characterized in that, Before determining the associated compilation project of the first associated project branch based on the first associated project branch, the method further includes: Based on the target code repository information, the project branch information of the first associated project branch, and the preset associated project engineering database table, the second associated project of the first associated project branch is determined; The associated project engineering database table contains code repository information, project branch information, and project information, and includes the mapping relationship between the code repository information and the project branch information, as well as the mapping relationship between the project branch information and the project information.

8. The method according to claim 7, characterized in that, The process of determining the associated compilation project for the first associated project branch based on the first associated project branch includes: The union of each first associated project and each second associated project of the first associated project branch is determined as the associated compilation project of the first associated project branch.

9. The method according to claim 1, characterized in that, Before filtering each project of the first associated project branch based on the associated components associated with the target code repository information for each first associated project branch, the method further includes: The first related project branches are initially screened using a preset threshold for the importance level of project branches.

10. The method according to claim 9, characterized in that, The step of using a preset threshold for the importance level of project branches to perform preliminary screening of the first associated project branches includes: Select each of the first associated project branches whose importance level value is greater than or equal to the project branch importance level threshold. The higher the level of importance, the greater the numerical value of the level of importance.

11. The method according to claim 1, characterized in that, Before performing associated compilation on the code of the associated compilation project for each of the first associated project branches, the method further includes: A second screening is performed on the associated compilation projects of each first associated project branch using a preset threshold for project importance level.

12. The method according to claim 11, characterized in that, Using a preset threshold for project importance, a secondary screening is performed on the associated compilation projects of each first-related project branch, including: For each first associated project branch, select the projects whose importance level value is greater than or equal to the project importance level threshold among the associated compilation projects of the first associated project branch; The higher the degree of importance, the greater the numerical value of the degree of importance.

13. An associative compilation apparatus, characterized in that, include: The target code repository information determination module is used to determine the target code repository information for the code to be submitted. The first associated project branch determination module is used to determine each first associated project branch associated with the code to be submitted based on the target code repository information of the code to be submitted, wherein each first associated project branch contains one or more projects; The project filtering module is used to filter each project of the first associated project branch based on the associated components associated with the target code repository information for each first associated project branch, so as to determine the first associated project of the first associated project branch. The associated components are binary files generated by compiling code from one or more code repositories. The associated compilation project determination module is used to determine the associated compilation project of the first associated project branch based on the first associated project branch, and to perform associated compilation on the code of the associated compilation project of each first associated project branch respectively.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by the processor to perform the steps of the associative compilation method according to any one of claims 1 to 12.

15. A terminal comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the associative compilation method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Project construction method and device, computer equipment and storage medium

    CN110597518A

  • Component compiling method, device and equipment and computer readable storage medium

    CN112965720A