Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example one
Fig. 1 is a flowchart illustrating a plug-in version information verification method according to a first embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S101, compiling the plug-in to be compiled, and reading first version information of the plug-in the process of compiling the plug-in.
The compiling process involves a plurality of processes, for example, developing plug-in of Android (Android) system, and the compiling process may include: (1) packing the resource files to generate R.java files; (2) processing aidl (Android interface definition language) files to generate corresponding java files; (3) compiling the engineering source code to generate a corresponding class file (namely a class file); (4) converting all class files to generate class. (5) Packaging generates a plug-in package (i.e., apk) and signs, etc. The invention adds the step of reading and checking the version information of the plug-in the existing compiling process, so as to find out whether the version information of the plug-in has problems in the compiling process in time, wherein the version information of the plug-in can comprise version numbers, project marks and other information. For the convenience of distinction, the version information of the plug-in is called first version information, the version information of the version of the newly released plug-in the server is called second version information, and the version information of the plug-in recorded in the configuration item of the main project is called third version information.
And step S102, pulling second version information of the latest release plug-in version corresponding to the plug-in from the server.
In practical application, an individual plug-in package or a main project package containing a plurality of plug-in packages can be released in a server after development and testing are completed, and the server records version information of a released plug-in version, wherein the released plug-in version contains the released individual plug-in package and the plug-in package corresponding to the plug-in the released main project package. In the present invention, the second version information of the latest release plugin version corresponding to the plugin recorded in the server is used as the most accurate version information, and the second version information is used as the reference for verification, and in step S102, the second version information of the latest release plugin version corresponding to the plugin is pulled from the server.
Step S103, checking the first version information according to the second version information; if the verification is passed, executing step S104; if the verification fails, step S105 is executed.
After the second version information is obtained by pulling, whether the first version information accords with the preset version setting rule or not can be verified according to the second version information. Those skilled in the art can set the version setting rule according to actual needs. For example, the version setting rule may be set such that the version number is incremented and the difference between the first version number in the first version information and the second version number in the second version information should meet a preset threshold. If the verification is passed, executing step S104; if the verification fails, step S105 is executed.
And step S104, packaging and generating a plug-in package corresponding to the plug-in.
And if the verification is passed, the configuration of the first version information meets the requirement of the reasonability of the version information, and if no problem exists, the subsequent compiling processing aiming at the plug-in can be continuously executed until the plug-in package corresponding to the plug-in is generated by packaging.
Step S105, generating a first error report message for correction according to the first error report message.
If the verification fails, the explanation shows that the configuration of the first version information has problems, the compiling process is terminated, the first error information is generated, the first error information can be printed or output and displayed, so that developers and the like can correct the first version information of the plug-in according to the first error information, and the plug-in is recompiled after the correction of the first version information is completed.
By utilizing the method for checking the version information of the plug-ins, the version information of the plug-ins is read in the process of compiling the plug-ins, and the checking is carried out according to the version information of the latest release plug-in version pulled from the server, so that whether the version information of the plug-ins has problems or not can be found in time in the process of compiling the plug-ins, the problem that the version information of the plug-ins is found after compiling is finished or even after release is avoided, and the timeliness of finding the version information problem is greatly improved; and in addition, error reporting information can be automatically generated under the condition that the verification fails, so that developers and the like can timely correct the version information of the plug-ins according to the error reporting information, and the overall compiling efficiency is improved.
Example two
Fig. 2 is a flowchart illustrating a plug-in version information verification method according to a second embodiment of the present invention, and as shown in fig. 2, the method includes the following steps:
step S201, compiling the plug-in to be compiled, and reading the first version information of the plug-in the process of compiling the plug-in.
The invention adds the steps of reading and checking the version information of the plug-in the current compiling process of the compiler so as to automatically and timely find whether the version information of the plug-in has problems in the compiling process. In step S201, a Hook function is called in the process of compiling the plug-in, and the first version information of the plug-in is read from the position for configuring the version information in the plug-in through the Hook function.
Step S202, second version information of the latest release plug-in version corresponding to the plug-in is pulled from the server.
In the invention, the second version information of the latest release plug-in version corresponding to the plug-in recorded in the server is taken as the most accurate version information, the second version information of the latest release plug-in version corresponding to the plug-in is pulled from the server, and the second version information is taken as the reference for the rationality check of the subsequent version information.
Step S203, checking the first version information according to the second version information; if the verification is passed, executing step S204; if the verification fails, step S209 is executed.
In order to facilitate the verification of the first version information, a version setting rule may be preset, and the version setting rule may record requirements that the first version information needs to meet, for example, the version number increases incrementally, and a difference between a first version number in the first version information and a second version number in the second version information should meet a preset threshold. Then in step S203, it may be determined whether the first version number in the first version information is greater than the second version number in the second version information. If the first version number is larger than the second version number, the first version number in the first version information meets the requirement of increasing the version number, the difference between the first version number and the second version number is continuously calculated, and whether the difference meets a preset threshold value is judged; if the preset threshold value is met, the verification is passed, and then the step S204 is executed; if the threshold is not met, the verification is not passed, and step S209 is executed. If the first version number is less than or equal to the second version number, which indicates that the first version number in the first version information does not meet the requirement of increasing the version number, the verification fails, and then step S209 is performed.
In an alternative embodiment, the predetermined threshold may be a value, and if the difference is equal to the value, it may be determined that the difference meets the predetermined threshold, and if the difference is not equal to the value, it may be determined that the difference does not meet the predetermined threshold. If the preset threshold is 5, the first version number is greater than the second version number, and the difference between the first version number and the second version number is also 5, the difference is in accordance with the preset threshold, and the check is passed. In another alternative embodiment, the preset threshold may be a certain range, and if the difference is within the range, it may be determined that the difference meets the preset threshold, and if the difference is not within the range, it may be determined that the difference does not meet the preset threshold.
And step S204, packaging and generating a plug-in package corresponding to the plug-in.
And if the verification is passed, the configuration of the first version information meets the requirement of the rationality of the version information, and then the subsequent compiling processing aiming at the plug-in can be continuously executed until the compiling and packaging processing of the plug-in is completed, and the plug-in package corresponding to the plug-in is generated by packaging. In an optional implementation manner, if only a separate plug-in package needs to be generated for testing or release, after the plug-in package corresponding to the plug-in is generated by packaging, the method is ended; in another optional embodiment, if a plug-in is a certain plug-in the main project to be compiled, after a plug-in package corresponding to the plug-in is generated by packaging, the main project needs to be compiled and packaged, and then the method needs to perform step S205 to step S208.
And S205, storing the plug-in package into the main project, compiling the main project, and reading the third version information of the plug-in the configuration item in the process of compiling the main project.
And if the plug-in is the plug-in the main project to be compiled, storing the plug-in package generated in the step S204 into the main project by using the compiler, and performing overall compiling construction on the main project. In the process of compiling the main project, compiling to generate class files (namely class files), and reading the class files by using a preset class library to obtain third version information of the plug-ins in the configuration items. The preset class library may be an ASM class library, and the ASM is a Java byte code (byte) processing class library, which has a faster processing efficiency. The ASM can directly generate binary class files and also can dynamically change behaviors, methods and the like. In the process of compiling the main project, after the plurality of class files are compiled and generated, the present embodiment searches the class file for configuring the version information of the plug-in from the plurality of class files of the main project by using the ASM, then reads the class file, and reads the third version information of the plug-in the configuration item from the class file. Specifically, the class file for configuring the version information of the plug-in may include the configuration information of the plug-in, and the configuration information of the plug-in records each plug-in the main project and the third version information of each plug-in, so that the plug-in configuration information in the class file may be read by using the ASM, and the third version information of the plug-in to be compiled is quickly read from the read.
Step S206, judging whether the third version information is consistent with the first version information; if yes, go to step S207; if not, go to step S208.
In an actual application scenario, there may also be a problem that the third version information configuration of the plug-in the configuration item of the main project is inconsistent, for example, the third version information of a certain plug-in the configuration item of the main project is inconsistent with the first version information of the plug-in itself, which causes an error in the main project package generated by packaging, and after the user installs the main project package, the user needs to download the plug-in package corresponding to the plug-in from the server for updating after entering the corresponding application program each time. In order to effectively solve the above problem, in this embodiment, after the verification of the rationality of the version information is completed, the consistency between the third version information and the first version information is also verified in the process of compiling the main project. Specifically, whether the third version information is consistent with the first version information is judged; if the third version information is consistent with the first version information, which indicates that the requirement of consistency of the version information is met, executing step S207; if the third version information is not consistent with the first version information, which indicates that the requirement of consistency of the version information is not met, and there is a problem with the configuration of the third version information, step S208 is executed.
And step S207, packaging to generate a main project package corresponding to the main project.
And under the condition that the third version information is consistent with the first version information after the step S206, continuing to execute the subsequent compiling processing aiming at the main project until the compiling and packaging processing of the main project is completed, and packaging to generate a main project package corresponding to the main project for testing or releasing.
Step S208, generating a second error message for correction according to the second error message.
If it is determined in step S206 that the third version information is inconsistent with the first version information, the compiling process is terminated, and second error information is generated, which can be printed or output and displayed, so that developers and the like can modify the third version information of the plug-in the configuration item of the main project according to the second error information, and recompile the third version information after completing the modification of the third version information. The second error information may record a problem that the third version information exists, for example, the content of the second error information may be "the version information of the XXX plug-in the main project configuration item is inconsistent with the version information of the plug-in itself, please correct", and the like.
In step S209, a first error message is generated for correction according to the first error message.
If the verification is not passed in step S203, it is described that there is a problem with the configuration of the first version information, the compiling process is terminated, the first error information is generated, and the first error information may be printed or output and displayed, so that a developer or the like can correct the first version information of the plug-in according to the first error information, and the plug-in is recompiled after the correction of the first version information is completed. The first error information may record a problem that the first version information exists, and a person skilled in the art may set the content of the first error information according to actual needs, which is not limited herein. For example, the content of the first error information may be "version number should not be less than or equal to version number XXXX of the latest release plug-in version, please correct" or "difference between version number and version number XXXX of the latest release plug-in version does not meet threshold XX", or the like.
It can be understood that the main project includes a plurality of plug-ins, when the first version information of any plug-in passes the verification by comparing with the second version information thereof or when the first version information of any plug-in is inconsistent with the third version information thereof, the compiling process is terminated, and corresponding error information is generated, so that developers and the like can correct in time according to the error information.
By utilizing the plug-in version information checking method provided by the embodiment, the rationality and consistency of the plug-in version information are automatically checked in the compiling process, so that whether the plug-in version information has problems or not can be timely and comprehensively found, the problem that the plug-in version information is found after compiling is finished or even after the plug-in version information is released is avoided, and the timeliness of finding the version information problem is greatly improved; moreover, under the condition that the version information has problems, corresponding error reporting information can be automatically generated, and the problems can be quickly and accurately positioned, so that developers and the like can timely correct the version information of the plug-in according to the error reporting information, and the overall compiling efficiency is improved.
EXAMPLE III
The third embodiment of the invention provides a nonvolatile storage medium, wherein the storage medium stores at least one executable instruction, and the executable instruction can execute the plug-in version information verification method in any method embodiment.
The executable instructions may be specifically configured to cause the processor to: compiling the plug-in to be compiled, and reading first version information of the plug-in the process of compiling the plug-in; pulling second version information of the latest release plug-in version corresponding to the plug-in from the server; according to the second version information, checking the first version information; and if the verification fails, generating first error information for correction according to the first error information.
In an alternative embodiment, the executable instructions further cause the processor to: judging whether a first version number in the first version information is larger than a second version number in the second version information; if the first version number is larger than the second version number, calculating a difference value between the first version number and the second version number, and judging whether the difference value meets a preset threshold value or not; if the preset threshold value is met, the verification is passed; if the current time does not meet the preset threshold value, the verification is not passed; and if the first version number is less than or equal to the second version number, the verification is failed.
In an alternative embodiment, the executable instructions further cause the processor to: and if the verification is passed, packaging to generate a plug-in package corresponding to the plug-in.
In an alternative embodiment, if the plug-in is a plug-in a host project to be compiled, the executable instructions further cause the processor to: storing the plug-in package into a main project, and compiling the main project; reading the third version information of the plug-in the configuration item in the process of compiling the main project; judging whether the third version information is consistent with the first version information; if the main project packages are consistent, packaging to generate a main project package corresponding to the main project; and if the two pieces of error information are not consistent, generating second error information for correction according to the second error information.
In an alternative embodiment, the executable instructions further cause the processor to: and in the process of compiling the main project, compiling to generate class files, reading the class files by using a preset class library, and obtaining the third version information of the plug-ins in the configuration items.
Example four
Fig. 3 is a schematic structural diagram of a computing device according to a fourth embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the computing device.
As shown in fig. 3, the computing device may include: a processor (processor)302, acommunication Interface 304, a memory 306, and a communication bus 308.
Wherein:
the processor 302,communication interface 304, and memory 306 communicate with each other via a communication bus 308.
Acommunication interface 304 for communicating with network elements of other devices, such as clients or other servers.
The processor 302 is configured to execute theprogram 310, and may specifically execute the relevant steps in the above-described embodiment of the plug-in version information checking method.
In particular,program 310 may include program code comprising computer operating instructions.
The processor 302 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computing device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 306 for storing aprogram 310. Memory 306 may comprise high-speed RAM memory and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Theprogram 310 may specifically be configured to cause the processor 302 to perform the following operations: compiling the plug-in to be compiled, and reading first version information of the plug-in the process of compiling the plug-in; pulling second version information of the latest release plug-in version corresponding to the plug-in from the server; according to the second version information, checking the first version information; and if the verification fails, generating first error information for correction according to the first error information.
In an alternative embodiment,program 310 further causes processor 302 to: judging whether a first version number in the first version information is larger than a second version number in the second version information; if the first version number is larger than the second version number, calculating a difference value between the first version number and the second version number, and judging whether the difference value meets a preset threshold value or not; if the preset threshold value is met, the verification is passed; if the current time does not meet the preset threshold value, the verification is not passed; and if the first version number is less than or equal to the second version number, the verification is failed.
In an alternative embodiment,program 310 further causes processor 302 to: and if the verification is passed, packaging to generate a plug-in package corresponding to the plug-in.
In an alternative embodiment, if the plug-in is a plug-in the main project to be compiled, theprogram 310 further causes the processor 302 to: storing the plug-in package into a main project, and compiling the main project; reading the third version information of the plug-in the configuration item in the process of compiling the main project; judging whether the third version information is consistent with the first version information; if the main project packages are consistent, packaging to generate a main project package corresponding to the main project; and if the two pieces of error information are not consistent, generating second error information for correction according to the second error information.
In an alternative embodiment,program 310 further causes processor 302 to: and in the process of compiling the main project, compiling to generate class files, reading the class files by using a preset class library, and obtaining the third version information of the plug-ins in the configuration items.
For specific implementation of each step in theprogram 310, reference may be made to the description corresponding to the corresponding step in the foregoing plug-in version information checking embodiment, which is not described herein again. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described device may refer to the corresponding process description in the foregoing method embodiment, and is not described herein again.
By the scheme provided by the embodiment, whether the version information of the plug-in has a problem can be found in time in the process of compiling the plug-in, so that the timeliness of the problem finding of the version information is greatly improved; and in addition, error reporting information can be automatically generated under the condition that the verification fails, so that developers and the like can timely correct the version information of the plug-ins according to the error reporting information, and the overall compiling efficiency is improved.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The invention discloses:
A1. a plug-in version information verification method comprises the following steps:
compiling the plug-in to be compiled, and reading first version information of the plug-in the process of compiling the plug-in;
pulling second version information of the latest release plug-in version corresponding to the plug-in from the server;
according to the second version information, verifying the first version information;
and if the verification fails, generating first error information for correction according to the first error information.
A2. The method of a1, wherein the verifying the first version information according to the second version information further comprises:
judging whether a first version number in the first version information is larger than a second version number in the second version information;
if the first version number is larger than the second version number, calculating a difference value between the first version number and the second version number, and judging whether the difference value meets a preset threshold value or not; if the preset threshold value is met, the verification is passed; if the current time does not meet the preset threshold value, the verification is not passed;
and if the first version number is less than or equal to the second version number, the verification is failed.
A3. The method of a1 or a2, the method further comprising: and if the verification is passed, packaging to generate a plug-in package corresponding to the plug-in.
A4. According to the method of a3, if the plug-in is a plug-in a main project to be compiled, after generating a plug-in package corresponding to the plug-in by packaging, the method further includes:
storing the plug-in package into a main project, and compiling the main project; reading third version information of the plug-in the configuration item in the process of compiling the main project;
judging whether the third version information is consistent with the first version information;
if the main project packages are consistent, packaging to generate a main project package corresponding to the main project; and if the two pieces of error information are not consistent, generating second error information for correction according to the second error information.
A5. The method of A4, wherein reading the third version information of the plug-in the configuration item during the process of compiling the main project further comprises:
and in the process of compiling the main project, compiling to generate class files, reading the class files by using a preset class library, and obtaining the third version information of the plug-ins in the configuration items.
B6. A computing device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to:
compiling the plug-in to be compiled, and reading first version information of the plug-in the process of compiling the plug-in;
pulling second version information of the latest release plug-in version corresponding to the plug-in from the server;
according to the second version information, verifying the first version information;
and if the verification fails, generating first error information for correction according to the first error information.
B7. The computing device of B6, the executable instructions further cause the processor to:
judging whether a first version number in the first version information is larger than a second version number in the second version information;
if the first version number is larger than the second version number, calculating a difference value between the first version number and the second version number, and judging whether the difference value meets a preset threshold value or not; if the preset threshold value is met, the verification is passed; if the current time does not meet the preset threshold value, the verification is not passed;
and if the first version number is less than or equal to the second version number, the verification is failed.
B8. The computing device of B6 or B7, the executable instructions further cause the processor to:
and if the verification is passed, packaging to generate a plug-in package corresponding to the plug-in.
B9. According to the computing device of B8, if the plug-in is a plug-in a main project to be compiled, the executable instructions further cause the processor to:
storing the plug-in package into a main project, and compiling the main project; reading third version information of the plug-in the configuration item in the process of compiling the main project;
judging whether the third version information is consistent with the first version information;
if the main project packages are consistent, packaging to generate a main project package corresponding to the main project; and if the two pieces of error information are not consistent, generating second error information for correction according to the second error information.
B10. The computing device of B9, the executable instructions further cause the processor to:
and in the process of compiling the main project, compiling to generate class files, reading the class files by using a preset class library, and obtaining the third version information of the plug-ins in the configuration items.
C11. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform an operation corresponding to the plug-in version information verification method as described in any one of a1-a 5.