Source code processing method, system, storage medium and electronic device
By acquiring and processing the source code repository identifier and branch information of the system project, and using the distributed version control system interface to obtain the source code and perform preprocessing and compilation on the local compilation server, the problem of low efficiency in system project construction and deployment is solved, and efficient system project construction and deployment is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2022-02-14
- Publication Date
- 2026-07-07
AI Technical Summary
Existing system project building and deployment tools are inefficient in completing the building and deployment tasks of multiple interrelated large Java projects in complex systems, resulting in low efficiency.
By identifying each project in the compilation task, obtaining the identifier and branch information of the source code repository, using the distributed version control system interface to obtain the source code, preprocessing and compiling it on the local compilation server, generating compiled artifacts, matching them with the preset deployment strategy, and generating a deployment strategy file.
It enables efficient building and deployment of system projects, improves the efficiency of building and deployment, ensures that the source code is compatible with the system and avoids resource waste and compilation errors.
Smart Images

Figure CN114489676B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more specifically, to a source code processing method, system, storage medium, and electronic device. Background Technology
[0002] Existing system project build and deployment tools consist of specific build management tools tailored to project needs. Some common build management tools include Ant (Apache Ant), Maven, and Jenkins. Apache Ant is a standard open-source build tool for Java projects. Ant uses the easily understood XML (Extensive Markup Language) language as its configuration format to configure specific parameters during the project build process. Maven is a software (especially Java-based software projects) project management and automated build tool. Maven also uses XML as its configuration format, but it also applies a unified object model (POM) concept. The POM provides a central information unit that manages the build, reporting, and documentation steps of a project. Jenkins is an open-source continuous integration tool that can be used for various automated tasks in software development, including building, testing, and deployment, and is an important component of the system project build and deployment toolchain. However, Ant, Maven, and Jenkins can only perform deployment or build tasks individually based on project needs, and cannot perform both build and deployment tasks simultaneously.
[0003] The need for high-quality, short-cycle software version iterations and highly automated system project building and deployment processes is becoming increasingly urgent. For a complex system that protects multiple interconnected large Java projects, the offline manual compilation of Java projects and the single-point manual deployment of program installation packages cannot meet the efficiency, quality and automation requirements of today's system project building and deployment for build tools.
[0004] There is currently no effective solution to the problem of low efficiency in system project construction and deployment in related technologies. Summary of the Invention
[0005] This application provides a source code processing method, system, storage medium, and electronic device to solve the problem of low efficiency in system project construction and deployment in related technologies.
[0006] According to one aspect of this application, a method for processing source code is provided. The method includes: identifying each project in a compilation task; obtaining the identifier of the source code repository for each project and the branch information required to compile each project, and obtaining an interface to a distributed version control system; obtaining the source code of each project from a remote code hosting repository through the interface based on the identifier and branch information, and saving the source code of each project to a local compilation server; generating a list of projects to be released based on the source code of each project, preprocessing the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, and using the preprocessed projects to form a list of projects to be compiled; compiling the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; matching the compiled artifacts with a preset deployment strategy, and generating a deployment strategy file for the compiled artifacts if the matching is successful.
[0007] Optionally, after saving the source code of each project to the local compilation server, the method further includes: checking whether the source code conforms to source code management rules; if the source code conforms to the source code management rules, performing the step of generating a list of projects to be released based on the source code of each project; and discarding the source code if it does not conform to the source code management rules. By checking the source code, it is ensured that the processed source code can be adapted to the corresponding system.
[0008] Optionally, based on the identifier and branch information, retrieving the source code of each project from the remote code hosting repository via an interface includes: determining whether the local build server contains the source code corresponding to the branch information of each project; if the local build server does not contain the source code corresponding to the branch information, retrieving all source code corresponding to the branch information from the remote code hosting repository; if the local build server contains the source code corresponding to the branch information, retrieving the incremental source code corresponding to the branch information from the remote code hosting repository, wherein the incremental source code is the source code that is different from the source code already stored in the local build server. Obtaining source code through both incremental and full download methods allows for efficient use of the local build server, avoiding waste of the bandwidth resources required for downloading source code.
[0009] Optionally, before preprocessing the projects in the list of projects to be published that require compilation, the method further includes: determining whether any project in the list of projects to be published is associated with preset flag information, wherein the preset flag information is used to indicate that the project needs to be compiled; classifying the projects in the list of projects to be published according to whether they are associated with preset flag information to obtain projects that need to be compiled and projects that do not need to be compiled, wherein projects that need to be compiled are those associated with preset flag information, and projects that do not need to be compiled are those that are not associated with preset flag information. By distinguishing whether projects need to be compiled or not, the local compilation server can avoid duplicate compilation during compilation, thus preventing resource waste.
[0010] Optionally, preprocessing the projects in the project list that need to be compiled includes: determining whether each project in the project list has dependencies on other projects, where other projects are those in the project list; if a project has no dependencies on other projects, determining the project information and marking dependencies; if a project has dependencies on other projects, determining the dependent projects, determining their information and marking dependencies, and determining their information and marking dependencies. By confirming the dependencies between projects, compilation errors caused by disordered compilation order of dependent projects during compilation can be avoided.
[0011] Optionally, preprocessing of projects in the list of projects to be compiled also includes: determining whether each project in the list is an incremental deployment project; adding a full deployment flag to a project if it is not an incremental deployment project; and adding an incremental deployment flag to a project if it is an incremental deployment project. Adding the incremental deployment flag ensures that the compilation process distinguishes between incremental and full compilation for each project.
[0012] Optionally, the projects in the list of projects to be compiled are compiled using a local build server to obtain the compiled artifacts. This includes: allocating a thread for each project in the list; before starting the thread corresponding to the current project to be compiled, determining whether the project has dependent projects based on dependency identifiers; if the current project has dependent projects, determining whether the dependent project is the parent project of the current project; if the dependent project is the parent project, stopping the execution of the current project's thread and executing the thread corresponding to the parent project; if the dependent project is not the parent project, compiling the current project to obtain the compiled artifacts corresponding to the current project. By adjusting the compilation order of projects with dependencies, projects with dependencies can be compiled in a specific order without causing compilation errors.
[0013] Optionally, matching the compiled artifact with the preset deployment policy includes: obtaining the compiled artifact and the preset deployment policy; verifying whether the compiled artifact and the preset deployment policy conform to preset rules; if both the compiled artifact and the preset deployment policy conform to the preset rules, performing the step of matching the compiled artifact with the preset deployment policy; if the compiled artifact and the preset deployment policy do not conform to the preset rules, prohibiting the step of matching the compiled artifact with the preset deployment policy. The success or failure of the source code processing is determined by matching the compiled artifact with the preset deployment policy.
[0014] Optionally, if a match is successful, generating a deployment strategy file for the compiled artifact includes: matching a preset deployment strategy with the operational phase of the compiled artifact to obtain the deployment strategy corresponding to each operational phase; and generating a deployment strategy file based on the operational phase of the compiled artifact and the deployment strategy corresponding to each operational phase. Generating a deployment strategy file can guide the application of system modules corresponding to the operational phase.
[0015] According to another aspect of this application, a source code processing system is provided. The system includes: a control unit for controlling a self-testing unit, a source code management unit, a project compilation unit, and a deployment strategy management unit to operate sequentially; a self-testing unit for performing a pre-verification operation, wherein the pre-verification operation includes at least verifying the configuration parameters of the verification system and the external connection devices of the verification system; a source code management unit for generating source code management tasks, obtaining the identifiers of the source code version repositories of each project in the source code management task and the branch information required to compile each project, and downloading the source code of each project from a remote code hosting repository to a local compilation server based on the identifiers and branch information; a project compilation unit for determining project compilation tasks based on the projects in the source code management task, generating a list of projects to be released based on the source code of each project in the project compilation task, preprocessing the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, forming a list of projects to be compiled from the preprocessed projects, and compiling the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; and a deployment strategy management unit for matching the compiled artifacts with a preset deployment strategy, and generating a deployment strategy file for the compiled artifacts if the matching is successful.
[0016] According to another aspect of the present invention, a computer storage medium is also provided for storing a program, wherein the program, when running, controls the device where the non-volatile storage medium is located to execute a source code processing method.
[0017] According to another aspect of the present invention, an electronic device is also provided, comprising a processor and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein the computer-readable instructions execute a source code processing method when they are executed.
[0018] This application employs the following steps: identifying each project in the compilation task; obtaining the identifier of the source code repository for each project and the branch information required for compiling each project, and obtaining the interface of the distributed version control system; based on the identifier and branch information, retrieving the source code of each project from the remote code hosting repository through the interface, and saving the source code of each project to the local compilation server; generating a list of projects to be released based on the source code of each project, preprocessing the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, and using the preprocessed projects to form a list of projects to be compiled; compiling the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; matching the compiled artifacts with a preset deployment strategy, and generating a deployment strategy file for the compiled artifacts if the match is successful, thus solving the problem of low system project construction and deployment efficiency in related technologies. By integrating source code management, project compilation, and deployment strategy management functions to uniformly process system projects, the effect of efficient system project construction and deployment is achieved. Attached Figure Description
[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0020] Figure 1 This is a flowchart of a processing method based on the source code provided in the embodiments of this application;
[0021] Figure 2 This is a flowchart illustrating the download of source code from a local compilation server according to an embodiment of this application;
[0022] Figure 3 This is a flowchart of the project deployment strategy management corresponding to the source code provided in the embodiments of this application;
[0023] Figure 4 This is a schematic diagram of the processing system structure based on the source code provided in the embodiments of this application;
[0024] Figure 5 This is a schematic diagram of the external connection environment of the source code processing system provided in the embodiments of this application;
[0025] Figure 6 This is a flowchart of the project compilation method provided in the embodiments of this application;
[0026] Figure 7 This is a schematic diagram of a source code processing apparatus provided according to an embodiment of this application;
[0027] Figure 8 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0028] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0032] Maven: Apache Maven, commonly known as Maven, is a software (especially Java software) project management and automated build tool. Based on the concept of Object Model (POM), it uses a central piece of information to manage the build, reporting, and documentation steps of a project.
[0033] Continuous integration is a software engineering process that involves continuously integrating all working copies of the software from all software engineers into a shared mainline. It is used to address various issues encountered when integrating software into a system.
[0034] Compilation is a process that uses a compiler to generate an object program from source code written in a source language. It can program high-level languages into binary languages that computers can recognize.
[0035] SQL: Structured Query Language, is a database language with multiple functions such as data manipulation and data definition.
[0036] According to an embodiment of this application, a method for processing source code is provided.
[0037] Figure 1 This is a flowchart of a processing method based on the source code provided in an embodiment of this application. For example... Figure 1 As shown, the method includes the following steps:
[0038] Step S102: Determine the individual items in the compilation task.
[0039] Specifically, each project in the compilation task refers to a system project whose source code needs to be updated.
[0040] Step S104: Obtain the identifier of the source code repository of each project and the branch information required to compile each project, and obtain the interface of the distributed version control system.
[0041] Specifically, a source code repository is a remote code hosting repository that stores the source code of a system project. Each project has a unique identifier in the source code repository. Branch information refers to the information corresponding to the source code that needs to be modified in the project. The interface of the distributed version control system is the interface corresponding to the download path of the source code repository.
[0042] Step S106: Based on the identifier and branch information, retrieve the source code of each project from the remote code hosting repository through the interface, and save the source code of each project to the local compilation server.
[0043] Specifically, the identifier and branch information can identify the repository and project branch where the source code that needs to be updated is located, and the corresponding source code that needs to be updated can be downloaded to the local compilation server through the interface.
[0044] Step S108: Generate a list of projects to be released based on the source code of each project, preprocess the projects that need to be compiled in the list of projects to be released, obtain the preprocessed projects, and form the list of projects to be compiled from the preprocessed projects.
[0045] Specifically, the list of projects to be released is a list of projects that need to be updated corresponding to system projects. The list of projects to be released includes projects that need to be compiled and projects that do not need to be compiled. Projects that do not need to be compiled do not need to be preprocessed. Preprocessing is to add dependency tags and incremental update tags to projects that need to be compiled before compilation. After adding the tags, the corresponding projects can be compiled.
[0046] Step S110: Compile the items in the list of items to be compiled using the local compilation server to obtain the compiled artifact.
[0047] Specifically, compiling the items in the list of items to be compiled means updating the configuration of the source code to be updated, and obtaining the updated source code, which is the compiled artifact.
[0048] Step S112: Match the compiled artifact with the preset deployment strategy, and if the match is successful, generate the deployment strategy file for the compiled artifact.
[0049] Specifically, the preset deployment strategy is based on the projects corresponding to each module involved in the operation and maintenance of the source code processing system. A successful match means that the updated source code corresponding to the project can be used normally during operation and maintenance.
[0050] The source code processing method provided in this application's embodiments identifies each project in the compilation task; obtains the identifier of the source code repository for each project and the branch information required to compile each project, and obtains the interface of the distributed version control system; based on the identifier and branch information, retrieves the source code of each project from the remote code hosting repository through the interface, and saves the source code of each project to the local compilation server; generates a list of projects to be released based on the source code of each project, preprocesses the projects that need to be compiled in the list of projects to be released, obtains preprocessed projects, and the preprocessed projects constitute the list of projects to be compiled; compiles the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; matches the compiled artifacts with a preset deployment strategy, and if the match is successful, generates a deployment strategy file for the compiled artifacts, thus solving the problem of low system project construction and deployment efficiency in related technologies. By integrating the functions of source code management, project compilation, and deployment strategy management to uniformly process system projects, the method achieves the effect of efficient system project construction and deployment.
[0051] Since source code downloaded from the source code repository may be incompatible with the local compilation server, optionally, in the source code processing method provided in this application embodiment, after saving the source code of each project to the local compilation server, the method further includes: detecting whether the source code conforms to the source code management rules; if the source code conforms to the source code management rules, performing the step of generating a list of projects to be released based on the source code of each project; if the source code does not conform to the source code management rules, discarding the source code.
[0052] Specifically, source code management rules are set to determine whether downloaded code is compatible with the local compilation server. For example, configuring code review rules and code quality risk rules falls under source code management rules. If the downloaded code is incompatible with the local compilation server, compatible source code needs to be downloaded again. By inspecting the source code, it is ensured that it is compatible with the corresponding system after processing.
[0053] Since the local compilation server contains partial source code of the project to be updated, optionally, in the source code processing method provided in this application embodiment, obtaining the source code of each project from the remote code hosting repository through an interface based on the identifier and branch information includes: determining whether the local compilation server has source code corresponding to the branch information of each project; if the local compilation server does not have source code corresponding to the branch information, obtaining all source code corresponding to the branch information from the remote code hosting repository; if the local compilation server has source code corresponding to the branch information, obtaining the incremental source code corresponding to the branch information from the remote code hosting repository, wherein the incremental source code is source code different from the source code already stored in the local compilation server.
[0054] Specifically, Figure 2 This is a flowchart illustrating the download of source code from a local compilation server according to an embodiment of this application, such as... Figure 2 As shown, the system determines the status of the source code repository on the local compilation server and checks if the source code corresponding to each branch of each project exists. For example, if a project has branches A and B, and the local compilation server does not have the source code for branch A, then during download, a full download (clone operation) is performed on the source code for branch A, meaning all source code for branch A from the remote server is downloaded to the local compilation server. If the local compilation server has the source code for branch B, then during download, an incremental download (pull operation) is performed on the source code for branch B, meaning only the differences between the source code on the remote server and the local compilation server are updated and merged. The system monitors the source code update progress during download and returns an update progress status code to the source code processing system. Obtaining source code through both incremental and full downloads allows for efficient use of the local compilation server, avoiding wasted bandwidth resources for downloading source code.
[0055] Since the downloaded source code also includes some source code that needs to be updated, optionally, in the source code processing method provided in this application embodiment, before preprocessing the projects that need to be compiled in the list of projects to be released, the method further includes: determining whether the projects in the list of projects to be released are associated with preset flag information, wherein the preset flag information is used to indicate that the project needs to be compiled; classifying the projects in the list of projects to be released according to whether they are associated with preset flag information to obtain projects that need to be compiled and projects that do not need to be compiled, wherein the projects that need to be compiled are projects that are associated with preset flag information, and the projects that do not need to be compiled are projects that are not associated with preset flag information.
[0056] Specifically, the default flag information is the flag corresponding to the object model configuration file (i.e., pom.xml). By parsing the obtained list of projects to be released line by line, the projects in the list are divided into two categories based on whether they need to be compiled. The method for determining this is to recursively scan the projects in the list and their corresponding parent and sibling directories, using the presence or absence of the Maven-required project object model configuration file as the flag indicating whether compilation is required. Project branches that do not need to be compiled do not have the object model configuration file flag, while project branches that need to be compiled do. For branches that do not need to be compiled, such as configuration files and configuration-related database SQL scripts, these branches are directly transferred to the compiled artifact. For branches that need to be compiled, these branches are usually files contained in the Java project that need to be compiled by the compiler before they can run on the server. These branches are compiled by the local compilation server. By distinguishing whether a project needs to be compiled or not, the local compilation server can avoid duplicate compilations that would waste resources.
[0057] Since there may be dependencies between branches of the project to be compiled, optionally, in the source code processing method provided in this application embodiment, the preprocessing of the projects to be compiled in the project list to be released includes: determining whether there is a dependency between each project in the project list to be compiled and other projects, wherein the other projects are projects in the project list to be compiled; if there is no dependency between a project and other projects, determining the project information of the project and marking the dependency relationship identifier; if there is a dependency between a project and other projects, determining the dependent projects corresponding to the project, determining the project information and marking the dependency relationship identifier, and determining the project information of the dependent projects and marking the dependency relationship identifier.
[0058] Specifically, each branch in the release manifest that needs to be compiled is processed one by one. Each branch contains an object model configuration file. By parsing the project object model configuration file, it is determined whether there are dependencies between different branches in the release manifest. Dependencies are determined by checking whether the configurations of different branches affect each other. For example, if branch A and branch B have a dependency, then updating the parameters corresponding to branch A will also require adjusting the parameters corresponding to branch B. If there are no dependencies between the release branches, information about the projects to be compiled in the release manifest is collected and compilation elements are marked. These compilation elements include project object model configuration, incremental update markers, dependency resolution, etc. If there are dependencies between the release branches, based on the obtained dependent branches A and B, the project object model configuration files of the Maven projects containing A and B are parsed to determine the parent-child dependency relationship between branches A and B. That is, if updating the parameters of branch A will affect branch B, then branch A is the parent project branch, and a parent project dependency marker is added to branch B; or if updating the parameters of branch B will affect branch A, then branch B is the parent project branch, and a parent project dependency marker is added to branch A. By confirming the dependencies between projects, we can avoid compilation errors caused by a disordered compilation order of dependent projects during compilation.
[0059] Since the compilation process may involve compiling both incrementally downloaded source code and fully downloaded source code, optionally, in the source code processing method provided in this application embodiment, the preprocessing of the projects that need to be compiled in the project list to be released further includes: determining whether each project in the project list to be compiled is an incremental deployment project; adding a full deployment mark to a project if it is not an incremental deployment project; and adding an incremental deployment mark to a project if it is an incremental deployment project.
[0060] Specifically, based on the list of projects to be released, each incoming branch is checked to determine whether it is an incremental deployment project. Incremental deployment projects typically involve only minor changes to business logic; the actual compilation and deployment only require updating the modified parts. Incremental updates, with their "small steps, quick progress" pace, effectively improve the efficiency of version iteration compilation and deployment. The criteria for determining an incremental deployment project are whether the change list corresponding to the branch to be released contains only Java project source code files. For example, if project C is an incremental deployment project, it means that in this compilation task, project C only has business logic modifications and no new dependency packages, making it an incremental deployment project, and incremental compilation should be performed on project C. Conversely, if project D is not an incremental deployment project, and its change list includes project object model configuration files and configuration files, it means that project D may have added dependency packages or configuration variables in this compilation task, requiring a full compilation of project D. For projects requiring full deployment, a full deployment flag is added. For incremental deployment projects, the object model configuration file is further parsed to identify the target JAR files of the projects to be compiled. Incremental deployment flags are then added to the incremental deployment projects, completing the parsing of the list of projects to be compiled and generating a list containing compilation element flags. Projects in this list are then compiled in parallel. Adding incremental deployment flags ensures that the compiler distinguishes between incremental and full compilation for each project.
[0061] During parallel compilation, projects marked with dependency identifiers may be encountered. Optionally, in the source code processing method provided in this application embodiment, the projects in the list of projects to be compiled are compiled by a local compilation server to obtain the compiled artifacts. This includes: allocating a thread for each project in the list of projects to be compiled; before starting the thread corresponding to the current project to be compiled, determining whether the project to be compiled has dependent projects based on the dependency identifier; if the current project has dependent projects, determining whether the dependent project is the parent project of the current project; if the dependent project is the parent project, stopping the execution of the current project's thread and executing the thread corresponding to the parent project; if the dependent project is not the parent project, compiling the current project to obtain the compiled artifacts corresponding to the current project.
[0062] Specifically, before parallel compilation begins, it is determined whether the project in this thread has parent project dependencies. For example, if project E has a parent project dependency (i.e., project E carries a parent project dependency identifier), the thread's priority is adjusted, and project E enters a sleep and blocked state. Compilation of project E resumes after its dependent projects have finished compiling. If project F does not have a parent project dependency identifier, the compilation method is called directly for compilation. For projects that fail to compile, the thread allows three retries. For projects that have succeeded more than once, the compilation completion status information is sent to the source code processing system. After successful compilation, the resulting artifacts are categorized according to predetermined rules, such as whether they are binary files, configuration files, or tightly coupled with environment information. The categorized artifacts are then compressed according to configuration parameters and a specific naming convention, and a compilation task completion signal is sent to the source code processing system. By adjusting the compilation order of dependent projects, projects with dependencies can be compiled sequentially without causing compilation errors.
[0063] The compiled artifact obtained after compilation may not be compatible with the deployment strategy. Optionally, in the source code processing method provided in this application embodiment, matching the compiled artifact with the preset deployment strategy includes: obtaining the compiled artifact and the preset deployment strategy; verifying whether the compiled artifact and the preset deployment strategy conform to preset rules respectively; if both the compiled artifact and the preset deployment strategy conform to the preset rules, performing the step of matching the compiled artifact with the preset deployment strategy; if the compiled artifact and the preset deployment strategy do not conform to the preset rules, prohibiting the step of matching the compiled artifact with the preset deployment strategy.
[0064] Specifically, the deployment strategy is the rule for distributing compiled artifacts to the operation and maintenance system. The deployment strategy includes rule triggering conditions, server information to be distributed, operating system user executing the distribution, permissions of the distributed media, and custom-defined operating system scripts. Figure 3 This is a flowchart of the project deployment strategy management corresponding to the source code provided in the embodiments of this application, such as... Figure 3As shown, the source code processing system initiates a new deployment strategy management task, submitting the compiled artifact information and the preset deployment strategy configuration as input parameters to the deployment strategy management unit. The deployment strategy management unit validates the received parameters and local configuration files, then loads the preset deployment strategy and matches it with the compiled artifact. If the compiled artifact does not match the preset deployment strategy configuration, meaning it cannot complete the task assigned by the preset deployment strategy, the system project build fails, and an error signal is sent to the source code processing system. If the compiled artifact matches the preset deployment strategy configuration, meaning it can complete the task assigned by the preset deployment strategy, the system project build is successful. The success or failure of the source code processing is determined by matching the compiled artifact with the preset deployment strategy.
[0065] After the system project is built, the system project enters the operation and maintenance phase. Optionally, in the source code processing method provided in this application embodiment, generating the deployment strategy file of the compiled artifact when the matching is successful includes: matching the preset deployment strategy according to the operation and maintenance phase of the compiled artifact to obtain the deployment strategy corresponding to each operation and maintenance phase; generating the deployment strategy file according to the operation and maintenance phase of the compiled artifact and the deployment strategy corresponding to each operation and maintenance phase.
[0066] Specifically, such as Figure 3 As shown, the deployment strategies for each system functional module are read from the configuration file of the local compilation server, which are closely related to the operational steps during the system operation and maintenance phase. Each module's deployment strategy consists of multiple program deployment elements. Based on the classification of operational steps during the operation and maintenance phase of the system project build and deployment tool, the deployment strategies can be prioritized and divided into five modules: directory preprocessing, update media transfer, configuration file transfer, function startup, and custom script execution. Based on the analysis results of the compiled artifacts and deployment strategies, a formatted automated deployment strategy file is generated for use during the operation and maintenance phase. This file corresponds one-to-one with the compiled artifacts generated in this build task and can be used for automated operation and maintenance by the system project build and deployment tool. Generating the deployment strategy file guides the application of the corresponding system modules during the operation and maintenance phase.
[0067] According to another embodiment of this application, a source code processing system is provided. Figure 4 This is a schematic diagram of the processing system structure based on the source code provided in the embodiments of this application, such as... Figure 4As shown, the system includes: a control unit 401, used to control the self-test unit 402, source code management unit 403, project compilation unit 404, and deployment strategy management unit 405 to work sequentially; the self-test unit 402 is used to perform a pre-verification operation, wherein the pre-verification operation includes at least verifying the configuration parameters of the system and the external connection devices of the system; the source code management unit 403 is used to generate source code management tasks, obtain the identifier of the source code version repository of each project in the source code management task and the branch information required to compile each project, and download the source code of each project from the remote code hosting repository to the local compilation server according to the identifier and branch information; the project compilation unit 404 is used to determine the project compilation task according to the project in the source code management task, generate a list of projects to be released according to the source code of each project in the project compilation task, preprocess the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, the preprocessed projects constitute the list of projects to be compiled, and compile the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; the deployment strategy management unit 405 is used to match the compiled artifacts with the preset deployment strategy, and generate a deployment strategy file for the compiled artifacts if the match is successful.
[0068] Specifically, this invention provides a source code processing system, which includes: a control unit 401 for providing overall process control and retry functions for failed tasks; and a self-testing unit 402, a source code management unit 403, a project compilation unit 404, and a deployment strategy management unit 405 connected to the control unit 401, forming the four main parts of the system. The self-testing unit 402 consists of a parameter parsing module 21 and an environment check module 22, which performs validity checks on input parameters, loads necessary configuration parameters, and pre-checks the availability of the environment. If the pre-verification process passes and all configuration parameters are loaded, a signal is sent to the control unit 401, indicating that the system has entered the running state.
[0069] The source code management unit 403 consists of a version control system interface module 31 and a code repository management module 32. It provides the source code processing system with local source code repositories and version control functionality, ensuring that the software system corresponding to the source code, after undergoing different feature development and continuous integration, is released as a complete whole. The version control system interface module 31 can integrate with mature distributed version control tools, including Git and GitLab. The code repository management module 32 can provide customized source code management rules for the software system under development according to project requirements, such as configuring code review rules and code quality risk rules.
[0070] The project compilation unit 404 consists of an incremental program listing identification module 41, a Java project build configuration parsing module 42, and a compilation output classification module 43. It is an important part of the source code processing system. The incremental program listing identification module 41 and the Java project build configuration parsing module 42 are used to preprocess the projects that need to be compiled in the project list to be released. The compilation output classification module 43 is used to compile the projects in the project list to be compiled to obtain the compiled artifacts.
[0071] The deployment strategy management unit 405 consists of a deployment rule parsing module 51 and a deployment strategy generation module 52. It is a management unit for automated program deployment, providing a configuration management toolchain for automated deployment of system projects corresponding to the source code. By managing the basic equipment deployed by the software as "code" through configuration, the development and runtime systems share a homogeneous basic environment, thereby reducing production problems caused by environmental differences.
[0072] It should be noted that, Figure 5 This is a schematic diagram of the external connection environment of the source code processing system provided in the embodiments of this application, such as... Figure 5 As shown, the system project construction and deployment system consists of a distributed version control system 501, a continuous integration system 502, and a system project construction and deployment workflow system 503. Each update to a complex IT system requires developers to initiate changes from the distributed version control system 501, which then connects to the system project construction and deployment workflow system 503 via the continuous integration system 502. Only after completing all three stages of the system project construction and deployment workflow can the release be finalized. The distributed version control system 501 is the project's code repository, containing several code repositories. These repositories are categorized by function, into code repositories storing parameters or configuration tables and code repositories 1-n storing system features and functionalities. The system project construction and deployment workflow system 503 can be divided into three stages: a source code processing system, a deployment strategy system, and an operation and maintenance system. The source code processing system mentioned in this invention is the first processing step in the system project construction and deployment workflow system, connecting the deployment strategy system and the operation and maintenance system.
[0073] According to another embodiment provided in this application, a method for compiling a project is provided.
[0074] Figure 6 This is a flowchart of the project compilation method provided in the embodiments of this application, such as... Figure 6As shown, the main control program will initiate a new project compilation task and pass all necessary parameters and configuration files to the compilation process, such as source code repository branch information, source code repository directory, list of projects to be released, and directory of compiled artifacts. Next, the parameters and local configuration files passed in by the main control program are loaded and parsed. After parsing the entry parameters and local configuration files, the distributed version control product of the source code management unit is linked, and the version control tag information in the entry parameters is used to obtain the list of projects to be released or configurations related to this compilation task. The obtained list of projects to be released is parsed line by line. Based on whether compilation is required, the items in the list are divided into two categories. The method for determining this is to recursively scan the registered items and their parent and sibling directories, using the presence or absence of the Maven essential project object model configuration file (i.e., pom.xml) as a flag indicating whether compilation is required. For items that do not require compilation, such as configuration files and configuration-related database SQL scripts, these items are directly handed over to the artifact retrieval module, which does not require a compilation branch. The module categorizes the incoming file objects according to predetermined rules, such as whether they are binary files, configuration files, or tightly coupled with environment information. It then parses the directory containing the incoming artifacts, compresses them according to configuration parameters and a specific naming convention, and sends a compilation task completion signal to the control unit.
[0075] For items that need to be compiled, typically files within a Java project, these need to be compiled by the compiler before they can run on the server. These items are handled by the compilation branch. The process involves parsing each item in the release manifest, outputting a manifest object composed of compilation elements such as the project object model configuration (pom.xml), incremental update flags, and dependency resolution. The specific steps are as follows: Each item in the release manifest that needs to be compiled is processed; the project object model configuration file (pom.xml) is parsed; and dependencies between items in the release manifest are determined. If no dependencies exist between the release items, information about the projects to be compiled in the release manifest is collected, compilation elements are marked, and the information object of the projects to be compiled is submitted to the target JAR for compilation as an append object. Compilation elements include the project object model configuration (pom.xml), incremental update flags, and dependency resolution. Since the release manifest may not include parent projects, the final number of projects to be compiled is greater than or equal to the number of release projects.
[0076] If dependencies exist between items to be released, the project object model configuration file (pom.xml) of the Maven project containing the obtained items with dependencies is parsed to determine the parent-child dependencies between the projects to be released. This information is then sent asynchronously to the parent and child project object information to the build element tagging module. Based on the obtained list of items to be released, it is determined whether the passed-in items are for incremental deployment. Incremental deployment is used as the criterion because changes to projects that only modify business logic are usually small. Actual compilation and deployment only require updating the modified parts to take effect. Incremental updates, with their "small steps, quick progress" pace, effectively improve the efficiency of version iteration compilation and deployment. The criteria for incremental deployment are as follows: If the change list of the item to be released only contains Java project source code files, it indicates that only business logic has been modified in this compilation task, and no new dependency packages have been added. This is an incremental deployment project. Further analysis of the object model configuration file (pom.xml) is performed to identify the target JAR file of the compilation project. The project to be compiled is marked with incremental / existing deployment attributes, and an asynchronous update request for object properties is sent to the pre-compiled pom.xml list. If the change list of the item to be released includes the project object model configuration file (pom.xml), configuration file (application.properties), etc., it indicates that this compilation task may have added dependency packages or configuration variables, requiring a full compilation of the project. The project requiring full deployment is obtained, a full deployment mark is added, and an asynchronous update request for object properties is sent to the pre-compiled pom.xml list.
[0077] The process involves parsing the list of projects to be compiled, generating a list of projects containing compilation element tags, and submitting the list to the compilation module for parallel compilation. It receives the incoming list of projects to be compiled, initializes the thread pool, allocates a thread to each task to be compiled, and begins parallel compilation. Before parallel compilation begins, it checks if the current thread's project has parent project dependencies. If dependencies exist, the thread sends a priority adjustment request to the scheduling module in the parallel compilation process. This module is responsible for updating the status of the list of projects to be compiled, determining the lifecycle of each thread holding a compilation task, specifically including marking the compilation completion status, and handling priority adjustment requests from threads about to enter a sleep or blocked state. After processing all projects to be compiled, a request to transfer the compiled artifacts is initiated, followed by a sleep and blocking state. If there are no parent project dependencies, the thread enters the thread's compilation completion counting module. For projects that fail to compile, three retries are allowed, and the artifacts are resubmitted to the thread. For projects with more than one successful compilation, a completion update request is sent to the scheduling module in the parallel compilation process. The directory information of the compiled artifacts is submitted to the subsequent module, which parses the passed-in directory of the compiled artifacts, compresses the compiled artifacts according to the configuration parameters and a certain naming rule, and sends a compilation task completion signal to the control unit.
[0078] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0079] This application also provides a source code processing apparatus. It should be noted that the source code processing apparatus of this application can be used to execute the source code processing method provided in this application. The source code processing apparatus provided in this application will be described below.
[0080] Figure 7 This is a schematic diagram of a source code processing apparatus according to an embodiment of this application. Figure 7As shown, the device includes: a determining unit 10, used to determine each project in the compilation task; an acquiring unit 20, used to acquire the identifier of the source code repository of each project and the branch information required to compile each project, and to acquire the interface of the distributed version control system; a storage unit 30, used to acquire the source code of each project from the remote code hosting repository through the interface according to the identifier and branch information, and save the source code of each project to the local compilation server; a generating unit 40, used to generate a list of projects to be released based on the source code of each project, preprocess the projects that need to be compiled in the list of projects to be released, obtain preprocessed projects, and the preprocessed projects constitute the list of projects to be compiled; a compiling unit 50, used to compile the projects in the list of projects to be compiled through the local compilation server, and obtain compiled artifacts; and a matching unit 60, used to match the compiled artifacts with a preset deployment strategy, and if the matching is successful, generate a deployment strategy file for the compiled artifacts.
[0081] The source code processing apparatus provided in this application embodiment includes: a determining unit 10 for determining each project in the compilation task; an acquiring unit 20 for acquiring the identifier of the source code repository of each project and the branch information required to compile each project, and acquiring the interface of the distributed version control system; a storage unit 30 for acquiring the source code of each project from the remote code hosting repository through the interface according to the identifier and branch information, and saving the source code of each project to the local compilation server; a generating unit 40 for generating a list of projects to be released based on the source code of each project, preprocessing the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, and using the preprocessed projects to form a list of projects to be compiled; a compiling unit 50 for compiling the projects in the list of projects to be compiled through the local compilation server to obtain compiled artifacts; and a matching unit 60 for matching the compiled artifacts with a preset deployment strategy, and generating a deployment strategy file for the compiled artifacts if the matching is successful. This solves the problem of low system project construction and deployment efficiency in related technologies. By integrating the functions of source code management, project compilation and deployment strategy management, the apparatus uniformly processes system projects, thereby achieving the effect of efficient system project construction and deployment.
[0082] Optionally, in the source code processing apparatus provided in this application embodiment, the apparatus further includes: a detection unit, used to detect whether the source code conforms to the source code management rules; if the source code conforms to the source code management rules, to perform the step of generating a list of projects to be released based on the source code of each project; if the source code does not conform to the source code management rules, to discard the source code.
[0083] Optionally, in the source code processing apparatus provided in this application embodiment, the storage unit 30 includes: a first judgment module, used to determine whether the local compilation server has source code corresponding to the branch information of each project; a first acquisition module, used to acquire all source code corresponding to the branch information from a remote code hosting repository when the local compilation server does not have source code corresponding to the branch information; and a second acquisition module, used to acquire incremental source code corresponding to the branch information from a remote code hosting repository when the local compilation server has source code corresponding to the branch information, wherein the incremental source code is source code different from the source code already stored in the local compilation server.
[0084] Optionally, in the source code processing apparatus provided in this application embodiment, the generation unit 40 includes: a second judgment module, used to judge whether the projects in the list of projects to be released are associated with preset flag information, wherein the preset flag information is used to indicate that the projects need to be compiled; and a classification module, used to classify the projects in the list of projects to be released according to whether they are associated with preset flag information, to obtain projects that need to be compiled and projects that do not need to be compiled, wherein projects that need to be compiled are projects associated with preset flag information, and projects that do not need to be compiled are projects that are not associated with preset flag information.
[0085] Optionally, in the source code processing apparatus provided in this application embodiment, the generation unit 40 further includes: a third judgment module, used to determine whether there is a dependency relationship between each project in the project list to be compiled and other projects, wherein the other projects are projects in the project list to be compiled; a first determination module, used to determine the project information of a project and mark the dependency relationship identifier when there is no dependency relationship between a project and other projects; and a second determination module, used to determine the dependent projects corresponding to a project, determine the project information and mark the dependency relationship identifier when there is a dependency relationship between a project and other projects, and determine the project information of the dependent projects and mark the dependency relationship identifier.
[0086] Optionally, in the source code processing apparatus provided in the embodiments of this application, the generation unit 40 further includes: a fourth judgment module, used to judge whether each project in the list of projects to be compiled is an incremental deployment project; a first marking module, used to add a full deployment mark to a project if the project is not an incremental deployment project; and a second marking module, used to add an incremental deployment mark to a project if the project is an incremental deployment project.
[0087] Optionally, in the source code processing apparatus provided in this application embodiment, the compilation unit 50 includes: an allocation module, used to allocate a thread to each project in the list of projects to be compiled; a fifth judgment module, used to determine whether the project to be compiled has dependent projects by means of a dependency relationship identifier before starting the thread corresponding to the current project to be compiled; the fifth judgment module includes a judgment submodule, used to determine whether the dependent project is the parent project of the current project if the current project has dependent projects; a first execution module, used to stop the execution of the thread of the current project and execute the thread corresponding to the parent project if the dependent project is the parent project; and a compilation module, used to compile the current project to obtain the compiled artifact corresponding to the current project if the dependent project is not the parent project.
[0088] Optionally, in the source code processing apparatus provided in this application embodiment, the matching unit 60 includes: a third acquisition module, used to acquire the compiled artifact and a preset deployment strategy; a verification module, used to verify whether the compiled artifact and the preset deployment strategy conform to preset rules respectively; a second execution module, used to execute the step of matching the compiled artifact with the preset deployment strategy when both the compiled artifact and the preset deployment strategy conform to the preset rules; and a prohibition module, used to prohibit the execution of the step of matching the compiled artifact with the preset deployment strategy when the compiled artifact and the preset deployment strategy do not conform to the preset rules.
[0089] Optionally, in the source code processing apparatus provided in this application embodiment, the matching unit 60 further includes: a matching module, used to match a preset deployment strategy according to the operation and maintenance stage of the compiled artifact, to obtain the deployment strategy corresponding to each operation and maintenance stage; and a generation module, used to generate a deployment strategy file based on the operation and maintenance stage of the compiled artifact and the deployment strategy corresponding to each operation and maintenance stage.
[0090] The aforementioned source code processing device includes a processor and a memory. The aforementioned determining unit 10, obtaining unit 20, storing unit 30, generating unit 40, compiling unit 50, and matching unit 60 are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to implement the corresponding functions.
[0091] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, the system can achieve automated and efficient building and deployment of projects.
[0092] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0093] This application also provides a computer storage medium for storing a program, wherein the program, when running, controls the device where the non-volatile storage medium is located to execute a source code processing method.
[0094] This application also provides an electronic device. Figure 8 This is a schematic diagram of an electronic device provided according to an embodiment of this application, such as... Figure 8 As shown, the electronic device 801 includes a processor and a memory; the memory stores computer-readable instructions, and the processor executes these computer-readable instructions, wherein the execution of the computer-readable instructions performs a source code processing method. The electronic device in this document can be a server, PC, PAD, mobile phone, etc.
[0095] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, 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, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0097] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0098] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0099] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0100] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0101] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0102] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0103] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for processing source code, characterized in that, include: Identify the individual items in the compilation task; Obtain the identifier of the source code repository of each project and the branch information required to compile each project, and obtain the interface of the distributed version control system; Based on the identifier and the branch information, the source code of each project is obtained from the remote code hosting repository through the interface, and the source code of each project is saved to the local compilation server; A list of projects to be released is generated based on the source code of each project. The projects that need to be compiled in the list of projects to be released are preprocessed to obtain preprocessed projects. The preprocessed projects constitute the list of projects to be compiled. The local compilation server compiles the items in the list of items to be compiled to obtain compiled artifacts. The compiled artifact is matched with a preset deployment strategy, and if the match is successful, a deployment strategy file for the compiled artifact is generated. The process of matching the compiled artifact with a preset deployment strategy includes: obtaining the compiled artifact and the preset deployment strategy; verifying whether the compiled artifact and the preset deployment strategy conform to preset rules; if both the compiled artifact and the preset deployment strategy conform to the preset rules, performing the step of matching the compiled artifact with the preset deployment strategy; and if the compiled artifact and the preset deployment strategy do not conform to the preset rules, prohibiting the step of matching the compiled artifact with the preset deployment strategy.
2. The method according to claim 1, characterized in that, After saving the source code of each project to the local compilation server, the method further includes: Check whether the source code complies with source code management rules; If the source code complies with the source code management rules, the step of generating a list of projects to be released based on the source code of each project is executed; If the source code does not comply with the source code management rules, the source code shall be discarded.
3. The method according to claim 1, characterized in that, Based on the identifier and the branch information, retrieving the source code of each project from the remote code hosting repository through the interface includes: Determine whether the local compilation server contains the source code corresponding to the branch information of each project; If the source code corresponding to the branch information does not exist on the local compilation server, all source code corresponding to the branch information is obtained from the remote code hosting repository; If the source code corresponding to the branch information exists on the local compilation server, the incremental source code corresponding to the branch information is obtained from the remote code hosting repository, wherein the incremental source code is different from the source code already stored on the local compilation server.
4. The method according to claim 1, characterized in that, Before preprocessing the projects that need to be compiled in the list of projects to be released, the method further includes: Determine whether any project in the list of projects to be published is associated with preset flag information, wherein the preset flag information is used to indicate that the project needs to be compiled; The projects in the list of projects to be published are classified according to whether they are associated with the preset flag information, resulting in projects that need to be compiled and projects that do not need to be compiled. The projects that need to be compiled are those associated with the preset flag information, and the projects that do not need to be compiled are those that are not associated with the preset flag information.
5. The method according to claim 1, characterized in that, Preprocessing of the projects that need to be compiled in the list of projects to be released includes: Determine whether there is a dependency relationship between each project in the list of projects to be compiled and other projects, wherein the other projects are the projects in the list of projects to be compiled; If no dependency relationship exists between a project and other projects, determine the project information of the project and mark the dependency relationship identifier; In the case where there is a dependency relationship between a project and other projects, determine the dependent projects corresponding to the project, determine the information of the project and mark the dependency relationship identifier, and determine the project information of the dependent projects and mark the dependency relationship identifier.
6. The method according to claim 1, characterized in that, Preprocessing of the projects that need to be compiled in the list of projects to be released also includes: Determine whether each project in the list of projects to be compiled is an incremental deployment project; If a project is not an incremental deployment project, add a full deployment flag to the project; If a project is an incremental deployment project, add an incremental deployment tag to the project.
7. The method according to claim 5, characterized in that, The projects in the list of projects to be compiled are compiled using the local compilation server to obtain the following compiled artifacts: Allocate a thread for each project in the list of projects to be compiled; Before starting the thread corresponding to the current project to be compiled, the dependency relationship identifier is used to determine whether the project to be compiled has any dependent projects; If the current project has dependent projects, determine whether the dependent project is the parent project of the current project; If the dependent project is the parent project, stop executing the thread of the current project and execute the thread corresponding to the parent project; If the dependent project is not the parent project, the current project is compiled to obtain the compiled artifact corresponding to the current project.
8. The method according to claim 1, characterized in that, If the match is successful, the deployment strategy file generated for the compiled artifact includes: The preset deployment strategy is matched according to the operation and maintenance stage of the compiled artifact to obtain the deployment strategy corresponding to each operation and maintenance stage; The deployment strategy file is generated based on the operation and maintenance phase of the compiled artifact and the deployment strategy corresponding to each operation and maintenance phase.
9. A source code processing system, characterized in that, include: The control unit is used to control the self-test unit, source code management unit, project compilation unit, and deployment strategy management unit to work sequentially. The self-test unit is used to perform a pre-verification operation, wherein the pre-verification operation includes at least verifying the system's configuration parameters and verifying the system's external connected devices. The source code management unit is used to generate source code management tasks, obtain the identifier of the source code version repository of each project in the source code management task and the branch information required to compile each project, and download the source code of each project from the remote code hosting repository to the local compilation server according to the identifier and the branch information. The project compilation unit is used to determine the project compilation task based on the project in the source code management task, generate a list of projects to be released based on the source code of each project in the project compilation task, preprocess the projects that need to be compiled in the list of projects to be released to obtain preprocessed projects, form a list of projects to be compiled by the preprocessed projects, and compile the projects in the list of projects to be compiled by the local compilation server to obtain compiled artifacts. The deployment strategy management unit is used to match the compiled artifacts with preset deployment strategies, and generate a deployment strategy file for the compiled artifacts if the match is successful. The deployment strategy management unit is further configured to: obtain the compiled artifact and the preset deployment strategy; verify whether the compiled artifact and the preset deployment strategy conform to preset rules; if both the compiled artifact and the preset deployment strategy conform to the preset rules, perform the step of matching the compiled artifact with the preset deployment strategy; if the compiled artifact and the preset deployment strategy do not conform to the preset rules, prohibit the step of matching the compiled artifact with the preset deployment strategy.
10. A computer storage medium, characterized in that, The computer storage medium is used to store a program, wherein the program, when running, controls the device where the computer storage medium is located to execute the source code processing method according to any one of claims 1 to 8.
11. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-readable instructions, and the processor being configured to execute the computer-readable instructions, wherein the computer-readable instructions, when executed, perform the source code processing method according to any one of claims 1 to 8.