Method, device, computer equipment and storage medium for generating application software package
The output directory and tag information are determined by the compilation tool, and the target program is automatically copied to the target folder, which solves the problem of low efficiency and high error rate in the application software package generation in the existing technology, and realizes efficient and low-error cross-platform packaging.
Patent Information
- Application Number
- CN202210025899.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-11
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-01-11
AI Technical Summary
Existing methods for generating application software packages are inefficient and have high error rates, and rely on manual copying, which results in low efficiency and is prone to errors.
The output directory is determined by the compilation tool, tag information is obtained, the absolute path of the target program is determined based on the tag information, and it is automatically copied to the target folder to generate an application software package, supporting cross-platform deployment.
It improves the efficiency of application software package generation, reduces the error rate, and realizes an automated cross-platform packaging process.
Smart Images

Figure CN114527987B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and apparatus for generating an application software package, a computer device, and a storage medium. Background Art
[0002] An application package is a pre-compiled, complete software system that performs a specific function. During the application package development process, many compilation tools support cross-platform compilation, meaning they can compile user-written source code into an application package that can run on the same or different platforms as the compilation platform.
[0003] Based on this, when users deploy application software packages, they need to collect the program files compiled from the source code, the data documents used by the program files, and other related documentation from the output directory of the compilation tool and store them in the target folder, thereby forming an application software package corresponding to the software deployment platform.
[0004] Existing methods for generating application software packages mostly rely on manual copying, which is inefficient and has a high error rate. Summary of the Invention
[0005] The present invention provides a method and apparatus for generating an application software package, a computer device and a storage medium, which solve the problem of low generation efficiency and high error rate of the application software package.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a method for generating an application software package, the method comprising:
[0008] Determine the output directory of the compilation tool based on the preset software deployment platform;
[0009] Compile the code using the compilation tool and store multiple target programs in the output directory;
[0010] After the code is compiled, a plurality of label information is obtained, where one label information is used to indicate one target program among the plurality of target programs;
[0011] Determine, according to each piece of label information, a relative path of the target program indicated by each piece of label information in the workspace of the compilation tool;
[0012] Determine the absolute path corresponding to each tag information based on the absolute path of the compilation tool's workspace and the relative path corresponding to each tag information;
[0013] Copy multiple target programs to the target folder according to the absolute path corresponding to each tag information;
[0014] Generate an application package based on the target folder.
[0015] In a possible implementation, the method for generating the application software package further includes:
[0016] According to the absolute path corresponding to each tag information, the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information are determined to obtain the file names and soft link paths of multiple dynamic link library files; according to the file names and soft link paths of multiple dynamic link library files, the multiple dynamic link library files are copied to the target folder.
[0017] In a possible implementation, multiple dynamic link library files are copied to a target folder based on their file names and soft link paths, including: determining the real path of each dynamic link library file based on the soft link path of each dynamic link library file; sorting the multiple dynamic link library files in alphabetical order of the soft link paths; copying the first dynamic link library file after sorting to the target folder; copying the second library file to the target folder when the file name of the second library file is different from that of the first library file, or when the file name of the second library file is the same as that of the first library file and the real path of the second library file is different from that of the first library file; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file.
[0018] In one possible implementation, the method for generating an application software package also includes: utilizing a query function of a compilation tool to determine, based on the absolute path corresponding to each tag information, the file name and soft link path of the data file corresponding to the target program indicated by each tag information, thereby obtaining the file names and soft link paths of multiple data files; and copying the multiple data files to a target folder based on the file names and soft link paths of the multiple data files.
[0019] In one possible implementation, the data file includes multiple first files of source file type and multiple second files of file group type. The query function of the compilation tool is used to determine the file name and soft link path of the data file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, including: determining the file name and soft link path of each first file corresponding to the target program indicated by each tag information, as well as the file name and soft link path of each second file through a dependent query method according to the absolute path corresponding to each tag information; determining the file name and soft link path of the target file in multiple second files through a dependent query method according to the file name and soft link path of each second file.
[0020] In a second aspect, the present invention provides a device for generating an application software package, comprising:
[0021] A first determining module is used to determine the output directory of the compilation tool according to a preset software deployment platform;
[0022] The storage module is used to compile the code through the compilation tool and store multiple target programs in the output directory;
[0023] An acquisition module is used to obtain multiple tag information after compiling the code, where one tag information is used to indicate one target program among multiple target programs;
[0024] A second determining module is used to determine, based on each piece of tag information, a relative path of the target program indicated by each piece of tag information in the workspace of the compilation tool;
[0025] a third determining module, configured to determine an absolute path corresponding to each tag information according to the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information;
[0026] The copy module is used to copy multiple target programs to the target folder according to the absolute path corresponding to each tag information;
[0027] The generation module is used to generate an application software package according to the target folder.
[0028] In one possible implementation, the third determination module is also used to determine the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information based on the absolute path corresponding to each tag information, and obtain the file names and soft link paths of multiple dynamic link library files; the copy module is also used to copy multiple dynamic link library files to the target folder based on the file names and soft link paths of multiple dynamic link library files.
[0029] In a possible implementation, the copy module is specifically used to: determine the real path of each dynamic link library file based on the soft link path of each dynamic link library file; sort multiple dynamic link library files in alphabetical order of the soft link paths; copy the first dynamic link library file after sorting to a target folder; when the file name of the second library file is different from the file name of the first library file, or when the file name of the second library file is the same as the file name of the first library file and the real path of the second library file is different from the real path of the first library file, copy the second library file to the target folder; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file.
[0030] In one possible implementation, the third determination module is also used to utilize the query function of the compilation tool to determine the file name and soft link path of the data file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, and obtain the file names and soft link paths of multiple data files; the copy module is also used to copy multiple data files to the target folder according to the file names and soft link paths of multiple data files.
[0031] In one possible implementation, the data file includes a first file of the source file type and multiple second files of the file group type, and the third determination module is further used to: determine the file name and soft link path of each first file corresponding to the target program indicated by each tag information, as well as the file name and soft link path of each second file, through a dependent query method based on the absolute path corresponding to each tag information; determine the file name and soft link path of the target file in multiple second files through a dependent query method based on the file name and soft link path of each second file.
[0032] In a third aspect, the present invention provides a computer device comprising: a processor and a memory. The memory is configured to store computer program code, the computer program code comprising computer instructions. When the processor executes the computer instructions, the computer device performs the method for generating an application software package according to the first aspect and any possible implementation thereof.
[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon. When the computer instructions are executed on a computer device, the computer device executes a method for generating an application software package as in the first aspect or any one of the possible implementations of the first aspect.
[0034] In a fifth aspect, the present invention provides a computer program product comprising computer instructions, which, when executed on a computer device, cause the computer device to execute a method for generating an application software package as in the first aspect and any possible implementation thereof.
[0035] The method for generating an application software package provided by an embodiment of the present invention comprises the following steps: a computer device determines an output directory of a compilation tool according to a preset software deployment platform, compiles code through the compilation tool, stores multiple target programs in the output directory, and obtains multiple tag information after compiling the code, wherein one tag information is used to indicate one target program among the multiple target programs, and according to each tag information, determines the relative path of the target program indicated by each tag information in the workspace of the compilation tool, determines the absolute path corresponding to each tag information according to the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information, and copies the multiple target programs to a target folder according to the absolute path corresponding to each tag information, and finally generates an application software package according to the target folder. In the embodiment of the present invention, based on the cross-platform compilation function of the compilation tool and according to the preset software deployment platform, the computer device automatically copies and packages the multiple target programs output by the compilation tool after compiling the code into a corresponding cross-platform deployable application software package, thereby improving the generation efficiency of the application software package and reducing the error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic diagram of an application scenario of a method for generating an application software package provided by an embodiment of the present invention;
[0037] Figure 2 One of the flow charts of a method for generating an application software package provided in an embodiment of the present invention;
[0038] Figure 3 A second flowchart of a method for generating an application software package provided in an embodiment of the present invention;
[0039] Figure 4 Flowchart 3 of a method for generating an application software package provided by an embodiment of the present invention;
[0040] Figure 5 A fourth flowchart of a method for generating an application software package provided in an embodiment of the present invention;
[0041] Figure 6 Flowchart 5 of a method for generating an application software package provided by an embodiment of the present invention;
[0042] Figure 7 A schematic diagram of the composition of a device for generating an application software package provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0044] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "multiple" means two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values may be based on additional conditions or values beyond the stated in practice.
[0045] In order to solve the problems of low efficiency and high error rate in generating application software packages, embodiments of the present invention provide a method, apparatus, computer device, and storage medium for generating an application software package. The computer device determines an output directory of a compilation tool based on a preset software deployment platform, compiles code using the compilation tool, stores multiple target programs in the output directory, and obtains multiple tag information after compiling the code, wherein one tag information is used to indicate one target program among the multiple target programs. Based on each tag information, a relative path of the target program indicated by each tag information in a workspace of the compilation tool is determined. Based on the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information, an absolute path corresponding to each tag information is determined. Based on the absolute path corresponding to each tag information, the multiple target programs are copied to a target folder according to the absolute path corresponding to each tag information. Finally, an application software package is generated based on the target folder.
[0046] In this way, based on the cross-platform compilation function of the compilation tool and according to the preset software deployment platform, the computer device automatically copies and packages the multiple target programs output by the compilation tool after compiling the code into corresponding application software packages that can be deployed across platforms, thereby improving the generation efficiency of the application software package and reducing the error rate.
[0047] The execution subject of the method for generating an application software package provided in the embodiment of the present invention is a computer device. The computer device can be a terminal device, for example, a tablet computer or a laptop computer that can run a compilation tool, or a server, or a server cluster, which is not limited in the embodiment of the present invention. For example, Figure 1 A schematic diagram of an application scenario of a method for generating an application software package provided by an embodiment of the present invention, with Figure 1 Taking the computer device 10 in the example, computer device 10 is installed with a compilation tool that compiles user-written source code into a binary executable file, i.e., a target program, that the computer device can recognize. Computer device 10 can also determine the absolute paths of multiple target programs based on the tag information corresponding to each compiled target program, thereby copying the multiple target programs to a target folder and generating an application software package. The following describes the method for generating an application software package in an embodiment of the present invention, using a computer device as an example.
[0048] Figure 2 Flowchart of a method for generating an application software package provided by an embodiment of the present invention. Figure 2 As shown, the method for generating an application software package may include the following steps S201 to S207.
[0049] S201: The computer device determines an output directory of a compilation tool according to a preset software deployment platform.
[0050] A compilation tool can be a compilation program that compiles user-written source code into a binary executable file that can be recognized by a computer device, i.e., a target program. The compilation tool can support cross-platform compilation, i.e., the compilation platform of the target program is different from the target program running platform. For example, taking the common cross-platform compilation tool Bazel as an example, Bazel can support projects with mixed languages, such as Java, C++, Android, iOS, Go, and various other languages, and can compile different target programs according to different preset software deployment platforms. For example, Bazel can compile a target program that can be run on the x86_64 platform in the x86_64 platform, and can also compile a target program that can be run on the aarch64 platform in the x86_64 platform.
[0051] It's understood that the output directory of the target program compiled by the compilation tool will vary depending on the pre-set software deployment platform. For example, Bazel can select different output directories based on different compilation options. For example, if the CPU setting in the compilation options is x86_64, the output directory may be bazel-out / x86_64-py2-opt / . If the CPU setting in the compilation options is aarch64, the output directory may be bazel-out / aarch64-py2-opt / .
[0052] Specifically, the computer device may determine the output directory of the compilation tool according to a preset software deployment platform.
[0053] S202: The computer device compiles the code using a compilation tool and stores multiple target programs in an output directory.
[0054] Specifically, the terminal device may compile the code through a compilation tool to obtain multiple target programs, and store the compiled multiple target programs in an output directory corresponding to the preset software deployment platform according to the preset software deployment platform.
[0055] S203 : After compiling the code, the computer device obtains a plurality of tag information, where one tag information is used to indicate one target program among the plurality of target programs.
[0056] It is understood that after the compilation tool compiles the code, each target program will generate a unique label, i.e., label information, which corresponds to the output directory of the target program. For example, in Bazel, the label information of a target program can be / / a / b:c.
[0057] Specifically, the computer device may compile the code and obtain the tag information corresponding to each target program to obtain multiple tag information.
[0058] S204: The computer device determines, based on each piece of tag information, a relative path of the target program indicated by each piece of tag information in the workspace of the compilation tool.
[0059] It can be understood that the workspace is the file system of the compilation tool, which includes source files, symbolic links, and output directories, etc. Each tag information corresponds one-to-one to the relative path of the target program it indicates in the workspace.
[0060] The computer device can determine the relative path of the target program indicated by each tag information in the workspace of the compilation tool based on each tag information. For example, in Bazel, the relative path of the target program with tag information / / a / b:c can be bazel-bin / a / b / c in the current workspace.
[0061] S205: The computer device determines the absolute path corresponding to each piece of tag information according to the absolute path of the workspace of the compilation tool and the relative path corresponding to each piece of tag information.
[0062] Specifically, the computer device may concatenate the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information, thereby obtaining the absolute path corresponding to each tag information.
[0063] S206: The computer device copies the multiple target programs to the target folder according to the absolute path corresponding to each tag information.
[0064] Specifically, the computer device may determine the storage location of each target program according to the absolute path corresponding to each tag information, and copy each target program to the same target folder according to the storage location of each target program.
[0065] S207: The computer device generates an application software package according to the target folder.
[0066] Optionally, the computer device may directly determine the target folder as the application software package, or may determine a compressed package obtained by compressing the target folder as the application software package. The generation method of the application software package is not limited here.
[0067] In this embodiment, a computer device determines an output directory of a compilation tool based on a preset software deployment platform, compiles code using the compilation tool, stores multiple target programs in the output directory, and obtains multiple tag information after compiling the code, wherein one tag information is used to indicate one of the multiple target programs. Based on each tag information, a relative path of the target program indicated by each tag information in the workspace of the compilation tool is determined. Based on the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information, an absolute path corresponding to each tag information is determined. Based on the absolute path corresponding to each tag information, the multiple target programs are copied to a target folder, and finally, an application software package is generated based on the target folder. In this embodiment of the present invention, based on the cross-platform compilation function of the compilation tool and the preset software deployment platform, the computer device automatically copies and packages the multiple target programs output by the compilation tool after compiling the code into corresponding cross-platform deployable application software packages, thereby improving the generation efficiency of the application software package and reducing the error rate.
[0068] Optionally, based on the above embodiment, Figure 2 ,like Figure 3 As shown, the method for generating the application software package further includes:
[0069] S301. The computer device determines the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, and obtains the file names and soft link paths of multiple dynamic link library files.
[0070] The target program may require a dynamic link library file when running. Based on this, the computer device can, after obtaining the absolute path of each target program, pass the absolute paths of all target programs as parameters at one time to the program instructions corresponding to the preset software deployment platform, and analyze the file name and soft link path of the dynamic link library file required by each target program through the program instructions, thereby obtaining the file names and soft link paths of multiple dynamic link library files.
[0071] It is understandable that if the preset software deployment platform is different, the type of program instruction will also be different.
[0072] For example, when the compilation platform is the x86_64 platform, if the preset software deployment platform is the x86_64 platform, the program instruction can be the ldd command; if the preset software deployment platform is the aarch64 platform, the program instruction can be the readelf command. The computer device can obtain the shared library information through the readelf command to determine the dynamic link library required by the target program.
[0073] S302: The computer device copies the multiple dynamic link library files to a target folder according to the file names and soft link paths of the multiple dynamic link library files.
[0074] Specifically, the computer device can determine the storage location of each dynamic link library file according to the file names and soft link paths of the multiple dynamic link library files, and copy each dynamic link library file to the target folder according to the storage location of each dynamic link library file.
[0075] In this embodiment, the computer device determines the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information based on the absolute path corresponding to each tag information, obtains the file names and soft link paths of multiple dynamic link library files, and copies the multiple dynamic link library files to the target folder based on the file names and soft link paths of the multiple dynamic link library files, thereby automatically generating an application software package, improving the generation efficiency of the application software package and reducing the error rate.
[0076] Optionally, based on the above embodiment, Figure 3 ,like Figure 4 As shown, the above step S302 includes:
[0077] S401. The computer device determines the real path of each dynamic link library file according to the soft link path of each dynamic link library file.
[0078] It is understandable that each dynamic link library file will only have a unique entity in the output directory of the compilation tool, so the dynamic link library files in the directory linked by each target program are just soft links to those dynamic link library files. Since multiple target programs may link to a large number of identical dynamic link library files, in the above embodiment, multiple dynamic link library files are copied to the target folder based on the file name and soft link path of the dynamic link library file, which may result in repeated copying of the same dynamic link library file. For example, in Bazel, the target program with the label information / / a / b:c links to / home / dev / repo / bazel-bin / a / b / c / .. / .. / _solib_x86_64 / lib1.so, and the target program with the label information / / b / c:d links to / home / dev / repo / bazel-bin / b / c / d / .. / .. / _solib_x86_64 / lib1.so, and the real paths of these two directories both point to / home / dev / repo / bazel-bin / lib1.so. Therefore, in order to support the rapid packaging of a large number of dynamic library files, the computer device needs to perform deduplication when copying the dynamic library files.
[0079] Specifically, the computer device may determine the real path of each dynamic link library file according to the soft link path of each dynamic link library file.
[0080] S402. The computer device sorts the multiple dynamic link library files in alphabetical order of the soft link paths.
[0081] Specifically, in order to perform deduplication, the computer device may sort multiple dynamic link library files in alphabetical order of the soft link paths, and perform deduplication judgment on the dynamic link library files in sequence during the copying process from front to back.
[0082] S403: The computer device copies the sorted first dynamic link library file to the target folder.
[0083] It is understandable that the first library file after sorting is the object to be copied for the first time, so there is no need to perform deduplication judgment, and the computer device can copy the first library file after sorting to the target folder.
[0084] S404. The computer device copies the second library file to the target folder when the file name of the second library file is different from the file name of the first library file, or when the file name of the second library file is the same as the file name of the first library file but the real path of the second library file is different from the real path of the first library file; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file.
[0085] It is understandable that the deduplication determination may be to determine whether the real paths pointed to by the two adjacent sorted first library files and the second library files are the same.
[0086] Specifically, the computer device can skip copying the second library file when the file name of the second library file is the same as the file name of the first library file, and the real path pointed to by the second library file and the first library file is the same. In other words, the computer device can copy the second library file to the target folder when the file name of the second library file is different from the file name of the first library file, or when the file name of the second library file is the same as the file name of the first library file, but the real path of the second library file is different from the real path of the first library file, thereby achieving deduplication when copying dynamic link library files.
[0087] In this embodiment, the computer device sorts the soft link paths of the dynamic link library files in alphabetical order, and copies the second library file to the target folder when the file name of the sorted second library file is different from the file name of the first library file, or when the file name of the second library file is the same as the file name of the first library file and the real path of the second library file is different from the real path of the first library file, thereby achieving deduplication when copying the dynamic link library files and improving the efficiency of copying the dynamic link library files.
[0088] Optionally, based on the above embodiment, Figure 4 ,like Figure 5 As shown, the method for generating the application software package further includes:
[0089] S501. The computer device uses the query function of the compilation tool to determine the file name and soft link path of the data file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, and obtains the file names and soft link paths of multiple data files.
[0090] The target program may also depend on data files during runtime. Based on this, the computer device can use the query function of the compilation tool after obtaining the absolute path of each target program, and use the corresponding query instructions to perform dependency queries on each target program, thereby obtaining the file names and soft link paths of the data files that multiple target programs depend on.
[0091] For example, in Bazel, a computer device can query all data files with the attribute "data" that all target programs depend on through Bazel's own query command "bazel query", thereby obtaining the file names and soft link paths of the data files that multiple target programs depend on.
[0092] S502: The computer device copies the multiple data files to a target folder according to the file names and soft link paths of the multiple data files.
[0093] Specifically, the computer device may determine the storage location of each data file according to the file names and soft link paths of the multiple data files, and copy each data file to the target folder according to the storage location of each data file.
[0094] In this embodiment, the computer device determines the file name and soft link path of the data file corresponding to the target program indicated by each tag information based on the absolute path corresponding to each tag information, obtains the file names and soft link paths of multiple data files, and copies the multiple data files to the target folder based on the file names and soft link paths of the multiple data files, thereby automatically generating an application software package, improving the generation efficiency of the application software package and reducing the error rate.
[0095] Optionally, based on the above embodiment, Figure 5 ,like Figure 6 As shown, the data file includes a plurality of first files of the source file type and a plurality of second files of the file group type. The above step S501 includes:
[0096] S601. The computer device determines the file name and soft link path of each first file and the file name and soft link path of each second file corresponding to the target program indicated by each tag information through a dependent query method based on the absolute path corresponding to each tag information.
[0097] Exemplarily, in Bazel, the data files with the attribute data found out may include files of type source, that is, first files of type source file, and files of type filegroup, that is, second files of type filegroup.
[0098] Specifically, the computer device can determine the file name and soft link path of each first file corresponding to the target program indicated by each tag information, as well as the file name and soft link path of each second file based on the absolute path corresponding to each tag information and the query instructions corresponding to the compilation tool.
[0099] Exemplarily, the computer device may query the first file and the second file contained in Bazel through the bazel query instruction provided in Bazel, and then copy the first file and the second file to the target folder according to the output directory of Bazel.
[0100] S602: The computer device determines the file name and soft link path of the target file from a plurality of second files by means of a dependency query according to the file name and soft link path of each second file.
[0101] It is understandable that the target file may be the second file in the file group type, which is the file that the target program actually depends on.
[0102] Specifically, the computer device may determine the file name and soft link path of the target file from the plurality of second files in a dependent query manner according to the file name and soft link path of each second file.
[0103] Exemplarily, the computer device may use the bazel query command provided in Bazel to perform dependency query again on the second file of the filegroup type, find the truly dependent part, and then copy it to the target folder.
[0104] In this embodiment, the computer device performs further dependency query on the files of the file group type, so that when the computer copies the data files, it filters out the parts that are not dependent on the target program, thereby improving the efficiency of data file copying and the efficiency of generating the application software package.
[0105] The above mainly introduces the solution provided by the embodiment of the present invention from the perspective of the device. It can be understood that in order to realize the above functions, the device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0106] Figure 7 A schematic diagram of a possible device for generating an application software package is shown in FIG. Figure 7 As shown, the device for generating an application software package may include a first determining module 71 , a storage module 72 , an acquiring module 73 , a second determining module 74 , a third determining module 75 , a copying module 76 and a generating module 77 .
[0107] The first determining module 71 is configured to determine an output directory of a compilation tool according to a preset software deployment platform.
[0108] The storage module 72 is used to compile the code using a compilation tool and store multiple target programs in an output directory.
[0109] The acquisition module 73 is used to obtain multiple tag information after compiling the code, where one tag information is used to indicate one target program among multiple target programs.
[0110] The second determining module 74 is configured to determine, based on each piece of tag information, a relative path of the target program indicated by each piece of tag information in the workspace of the compilation tool.
[0111] The third determining module 75 is configured to determine the absolute path corresponding to each piece of tag information according to the absolute path of the workspace of the compilation tool and the relative path corresponding to each piece of tag information.
[0112] The copy module 76 is used to copy multiple target programs to a target folder according to the absolute path corresponding to each tag information.
[0113] The generating module 77 is used to generate an application software package according to the target folder.
[0114] Optionally, the third determination module 75 is also used to determine the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information based on the absolute path corresponding to each tag information, and obtain the file names and soft link paths of multiple dynamic link library files; the copy module 76 is also used to copy multiple dynamic link library files to the target folder based on the file names and soft link paths of multiple dynamic link library files.
[0115] Optionally, the copy module 76 is specifically used to: determine the real path of each dynamic link library file based on the soft link path of each dynamic link library file; sort multiple dynamic link library files in alphabetical order of the soft link paths; copy the first dynamic link library file after sorting to the target folder; when the file name of the second library file is different from the file name of the first library file, or when the file name of the second library file is the same as the file name of the first library file and the real path of the second library file is different from the real path of the first library file, copy the second library file to the target folder; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file.
[0116] Optionally, the third determination module 75 is also used to utilize the query function of the compilation tool to determine the file name and soft link path of the data file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, and obtain the file names and soft link paths of multiple data files; the copy module is also used to copy multiple data files to the target folder according to the file names and soft link paths of multiple data files.
[0117] Optionally, the data file includes multiple first files of source file type and multiple second files of file group type, and the third determination module 75 is also used to: determine the file name and soft link path of each first file corresponding to the target program indicated by each tag information, as well as the file name and soft link path of each second file through a dependent query method based on the absolute path corresponding to each tag information; determine the file name and soft link path of the target file in multiple second files through a dependent query method based on the file name and soft link path of each second file.
[0118] The device for generating an application software package provided by an embodiment of the present invention is used to execute the aforementioned method for generating an application software package, and thus can achieve the same effect as the aforementioned method for generating an application software package.
[0119] Another embodiment of the present invention provides a computer device comprising a processor and a memory. The memory is configured to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the computer device executes the method for generating an application software package as described in the above method embodiment.
[0120] Another embodiment of the present invention further provides a computer-readable storage medium having computer instructions stored therein. When the computer instructions are executed on a computer device, the computer device executes the method for generating an application software package shown in the above method embodiment.
[0121] Another embodiment of the present invention further provides a computer program product, which includes computer instructions. When the computer instructions are executed on a computer device, the computer device executes the method for generating an application software package shown in the above method embodiment.
[0122] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention shall be covered by the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A method for generating an application software package, characterized in that: include: Determine the output directory of the compilation tool based on the preset software deployment platform; Compile the code using the compilation tool and store multiple target programs in the output directory; After compiling the code, a plurality of label information is obtained, where one piece of label information is used to indicate one of the plurality of target programs; According to each piece of label information, determining a relative path of the target program indicated by each piece of label information in the workspace of the compilation tool; Determine the absolute path corresponding to each tag information according to the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information; Copy the multiple target programs to a target folder according to the absolute path corresponding to each tag information; Determine the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, and obtain the file names and soft link paths of multiple dynamic link library files; Determine the real path of each dynamic link library file according to the soft link path of each dynamic link library file; Sort the multiple dynamic link library files in alphabetical order of the soft link paths; copying the first dynamic link library file after sorting to the target folder; if the file name of the second library file is different from the file name of the first library file, or if the file name of the second library file is the same as the file name of the first library file and the real path of the second library file is different from the real path of the first library file, copying the second library file to the target folder; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file; The application software package is generated according to the target folder.
2. The method for generating an application software package according to claim 1, wherein: The method for generating the application software package further includes: Using the query function of the compilation tool, according to the absolute path corresponding to each tag information, the file name and soft link path of the data file corresponding to the target program indicated by each tag information are determined, and the file names and soft link paths of the multiple data files are obtained; The multiple data files are copied to the target folder according to the file names and soft link paths of the multiple data files.
3. The method for generating an application software package according to claim 2, wherein: The data files include a plurality of first files of a source file type and a plurality of second files of a file group type, and using the query function of the compilation tool to determine the file name and soft link path of the data file corresponding to the target program indicated by each tag information according to the absolute path corresponding to each tag information, including: According to the absolute path corresponding to each tag information, determine the file name and soft link path of each first file corresponding to the target program indicated by each tag information, and the file name and soft link path of each second file by a dependent query method; According to the file name and soft link path of each second file, the file name and soft link path of the target file are determined in the plurality of second files in a dependent query manner.
4. A device for generating an application software package, characterized in that: include: A first determining module is used to determine the output directory of the compilation tool according to a preset software deployment platform; A storage module, configured to compile code using the compilation tool and store multiple target programs in the output directory; an acquisition module, configured to acquire a plurality of tag information after compiling the code, wherein one tag information is used to indicate one target program among the plurality of target programs; A second determining module is configured to determine, based on each piece of tag information, a relative path of the target program indicated by each piece of tag information in the workspace of the compilation tool; a third determining module, configured to determine the absolute path corresponding to each tag information based on the absolute path of the workspace of the compilation tool and the relative path corresponding to each tag information; and determine the file name and soft link path of the dynamic link library file corresponding to the target program indicated by each tag information based on the absolute path corresponding to each tag information, thereby obtaining the file names and soft link paths of multiple dynamic link library files; A copy module is used to copy the plurality of target programs to a target folder according to the absolute path corresponding to each tag information; and to determine the real path of each dynamic link library file according to the soft link path of each dynamic link library file; Sort the multiple dynamic link library files in alphabetical order of the soft link paths; copying the first dynamic link library file after sorting to the target folder; if the file name of the second library file is different from the file name of the first library file, or if the file name of the second library file is the same as the file name of the first library file and the real path of the second library file is different from the real path of the first library file, copying the second library file to the target folder; the first library file and the second library file are two adjacent dynamic link library files after sorting, and the second library file is located after the first library file; A generating module is used to generate the application software package according to the target folder.
5. The device for generating an application software package according to claim 4, characterized in that: The third determining module is further configured to determine, using a query function of the compilation tool, a file name and a soft link path of a data file corresponding to a target program indicated by each tag information based on an absolute path corresponding to each tag information, thereby obtaining the file names and soft link paths of the plurality of data files; The copy module is further configured to copy the multiple data files to the target folder according to the file names and soft link paths of the multiple data files.
6. The device for generating an application software package according to claim 5, wherein: The data files include a plurality of first files of a source file type and a plurality of second files of a file group type, and the third determining module is specifically configured to: According to the absolute path corresponding to each tag information, determine the file name and soft link path of each first file corresponding to the target program indicated by each tag information, and the file name and soft link path of each second file by a dependent query method; According to the file name and soft link path of each second file, the file name and soft link path of the target file are determined in the plurality of second files in a dependent query manner.
7. A computer device, characterized in that: The computer device includes: a processor and a memory; the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the computer device executes the method for generating an application software package according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on a computer device, enable the computer device to execute the method for generating an application software package according to any one of claims 1 to 3.
Citation Information
Patent Citations
Automatic quick generation system and method for UKey installation package
CN104572237A
Method and device for automatically generating software installation package
CN104714788A