Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
As will be appreciated by those skilled in the art, a "terminal" as used herein includes both devices having a wireless signal receiver, which are devices having only a wireless signal receiver without transmit capability, and devices having receive and transmit hardware, which have devices having receive and transmit hardware capable of two-way communication over a two-way communication link. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, facsimile and/or data communication capabilities; a PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, internet/intranet access, a web browser, a notepad, a calendar and/or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal" or "terminal device" may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space. As used herein, a "terminal Device" may also be a communication terminal, a web terminal, a music/video playing terminal, such as a PDA, an MID (Mobile Internet Device) and/or a Mobile phone with music/video playing function, or a smart tv, a set-top box, etc.
The inventor of the invention finds that the dependency relationship of the current software release and development platform such as OBS and the like on the compiling project is only a simple trigger relationship, and does not detect and process any loop dependency possibly generated by the trigger relationship.
For example, fig. 1 is a schematic diagram of a specific example of existing compilation based on a loop dependency relationship. The cyclic dependencies in fig. 1 include: the compilation of the item A depends on the item C, the compilation of the item C depends on the item B, and the compilation of the item B depends on the item A. According to the loop dependency relationship, when the item A is updated, the item A is compiled, and when the item A is compiled, the software release development platform automatically triggers the compiling of the item B. Similarly, when the project B is updated, the project B is compiled, the compilation of the project C is automatically triggered after the project B is compiled, and the compilation of the project A is triggered by the project C, so that the uninterrupted loop compilation among the projects A-C in the software release and development platform is caused.
The inventor of the present invention also finds that if the occurrence of loop dependency is avoided as much as possible by manually checking the dependency relationship of maintenance project compilation or manually checking the loop dependency of a developer by a maintainer of a software release development platform, a great extra workload is caused to the maintainer or the developer, which greatly increases the time cost. Moreover, even if a maintainer or a developer finds that the loop dependency exists, loop compilation based on the loop dependency cannot be avoided, which may result in that some projects on the software release and development platform cannot complete compilation or software rework in development.
The technical solution of the embodiments of the present invention is specifically described below with reference to the accompanying drawings.
The embodiment of the invention is suitable for software release development platforms, such as OBS (Open Build Service) platforms and the like.
In the embodiment of the invention, after the source code file of a certain project is updated and submitted to the software release development platform by developers, the update compiling process of the software release development platform is automatically triggered, the project compiled because the source code file is submitted is an update project, and the project compiled because of the dependency relationship instead of the source code file is a non-update project.
For example, item B in fig. 1 depends on item a, and when the source code file of item a is updated and submitted, the compilation of item a is triggered; item A is an updated item and item B is a non-updated item, and compiling of item B is not triggered while item A is being compiled.
An embodiment of the present invention provides a compiling method, a flowchart of which is shown in fig. 2, and includes the following steps:
s201: when an update item is received, judging whether a cyclic dependency exists in a dependency relation related to the update item; when the judgment result shows that the loop dependency exists, executing step S202; when the judgment result indicates that there is no loop dependency, step S204 is executed.
Preferably, after a submission request sent by a source code file of a certain project or a source code file for updating to the software release development platform is monitored, the request is intercepted, the project is used as an update project, and the update project is determined to be received.
Determining all items that depend on the updated item; judging whether an updated item exists in all the items; when the judgment result is that the updated items exist in all the items, the cyclic dependence is indicated; when the judgment result indicates that there is loop dependency, step S202 is executed. Of all items that depend on the update item, items other than the update item are non-update items.
Preferably, all projects that are dependent on the update project are determined from the software release development platform. For each item in all items depending on the updated item, judging whether the dependent item exists in each item; when judging that each item has a dependent item, judging whether the dependent item is an updated item; when it is determined that the dependent item is an update item, indicating that there is a loop dependency, i.e., the determination result indicates that there is a loop dependency, the subsequent step S202 is performed.
When the dependent item is judged not to be the update item, the judgment of the next item dependent on the update item is continued.
When it is determined that there is no dependent item in the item dependent on the update item, it is determined that the item is a non-update item, and determination is continued for the next item dependent on the update item.
When there is no dependent item for each item dependent on the update item, or when there is a dependent item but the dependent item is a non-update item, it is determined that there is no loop dependency based on the update item, that is, the determination result indicates that there is no loop dependency, the subsequent step S204 is performed.
S202: and performing compilation from the updated item, and setting at least one non-updated item involved in the loop dependence as non-compilable.
Preferably, the (updated) source code file of the update project is submitted to the software release development platform, so that the software release development platform performs compilation from the update project; and setting at least one non-updating item involved in the loop dependence in the software release development platform as non-compilable. Further, setting at least one non-updated item involved in the loop dependency as non-compilable, includes: for all items depending on the updated item, determining all items except the updated item as non-updated items; and setting at least one non-updating item in the determined non-updating items as non-compilable.
For example, fig. 3 is a schematic diagram of a specific example of compiling based on converting a cyclic dependency into a non-cyclic dependency according to an embodiment of the present invention. In fig. 3, the compilation of item a depends on item C, the compilation of item C depends on item B, and the compilation of item B depends on item a. When the source code file of the item B is updated, the item B is an updated item, and the items A and C are non-updated items. Updating the source code file for project B can automatically trigger compilation for project B, setting project A to disable (meaning not compilable).
In this case, the software release development platform compiles both the update project and the default compilable non-update project related to the loop dependency related to the update project; and not compiling at least one non-updated item set as not compilable that is involved in the loop dependency. For example, update item B in fig. 3 and item C having update item B as a dependent item are compiled.
It can be appreciated that since the compilation process takes much longer than the non-compilable setup steps, even if the compilation of the updated item starts first and the non-compilable setup of the at least one non-updated item starts later, the non-compilable setup of the at least one non-updated item may be made to end first and the compilation of the updated item may be made to end later. Compilation can be prevented from getting trapped in loop dependencies, so that compilation is performed based on non-loop dependencies.
Preferably, the (updated) source code file of the update project is submitted to the software release development platform, so that the software release development platform executes compilation from the update project; meanwhile, at least one non-updating project involved in the loop dependency in the software release development platform is set to be not compilable.
It can be understood that since the compiling process takes much longer than the non-compilable setting step, the compiling of the update item starts simultaneously with the non-compilable setting of the at least one non-update item, and it can be ensured that the non-compilable setting of the at least one non-update item ends first and the compiling of the update item ends later.
For example, item A may be set to disable (meaning not compilable) while updating the source code file for item B in FIG. 3 automatically triggers compilation for item B.
Further, after setting at least one non-updated item involved in the loop dependency as not compilable, compiling is performed from the updated item. The compiling can be further prevented from being trapped in cyclic dependence, and compiling based on the dependence of non-cyclic is guaranteed.
For example, after item A in FIG. 3 is set to disable (indicating not compilable), then the source code file for item B is updated to trigger compilation for item B.
S203: and after the compiling is detected to stop, setting at least one non-updating item which is not compilable as compilable, and setting the updating item as not compilable, so that the compiling is continuously executed.
According to the steps, the update project and the default related to the cyclic dependence of the update project are compiled non-update projects, and the software release development platform automatically compiles the non-update projects; when the non-update item which is set as non-compilable and is involved in the loop dependence involved in the update item is encountered, the compilation is stopped, and the non-update item which is set as non-compilable is not compiled.
In this step, after the compiling is detected to be stopped, at least one non-update item which is not compilable in the software release development platform is set to be compilable, and the update item is set to be not compilable, so that the compiling is continuously executed.
On one hand, when the software release development platform detects that at least one non-updated project which is not compilable originally (in the steps) is set to be compilable, compiling of the at least one non-updated project is automatically executed; on the other hand, when the software release development platform detects that the original (in the above steps) compilable update item is set as not compilable, the update item is not compiled; thereby completing the compilation of the at least one non-updated item.
For example, in fig. 3, the non-update item a related to the loop dependency related to the update item B is set from able (compilable) to disable (non-compilable), so that the software release development platform compiles the non-update item a without compiling the update item B.
At this point, the original cyclic dependency relationship is split into more than two acyclic dependency relationships by reasonably setting the compilable and/or non-compilable of the updated item and the at least one non-updated item, so that the original cyclic dependent item is compiled.
It will be appreciated that since the compilation process takes much longer than the non-compilable and compilable setup steps, even if the compilation of at least one non-updated item begins first and the non-compilable setup of the updated item begins (or begins simultaneously), the non-compilable setup of the updated item ends first and the compilation of at least one non-updated item ends later. Compilation can be prevented from getting trapped in loop dependencies, so that compilation is performed based on non-loop dependencies.
Preferably, after at least one non-updated item that is not compilable is set as compilable, the updated item is set as not compilable.
For example, after the update item B in fig. 3 is set from able (compilable) to disable (not compilable), the non-update item a is set from disable (not compilable) to able (compilable), which further ensures that the software release development platform compiles the non-update item a without compiling the update item B.
S204: normal compilation is performed.
As is clear from the above-described procedure, since there is no loop dependency in the dependencies relating to the update items, in this procedure, all items relating to the dependencies relating to the update items are compiled while keeping all items in a state in which they can be compiled.
Based on the foregoing compiling method, an embodiment of the present invention further provides a compiling apparatus, where a frame schematic diagram of an internal structure of the compiling apparatus is shown in fig. 4, and the compiling apparatus includes: a loop dependency judgment module 401 and a state switching and compiling module 402.
The cyclic dependency determining module 401 is configured to determine whether a cyclic dependency exists in a dependency relationship related to an update item when the update item is received; and when the judgment result shows that the loop dependency exists, sending a state switching compiling notification.
The state switching and compiling module 402 is configured to, after receiving the state switching compiling notification, start to perform compiling from the update item, and set at least one non-update item related to the loop dependency as non-compilable; and after the compiling is detected to stop, setting at least one non-updating item which is not compilable as compilable, and setting the updating item as not compilable, so that the compiling is continuously executed.
Preferably, the loop dependency judgment module 401 is specifically configured to determine all items that depend on the updated item; judging whether an updated item exists in all the items; and when the judgment result shows that the updated items exist in all the items, indicating that the loop dependency exists, and sending a state switching compiling notification.
Preferably, the loop dependency determining module 401 is specifically configured to determine, for each item that depends on the updated item, whether there is a dependent item in each item; when it is determined that there is a dependent item for each item, it is determined whether the dependent item is an update item.
Preferably, the state switching and compiling module 402 is specifically configured to perform compiling from the updated item after setting at least one non-updated item involved in the loop dependency as non-compilable.
Preferably, the state switching and compiling module 402 is specifically configured to, for all items dependent on the updated item, determine all items except the updated item as non-updated items; and setting at least one non-updating item in the determined non-updating items as non-compilable.
Preferably, the state switching and compiling module 402 is specifically configured to set at least one non-updated item that is not compilable as compilable, and then set the updated item as not compilable.
The specific implementation method of the functions of the loop dependency determining module 401 and the state switching and compiling module 402 may be the specific content of the flow steps shown in fig. 2, and is not described herein again.
Preferably, an embodiment of the present invention further provides a compiling apparatus, where a framework diagram of an internal structure of the compiling apparatus is shown in fig. 5, and the framework diagram includes: a memory 501 and a processor 502.
The memory 501 is electrically connected to the processor 502.
At least one program, stored in the memory 501, configured to implement the following steps when executed by the processor 502: when an update item is received, judging whether a cyclic dependency exists in a dependency relation related to the update item; when the judgment result shows that the loop dependency exists, compiling is executed from the updated item, and at least one non-updated item related to the loop dependency is set as not-compilable; and after the compiling is detected to stop, setting at least one non-updating item which is not compilable as compilable, and setting the updating item as not compilable, so that the compiling is continuously executed.
Preferably, at least one program, in the step of determining whether there is a loop dependency in the dependency relationship related to the update item, specifically implements the following steps: determining all items that depend on the updated item; and judging whether the updated items exist in all the items.
Preferably, in the step of determining whether an updated item exists in all the items, at least one program specifically implements the following steps: for each item dependent on the updated item, judging whether a dependent item exists in each item; when it is determined that there is a dependent item for each item, it is determined whether the dependent item is an update item.
Preferably, the at least one program, during the step of performing compilation starting from an updated item and setting at least one non-updated item involved in the loop dependency as non-compilable, implements the following steps: after at least one non-updated item involved in the loop dependency is set as non-compilable, compilation is performed from the updated item.
Preferably, the at least one program, in implementing the step of setting at least one non-updated item involved in the loop dependency as not compilable, implements the following steps: for all items depending on the updated item, determining all items except the updated item as non-updated items; and setting at least one non-updating item in the determined non-updating items as non-compilable.
Preferably, the at least one program, during the step of setting at least one non-updated item that is not compilable as compilable and setting the updated item as not compilable, implements the following steps: and after at least one non-updating item which is not compilable is set to be compilable, the updating item is set to be not compilable.
In the embodiment of the invention, when judging that the dependency relationship related to the update item has loop dependency, setting at least one non-update item related to the loop dependency as non-compilable, and starting to execute compilation from the update item; and when the compiling is detected to stop, setting at least one non-updating item which is not compilable as compilable, and setting the updating item as not compilable, so that the compiling is executed. In the embodiment of the invention, the updating item and at least one non-updating item related to the loop dependency relationship are reasonably switched between the compiling state and the non-compiling state, the loop dependency relationship is split into the two-stage non-loop dependency relationship, the corresponding two-stage item compiling is respectively carried out according to the two-stage non-loop dependency relationship, and the compiling work of all items related to the loop dependency relationship is finally completed; therefore, the compiling work of the items related to the loop dependency relationship can be realized under the condition of preventing the loop compiling from being trapped.
In addition, in the embodiment of the invention, the software release development platform of the compilation project does not need to be changed; that is to say, the embodiment of the invention is suitable for project compiling work of a great number of software release development platforms, and has the advantages of wide application range and low application cost.
Further, in the embodiment of the present invention, all items depending on the update item may be determined, and when it is determined that an update item exists in all the items, it indicates that a cyclic dependency exists. Therefore, in the embodiment of the invention, the items are judged in a traversing manner, so that the omission of item judgment is avoided, and the judgment is more reliable; moreover, the judgment method is simple and rapid, and the efficiency is high.
Those skilled in the art will appreciate that the present invention includes apparatus directed to performing one or more of the operations described in the present application. These devices may be specially designed and manufactured for the required purposes, or they may comprise known devices in general-purpose computers. These devices have stored therein computer programs that are selectively activated or reconfigured. Such a computer program may be stored in a device (e.g., computer) readable medium, including, but not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magnetic-optical disks, ROMs (Read-Only memories), RAMs (Random Access memories), EPROMs (Erasable Programmable Read-Only memories), EEPROMs (Electrically Erasable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards, or any type of media suitable for storing electronic instructions, and each coupled to a bus. That is, a readable medium includes any medium that stores or transmits information in a form readable by a device (e.g., a computer).
It will be understood by those within the art that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. Those skilled in the art will appreciate that the computer program instructions may be implemented by a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the features specified in the block or blocks of the block diagrams and/or flowchart illustrations of the present disclosure.
Those of skill in the art will appreciate that various operations, methods, steps in the processes, acts, or solutions discussed in the present application may be alternated, modified, combined, or deleted. Further, various operations, methods, steps in the flows, which have been discussed in the present application, may be interchanged, modified, rearranged, decomposed, combined, or eliminated. Further, steps, measures, schemes in the various operations, methods, procedures disclosed in the prior art and the present invention can also be alternated, changed, rearranged, decomposed, combined, or deleted.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.