File generation method and device, electronic equipment and computer readable storage medium
By obtaining and utilizing a pre-built script compiler to generate application installation files, the problem of time-consuming compilation script writing is solved, and the efficiency of installation file generation is improved.
Patent Information
- Application Number
- CN202211338878.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-10-28
AI Technical Summary
In existing technologies, writing compilation scripts to generate application installation files is a labor-intensive and time-consuming process, resulting in low efficiency in generating installation files.
By obtaining the target application's program configuration information and program compilation files, inputting them into a preset script compiler, generating the target program script using a preset script, and executing the script to generate the installation file.
It reduces the workload of generating program scripts and installation files, and improves the efficiency of generating installation files.
Smart Images

Figure CN116126334B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular, the present application relates to a file generation method and device, electronic equipment and computer readable storage medium. BACKGROUND
[0002] An application program includes a computer program for completing one or more specific work, which runs in user mode, can interact with users, has a visual user interface and the like. The installation file of the application program, that is, the installation package, is a collection of self-decompressible files, and the installation file includes all files installed by the application program.
[0003] In the file generation scenario, for example, when generating the installation file of the application program, the compiled file is usually generated first; then the compiled file is packaged into the installation file in exe format. The advantage of this generation method is that it is convenient for system management, such as installation file upgrade, which can be automatically upgraded by the system; but this method also has certain defects, such as for different application programs, it is necessary to write a compiled script for each application program by using the software tool Inno Step to generate the installation file through the compiled script. However, the workload of writing the compiled script is large, time-consuming, which makes the efficiency of generating the installation file low. SUMMARY
[0004] The purpose of the present application is to at least solve one of the above technical defects, in particular, the technical defect that the workload of writing the compiled file is large, time-consuming, which leads to low efficiency of generating the installation file.
[0005] According to one aspect of the present application, a file generation method is provided, the method comprising:
[0006] obtaining program configuration information and program compiled files of a target application program; the program compiled files are generated based on source program files of the target application program;
[0007] inputting the program configuration information and the program compiled files into a preset script compiler to obtain a target program script of the target application program; wherein the script compiler executes a preset script to compile the program configuration information and the program compiled files to generate the target program script;
[0008] executing the target program script to generate an installation file of the target application program.
[0009] Optionally, before obtaining the program configuration information and the program compiled files of the target application program, the method further comprises:
[0010] According to a preset compiling flow, the preset script is generated; wherein the compiling flow comprises a flow of compiling the program configuration information and the program compiling file;
[0011] Based on the preset script, the script compiler is configured;
[0012] Optionally, the program compiling file is obtained, comprising:
[0013] The source program file to be compiled of the target application program is obtained;
[0014] The source program file is compiled to generate the program compiling file.
[0015] Optionally, the program configuration information and the program compiling file are input into the pre-configured script compiler to obtain the target program script of the target application program, comprising:
[0016] The preset script is executed to load the program configuration information;
[0017] According to the program configuration information, the initialization statement in the target program script is generated.
[0018] Optionally, the program configuration information and the program compiling file are input into the pre-configured script compiler to obtain the target program script of the target application program, comprising:
[0019] The preset script is executed to determine the file type of the program compiling file;
[0020] According to the file type, the target program script is generated.
[0021] Optionally, the target program script is generated according to the file type, comprising:
[0022] According to the file type, the file packing statement corresponding to the file type is generated;
[0023] The target program script comprises the file packing statement.
[0024] Optionally, the method further comprises:
[0025] A running statement is generated; and the program installation script comprises the running statement.
[0026] Optionally, the method further comprises:
[0027] When it is detected that the program configuration information of the target application program is updated, the target program script is updated based on the updated configuration information.
[0028] Optionally, the program configuration information comprises at least one of:
[0029] a name of the target application program; an identification number of the target application program; version information of the target application program; a name of an installation file of the target application program; an output directory of the installation file; a default installation directory of the installation file; and whether to create a desktop shortcut.
[0030] According to another aspect of the present application, a file generation apparatus is provided, the apparatus comprising:
[0031] an obtaining module configured to obtain program configuration information of a target application program and a program compilation file, the program compilation file being generated based on a source program file of the target application program;
[0032] a generating module configured to input the program configuration information and the program compilation file into a preset script compiler to obtain a target program script of the target application program; wherein the script compiler executes a preset script to compile the program configuration information and the program compilation file to generate the target program script;
[0033] an executing module configured to execute the target program script to generate an installation file of the target application program.
[0034] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:
[0035] one or more processors;
[0036] a memory;
[0037] one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the file generation method of any one of the first aspect of the present application.
[0038] For example, the third aspect of the present application provides a computing device, comprising: a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus;
[0039] The memory is configured to store at least one executable instruction, and the executable instruction causes the processor to execute operations corresponding to the file generation method of the first aspect of the present application.
[0040] According to still another aspect of the present application, a computer readable storage medium is provided, and the computer program is executed by the processor to implement the file generation method of any one of the first aspect of the present application.
[0041] For example, the fourth aspect of the embodiments of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The program is executed by a processor to implement the file generation method shown in the first aspect of the present application.
[0042] According to an aspect of the present application, a computer program product or computer program is provided, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the method provided in the various optional implementations of the first aspect.
[0043] The technical solution provided by the present application has the following beneficial effects:
[0044] In the embodiments of the present application, the program configuration information and the program compilation file of the target application program are obtained, the program configuration information and the program compilation file are input into a preset script compiler, the target program script of the target application program is obtained, the target program script is executed, and the installation file of the target application program is generated. The script compiler can compile the program configuration information and the program compilation file of each application program by executing a preset script to generate a program script, so as to generate the installation file of the application program through the program script. In the embodiments of the present application, for each application program, the program configuration information and the program compilation file are obtained when the program installation file is generated, that is, the program script can be generated by the script compiler, without the need to write the program script for each application program, thereby reducing the workload of generating the program script and the installation file and improving the corresponding efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced.
[0046] Figure 1 A system architecture diagram of a file generation method provided by the embodiments of the present application;
[0047] Figure 2 One of the flowcharts of the file generation method provided by the embodiments of the present application;
[0048] Figure 3 The second flowchart of the file generation method provided by the embodiments of the present application;
[0049] Figure 4 The third flowchart of the file generation method provided by the embodiments of the present application;
[0050] Figure 5 A structural schematic diagram of a file generation device provided by an embodiment of the present application is shown in FIG. 1.
[0051] Figure 6 A structural schematic diagram of an electronic device for file generation provided by an embodiment of the present application is shown in FIG. 2. DETAILED DESCRIPTION
[0052] Embodiments of the present application will be described below in conjunction with the accompanying drawings. It should be understood that the embodiments described below in conjunction with the accompanying drawings are exemplary descriptions of the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0053] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a", "an" and "the" used herein can also include the plural forms. It should be further understood that the terms "comprise" and "include" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or can mean that the element and the other element are connected through an intermediate element. In addition, "connected" or "coupled" used herein can include wireless connection or wireless coupling. The term "and / or" used herein means that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0054] To make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below in conjunction with the accompanying drawings.
[0055] First, the system architecture of the file generation method provided by an embodiment of the present application will be described in conjunction with FIG. 3. Figure 1 The system can include a server 101 and a terminal cluster, wherein the server 101 can be considered as a background server for file generation.
[0056] The terminal cluster can include a terminal 102, a terminal 103, a terminal 104, and so on, wherein the terminals are installed with a client supporting file generation. There can be a communication connection between the terminals, for example, there is a communication connection between the terminal 102 and the terminal 103, and there is a communication connection between the terminal 103 and the terminal 104.
[0057] Meanwhile, the server 101 can provide services for a terminal cluster through a communication connection function. Any terminal in the terminal cluster can have a communication connection with the server 101. For example, the terminal 102 has a communication connection with the server 101, and the terminal 103 has a communication connection with the server 101. The communication connection is not limited to a connection mode. The communication connection can be direct or indirect through a wired communication mode, or direct or indirect through a wireless communication mode, or through other modes.
[0058] The network of the communication connection can be a wide area network or a local area network, or a combination of the two. The present application does not limit this.
[0059] The file generation method of the embodiments of the present application can be executed on the server side or on the terminal side, and the embodiments of the present application do not limit the execution subject. The method provided by the embodiments of the present application can be executed by a computer device, which includes but is not limited to a terminal (also including the user terminal described above) or a server (also including the server 101 described above). The server can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected through wired or wireless communication modes, and the present application does not limit this.
[0060] Of course, the method provided by the embodiments of the present application is not limited to the application scenarios shown in the above description. Figure 1 The method can also be used in other possible application scenarios, and the embodiments of the present application do not limit this. The functions that can be achieved by the devices in the application scenarios shown in the above description will be described together in the subsequent method embodiments, and will not be described in detail here. Figure 1 The functions that can be achieved by the devices in the application scenarios shown in the above description will be described together in the subsequent method embodiments, and will not be described in detail here.
[0061] The embodiments of the present application provide a possible implementation manner. The scheme can be executed by any electronic device. Optionally, any electronic device can be a server device with file generation capability, or a device or chip integrated on the device. As shown in the above description, Figure 2 The embodiments of the present application provide a possible implementation manner. The scheme can be executed by any electronic device. Optionally, any electronic device can be a server device with file generation capability, or a device or chip integrated on the device. As shown in the above description,
[0062] Step S201: Obtain program configuration information of a target application program and a program compilation file; the program compilation file is generated based on a source program file of the target application program.
[0063] Optionally, the embodiments of the present application can be applied to the field of computer technology, and specifically can be applied to the application scenario of generating an installation file of an application program.
[0064] Specifically, an application program includes a computer program for completing one or more specific tasks, which runs in user mode, can interact with users, and has a visual user interface, etc. For example, in actual scenarios, an application program can include an office application program (such as a word, table, and other file editing application program), a social application program (such as an instant messaging application program), a game application program, etc.
[0065] In the embodiments of the present application, the target application program can be any application program; optionally, the target application program can be a Flutter application.
[0066] In actual scenarios, the program configuration information of the target application program and the program compilation file can be obtained when it is necessary to generate an installation file of the target application program, that is, when a request to generate an installation file of the target application program is received.
[0067] The program configuration information of the target application program includes information for representing the basic situation, related attributes, configuration situation, etc. of the target application program; for example, the program configuration information can include the name, identity document (ID), version information, etc. of the target application program, and also includes the name of the installation file of the target application program, the output directory of the installation file, the default installation directory of the installation file, whether to create a desktop shortcut, etc. Optionally, the program configuration information can be pre-written according to the target application program, and in addition, when the target application program is updated, the program configuration information can also be updated accordingly.
[0068] The program compilation file is a file generated based on a source program file of the target application program; specifically, in actual implementation scenarios, for a target application program, a source program file to be compiled of the target application program can be obtained, and the source program file is compiled to generate the program compilation file. The source program file can include a source code file, a plug-in, a resource file, etc.
[0069] Step S202: Input the program configuration information and the program compilation file to a preset script compiler to obtain a target program script of the target application program.
[0070] The script compiler executes a preset script, compiles the program configuration information and the program compiling file, and generates the target program script.
[0071] Specifically, after the program configuration information and the program compiling file are acquired, the target program script of the target application program can be generated by inputting the program configuration information and the program compiling file into a preset script compiler.
[0072] The target program script is script information used to generate an installation file of the target application program.
[0073] The installation file, that is, the installation package, is a collection of self-decompressible files, and the installation file includes all files of the application program installation. Running the installation file, that is, the installation file of the application program, releases all files of the application program to the hard disk, and completes the work of modifying the registry, modifying the system settings, creating a shortcut, and the like, to install the application program. In actual application scenarios, the installation file in the windows system is mostly in the exe format.
[0074] In the embodiment of the application, the script compiler is a compiler used to generate the target program script; the script compiler executes a preset script, compiles the program configuration information and the program compiling file, and generates the target program script; that is, the preset script is script information used to generate the target program script.
[0075] It can be understood that, in the embodiment of the application, the script compiler can compile the program configuration information and the program compiling file of each application program by executing a preset script, and generate the program script of the application program. Optionally, in the embodiment of the application, the program script can be in the iss file format.
[0076] Step S203: executing the target program script to generate an installation file of the target application program.
[0077] In the embodiment of the application, the target program script is script information used to generate an installation file of the target application program; after the target program script is generated, the installation file of the target application program can be generated by executing the target program script; and the installation file is used to install the target application program.
[0078] Optionally, in the embodiment of the application, the Inno Setup software can be used to execute the target program script to generate the installation file.
[0079] In this embodiment, by obtaining the program configuration information and program compilation files of the target application, the program configuration information and program compilation files are input into a preset script compiler to obtain the target program script of the target application. The target program script is then executed to generate the installation file of the target application. The script compiler can compile the program configuration information and program compilation files of each application by executing a preset script to generate a program script, which is then used to generate the application's installation file. In this embodiment, for each application, its program configuration information and program compilation files are obtained when generating the program installation file, and the program script can be generated by the script compiler. This eliminates the need to write separate program scripts for each application, reducing the workload of generating program scripts and installation files and improving efficiency.
[0080] In one embodiment of this application, before obtaining the program configuration information and program compilation files of the target application, the method further includes:
[0081] The preset script is generated according to a preset compilation process; wherein, the compilation process includes a process of compiling the program configuration information and the program compilation file;
[0082] Configure the script compiler based on the pre-set script;
[0083] Specifically, embodiments of this application further include the step of configuring a script compiler; wherein, the script compiler is configured with a preset script. The preset script can be written based on the process of compiling the program configuration information and the program compilation file; as an example, the process of compiling the program configuration information and the program compilation file may include the following steps: reading program configuration information, generating corresponding script statements according to program configuration information, traversing program compilation files, generating script statements corresponding to program compilation files, generating execution script statements, and storing the above script statements.
[0084] In one embodiment of this application, obtaining the program compilation file includes:
[0085] Obtain the source code file to be compiled for the target application;
[0086] The source program file is compiled to generate the compiled program file.
[0087] Optionally, the source program file can include a source code file, a plug-in, a resource file, etc. In an embodiment of the present application, the source program file can be compiled by executing flutter build windows, and the generated program compilation file can be stored in the build\windows\runner\Release folder.
[0088] In an embodiment of the present application, the step of inputting the program configuration information and the program compilation file into the pre-configured script compiler to obtain the target program script of the target application can include the following steps:
[0089] Optionally, in combination with Figure 3 As shown in the figure, the pre-configured script can be executed to load the program configuration information.
[0090] According to the program configuration information, an initialization statement in the target program script can be generated.
[0091] Specifically, the configuration information can include the name, identity document (ID), and version information of the target application, and also include the name of the installation file of the target application, the output directory of the installation file, the default installation directory of the installation file, and whether to create a desktop shortcut.
[0092] After loading the program configuration information, according to the program configuration information, an initialization statement corresponding to the program configuration information can be generated, which is used to configure the installation file, such as the name of the installation file, the output directory of the installation file, the default installation directory of the installation file, and whether to create a desktop shortcut.
[0093] In addition, in combination with Figure 3 As shown in the figure, the step of generating the target program script can further include:
[0094] The pre-configured script is executed to determine the file type of the program compilation file.
[0095] According to the file type, the target program script is generated.
[0096] Specifically, the directory of the program compilation file can be traversed to determine the file type of the program compilation file, and according to the file type, a file packaging statement corresponding to the file type is generated.
[0097] For example, it is determined whether the program compilation file is a folder, if the program compilation file is of the folder type, a file packing statement for packing the folder is generated, and if the program compilation file is of the file type, a file packing statement for packing the file is generated. Optionally, the file packing statement for packing the folder can include a folder path and a folder directory, and the file packing statement for packing the file can include a file path, and the like.
[0098] In addition, in combination with Figure 3 As shown in the figure, the step of generating the target program script can further include generating a running statement.
[0099] Then, the target program script is generated according to the generated initialization statement, the file packing statement, and the running statement. It can be understood that the target program script in the embodiment of the present application can include the initialization statement, the file packing statement, and the running statement.
[0100] Optionally, the target program script can be stored in a build.iss file in a root directory corresponding to the target application program.
[0101] In addition, the target program script in the embodiment of the present application can be updated according to the update of the target application program; for example, in an embodiment of the present application, when it is detected that the program configuration information of the target application program is updated, the target program script can be updated based on the updated configuration information.
[0102] In the embodiment of the present application, the program configuration information and the program compilation file of the target application program are obtained, the program configuration information and the program compilation file are input to a preset script compiler, the target program script of the target application program is obtained, the target program script is executed, and the installation file of the target application program is generated. The script compiler can compile the program configuration information and the program compilation file of each application program by executing a preset script, generate a program script, and generate an installation file of the application program through the program script. In the embodiment of the present application, for each application program, the program configuration information and the program compilation file are obtained when the program installation file is generated, that is, the program script can be generated through the script compiler, without the need to write the program script for each application program, thereby reducing the workload of generating the program script and the installation file and improving the corresponding efficiency.
[0103] The following will be described in combination with Figure 4 The overall flow of the file generation method in the embodiment of the present application will be described.
[0104] First, program configuration information of the target application program can be written; then, the source program file of the target application program is compiled by Flutter to generate a program compiled file; a preset script is executed to generate an iss file based on the program configuration information and the program compiled file, the iss file being the target program script in the embodiment of the application; and the iss file is executed to generate an exe installation package of the target application program.
[0105] The embodiment of the application provides a file generation device, as shown in the figure, the file generation device 50 can include an acquisition module 501, a generation module 502 and an execution module 503, wherein, Figure 5
[0106] The acquisition module 501 is configured to acquire program configuration information and a program compiled file of a target application program; the program compiled file is generated based on a source program file of the target application program;
[0107] The generation module 502 is configured to input the program configuration information and the program compiled file into a preset script compiler to obtain a target program script of the target application program; wherein the script compiler executes a preset script, compiles the program configuration information and the program compiled file, and generates the target program script;
[0108] The execution module 503 is configured to execute the target program script to generate an installation file of the target application program.
[0109] In an embodiment of the application, the method further includes a configuration module configured to, before the acquisition module acquires the program configuration information and the program compiled file of the target application program,
[0110] generate the preset script according to a preset compilation process; wherein the compilation process includes a process of compiling the program configuration information and the program compiled file;
[0111] configure the script compiler based on the preset script;
[0112] In an embodiment of the application, the acquisition module is specifically configured to:
[0113] acquire a source program file to be compiled of the target application program;
[0114] compile the source program file to generate the program compiled file.
[0115] In an embodiment of the application, the generation module is specifically configured to:
[0116] execute the preset script to load the program configuration information;
[0117] According to the program configuration information, an initialization statement in the target program script is generated.
[0118] In an embodiment of the present application, the generating module is specifically configured to:
[0119] The preset script is executed to determine a file type of the program compilation file;
[0120] According to the file type, the target program script is generated.
[0121] In an embodiment of the present application, the generating module is specifically configured to:
[0122] According to the file type, a file packaging statement corresponding to the file type is generated;
[0123] The target program script comprises the file packaging statement.
[0124] In an embodiment of the present application, the generating module is specifically configured to:
[0125] A running statement is generated; and the program installation script comprises the running statement.
[0126] In an embodiment of the present application, the apparatus further comprises an updating module configured to, when detecting that the program configuration information of the target application program is updated, update the target program script based on the updated configuration information.
[0127] In an embodiment of the present application, the program configuration information comprises at least one of:
[0128] a name of the target application program, an identification number of the target application program, version information of the target application program, a name of an installation file of the target application program, an output directory of the installation file, a default installation directory of the installation file, and whether to create a desktop shortcut.
[0129] The apparatus of the embodiments of the present application can execute the method provided by the embodiments of the present application, the implementation principles of which are similar. The actions performed by each module in the apparatus of the embodiments of the present application are corresponding to the steps in the method of the embodiments of the present application. The detailed function description of each module of the apparatus can be referred to the description of the corresponding method in the foregoing description, and will not be repeated here.
[0130] In the embodiment of the present application, the program configuration information and the program compiling file of the target application program are acquired, the program configuration information and the program compiling file are input into a preset script compiler, the target program script of the target application program is obtained, the target program script is executed, and the installation file of the target application program is generated. The script compiler can compile the program configuration information and the program compiling file of each application program by executing a preset script, generate a program script, and generate the installation file of the application program through the program script. In the embodiment of the present application, for each application program, the program configuration information and the program compiling file are acquired when the program installation file is generated, the program script can be generated through the script compiler, and the program script of each application program does not need to be written separately, thereby reducing the workload of generating the program script and the installation file and improving the corresponding efficiency.
[0131] The electronic device provided in the embodiment of the present application comprises a memory and a processor, and at least one program stored in the memory and used for being executed by the processor to realize the following technical effects compared with the prior art:
[0132] In the embodiment of the present application, the program configuration information and the program compiling file of the target application program are acquired, the program configuration information and the program compiling file are input into a preset script compiler, the target program script of the target application program is obtained, the target program script is executed, and the installation file of the target application program is generated. The script compiler can compile the program configuration information and the program compiling file of each application program by executing a preset script, generate a program script, and generate the installation file of the application program through the program script. In the embodiment of the present application, for each application program, the program configuration information and the program compiling file are acquired when the program installation file is generated, the program script can be generated through the script compiler, and the program script of each application program does not need to be written separately, thereby reducing the workload of generating the program script and the installation file and improving the corresponding efficiency.
[0133] In an optional embodiment, an electronic device is provided, which comprises Figure 6 As shown in Figure 6 The electronic device 4000 shown in the embodiment comprises a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, through a bus 4002. Optionally, the electronic device 4000 can further comprise a transceiver 4004, which can be used for data interaction, such as data transmission and / or data reception, between the electronic device and other electronic devices. It should be noted that in actual application, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0134] The processor 4001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in connection with the disclosure. The processor 4001 can also be a combination of computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0135] The bus 4002 can include a path for transmitting information between the above-mentioned components. The bus 4002 can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, Figure 6 In the figure, only one thick line is used, but it does not mean that there is only one bus or only one type of bus.
[0136] The memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, an optical disk storage (including a compact disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but not limited to this.
[0137] The memory 4003 is configured to store application code (computer program) for implementing the scheme of the present application, and the processor 4001 is configured to control the execution. The processor 4001 is configured to execute the application code stored in the memory 4003 to implement the content shown in the foregoing method embodiments.
[0138] The electronic device includes, but is not limited to, a mobile phone, a notebook computer, a multimedia player, a desktop computer, and the like.
[0139] The computer readable storage medium of the embodiment of the present application stores a computer program, and when the computer program is run on a computer, the computer can execute the corresponding content in the foregoing method embodiments.
[0140] In the embodiment of the present application, the program configuration information and the program compilation file of the target application program are obtained, the program configuration information and the program compilation file are input into a preset script compiler, the target program script of the target application program is obtained, the target program script is executed, and the installation file of the target application program is generated. The script compiler can compile the program configuration information and the program compilation file of each application program by executing a preset script to generate a program script, so as to generate the installation file of the application program through the program script. In the embodiment of the present application, for each application program, the program configuration information and the program compilation file are obtained when the program installation file is generated, that is, the program script can be generated by the script compiler, without the need to write the program script for each application program, thereby reducing the workload of generating the program script and the installation file and improving the corresponding efficiency.
[0141] The terms "first", "second", "third", "fourth", "1", "2", and the like (if any) in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described.
[0142] It should be understood that although each operation step in the flowchart of the embodiments of the present application is indicated by an arrow, the implementation order of the steps is not limited to the order indicated by the arrow. Unless explicitly stated herein, in some implementation scenarios of the embodiments of the present application, the implementation steps in each flowchart can be executed in other orders as required. In addition, part or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on the actual implementation scenario. Part or all of these sub-steps or stages can be executed at the same time, and each of these sub-steps or stages can also be executed at different times. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured as required, and the embodiments of the present application do not limit this.
[0143] The above is only an optional implementation of some implementation scenarios of the present application. It should be pointed out that, for ordinary skilled persons in the technical field, other similar implementation means based on the technical idea of the present application without departing from the technical concept of the present application also belong to the protection scope of the embodiments of the present application.
Claims
1. A method for generating a file, characterized in that, include: Obtain the program configuration information and program compilation files of the target application; the program compilation files are generated based on the source program files of the target application. The program configuration information and the program compilation file are input into a preset script compiler to obtain the target program script of the target application; wherein, the script compiler executes a preset script to compile the program configuration information and the program compilation file to generate the target program script; Execute the target program script to generate the installation file for the target application; Before obtaining the program configuration information and program compilation files of the target application, the method further includes: The preset script is generated according to a preset compilation process; wherein, the compilation process includes a process of compiling the program configuration information and the program compilation file; Based on the pre-set script, the script compiler is configured; wherein the script compiler is configured with a pre-set script, which is written based on the process of compiling the program configuration information and the program compilation file; the process of compiling the program configuration information and the program compilation file includes the steps of reading the program configuration information, generating corresponding script statements according to the program configuration information, traversing the program compilation file, generating script statements corresponding to the program compilation file, generating execution script statements, and storing the above script statements.
2. The file generation method according to claim 1, characterized in that, Obtaining the compiled program file includes: Obtain the source code file to be compiled for the target application; The source program file is compiled to generate the compiled program file.
3. The file generation method according to claim 1, characterized in that, The step of inputting the program configuration information and the program compilation file into a pre-configured script compiler to obtain the target program script of the target application includes: Execute the preset script to load the program configuration information; Based on the program configuration information, generate the initialization statements in the target program script.
4. The file generation method according to claim 1, characterized in that, The step of inputting the program configuration information and the program compilation file into a pre-configured script compiler to obtain the target program script of the target application includes: Execute the preset script to determine the file type of the program compilation file; Generate the target program script based on the file type.
5. The file generation method according to claim 4, characterized in that, The step of generating the target program script based on the file type includes: Generate a file packaging statement corresponding to the file type based on the file type; The target program script includes the file packaging statement.
6. The file generation method according to claim 4, characterized in that, The method further includes: Generate execution statements; the target program script includes the execution statements.
7. The file generation method according to claim 1, characterized in that, The method further includes: When an update to the program configuration information of the target application is detected, the target program script is updated based on the updated configuration information.
8. The file generation method according to claim 1, characterized in that, The program configuration information includes at least one of the following: The name of the target application; the identifier of the target application; the version information of the target application; the name of the installation file generated from the target application; the output directory of the installation file; the default installation directory of the installation file; Create a desktop shortcut.
9. A document generation device, characterized in that, include: The acquisition module is used to acquire the program configuration information and program compilation files of the target application; the program compilation files are generated based on the source program files of the target application. A generation module is used to input the program configuration information and the program compilation file into a preset script compiler to obtain the target program script of the target application; wherein, the script compiler executes a preset script to compile the program configuration information and the program compilation file to generate the target program script; An execution module is used to execute the target program script and generate the installation file of the target application. A configuration module is used to generate a preset script according to a preset compilation process; wherein the compilation process includes a process of compiling the program configuration information and the program compilation file; and to configure the script compiler based on the preset script; wherein the script compiler is configured with a preset script, which is written based on the process of compiling the program configuration information and the program compilation file; the process of compiling the program configuration information and the program compilation file includes the steps of reading the program configuration information, generating corresponding script statements according to the program configuration information, traversing the program compilation file, generating script statements corresponding to the program compilation file, generating execution script statements, and storing the above script statements.
10. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the file generation method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the file generation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Program compiling method and device, electronic equipment and readable storage medium
CN112882694A
Android application program packaging method and device, equipment and storage medium
CN114610318A