CN111273944B - Method and device for generating program file and uploading program file to code warehouse - Google Patents

Method and device for generating program file and uploading program file to code warehouse Download PDF

Info

Publication number
CN111273944B
CN111273944B CN201811480867.6A CN201811480867A CN111273944B CN 111273944 B CN111273944 B CN 111273944B CN 201811480867 A CN201811480867 A CN 201811480867A CN 111273944 B CN111273944 B CN 111273944B
Authority
CN
China
Prior art keywords
file
code
uploading
plug
program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811480867.6A
Other languages
Chinese (zh)
Other versions
CN111273944A (en
Inventor
刘清洁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
3600 Technology Group Co ltd
Original Assignee
3600 Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 3600 Technology Group Co ltd filed Critical 3600 Technology Group Co ltd
Priority to CN201811480867.6A priority Critical patent/CN111273944B/en
Publication of CN111273944A publication Critical patent/CN111273944A/en
Application granted granted Critical
Publication of CN111273944B publication Critical patent/CN111273944B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

The invention discloses a method and a device for generating a program file and uploading the program file to a code warehouse. Wherein the method comprises the following steps: analyzing a source file code for generating a program file, and searching conflict sentences which are contained in the source file code and accord with preset conflict rules; deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code; acquiring plug-in source codes of uploading plug-ins corresponding to a code warehouse, and determining codes related to file uploading operations contained in the plug-in source codes; and associating the preset path with the code related to the file uploading operation, acquiring the program file positioned under the preset path through the code related to the file uploading operation contained in the uploading plug-in, and uploading the program file to a code warehouse. The method not only solves the problem that the program file cannot be normally generated, but also can upload the generated program file into the code warehouse through the uploading plug-in corresponding to the code warehouse.

Description

Method and device for generating program file and uploading program file to code warehouse
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating a program file and uploading the program file to a code repository.
Background
In order to increase the user volume of program files, it is often necessary to upload the generated program files to a designated code repository, from which sharing of the program files is achieved through a preset access interface. Because the code warehouse of the third party has a large number of users and various standardized access interfaces are provided, the downloading amount of the program files is improved by the aid of the code warehouse of the third party.
In the prior art, for user convenience, a code repository of a third party will typically provide a corresponding upload plug-in, which internally contains tasks for generating individual program files and functions for uploading the generated program files. Therefore, the uploading plug-in provided by the code warehouse can automatically realize the generation and uploading operation of the program file.
However, the inventors have found that in implementing the present invention, at least the following limitations exist in the above manner: the code included in the task for generating each program file included in the uploading plug-in is set for conventional source file code, and once some irregular code segments are included in the source file code for generating the program file, the task may be caused to report errors in the process of generating the program file. Moreover, since there is an association between the function for uploading the generated program file and the task for generating each program file, once the program file cannot be normally generated by the uploading plug-in, it cannot necessarily be uploaded to the code repository by the uploading plug-in.
Disclosure of Invention
The present invention has been made in view of the above problems, and it is an object of the present invention to provide a method and apparatus for generating a program file and uploading the file to a code repository that overcomes or at least partially solves the above problems.
According to one aspect of the present invention, there is provided a method of generating a program file and uploading to a code repository, comprising:
analyzing a source file code for generating a program file, and searching conflict sentences which are contained in the source file code and accord with preset conflict rules;
deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code;
obtaining plug-in source codes of uploading plug-ins corresponding to a code warehouse, and determining codes related to file uploading operations contained in the plug-in source codes;
and associating the preset path with the code related to the file uploading operation, acquiring the program file positioned under the preset path through the code related to the file uploading operation and uploading the program file to a code warehouse.
According to yet another aspect of the present invention, there is provided an apparatus for generating a program file and uploading the program file to a code repository, comprising:
the searching module is suitable for analyzing source file codes for generating program files and searching conflict sentences which are contained in the source file codes and accord with preset conflict rules;
the deleting module is suitable for deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code;
the acquisition module is suitable for acquiring plug-in source codes of uploading plug-ins corresponding to the code warehouse and determining codes related to file uploading operation contained in the plug-in source codes;
and the uploading module is suitable for associating the preset path with the codes related to the file uploading operation, acquiring the program files positioned under the preset path through the codes related to the file uploading operation and uploading the program files to a code warehouse.
According to still another aspect of the present invention, there is provided an electronic apparatus including: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface are communicated with each other through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the method for generating the program file and uploading the program file to the code warehouse.
According to still another aspect of the present invention, there is provided a computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the method of generating a program file and uploading to a code repository as described above.
In the method and the device for generating the program file and uploading the program file to the code warehouse, the conflict rule is set in advance according to various abnormal conditions that the program file cannot be normally generated, the conflict statement conforming to the preset conflict rule is searched in the source file code for generating the program file, and the searched conflict statement is deleted from the source file code, so that the program file positioned under the preset path is generated according to the deleted source file code, and the problem that the program file cannot be normally generated due to the fact that the source file contains an unconventional code segment is solved. In addition, codes related to file uploading operation contained in plug-in source codes of uploading plug-ins corresponding to the code warehouse are further determined, and further a preset path where the generated program file is located is associated with the codes related to the file uploading operation, so that the program file located under the preset path is obtained through the uploading plug-in and uploaded to the code warehouse. Therefore, the method not only solves the problem that the program file cannot be normally generated, but also can upload the generated program file into the code warehouse through the uploading plug-in corresponding to the code warehouse.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow diagram illustrating a method of generating a program file and uploading to a code repository according to one embodiment of the invention;
FIG. 2 is a flow chart of a method of generating a program file and uploading the program file to a code repository according to another embodiment of the present invention;
FIG. 3 is a device block diagram illustrating a device for generating and uploading program files to a code repository in accordance with yet another embodiment of the present invention;
fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
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.
Embodiment 1,
FIG. 1 illustrates a flow diagram of a method of generating a program file and uploading to a code repository according to one embodiment of the invention. As shown in fig. 1, the method includes:
step S110: and analyzing a source file code for generating a program file, and searching conflict sentences contained in the source file code and conforming to preset conflict rules.
The specific type of source file code used for generating the program file depends on the specific type of the program file to be generated, and the specific meaning of the source file code used for generating the program file is not limited in the present invention. Normally, the program file corresponding to the source file code can be automatically generated directly through the uploading plug-in corresponding to the code warehouse. However, when source file code contains some unusual code segments, it may result in a program file generation failure.
For this reason, in the present embodiment, a conflict rule for detecting an irregular code segment having an influence on the generation link of the program file is set in advance. The invention is not limited to the specific meaning of the conflict rule, and any rule corresponding to a code segment which can affect the generation process of the program file can be contained in the conflict rule. For example, assuming that statements contained in the source file code that have a reference relationship with the third party class library will have an impact on the process of generating the program file, the conflict rules include: rules for identifying statements contained in source file code that have a reference relationship with a third party class library. In summary, the preset conflict rules can be determined by one skilled in the art according to various factors such as the item type corresponding to the source file code, the reference relationship between the source file code and the third party class library, and the like. Accordingly, in this step, the statement conforming to the preset conflict rule contained in the source file code is determined as a conflict statement.
Step S120: deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code.
Specifically, when the searched conflict statement is deleted from the source file code, the conflict statement can be directly deleted from the source file code, or the conflict statement can be modified into the annotation form. In short, the present invention is not limited to the specific implementation manner of deletion, as long as the deleted source file code does not execute the conflict statement during the running process. Accordingly, when a program file is generated from the deleted source file code, since the conflict statement is not executed, the program file can be smoothly generated. In addition, in order to facilitate the implementation of the subsequent uploading operation, in this embodiment, the generated program file is stored under a preset path, and the preset path can be flexibly set by those skilled in the art.
Step S130: and obtaining plug-in source codes of the uploading plug-ins corresponding to the code warehouse, and determining codes related to file uploading operation contained in the plug-in source codes.
Specifically, in this embodiment, the uploading operation of the program file needs to be implemented by means of the uploading plug-in corresponding to the code repository, and since the uploading plug-in uploads the program file generated by the task carried by the plug-in by default, in order to enable the generated program file to be uploaded smoothly, the plug-in source code of the uploading plug-in needs to be processed correspondingly. In particular, code associated with a file upload operation included in plug-in source code of the upload plug-in needs to be determined. The code related to the file uploading operation includes various forms such as functions, fields, parameters, variables and the like, so long as the code is related to the file uploading function.
Step S140: and associating the preset path with the code related to the file uploading operation, acquiring the program file positioned under the preset path through the code related to the file uploading operation and uploading the program file to a code warehouse.
Specifically, the purpose of associating the preset path with the code related to the file upload operation is to: the code related to the file uploading operation can acquire the preset path, and the corresponding program file is uploaded according to the preset path. Therefore, any association method capable of achieving the above object can be applied to the present invention, and the present invention is not limited to the specific implementation method of association. For example, code associated with a file upload operation may be modified directly from a preset path to enable an upload plug-in to upload a program file under the preset path.
Therefore, in the method for generating the program file and uploading the program file to the code warehouse, conflict rules are set in advance according to various abnormal conditions that the program file cannot be normally generated, conflict sentences conforming to the preset conflict rules are searched in the source file code for generating the program file, and the searched conflict sentences are deleted from the source file code, so that the program file located under a preset path is generated according to the deleted source file code, and the problem that the program file cannot be normally generated due to the fact that the source file contains irregular code segments is solved. In addition, codes related to file uploading operation contained in plug-in source codes of uploading plug-ins corresponding to the code warehouse are further determined, and further a preset path where the generated program file is located is associated with the codes related to the file uploading operation, so that the program file located under the preset path is obtained through the uploading plug-in and uploaded to the code warehouse. Therefore, the method not only solves the problem that the program file cannot be normally generated, but also can upload the generated program file into the code warehouse through the uploading plug-in corresponding to the code warehouse.
Embodiment II,
FIG. 2 is a flow chart of a method of generating a program file and uploading the program file to a code repository according to another embodiment of the present invention. In this embodiment, a description will be given by taking a program file to be generated as a Javadoc file as an example, and in this embodiment, the code repository is a JCenter repository. Specifically, the SDK needs to be uploaded to the JCenter in the final stage of development so that other developers can use our issued SDK.
For easy understanding, a specific application scenario of the embodiment will be described first. In this embodiment, the developed project files such as the SDK need to be uploaded to the JCenter repository, so as to realize sharing of the project files. According to the relevant specification of the JCenter repository, all the project files uploaded to the repository must contain the following four necessary program files: xxx-java doc. Jar (i.e., java doc file), xxx-sources. Jar (i.e., jar file), xxx. Pore (i.e., pom file), xxx. Aar. In order to pass the audit normally, the four program files are not necessary.
Specifically, the above-described four program files are each generated from a corresponding item file, and for example, may be generated from source file code for generating the program files. In order to implement the above-mentioned rapid generation and upload operations of four program files, the JCenter repository itself provides an official upload plug-in, i.e., an upload plug-in corresponding to the JCenter repository (i.e., a JCenter upload plug-in). The uploading plug-in comprises four plug-in generating tasks which are respectively used for generating corresponding program files. For example, it includes: a java doc plug-in generation task (i.e., java doctask) for generating java doc files, a Jar file plug-in generation task (i.e., sourcesTask) for generating Jar files, a Pom plug-in generation task (i.e., pomtsk) for generating Pom files, and a aar plug-in generation task (i.e., aarTask) for generating aar files. The four plug-in generating tasks respectively generate corresponding program files under the corresponding generating catalogues, and unified archiving and uploading of the four program files is realized by means of codes related to file uploading operation provided in the uploading plug-in.
However, in the process of implementing the above operation by using the uploading plug-in corresponding to the JCenter repository, errors in the generation and uploading process of a certain program file are often caused by the inclusion of some unconventional code in the source file code. For example, in this embodiment, the Javadoc file cannot be successfully generated by the uploading plug-in. In order to solve the above problems, a method in an embodiment of the present invention is provided, as shown in fig. 2, and specifically includes the following steps:
step S200: custom generation tasks are created in advance.
Because the Java plug-in generation task contained in the uploading plug-in cannot normally generate the Java file, a custom generation task needs to be created in the embodiment, so that business logic for generating the Java file in the invention is realized through the custom generation task. The custom generating task is used for replacing the generating task of the Java plug-in provided by the uploading plug-in, and generating operation of the Java file is realized.
In the implementation, the custom generation task can be created inside the uploading plug-in, or can be created outside the uploading plug-in, and the invention is not limited to the specific form. Accordingly, in order to prevent the problem of error reporting caused by the running of the original java doc plug-in generating task in the uploading plug-in, in this embodiment, the java doc plug-in generating task needs to be deleted from the plug-in source code of the uploading plug-in. For example, a code segment corresponding to a java doc plug-in generation task may be directly deleted or annotated, so long as the operation of the java doc plug-in generation task can be prevented. In addition, the deletion time of the java doc plug-in generation task can be flexibly set by a person skilled in the art, so long as deletion is ensured before the java doc file is uploaded to the code repository so as not to affect the normal operation of the plug-in.
Step S210: and analyzing a source file code for generating a program file, searching for a blank statement related to the blank form contained in the source file code, and determining the blank statement as a conflict statement conforming to a preset conflict rule.
Specifically, step S210 and step S220 are both implemented by the custom generation task described above. The source file code for generating the Java file is acquired through the corresponding project file. The inventors found in the course of implementing the present invention that: some project files, in order to be compatible with some projects created earlier, or older in version, will contain in the source file code statements that some programs of the current version have failed to run (which can run in programs of the lower version). To achieve compatibility, these statements, which can only run in certain low-version projects, are typically implemented in a blank form. Accordingly, in the process of developing the SDK, a web library (e.g., apache web library) is used in a manner of useLibrary' org. However, since the JCenter upload plug-in itself does not support the blank form, the subsequent Javadoc file cannot be generated by the JCenter upload plug-in.
In order to solve the above-described problem, in the present embodiment, source file codes for generating program files are analyzed by a custom generation task to find a blank sentence associated with a blank form contained in the source file codes, and the blank sentence is determined as a conflict sentence conforming to a preset conflict rule. Wherein, the empty shell sentence mainly refers to: statements in class libraries or code that are used at compile time but are not used at run time and are not contained in the project end files. For example, considering the requirements of compatible old projects, some project class libraries are only used at compile time to ensure that the compilation process does not report errors. However, the part of the item class library is not used any more in the operation period, but is replaced by the system class library, so that the packaged file after the final packaging of the item does not contain the content in the part of the item class library, and correspondingly, the sentence content in the part of the item class library is a blank sentence. It follows that, for use during compilation, the manner in which the system class library is replaced at run-time is referred to as "empty replacement", and that all statements associated with the empty replacement belong to empty statements associated with the empty form. More broadly, the blank sentences of the present invention refer broadly to various types of sentences that are used during the compilation of a project, but are not used during the running and/or packaging of the project for various reasons. Specifically, the sentence characteristic information of the blank sentence related to the blank form may be collected in advance, for example, sentence characteristic information such as sentence type information, sentence name information, and the like contained in the sentence of the blank sentence related to the blank form is collected, and accordingly, the source file code and the sentence characteristic information of the blank sentence are matched, and once the matching is successful, the corresponding sentence is determined to be the blank sentence, and then is determined to be the conflict sentence. It can be seen that the conflict statement in this embodiment mainly refers to a statement in the form of a blank case corresponding to useLibrary.
Step S220: deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code.
Specifically, once a conflicting statement is found, it is deleted from the source file code. In particular implementations, the hollow statements associated with the hollow form contained in the source file code may be identified by the Gradle script file, and once the hollow statement is identified, the hollow statement is removed and the Gradle script task is refreshed. Alternatively, the source file code can also be directly implemented in a mode of Gradle script files, so that empty sentences in the Gradle script files can be identified and removed by scanning the Gradle script files.
After all the blank sentences contained in the source file codes are deleted, a custom generation task generates a program file positioned under a preset path according to the deleted source file codes. Because the deleted source file code does not contain blank sentences, the Javadoc file can be normally generated. In addition, in order to facilitate the implementation of the subsequent uploading operation, in this embodiment, the generated program file is stored under a preset path, where the preset path can be flexibly set by a person skilled in the art, and the present invention does not limit the specific position of the preset path, as long as the uploading of the Javadoc file can be implemented according to the preset path.
Step S230: and obtaining plug-in source codes of the uploading plug-ins corresponding to the code warehouse, and determining codes related to file uploading operation contained in the plug-in source codes.
Specifically, since the uploading plug-in corresponding to the code warehouse provides a function of uploading files to the code warehouse, and since other three program files can still be generated and uploaded through the uploading plug-in, in the embodiment, the uploading operation of the Java file generated by the custom generation task is realized by means of the uploading plug-in. Because the plug-in source code of the uploading plug-in contains codes related to file uploading operation. The partial code can realize the uploading function of the program file, so that the code related to the file uploading operation contained in the plug-in source code needs to be determined first for subsequent processing.
Step S240: and determining an uploading path contained in codes related to file uploading operation, linking the uploading path to the preset path, and acquiring the program files located under the preset path through the codes related to the file uploading operation contained in the uploading plug-in and uploading the program files to a code warehouse.
In particular, an upload path included in code associated with a file upload operation is used to obtain a program file to be uploaded, and the upload path may be implemented in the form of an archive field. The uploading path is linked to the preset path, so that the purpose of uploading the program file located under the preset path through the uploading plug-in can be achieved. In the specific linking, the uploading path can be linked to the preset path through a hooking function, for example: through a Hook mechanism. In the implementation, first, codes related to file uploading operations contained in plug-in source codes of uploading plug-ins are analyzed to determine mounting points (namely positions where hook functions are set), so that a Java file under a preset path is mounted under an archiving field. Then, the script of the mounting point is changed to realize the operation of acquiring the program file positioned under the preset path through the archiving field. When the script of the mounting point is changed, the code of the mounting point can be directly modified, and the code can be realized by setting the internal logic of the hooking function.
By the method, the Java file can be generated by means of the custom generation task, so that generation failure caused by blank sentences is avoided; in addition, by linking the uploading path in the uploading plug-in to the preset path where the Javadoc file is located, the uploading operation of the Javadoc file can be realized by the uploading plug-in, so that the four program files mentioned above can be packed and archived uniformly and uploaded to a code warehouse.
The method can bypass the Java docTask used for automatically generating the Java doc in the JCenter uploading plug-in, then links the Java doc folder path generated by the script to the Java docJar in the JCenter uploading plug-in, so that the Java doc can be successfully generated and can be archived under a designated file directory, and finally the uploading operation of the whole SDK is completed. The method can upload the developed SDK to the JCenter warehouse, so that not only can the product inside the developer use the SDK, but also an external third party product can use the SDK, and the downloading amount and the user amount for using the SDK are widened. In addition, it should be emphasized that the implementation manner of the source file code does not need to be changed in the manner of the invention, and the network library can still be used in a blank manner of useLibrary 'org. Apache. Http. Legacy', and the network library is not required to be referenced in other manners of SDK replacement, so that convenience is provided for project development. If the SDK replaces the network library in other ways (in a non-empty way), other unnecessary files are contained in the SDK, and the volume of the SDK is increased, so that unnecessary influence is brought to the project. Therefore, the method can realize the generation and uploading operation of the program file on the premise of not changing the project implementation mode and not changing the size of the project file package, has strong universality, can be widely applied to various application scenes, and can be adopted in the case of generation failure caused by conflict between the uploading plug-in and the source file code.
Fig. 3 is a block diagram showing an apparatus for generating a program file and uploading the program file to a code repository according to still another embodiment of the present invention. As shown in fig. 3, the present apparatus includes:
a search module 31 adapted to analyze a source file code for generating a program file, and search for conflict statements included in the source file code and conforming to a preset conflict rule;
the deleting module 32 is adapted to delete the searched conflict statement from the source file code, and generate a program file under a preset path according to the deleted source file code;
the obtaining module 33 is suitable for obtaining plug-in source codes of uploading plug-ins corresponding to the code warehouse and determining codes related to file uploading operation contained in the plug-in source codes;
and the uploading module 34 is adapted to associate the preset path with the code related to the file uploading operation, acquire the program file located under the preset path through the code related to the file uploading operation and upload the program file to a code warehouse.
Optionally, the search module 31 is specifically adapted to:
and searching a blank statement related to a blank form contained in the source file code, and determining the blank statement as the conflict statement conforming to a preset conflict rule.
Optionally, the program file located under the preset path is generated through a preset custom generation task;
and, the uploading module 34 is further configured to:
and determining a plug-in generation task contained in the uploading plug-in and used for generating the program file, and deleting the plug-in generation task from plug-in source codes of the uploading plug-in.
Optionally, the uploading module 34 is specifically configured to: and determining an uploading path contained in the code related to the file uploading operation, and linking the uploading path to the preset path.
Optionally, the uploading module 34 is specifically configured to: and linking the uploading path to the preset path through a hooking function.
Optionally, the code repository is a JCenter repository and the program file is a Javadoc file.
The specific structure and working principle of each module may refer to the description of corresponding steps in the method embodiment, and are not repeated herein.
The present application provides a non-volatile computer storage medium, where at least one executable instruction is stored, where the computer executable instruction may perform the method of generating a program file and uploading the program file to a code repository in any of the above method embodiments.
Fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention, and the specific embodiment of the present invention is not limited to the specific implementation of the electronic device.
As shown in fig. 4, the electronic device may include: a processor 402, a communication interface (Communications Interface) 404, a memory 406, and a communication bus 408.
Wherein:
processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.
A communication interface 404 for communicating with network elements of other devices, such as clients or other servers.
Processor 402 is configured to execute program 410, and may specifically perform relevant steps in the method embodiment described above for generating a program file and uploading the program file to a code repository.
In particular, program 410 may include program code including computer-operating instructions.
The processor 402 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in the electronic device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 406 for storing programs 410. Memory 406 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 410 may be specifically operative to cause processor 402 to perform the operations in the method embodiments described above.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood 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 construed as reflecting the intention that: i.e., the claimed invention 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 apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. 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. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units 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 but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the means for generating and uploading program files to the code repository according to embodiments of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
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. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (14)

1. A method of generating and uploading a program file to a code repository, comprising:
analyzing a source file code for generating a program file, and searching conflict sentences which are contained in the source file code and accord with preset conflict rules, wherein the preset conflict rules refer to rules of unconventional code segments for detecting influence on a generation link of the program file;
deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code;
obtaining plug-in source codes of uploading plug-ins corresponding to a code warehouse, and determining codes related to file uploading operations contained in the plug-in source codes;
and associating the preset path with the code related to the file uploading operation, acquiring the program file positioned under the preset path through the code related to the file uploading operation and uploading the program file to a code warehouse.
2. The method of claim 1, wherein the searching for conflict statements contained in the source file code that meet a preset conflict rule comprises:
and searching a blank statement related to a blank form contained in the source file code, and determining the blank statement as the conflict statement conforming to a preset conflict rule, wherein the blank statement refers to a statement which is used in a compiling period, is not used in a running period and is not contained in a class library or code of a final project file.
3. The method according to claim 1 or 2, wherein the program files located under the preset path are generated by preset custom generation tasks;
and before the program file located under the preset path is obtained through the code related to the file uploading operation contained in the uploading plug-in and uploaded to the code warehouse, the method further comprises:
and determining a plug-in generation task contained in the uploading plug-in and used for generating the program file, and deleting the plug-in generation task from plug-in source codes of the uploading plug-in.
4. A method according to any one of claims 1-3, wherein said associating said preset path with said code associated with a file upload operation comprises:
and determining an uploading path contained in the code related to the file uploading operation, and linking the uploading path to the preset path.
5. The method of claim 4, wherein the linking the upload path to the preset path specifically comprises:
and linking the uploading path to the preset path through a hooking function.
6. The method of any of claims 1-5, wherein the code repository is a JCenter repository and the program file is a Javadoc file.
7. An apparatus for generating and uploading program files to a code repository, comprising:
the searching module is suitable for analyzing source file codes for generating the program files and searching conflict sentences which are contained in the source file codes and accord with preset conflict rules, wherein the preset conflict rules refer to rules of unconventional code segments for detecting influence on generation links of the program files;
the deleting module is suitable for deleting the searched conflict statement from the source file code, and generating a program file positioned under a preset path according to the deleted source file code;
the acquisition module is suitable for acquiring plug-in source codes of uploading plug-ins corresponding to the code warehouse and determining codes related to file uploading operation contained in the plug-in source codes;
and the uploading module is suitable for associating the preset path with the codes related to the file uploading operation, acquiring the program files positioned under the preset path through the codes related to the file uploading operation and uploading the program files to a code warehouse.
8. The apparatus of claim 7, wherein the lookup module is specifically adapted to:
and searching a blank statement related to a blank form contained in the source file code, and determining the blank statement as the conflict statement conforming to a preset conflict rule, wherein the blank statement refers to a statement which is used in a compiling period, is not used in a running period and is not contained in a class library or code of a final project file.
9. The device according to claim 7 or 8, wherein the program files located under the preset path are generated by preset custom generation tasks;
and, the upload module is further to:
and determining a plug-in generation task contained in the uploading plug-in and used for generating the program file, and deleting the plug-in generation task from plug-in source codes of the uploading plug-in.
10. The apparatus according to any one of claims 7-9, wherein the uploading module is specifically configured to: and determining an uploading path contained in the code related to the file uploading operation, and linking the uploading path to the preset path.
11. The apparatus of claim 10, wherein the upload module is specifically configured to: and linking the uploading path to the preset path through a hooking function.
12. The apparatus of any of claims 7-11, wherein the code repository is a JCenter repository and the program file is a Javadoc file.
13. An electronic device, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform operations corresponding to the method of generating a program file and uploading the program file to a code repository according to any one of claims 1-6.
14. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the method of generating a program file and uploading to a code repository as claimed in any one of claims 1-6.
CN201811480867.6A 2018-12-05 2018-12-05 Method and device for generating program file and uploading program file to code warehouse Active CN111273944B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811480867.6A CN111273944B (en) 2018-12-05 2018-12-05 Method and device for generating program file and uploading program file to code warehouse

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811480867.6A CN111273944B (en) 2018-12-05 2018-12-05 Method and device for generating program file and uploading program file to code warehouse

Publications (2)

Publication Number Publication Date
CN111273944A CN111273944A (en) 2020-06-12
CN111273944B true CN111273944B (en) 2024-01-30

Family

ID=70998524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811480867.6A Active CN111273944B (en) 2018-12-05 2018-12-05 Method and device for generating program file and uploading program file to code warehouse

Country Status (1)

Country Link
CN (1) CN111273944B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484172A (en) * 2014-12-11 2015-04-01 上海天脉聚源文化传媒有限公司 Method and device for packaging files
CN105183789A (en) * 2015-08-21 2015-12-23 福建天晴数码有限公司 File merging method and system based on git source code confliction
CN105468411A (en) * 2015-11-25 2016-04-06 北京金山安全软件有限公司 Application processing method and device and electronic equipment
CN105912353A (en) * 2015-12-23 2016-08-31 北京奇虎科技有限公司 Method and device for packaging application program
CN106294164A (en) * 2016-08-15 2017-01-04 中国银行股份有限公司 A kind of code check method and device
CN108073501A (en) * 2016-11-14 2018-05-25 阿里巴巴集团控股有限公司 A kind of code conflicts detection method and equipment
CN108228206A (en) * 2016-12-20 2018-06-29 北京智能管家科技有限公司 A kind of application management method and device
CN108304175A (en) * 2018-01-29 2018-07-20 口碑(上海)信息技术有限公司 Packaging method and device is isolated in code file

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7570870B2 (en) * 2005-09-27 2009-08-04 Guideworks, Llc Systems and methods for recording programs of lesser interest when convenient

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484172A (en) * 2014-12-11 2015-04-01 上海天脉聚源文化传媒有限公司 Method and device for packaging files
CN105183789A (en) * 2015-08-21 2015-12-23 福建天晴数码有限公司 File merging method and system based on git source code confliction
CN105468411A (en) * 2015-11-25 2016-04-06 北京金山安全软件有限公司 Application processing method and device and electronic equipment
CN105912353A (en) * 2015-12-23 2016-08-31 北京奇虎科技有限公司 Method and device for packaging application program
CN106294164A (en) * 2016-08-15 2017-01-04 中国银行股份有限公司 A kind of code check method and device
CN108073501A (en) * 2016-11-14 2018-05-25 阿里巴巴集团控股有限公司 A kind of code conflicts detection method and equipment
CN108228206A (en) * 2016-12-20 2018-06-29 北京智能管家科技有限公司 A kind of application management method and device
CN108304175A (en) * 2018-01-29 2018-07-20 口碑(上海)信息技术有限公司 Packaging method and device is isolated in code file

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Conflict-Based Checking the Integrity of Linux Package Dependencies;Yuqing LAN等;IEICE TRANSACTIONS on Information and Systems(第12期);第2431-2439页 *
基于Android平台的代码保护技术研究;梅瑞等;信息网络安全(第7期);第10-15页 *

Also Published As

Publication number Publication date
CN111273944A (en) 2020-06-12

Similar Documents

Publication Publication Date Title
US9811360B2 (en) Dynamic determination of application server runtime classloading
US8464228B2 (en) Binary library
US8458681B1 (en) Method and system for optimizing the object code of a program
US9104797B1 (en) Efficient cloud-based annotation of crash reports
CN108304175B (en) Code file isolation packaging method and device
US20150082298A1 (en) Packaging and deploying hybrid applications
US8429632B1 (en) Method and system for debugging merged functions within a program
CN111176717B (en) Method and device for generating installation package and electronic equipment
CN106469049B (en) File scanning method and device
CN111061643B (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
US11328021B2 (en) Automatic resource management for build systems
CN110069259A (en) Analytic method, device, electronic equipment and storage medium based on idl file
CN113515303B (en) Project transformation method, device and equipment
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
CN111352631B (en) Interface compatibility detection method and device
CN111273944B (en) Method and device for generating program file and uploading program file to code warehouse
CN110941443A (en) Method and device for modifying file name in SDK and electronic equipment
CN113190235B (en) Code analysis method and device, electronic terminal and storage medium
CN111273940B (en) Method and device for uploading program file to code warehouse
CN114115982A (en) Code issuing method, device, equipment and storage medium
CN114816816A (en) Collapse stack information processing method, device, equipment and storage medium
US7873949B2 (en) In source code suppression of binary analysis
CN113094086A (en) Component integration method and device, computer-readable storage medium and electronic equipment
CN115168175A (en) Program error solving method, device, electronic equipment and storage medium
CN113760291A (en) Log output method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240105

Address after: Room 03, 2nd Floor, Building A, No. 20 Haitai Avenue, Huayuan Industrial Zone (Huanwai), Binhai New Area, Tianjin, 300450

Applicant after: 3600 Technology Group Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant