Software construction methods, apparatus, terminals, and storage media

By dividing the software building process into a shared intermediate representation generation stage and an operating system-specific software building generation stage, the problems of low efficiency, low flexibility, and high complexity in existing software building technologies are solved, and a more efficient and flexible software building method is achieved.

CN119718324BActive Publication Date: 2026-03-13BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing software development processes are inefficient, inflexible, and complex, especially due to the redundancy and maintenance difficulties caused by the need for independent build systems and hardware instruction sets for each operating system.

Method used

By transforming the code set of the software to be built into an intermediate representation and using the build system corresponding to the operating system to generate the build software, a shared intermediate representation generation stage and an operating system-specific build software generation stage are achieved, reducing repetitive work and maintenance overhead.

Benefits of technology

It improves the efficiency and flexibility of software building, simplifies the building process, is applicable to multiple operating systems, reduces the need for individual modifications for each operating system, and lowers maintenance complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718324B_ABST
    Figure CN119718324B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer technology, and more particularly to a software construction method, apparatus, terminal, and storage medium. The software construction method includes: obtaining a first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in a set of operating systems; converting the first code set into an intermediate representation; and controlling a construction system corresponding to any operating system to generate construction software corresponding to that operating system based on the intermediate representation, wherein the construction software is used to run on any operating system. Using this disclosure can improve the efficiency and flexibility of software construction and reduce the complexity of software construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a software construction method, apparatus, terminal, and storage medium. Background Technology

[0002] With the development of science and technology, software development has made significant progress. The emergence of various programming languages ​​and operating systems necessitates the creation of complex build systems. Traditional methods for building multi-operating system software modules involve maintaining a separate build system for each operating system. This build process is operating system-specific, with each operating system including its own set of scripts and tools. This can lead to redundancy, as the source code that needs to be compiled for each operating system often overlaps considerably. Furthermore, maintaining a separate build system for each operating system results in repetitive work, as each build system needs to be updated individually whenever the source code changes, leading to inefficiency. In addition, each operating system may support multiple hardware instruction set platforms, adding another layer of complexity to the process. Because the build process is tightly coupled to a specific operating system, adapting the process to other operating systems or instruction sets requires considerable effort, resulting in low flexibility. Summary of the Invention

[0003] This disclosure provides a software construction method, apparatus, terminal, and storage medium to at least solve the technical problems of low efficiency, low flexibility, and high complexity in software construction in related technologies. The technical solution of this disclosure is as follows:

[0004] According to a first aspect of the present disclosure, a software construction method is provided, comprising:

[0005] Obtain the first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the set of operating systems;

[0006] Transform the first code set into an intermediate representation;

[0007] The control system generates the build software corresponding to any operating system based on the intermediate representation, wherein the build software is used to run in any operating system.

[0008] Optionally, the step of controlling the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation includes:

[0009] Obtain a second code set corresponding to the software to be built, wherein the second code set includes multiple second code subsets, and the multiple second code subsets correspond one-to-one with multiple operating systems in the operating system set;

[0010] The system controls the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system.

[0011] Optionally, the method further includes:

[0012] Business analysis is performed on the software to be built to obtain business requirement information corresponding to the software to be built, wherein the business requirement information is used to indicate the first task set corresponding to any operating system;

[0013] Each task that exists in the first task set is placed into the second task set, and a third task set corresponding to any operating system is determined, wherein the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than the second task set;

[0014] The first code set corresponding to the software to be built is determined based on the second task set;

[0015] The second code subset corresponding to any operating system is determined based on the third task set corresponding to any operating system, thereby obtaining the second code set corresponding to the software to be built.

[0016] Optionally, determining the first code set corresponding to the software to be built based on the second task set includes:

[0017] The first code set is obtained by extracting a first code subset from the source code of the software to be built, which corresponds to any second task in the second task set.

[0018] Optionally, converting the first code set into an intermediate representation includes:

[0019] The first code set is compiled locally to obtain an intermediate representation.

[0020] Optionally, the step of locally compiling the first code set to obtain an intermediate representation includes:

[0021] If any first code in the first code set does not meet the code execution conditions, then the code format corresponding to any first code is converted into the target code format to obtain the converted first code, so as to obtain an intermediate representation.

[0022] Optionally, converting the code format corresponding to any of the first codes into the target code format includes:

[0023] Obtain the intermediate representation corresponding to the first code set to generate a script;

[0024] Run the intermediate representation generation script to obtain the target code format compiler;

[0025] The compiler controls the target code format to convert the code format corresponding to any of the first codes into the target code format.

[0026] Optionally, the step of controlling the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system includes:

[0027] The build system corresponding to any of the operating systems is controlled to cross-compile the second code subset corresponding to any of the operating systems and the intermediate representation to obtain the build software corresponding to any of the operating systems.

[0028] Optionally, the cross-compilation of the second code set and the intermediate representation includes:

[0029] Obtain the cross-compilation toolchain corresponding to any of the aforementioned operating systems;

[0030] The system controls the build system corresponding to any of the operating systems to perform cross-compilation on the second code subset and the intermediate representation corresponding to any of the operating systems according to the cross-compilation toolchain.

[0031] According to a second aspect of the present disclosure, a software building apparatus is provided, comprising:

[0032] The code acquisition unit is used to acquire a first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the operating system set;

[0033] A code conversion unit is used to convert the first code set into an intermediate representation;

[0034] A software building unit is configured to control the building system corresponding to any operating system to generate building software corresponding to any operating system based on the intermediate representation, wherein the building software is used to run in any operating system.

[0035] Optionally, the software building unit is used to control the building system corresponding to any operating system to generate the building software corresponding to any operating system based on the intermediate representation, specifically for:

[0036] Obtain a second code set corresponding to the software to be built, wherein the second code set includes multiple second code subsets, and the multiple second code subsets correspond one-to-one with multiple operating systems in the operating system set;

[0037] The system controls the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system.

[0038] Optionally, the code acquisition unit is further configured to:

[0039] Business analysis is performed on the software to be built to obtain business requirement information corresponding to the software to be built, wherein the business requirement information is used to indicate the first task set corresponding to any operating system;

[0040] Each task that exists in the first task set is placed into the second task set, and a third task set corresponding to any operating system is determined, wherein the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than the second task set;

[0041] The first code set corresponding to the software to be built is determined based on the second task set;

[0042] The second code subset corresponding to any operating system is determined based on the third task set corresponding to any operating system, thereby obtaining the second code set corresponding to the software to be built.

[0043] Optionally, when the code acquisition unit determines the first code set corresponding to the software to be built based on the second task set, it is specifically used for:

[0044] The first code set is obtained by extracting a first code subset from the source code of the software to be built, which corresponds to any second task in the second task set.

[0045] Optionally, when the code conversion unit converts the first code set into an intermediate representation, it is specifically used for:

[0046] The first code set is compiled locally to obtain an intermediate representation.

[0047] Optionally, when the code conversion unit performs local compilation on the first code set to obtain an intermediate representation, it is specifically used for:

[0048] If any first code in the first code set does not meet the code execution conditions, then the code format corresponding to any first code is converted into the target code format to obtain the converted first code, so as to obtain an intermediate representation.

[0049] Optionally, when the code conversion unit converts the code format corresponding to any of the first codes into the target code format, it is specifically used for:

[0050] Obtain the intermediate representation corresponding to the first code set to generate a script;

[0051] Run the intermediate representation generation script to obtain the target code format compiler;

[0052] The compiler controls the target code format to convert the code format corresponding to any of the first codes into the target code format.

[0053] Optionally, the software building unit is used to control the building system corresponding to any operating system to generate the building software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system, specifically for:

[0054] The build system corresponding to any of the operating systems is controlled to cross-compile the second code subset corresponding to any of the operating systems and the intermediate representation to obtain the build software corresponding to any of the operating systems.

[0055] Optionally, the software building unit is used to control the building system corresponding to any operating system to cross-compile the second code subset corresponding to any operating system and the intermediate representation, specifically for:

[0056] Obtain the cross-compilation toolchain corresponding to any of the aforementioned operating systems;

[0057] The system controls the build system corresponding to any of the operating systems to perform cross-compilation on the second code subset and the intermediate representation corresponding to any of the operating systems according to the cross-compilation toolchain.

[0058] According to a third aspect of the present disclosure, a terminal is provided, comprising:

[0059] processor;

[0060] Memory used to store the processor's executable instructions;

[0061] The processor is configured to execute the instructions to implement the software construction method described in any one of the preceding aspects.

[0062] According to a fourth aspect of this application, a storage medium is provided that, when instructions in the storage medium are executed by a processor of a terminal, enables the terminal to perform the software construction method described in any one of the preceding aspects.

[0063] According to a fifth aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in any one of the preceding aspects.

[0064] In summary, the method provided in this disclosure includes: obtaining a first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the set of operating systems; converting the first code set into an intermediate representation; and controlling a build system corresponding to any operating system to generate build software corresponding to any operating system based on the intermediate representation, wherein the build software is used to run on any operating system. Therefore, by dividing the build process into a shared intermediate representation generation stage and an operating system-specific build software generation stage, a higher degree of code reuse can be allowed, improving the efficiency and flexibility of software building. Furthermore, this software building method can be applied to multiple operating systems. When the source code of the software to be built changes, a single modification can be applied to multiple operating systems without requiring separate modifications and updates for each operating system, reducing the maintenance overhead of maintaining an independent build system for each operating system. Additionally, this software building method can generate build software for multiple operating systems, simplifying the build process and reducing the complexity of software building.

[0065] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0066] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0067] Figure 1 A flowchart illustrating a software construction method provided in an embodiment of this disclosure is shown.

[0068] Figure 2 A flowchart illustrating a software construction method according to another embodiment of this disclosure is shown;

[0069] Figure 3 This diagram illustrates a software construction method according to yet another embodiment of the present disclosure;

[0070] Figure 4 This diagram illustrates the structure of a software building apparatus provided in an embodiment of the present disclosure.

[0071] Figure 5 This is a block diagram illustrating a terminal according to an exemplary embodiment. Detailed Implementation

[0072] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0073] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure 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 so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0074] The present disclosure will now be described in detail with reference to specific embodiments.

[0075] In the first embodiment, such as Figure 1 As shown, Figure 1 This diagram illustrates a flowchart of a software construction method provided in an embodiment of the present disclosure. The method can be implemented using a computer program and can run on an apparatus for performing the software construction method. The computer program can be integrated into an application or run as a standalone utility application. The method can be executed by a terminal.

[0076] Specifically, the software construction method includes:

[0077] S101, Obtain the first code set corresponding to the software to be built;

[0078] In some implementations, the source code of the software to be built cannot be run directly in the operating system. Therefore, the software needs to be converted so that the converted software can run in the operating system. The source code includes a series of human-readable computer language instructions.

[0079] In some embodiments, in related technologies, when converting the software to be built, the source code needs to be converted separately for each operating system. However, there is overlap between the source code to be converted for different operating systems. The collection of this overlapping code is the first code set. That is, the first code set is applied to any operating system in the set of operating systems.

[0080] According to some embodiments, an operating system refers to the hardware and software that controls and manages a computer system, and the system software that allocates and schedules resources. Operating systems include, but are not limited to, mobile phone operating systems and computer operating systems. The underlying systems used to build different operating systems may be the same or different.

[0081] It is easy to understand that when a terminal builds software, it can obtain the first set of code corresponding to the software to be built.

[0082] S102, convert the first code set into an intermediate representation;

[0083] According to some embodiments, intermediate representation (IR) refers to the internal representation generated after scanning a first code set, representing the semantic and syntactic structure of the first code set. Converting intermediate representation into build software is more efficient than directly converting source code into build software.

[0084] In some embodiments, the process of transforming a first set of code into an intermediate representation during software construction is completely shared across multiple operating systems. Therefore, a higher degree of code reuse, flexibility, and efficiency are possible.

[0085] In some embodiments, the intermediate representation cannot be run directly in the operating system. This intermediate representation includes, but is not limited to, source code, configuration files, generic bytecode, etc.

[0086] The build process and tools used in the intermediate representation generation stage are not limited, as long as they can generate intermediate representations that can run on the current compilation platform.

[0087] It is easy to understand that when the terminal obtains the first code set, the terminal can convert the first code set into an intermediate representation.

[0088] S103 controls the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation.

[0089] According to some embodiments, a build system is a set of tools, frameworks, and processes that can be used to transform source code or intermediate representations into software artifacts that can be executed by a computer.

[0090] In some embodiments, the build software is designed to run on any operating system. The build software may also change as the operating system changes.

[0091] In some embodiments, the software build includes, but is not limited to, the final binary product, dynamic libraries, dynamic link libraries (.so files), static libraries, executable files, etc.

[0092] The build process and tools used in the software generation phase are not limited, as long as they can generate build software that can run on the operating system.

[0093] It is easy to understand that when the terminal obtains the intermediate representation, the terminal can control the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation.

[0094] In summary, the method provided in this disclosure obtains a first code set corresponding to the software to be built; converts the first code set into an intermediate representation; and controls a build system corresponding to any operating system to generate build software corresponding to that operating system based on the intermediate representation. Therefore, by dividing the build process into a shared intermediate representation generation stage and an operating system-specific build software generation stage, a higher degree of code reuse can be allowed, improving the efficiency and flexibility of software building. Furthermore, this software building method is applicable to multiple operating systems. When the source code of the software to be built changes, a single modification can be applied to multiple operating systems without requiring separate modifications and updates for each operating system, reducing the maintenance overhead of maintaining an independent build system for each operating system. Additionally, this software building method can generate build software for multiple operating systems, simplifying the build process and reducing the complexity of software building.

[0095] Please see Figure 2 , Figure 2 This diagram illustrates a software construction method according to an embodiment of the present disclosure. The method is executed by a terminal.

[0096] Specifically, the software construction method includes:

[0097] S201, Perform business analysis on the software to be built to obtain the business requirements information corresponding to the software to be built;

[0098] According to some embodiments, business requirement information is used to indicate a first set of tasks corresponding to any operating system.

[0099] For example, the software to be built can be used to perform multiple tasks, including A1, A2, A3, and A4. Operating system B1 needs to perform tasks A1, A2, and A3, while operating system B2 needs to perform tasks A2, A3, and A4.

[0100] S202, put the tasks that exist in each of the first task sets into the second task set, and determine the third task set corresponding to any operating system;

[0101] According to some embodiments, the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than the second task set.

[0102] For example, tasks A2 and A3 can be placed in the second task set, task A1 can be placed in the third task set corresponding to operating system B1, and task A4 can be placed in the third task set corresponding to operating system B2.

[0103] S203, determine the first code set corresponding to the software to be built based on the second task set;

[0104] According to some embodiments, a first code subset corresponding to any second task in the second task set can be obtained from the source code of the software to be built, thus obtaining the first code set.

[0105] For example, when task A2 is a graphics rendering task, it can be accomplished by executing certain JavaScript code in the source code. Therefore, this JavaScript code is the first subset of code corresponding to task A2.

[0106] S204, determine the second code subset corresponding to any operating system based on the third task set corresponding to any operating system, and obtain the second code set corresponding to the software to be built;

[0107] According to some embodiments, the process of obtaining the second code set is the same as that of obtaining the first code set, and will not be repeated here.

[0108] In some embodiments, the second code set includes multiple second code subsets, each of which corresponds one-to-one with a multiple operating system in the operating system set.

[0109] In some embodiments, the second code in the second code set may be, for example, a configuration file.

[0110] S205, Obtain the first code set corresponding to the software to be built, and compile the first code set locally to obtain an intermediate representation;

[0111] According to some embodiments, during the local compilation process, the program compiled under the current compilation platform can only run under the current platform, which includes, but is not limited to, the native platform, the development machine, the current development machine, etc.

[0112] In some embodiments, when the first code set is locally compiled to obtain an intermediate representation, if any first code in the first code set does not meet the code execution conditions, the code format corresponding to any first code is converted to the target code format to obtain the converted first code, thus obtaining the intermediate representation. Therefore, the efficiency and accuracy of obtaining the intermediate representation can be improved.

[0113] According to some embodiments, the operating conditions may be, for example, that the first code can run on the current compilation platform.

[0114] In some embodiments, the target code format refers to the code format that can run on the current compilation platform.

[0115] For example, JavaScript code cannot be executed directly on a native platform and needs to be converted into C source code. This C source code can then be compiled into binary code and run on the native platform. In this case, the intermediate representation includes the C source code corresponding to the JavaScript code.

[0116] According to some embodiments, when converting the code format corresponding to any first code to the target code format, an intermediate representation generation script corresponding to the first code set can be obtained; the intermediate representation generation script can be run to obtain the target code format compiler; and the target code format compiler can be controlled to convert the code format corresponding to any first code to the target code format. Therefore, the efficiency and accuracy of code format conversion can be improved.

[0117] In some embodiments, the intermediate representation generated script can be compiled based on business requirements information. The type of the intermediate representation generated script includes, but is not limited to, shell, python, node, lua, groovy, etc. The intermediate representation generated script can also be a hybrid script that combines multiple scripting languages.

[0118] In some embodiments, the intermediate representation generation script can run on the current compilation platform.

[0119] For example, based on business requirements, an intermediate representation generation script can be obtained to compile JavaScript code into C source code. During execution, this script can compile a JavaScript compiler, which, when executed, can compile the JavaScript code into C source code.

[0120] It should be noted that other related tools can also be used to convert the code format corresponding to any first code to the target code format.

[0121] For example, you can use Quick's engine to convert JavaScript code into C source code.

[0122] S206, obtain the second code set corresponding to the software to be built, and control the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system.

[0123] According to some embodiments, the build system corresponding to any operating system can be controlled to cross-compile the second code subset and intermediate products corresponding to any operating system to obtain the build software corresponding to any operating system.

[0124] In some embodiments, during cross-compilation, a program compiled on the current compilation platform can run on another operating system with a different operating system, but the compilation platform itself cannot run the program. Therefore, cross-compilation can convert a second set of code and intermediate representations that cannot run on an operating system into build software that can run on an operating system.

[0125] In some embodiments, different cross-compilation options can be configured on different operating systems to generate build artifacts, i.e., build software, for multiple instruction set platforms.

[0126] According to some embodiments, when controlling the build system corresponding to any operating system to cross-compile the second code subset and intermediate products corresponding to any operating system, a cross-compilation toolchain corresponding to any operating system can be obtained, and the build system corresponding to any operating system can be controlled to cross-compile the second code subset and intermediate products corresponding to any operating system based on the cross-compilation toolchain. Therefore, the efficiency and accuracy of cross-compilation can be improved.

[0127] In some embodiments, the cross-compilation toolchain corresponds one-to-one with the operating system, and the cross-compilation toolchain changes when the operating system changes. The cross-compilation toolchain can be a toolchain file specifically defined for the operating platform.

[0128] For example, when build system C1, corresponding to operating system B1, cross-compiles the second code subset and intermediate representation corresponding to operating system B1, the Native Development Kit (NDK) can be configured within the default configuration (defaultConfig) of operating system B1, and the Application Binary Interface (ABI) to be supported by operating system B1 can be specified. Next, compilation parameters can be configured for the second code subset and intermediate representation, and cross-compilation options can be specified. Finally, the corresponding compiled file paths for the second code subset and intermediate representation can be specified. Therefore, the second code subset and intermediate representation can be compiled into a build software that can run on operating system B1.

[0129] For example, the compilation parameters can be CMake parameters, and the compilation file can be a CMakeLists.txt file.

[0130] ABIs include, but are not limited to, armeabi-v7a and arm64-v8a.

[0131] To illustrate with an example scenario, when the build system C2 corresponding to operating system B2 cross-compiles the second code subset and intermediate representation corresponding to operating system B2, it can obtain a toolchain file specifically defined for operating system B2 and reference this toolchain file in the compilation file to compile the second code subset and intermediate representation into a build software that can run on operating system B2.

[0132] According to some embodiments, the build system can also generate the build system by calling relevant build tools via scripts. The types of scripts include, but are not limited to, shell, make, CMake, bazel, etc.

[0133] To give an example from a scenario, Figure 3 This diagram illustrates a flowchart of a software construction method provided in an embodiment of this disclosure. Figure 3 As shown, the first set of code in the source code is locally compiled to obtain the IR. The build system corresponding to each operating system cross-compiles the IR and the second set of code in the source code corresponding to that operating system to obtain the build artifact (Build Artifact or Artifact) corresponding to each instruction set in the multiple instruction sets corresponding to the build system, and finally obtains the build software corresponding to each operating system.

[0134] In summary, the method provided in this disclosure firstly obtains business requirement information corresponding to the software to be built by performing business analysis on the software to be built; tasks present in each first task set are placed into a second task set, and a third task set corresponding to any operating system is determined; a first code set corresponding to the software to be built is determined based on the second task set; and a second code subset corresponding to any operating system is determined based on the third task set corresponding to any operating system, thus obtaining a second code set corresponding to the software to be built. Therefore, the accuracy of obtaining the first and second code sets can be improved. Secondly, by obtaining the first code set corresponding to the software to be built and compiling it locally to obtain an intermediate representation, the accuracy of obtaining the intermediate representation can be improved. Finally, by obtaining the second code set corresponding to the software to be built and controlling the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system, the efficiency and accuracy of obtaining the build software can be improved. Furthermore, by dividing the build process into a shared intermediate representation generation stage and an operating system-specific build software generation stage, a higher degree of code reuse can be allowed, improving the efficiency and flexibility of software building. Furthermore, this software building method is applicable to multiple operating systems. When the source code of the software to be built changes, a single modification can be applied to multiple operating systems, eliminating the need for separate modifications and updates for each system and reducing the maintenance overhead associated with maintaining independent build systems for each operating system. Additionally, this method can generate build software for multiple operating systems, simplifying the build process and reducing the complexity of software building.

[0135] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0136] Please see Figure 4 This illustration shows a schematic diagram of a software building apparatus provided in an exemplary embodiment of the present disclosure. The software building apparatus can be implemented as all or part of an apparatus through software, hardware, or a combination of both. The software building apparatus 400 includes a code acquisition unit 401, a code conversion unit 402, and a software building unit 403, wherein:

[0137] The code acquisition unit 401 is used to acquire the first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the operating system set;

[0138] The code conversion unit 402 is used to convert the first code set into an intermediate representation;

[0139] The software building unit 403 is used to control the building system corresponding to any operating system to generate the building software corresponding to any operating system according to the intermediate representation, wherein the building software is used to run in any operating system.

[0140] Optionally, the software building unit 403 is used to control the building system corresponding to any operating system to generate the building software corresponding to any operating system based on the intermediate representation, specifically for:

[0141] Obtain the second code set corresponding to the software to be built, wherein the second code set includes multiple second code subsets, and the multiple second code subsets correspond one-to-one with multiple operating systems in the operating system set;

[0142] The system controls the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system.

[0143] Optionally, code retrieval unit 401 is also used for:

[0144] Business analysis is performed on the software to be built to obtain the business requirement information corresponding to the software to be built. The business requirement information is used to indicate the first set of tasks corresponding to any operating system.

[0145] Tasks that exist in each of the first task sets are placed into the second task set, and a third task set corresponding to any operating system is determined, wherein the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than those in the second task set;

[0146] The first code set corresponding to the software to be built is determined based on the second task set;

[0147] Based on the third task set corresponding to any operating system, determine the second code subset corresponding to any operating system, and obtain the second code set corresponding to the software to be built.

[0148] Optionally, when the code acquisition unit 401 determines the first code set corresponding to the software to be built based on the second task set, it is specifically used for:

[0149] The first code set is obtained by extracting a first code subset from the source code of the software to be built that corresponds to any second task in the second task set.

[0150] Optionally, when converting the first code set into an intermediate representation, the code conversion unit 402 is specifically used for:

[0151] The first code set is compiled locally to obtain an intermediate representation.

[0152] Optionally, when the code conversion unit 402 performs local compilation on the first code set to obtain an intermediate representation, it is specifically used for:

[0153] If any first code in the first code set does not meet the code execution conditions, then the code format corresponding to any first code is converted into the target code format to obtain the converted first code, thus obtaining an intermediate representation.

[0154] Optionally, when the code conversion unit 402 converts the code format corresponding to any first code into the target code format, it is specifically used for:

[0155] Get the intermediate representation corresponding to the first code set and generate the script;

[0156] The intermediate representation generates a script, which is then used to obtain the target code format compiler.

[0157] The compiler controls the target code format, converting the code format corresponding to any first code into the target code format.

[0158] Optionally, the software building unit 403 is used to control the building system corresponding to any operating system to generate the building software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system, specifically for:

[0159] The build system corresponding to any operating system is controlled to cross-compile the second code subset and intermediate representation corresponding to any operating system to obtain the build software corresponding to any operating system.

[0160] Optionally, the software build unit 403 is used to control the build system corresponding to any operating system to cross-compile the second code subset and intermediate representation corresponding to any operating system, specifically for:

[0161] Obtain the cross-compilation toolchain for any operating system;

[0162] The system controls the build system corresponding to any operating system to cross-compile the second code subset and intermediate representation corresponding to any operating system according to the cross-compilation toolchain.

[0163] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0164] In summary, the apparatus provided in this disclosure acquires a first code set corresponding to the software to be built through a code acquisition unit, wherein the first code set is applied to any operating system in the set of operating systems; a code conversion unit converts the first code set into an intermediate representation; and a software building unit controls the building system corresponding to any operating system to generate building software corresponding to any operating system based on the intermediate representation, wherein the building software is used to run on any operating system. Therefore, by dividing the building process into a shared intermediate representation generation stage and an operating system-specific building software generation stage, a higher degree of code reuse can be allowed, improving the efficiency and flexibility of software building. Furthermore, this software building method can be applied to multiple operating systems. When the source code of the software to be built changes, a single modification can be applied to multiple operating systems without requiring separate modifications and updates for each operating system, reducing the maintenance overhead of maintaining an independent building system for each operating system. Additionally, this software building method can generate building software for multiple operating systems, simplifying the building process and reducing the complexity of software building.

[0165] According to embodiments of this disclosure, this disclosure also provides a terminal, a readable storage medium, and a computer program product.

[0166] Figure 5 A schematic block diagram of an example terminal 500 that can be used to implement embodiments of the present disclosure is shown. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0167] like Figure 5 As shown, terminal 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded from storage unit 508 into random access memory (RAM) 503. RAM 503 may also store various programs and data required for the operation of terminal 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0168] Multiple components in terminal 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of displays, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows terminal 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0169] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as software construction methods. For example, in some embodiments, the software construction method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on terminal 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the software construction method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform software construction methods by any other suitable means (e.g., by means of firmware).

[0170] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0171] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0172] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0173] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0174] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0175] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0176] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0177] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A software construction method, characterized in that, include: Business analysis is performed on the software to be built to obtain business requirement information corresponding to the software to be built, wherein the business requirement information is used to indicate the first task set corresponding to any operating system. Each task that exists in the first task set is placed into the second task set, and a third task set corresponding to any operating system is determined, wherein the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than the second task set; The first code set corresponding to the software to be built is determined based on the second task set; Based on the third task set corresponding to any operating system, a second code subset corresponding to any operating system is determined, and a second code set corresponding to the software to be built is obtained. Obtain the first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the set of operating systems; Transform the first code set into an intermediate representation; The control system generates the build software corresponding to any operating system based on the intermediate representation, wherein the build software is used to run in any operating system.

2. The method according to claim 1, characterized in that, The control system for generating build software corresponding to any operating system based on the intermediate representation includes: Obtain a second code set corresponding to the software to be built, wherein the second code set includes multiple second code subsets, and the multiple second code subsets correspond one-to-one with multiple operating systems in the operating system set; The system controls the build system corresponding to any operating system to generate the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system.

3. The method according to claim 1, characterized in that, The step of determining the first code set corresponding to the software to be built based on the second task set includes: The first code set is obtained by extracting a first code subset from the source code of the software to be built, which corresponds to any second task in the second task set.

4. The method according to claim 1, characterized in that, The step of converting the first code set into an intermediate representation includes: The first code set is compiled locally to obtain an intermediate representation.

5. The method according to claim 4, characterized in that, The step of locally compiling the first code set to obtain an intermediate representation includes: If any first code in the first code set does not meet the code execution conditions, then the code format corresponding to any first code is converted into the target code format to obtain the converted first code, so as to obtain an intermediate representation.

6. The method according to claim 5, characterized in that, The step of converting the code format corresponding to any of the first codes into the target code format includes: Obtain the intermediate representation corresponding to the first code set to generate a script; Run the intermediate representation generation script to obtain the target code format compiler; The compiler controls the target code format to convert the code format corresponding to any of the first codes into the target code format.

7. The method according to claim 2, characterized in that, The control system for building any operating system generates the build software corresponding to any operating system based on the intermediate representation and the second code subset corresponding to any operating system, including: The build system corresponding to any of the operating systems is controlled to cross-compile the second code subset corresponding to any of the operating systems and the intermediate representation to obtain the build software corresponding to any of the operating systems.

8. The method according to claim 7, characterized in that, The control system for the build system corresponding to any of the operating systems performs cross-compilation of the second code subset corresponding to any of the operating systems and the intermediate representation, including: Obtain the cross-compilation toolchain corresponding to any of the aforementioned operating systems; The system controls the build system corresponding to any of the operating systems to perform cross-compilation on the second code subset and the intermediate representation corresponding to any of the operating systems according to the cross-compilation toolchain.

9. A software building apparatus, characterized in that, Applied to a target build system, wherein the target build system is a build system corresponding to any operating system in the set of operating systems, including: The code acquisition unit is used to acquire a first code set corresponding to the software to be built, wherein the first code set is applied to any operating system in the operating system set; A code conversion unit is used to convert the first code set into an intermediate representation; A software building unit is configured to control the building system corresponding to any operating system to generate building software corresponding to any operating system based on the intermediate representation, wherein the building software is used to run in any operating system; The device further includes: Before obtaining the first code set corresponding to the software to be built, business analysis is performed on the software to be built to obtain business requirement information corresponding to the software to be built. The business requirement information is used to indicate the first task set corresponding to any operating system. Each task that exists in the first task set is placed into the second task set, and a third task set corresponding to any operating system is determined. The third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system other than those in the second task set. The first code set corresponding to the software to be built is determined based on the second task set; The second code subset corresponding to any operating system is determined based on the third task set corresponding to any operating system, thereby obtaining the second code set corresponding to the software to be built.

10. A terminal, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the software construction method as described in any one of claims 1 to 8.

11. A storage medium, wherein instructions in the storage medium, when executed by a processor of a terminal, enable the terminal to perform the software construction method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Application program creating method and device, computer equipment and storage medium

    CN110134378A