Software construction method and device, terminal and storage medium

By converting the first set of codes of the software to be built into an intermediate representation and controlling the construction system of each operating system to generate construction software, the problems of low efficiency, low flexibility and high complexity in the existing technology are solved, and a more efficient, flexible and simplified software construction process is achieved.

CN119718324AActive Publication Date: 2025-03-28BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202311279155.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-03-28
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

In the prior art, software construction is less efficient, less flexible and more complex, especially in the adaptation process between multiple operating systems and hardware instruction set platforms.

Method used

By obtaining the first set of codes of the software to be built and converting it into an intermediate representation, the construction system that controls each operating system generates corresponding construction software based on the intermediate representation, thereby realizing code reuse and flexibility improvement across operating systems.

Benefits of technology

Improves the efficiency and flexibility of software construction, reduces the maintenance overhead of maintaining independent build systems for each operating system, and simplifies the build process and reduces complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718324A_ABST
    Figure CN119718324A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a software construction method and device, a terminal and a storage medium. The software construction method comprises the steps that a first code set corresponding to software to be constructed is obtained, and the first code set is applied to any operating system in an operating system set; converting the first code set into an intermediate representation; the construction system corresponding to any operating system is controlled to generate construction software corresponding to any operating system according to the intermediate representation, and the construction software is used for running in any operating system. By adopting the method and the device, the efficiency and the flexibility of software construction can be improved, and the complexity of software construction is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a software construction method and device, a terminal and a storage medium. Background Art

[0002] With the development of science and technology, software development has made significant progress, and the emergence of various programming languages ​​and operating systems requires the creation of complex build systems. In the related art, the traditional method of building multi-operating system software modules includes maintaining a separate build system for each operating system. This build process is specific to the operating system, and each operating system includes a set of independent scripts and tools, which may lead to redundancy because the source code that needs to be compiled for each operating system often has a large overlap. In addition, maintaining a separate build system for each operating system will lead to duplication of work, because each build system needs to be updated separately whenever the source code changes, which is inefficient. In addition, each operating system may support multiple hardware instruction set platforms, which adds another layer of complexity to the process, and because the build process is tightly coupled with a specific operating system, it takes a lot of effort to change the process to adapt to other operating systems or instruction sets, and the flexibility is low. Summary of the invention

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

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

[0005] 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 operating system set;

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

[0007] A build system corresponding to any one of the operating systems is controlled to generate build software corresponding to any one of the operating systems according to the intermediate representation, wherein the build software is used to run in any one of the operating systems.

[0008] Optionally, controlling the build system corresponding to any operating system to generate the build software corresponding to any operating system according to the intermediate representation includes:

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

[0010] A construction system corresponding to any one of the operating systems is controlled to generate construction software corresponding to any one of the operating systems according to the intermediate representation and a second code subset corresponding to any one of the operating systems.

[0011] Optionally, the method further includes:

[0012] Performing business analysis 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 a first task set corresponding to any one of the operating systems;

[0013] Putting tasks existing in each of the first task sets into a second task set, and determining a third task set corresponding to any one of the operating systems, wherein the third task set corresponding to any one of the operating systems includes tasks in the first task set corresponding to any one of the operating systems except the second task set;

[0014] Determine a first code set corresponding to the software to be built according to the second task set;

[0015] The second code subset corresponding to any operating system is determined according to the third task set corresponding to any operating system, and the second code set corresponding to the software to be built is obtained.

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

[0017] A first code subset corresponding to any second task in the second task set is obtained from the source code of the software to be built to obtain a first code set.

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

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

[0020] Optionally, 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 running condition, the code format corresponding to the any first code is converted into a target code format to obtain the converted any first code to obtain an intermediate representation.

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

[0023] Obtaining an intermediate representation generation script corresponding to the first code set;

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

[0025] The target code format compiler is controlled to convert a code format corresponding to any one of the first codes into the target code format.

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

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

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

[0029] Obtain a cross-compilation tool chain corresponding to any one of the operating systems;

[0030] A construction system corresponding to any one of the operating systems is controlled to cross-compile the second code subset corresponding to any one of the operating systems and the intermediate representation according to the cross-compilation tool chain.

[0031] According to a second aspect of an embodiment of the present disclosure, there is provided a software construction device, including:

[0032] A code acquisition unit, configured 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, configured to convert the first code set into an intermediate representation;

[0034] A software construction unit is used to control a construction system corresponding to any operating system to generate construction software corresponding to any operating system according to the intermediate representation, wherein the construction software is used to run in any operating system.

[0035] Optionally, the software construction unit is used to control the construction system corresponding to any operating system to generate the construction software corresponding to any operating system according to the intermediate representation, specifically to:

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

[0037] A construction system corresponding to any one of the operating systems is controlled to generate construction software corresponding to any one of the operating systems according to the intermediate representation and a second code subset corresponding to any one of the operating systems.

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

[0039] Performing business analysis 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 a first task set corresponding to any one of the operating systems;

[0040] Putting tasks existing in each of the first task sets into a second task set, and determining a third task set corresponding to any one of the operating systems, wherein the third task set corresponding to any one of the operating systems includes tasks in the first task set corresponding to any one of the operating systems except the second task set;

[0041] Determine a first code set corresponding to the software to be built according to the second task set;

[0042] The second code subset corresponding to any operating system is determined according to the third task set corresponding to any operating system, and the second code set corresponding to the software to be built is obtained.

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

[0044] A first code subset corresponding to any second task in the second task set is obtained from the source code of the software to be built to obtain a first code set.

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

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

[0047] Optionally, when the code conversion unit is used to locally compile the first code set to obtain an intermediate representation, it is specifically used to:

[0048] If any first code in the first code set does not meet the code running condition, the code format corresponding to the any first code is converted into a target code format to obtain the converted any first code to obtain an intermediate representation.

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

[0050] Obtaining an intermediate representation generation script corresponding to the first code set;

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

[0052] The target code format compiler is controlled to convert a code format corresponding to any one of the first codes into the target code format.

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

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

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

[0056] Obtain a cross-compilation tool chain corresponding to any one of the operating systems;

[0057] A construction system corresponding to any one of the operating systems is controlled to cross-compile the second code subset corresponding to any one of the operating systems and the intermediate representation according to the cross-compilation tool chain.

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

[0059] processor;

[0060] a memory for storing instructions executable by the processor;

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

[0062] According to a fourth aspect of the present application, a storage medium is provided. When instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to execute the software construction method described in any one of the preceding aspects.

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

[0064] In summary, the method provided by the embodiment of the present 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 operating system set; converting the first code set into an intermediate representation; controlling the construction system corresponding to any operating system to generate the construction software corresponding to any operating system according to the intermediate representation, wherein the construction software is used to run in any operating system. Therefore, by dividing the construction process into a shared intermediate representation generation phase and an operating system-specific construction software generation phase, a higher degree of code reuse can be allowed, which can improve the efficiency and flexibility of software construction. In addition, the software construction method can be applied to multiple operating systems. When the source code of the software to be built is changed, one modification can be applied to multiple operating systems, and there is no need to modify and update each operating system separately, which can reduce the maintenance overhead caused by maintaining an independent construction system for each operating system. In addition, the software construction method can generate construction software for multiple operating systems, simplifying the construction process and reducing the complexity of software construction.

[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0067] Figure 1 A flowchart of a software construction method provided by an embodiment of the present disclosure is shown;

[0068] Figure 2 A flowchart showing a software construction method provided by another embodiment of the present disclosure is shown;

[0069] Figure 3 A flowchart of a software construction method provided by another embodiment of the present disclosure is shown;

[0070] Figure 4 A schematic diagram showing the structure of a software construction device provided by an embodiment of the present disclosure is shown;

[0071] Figure 5 It is a block diagram of a terminal according to an exemplary embodiment. DETAILED DESCRIPTION

[0072] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0073] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0074] The present disclosure is described in detail below with reference to specific embodiments.

[0075] In the first embodiment, if Figure 1 As shown, Figure 1 A flowchart of a software construction method provided by an embodiment of the present disclosure is shown, and the method can be implemented by a computer program and can be run on a device for performing the software construction method. The computer program can be integrated into an application or run as an independent tool application. The method can be executed by a terminal.

[0076] Specifically, the software construction method includes:

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

[0078] According to some embodiments, the source code of the software to be constructed cannot be directly run in the operating system. Therefore, the software to be constructed needs to be converted so that the constructed software obtained after the conversion can be run in the operating system. The source code includes a series of human-readable computer language instructions.

[0079] In some embodiments, in the related art, when converting the software to be built, each operating system needs to convert the source code once separately, but there is overlap between the source codes required to be converted by different operating systems, and the set formed by the aggregation of these overlapping codes is the first code set. In other words, the first code set is applied to any operating system in the operating system set.

[0080] According to some embodiments, the operating system refers to the hardware and software that controls and manages the computer system, and the system software that allocates and schedules resources, and the operating system includes but is not limited to the mobile phone operating system, the computer operating system, etc. The construction systems corresponding to different operating systems may be the same or different.

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

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

[0083] According to some embodiments, an intermediate representation (IR) refers to an internal representation generated after scanning the first code set, representing the semantic and grammatical structure of the first code set. Compared with directly converting source code into built software, converting the intermediate representation into built software is more efficient.

[0084] In some embodiments, when software is built, the process of converting the first code set into the intermediate representation is completely shared by multiple operating systems, thereby allowing a higher degree of code reuse, flexibility and efficiency.

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

[0086] There is no limitation on the construction process and construction tools used in the intermediate representation generation stage, as long as an intermediate representation that can be run on the current compilation platform can be generated.

[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, controlling a construction system corresponding to any operating system to generate construction software corresponding to any operating system according to 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 an intermediate representation into a software artifact that can be executed by a computer.

[0090] In some embodiments, the build software is used to run in any operating system. When the operating system changes, the build software will also change.

[0091] In some embodiments, the construction software includes but is not limited to a final binary product, a dynamic library, a dynamic link library (.so file), a static library, an executable file, etc.

[0092] There is no limitation on the construction process and construction tools used in the generation phase of the construction software, as long as the construction software that can be run on the operating system can be generated.

[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 according to the intermediate representation.

[0094] In summary, the method provided by the embodiment of the present disclosure obtains a first code set corresponding to the software to be built; converts the first code set into an intermediate representation; controls the construction system corresponding to any operating system to generate the construction software corresponding to any operating system according to the intermediate representation. Therefore, by dividing the construction process into a shared intermediate representation generation phase and an operating system-specific construction software generation phase, a higher degree of code reuse can be allowed, which can improve the efficiency and flexibility of software construction. In addition, the software construction method can be applied to multiple operating systems. When the source code of the software to be built is changed, one modification can be applied to multiple operating systems. There is no need to modify and update each operating system separately, which can reduce the maintenance overhead caused by maintaining an independent construction system for each operating system. In addition, the software construction method can generate construction software for multiple operating systems, simplifying the construction process and reducing the complexity of software construction.

[0095] See also Figure 2 , Figure 2 A flowchart of a software construction method provided by an embodiment of the present disclosure is shown. The method is executed by a terminal.

[0096] Specifically, the software construction method includes:

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

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

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

[0100] S202, putting tasks existing in each first task set into a second task set, and determining a 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 except the second task set.

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

[0103] S203, determining a first code set corresponding to the software to be built according to the second task set;

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

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

[0106] S204, determining a second code subset corresponding to any operating system according to a third task set corresponding to any operating system, and obtaining a second code set corresponding to the software to be built;

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

[0108] In some embodiments, the second code set includes multiple second code subsets, and the multiple second code subsets correspond one-to-one to multiple operating systems 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, obtaining a first code set corresponding to the software to be built, and locally compiling the first code set to obtain an intermediate representation;

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

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

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

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

[0115] For example, JavaScript code cannot be directly executed on the native platform, and the JavaScript code needs to be converted into C source code, which can be compiled into binary code and run on the native platform. At this time, 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 into the target code format, an intermediate representation generation script corresponding to the first code set may be obtained; the intermediate representation generation script may be run to obtain a target code format compiler; and the target code format compiler may be controlled to convert the code format corresponding to any first code into the target code format. Therefore, the efficiency and accuracy of the code format conversion may be improved.

[0117] In some embodiments, the intermediate representation generation script may be compiled according to business requirement information. The types of the intermediate representation generation script include but are not limited to shell, python, node, lua, groovy, etc. The intermediate representation generation script may also be a mixed script of multiple scripting languages.

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

[0119] For example, according to the business requirement information, an intermediate representation generation script for compiling JavaScript code into C source code can be obtained. The script can compile a JavaScript compiler during operation, and the JavaScript code can be compiled into C source code by executing the JavaScript compiler.

[0120] It should be noted that the code format corresponding to any first code may also be converted into a target code format through other relevant tools.

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

[0122] S206, obtaining a second code set corresponding to the software to be built, and controlling a building system corresponding to any operating system to generate building software corresponding to any operating system according to the intermediate representation and the second code subset corresponding to any operating system.

[0123] According to some embodiments, a construction system corresponding to any operating system may be controlled to cross-compile the second code subset and the intermediate product corresponding to any operating system to obtain construction software corresponding to any operating system.

[0124] In some embodiments, during the cross-compilation process, the program compiled under the current compiling platform can be run on another operating system that is different from the operating system, but the compiling platform itself cannot run the program. Therefore, through cross-compilation, the second code set and the intermediate representation that cannot be run in the operating system can be converted into the construction software that can be run in the operating system.

[0125] In some embodiments, respective cross-compile options may be configured on different operating systems to generate build products, ie, build software, for multiple instruction set platforms.

[0126] According to some embodiments, when controlling the construction system corresponding to any operating system to cross-compile the second code subset and the intermediate product corresponding to any operating system, a cross-compilation tool chain corresponding to any operating system can be obtained, and the construction system corresponding to any operating system can be controlled to cross-compile the second code subset and the intermediate product corresponding to any operating system according to the cross-compilation tool chain. Therefore, the efficiency and accuracy of cross-compilation can be improved.

[0127] In some embodiments, the cross-compilation tool chain corresponds to the operating system one by one, and when the operating system changes, the cross-compilation tool chain will also change. The cross-compilation tool chain can be a tool chain file defined specifically for the operating platform.

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

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

[0130] Among them, ABI includes but is not limited to armeabi-v7a, arm64-v8a, etc.

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

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

[0133] Take a scenario as an example. Figure 3 A flowchart of a software construction method provided by an embodiment of the present disclosure is shown. Figure 3 As shown, the first code set in the source code is locally compiled to obtain IR, and the build system corresponding to each operating system cross-compiles the IR and the second code subset corresponding to the operating system in the source code to obtain a 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 by the embodiment of the present disclosure, first, by performing business analysis on the software to be built, the business demand information corresponding to the software to be built is obtained; the tasks existing in each first task set are placed in the second task set, and the third task set corresponding to any operating system is determined; the first code set corresponding to the software to be built is determined according to the second task set; the second code subset corresponding to any operating system is determined according to the third task set corresponding to any operating system, and the second code set corresponding to the software to be built is obtained; therefore, the accuracy of obtaining the first code set and the second code set can be improved. Secondly, by obtaining the first code set corresponding to the software to be built, and compiling the first code set locally to obtain the intermediate representation; therefore, 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 construction system corresponding to any operating system to generate the construction software corresponding to any operating system according to the intermediate representation and the second code subset corresponding to any operating system; therefore, the efficiency and accuracy of obtaining the construction software can be improved. At the same time, by dividing the construction process into a shared intermediate representation generation phase and an operating system-specific construction software generation phase, a higher degree of code reuse can be allowed, and the efficiency and flexibility of software construction can be improved. In addition, the software construction method can be applied to multiple operating systems. When the source code of the software to be built is changed, it can be applied to multiple operating systems with one modification, without the need to modify and update each operating system separately, which can reduce the maintenance overhead caused by maintaining an independent construction system for each operating system. In addition, the software construction method can generate construction software for multiple operating systems, simplifying the construction process and reducing the complexity of software construction.

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

[0136] See also Figure 4 , which shows a schematic diagram of the structure of a software construction device provided by an exemplary embodiment of the present disclosure. The software construction device can be implemented as all or part of the device through software, hardware or a combination of both. The software construction device 400 includes a code acquisition unit 401, a code conversion unit 402 and a software construction unit 403, wherein:

[0137] The code acquisition unit 401 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;

[0138] A code conversion unit 402, configured to convert the first code set into an intermediate representation;

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

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

[0141] Acquire 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 to multiple operating systems in the operating system set;

[0142] The construction system corresponding to any operating system is controlled to generate construction software corresponding to any operating system according to the intermediate representation and the second code subset corresponding to any operating system.

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

[0144] Performing business analysis 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 a first task set corresponding to any operating system;

[0145] Putting tasks existing in each first task set into the second task set, and determining a third task set corresponding to any operating system, wherein the third task set corresponding to any operating system includes tasks in the first task set corresponding to any operating system except the second task set;

[0146] Determine a first code set corresponding to the software to be built according to the second task set;

[0147] The second code subset corresponding to any operating system is determined according to the third task set corresponding to any operating system, and the second code set corresponding to the software to be constructed is obtained.

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

[0149] A first code subset corresponding to any second task in the second task set is obtained from the source code of the software to be built to obtain a first code set.

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

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

[0152] Optionally, when the code conversion unit 402 is used to locally compile the first code set to obtain the intermediate representation, it is specifically used to:

[0153] If any first code in the first code set does not meet the code running condition, the code format corresponding to any first code is converted into a target code format to obtain the converted any first code, so as to obtain an intermediate representation.

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

[0155] Obtain an intermediate representation generation script corresponding to the first code set;

[0156] Run the intermediate representation generation script to get the target code format compiler;

[0157] The target code format compiler is controlled to convert a code format corresponding to any first code into a target code format.

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

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

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

[0161] Get the cross-compilation toolchain corresponding to any operating system;

[0162] A construction system corresponding to any operating system is controlled to cross-compile the second code subset and the intermediate representation corresponding to any operating system according to a cross-compilation tool chain.

[0163] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0164] In summary, the device provided by the embodiment of the present disclosure obtains the first code set corresponding to the software to be built through the code acquisition unit, wherein the first code set is applied to any operating system in the operating system set; the code conversion unit converts the first code set into an intermediate representation; the software construction unit controls the construction system corresponding to any operating system to generate the construction software corresponding to any operating system according to the intermediate representation, wherein the construction software is used to run in any operating system. Therefore, by dividing the construction process into a shared intermediate representation generation phase and an operating system-specific construction software generation phase, a higher degree of code reuse can be allowed, which can improve the efficiency and flexibility of software construction. In addition, the software construction method can be applied to multiple operating systems. When the source code of the software to be built is changed, one modification can be applied to multiple operating systems, and there is no need to modify and update each operating system separately, which can reduce the maintenance overhead caused by maintaining an independent construction system for each operating system. In addition, the software construction method can generate construction software for multiple operating systems, simplifying the construction process and reducing the complexity of software construction.

[0165] According to an embodiment of the present disclosure, the present 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 implementations of the present disclosure described and / or claimed herein.

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

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

[0169] The computing unit 501 may be a variety of general and / or special 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 dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, 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, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the 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 execute the software construction method by any other appropriate means (e.g., by means of firmware).

[0170] Various implementations 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 chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0171] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0172] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, 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 (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).

[0174] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0175] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0176] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0177] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A software construction method, characterized in that: include: 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 operating system set; Converting the first code set into an intermediate representation; A build system corresponding to any one of the operating systems is controlled to generate build software corresponding to any one of the operating systems according to the intermediate representation, wherein the build software is used to run in any one of the operating systems.

2. The method according to claim 1, characterized in that: The controlling the construction system corresponding to any one of the operating systems to generate the construction software corresponding to any one of the operating systems according to the intermediate representation includes: Acquire a second code set corresponding to the software to be built, wherein the second code set includes a plurality of second code subsets, and the plurality of second code subsets correspond one-to-one to a plurality of operating systems in the operating system set; A construction system corresponding to any one of the operating systems is controlled to generate construction software corresponding to any one of the operating systems according to the intermediate representation and a second code subset corresponding to any one of the operating systems.

3. The method according to claim 2, characterized in that The method further comprises: Performing business analysis 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 a first task set corresponding to any one of the operating systems; Putting tasks existing in each of the first task sets into a second task set, and determining a third task set corresponding to any one of the operating systems, wherein the third task set corresponding to any one of the operating systems includes tasks in the first task set corresponding to any one of the operating systems except the second task set; Determine a first code set corresponding to the software to be built according to the second task set; The second code subset corresponding to any operating system is determined according to the third task set corresponding to any operating system, and the second code set corresponding to the software to be built is obtained.

4. The method according to claim 3, characterized in that The determining, according to the second task set, a first code set corresponding to the software to be constructed includes: A first code subset corresponding to any second task in the second task set is obtained from the source code of the software to be built to obtain a first code set.

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

6. The method according to claim 5, characterized in that The 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 running condition, the code format corresponding to the any first code is converted into a target code format to obtain the converted any first code to obtain an intermediate representation.

7. The method according to claim 6, characterized in that The converting the code format corresponding to any one of the first codes into a target code format comprises: Obtaining an intermediate representation generation script corresponding to the first code set; Running the intermediate representation generation script to obtain a target code format compiler; The target code format compiler is controlled to convert a code format corresponding to any one of the first codes into the target code format.

8. The method according to claim 2, characterized in that: The controlling the construction system corresponding to any one of the operating systems to generate the construction software corresponding to any one of the operating systems according to the intermediate representation and the second code subset corresponding to any one of the operating systems comprises: The construction system corresponding to any one of the operating systems is controlled to cross-compile the second code subset corresponding to any one of the operating systems and the intermediate representation to obtain construction software corresponding to any one of the operating systems.

9. The method according to claim 8, characterized in that The controlling the construction system corresponding to any one of the operating systems to cross-compile the second code subset corresponding to any one of the operating systems and the intermediate representation includes: Obtain a cross-compilation tool chain corresponding to any one of the operating systems; A construction system corresponding to any one of the operating systems is controlled to cross-compile the second code subset corresponding to any one of the operating systems and the intermediate representation according to the cross-compilation tool chain.

10. A software construction device, characterized in that: Applied to a target build system, where the target build system is a build system corresponding to any operating system in the operating system set, including: A code acquisition unit, configured 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, configured to convert the first code set into an intermediate representation; A software construction unit is used to control a construction system corresponding to any operating system to generate construction software corresponding to any operating system according to the intermediate representation, wherein the construction software is used to run in any operating system.

11. A terminal, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the software construction method according to any one of claims 1 to 9.

12. A storage medium, when instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to execute the software construction method according to any one of claims 1 to 9.

Citation Information

Patent Citations

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

    CN110134378A

  • Method and device for unifying online and offline function points, equipment and storage medium

    CN110457048A

  • Object interception method and device, medium and electronic equipment

    CN111913741A

  • Code configuration method and device, video playing equipment and storage medium

    CN112068895A

  • Software construction method, system, device, medium and program product

    CN115248680A