A resource index file compiling method and device

By filtering and compiling resource index files, the problems of wasted storage space and slow compilation speed caused by duplicate resource index information are solved, and a more efficient resource index file compilation process is achieved.

CN114706587BActive Publication Date: 2025-10-24DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210243143.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-11
Publication Date
2025-10-24
Estimated Expiration
2042-03-11

AI Technical Summary

Technical Problem

In Android application development, different modules may use the same resource files, resulting in resource index information being duplicated in multiple R files, which slows down the compression and disk writing process of R files.

Method used

By selecting the target resource index file and generating a second resource index file containing all resource index information based on the target resource index file and resource index information, only the second resource index file and other index files are compiled to generate the first executable file.

Benefits of technology

The storage space occupied by the first executable file is reduced, and the compression and disk writing speed are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114706587B_ABST
    Figure CN114706587B_ABST
Patent Text Reader

Abstract

The present disclosure provides a resource index file compiling method and device, which screens a target resource index file, generates a second resource index file containing all resource index information based on the target resource index file and resource index information, and then compiles the second resource index file and other first resource index files except the target index file, so that only the executable file corresponding to the second resource index file stores resource index information in the first executable file obtained after the compilation, thereby reducing the storage space occupied by the first executable file, improving the speed of compressing the first executable file and the speed of writing the first executable file to the disk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for compiling a resource index file. Background Art

[0002] An Android application usually needs to include resource files and source code. The source code needs to access the resource files needed through resource indexes. The resource index is usually stored in the installation package file of the Android application in the form of a resource index file. The resource index file is also called an R file and records information related to resource symbols (R symbols).

[0003] In development scenarios, it's often necessary to compile a plain text file (R.txt) containing resource index information into a source file (R.java) that conforms to Java source code syntax. This R.java file is then compiled into a bytecode file (R.class) recognizable by the Android system. The R.class file can then be compressed into an R.jar file and used in the compilation of other source code. Because an application's source code contains multiple modules, a corresponding R file must be generated for each module. However, different modules may use the same resource files, causing the resource index information for a single resource file to exist in multiple R files. This results in a large number of duplicate fields in the generated R files, slowing down the R file compression process and disk writing. Summary of the Invention

[0004] The embodiments of the present disclosure at least provide a method and device for compiling a resource index file.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for compiling a resource index file, comprising:

[0006] Obtaining a first resource index file corresponding to each functional module in a target application, and resource index information corresponding to the target application; the first resource index file includes identification information of resource files required by the functional modules; the resource index information includes identification information of each resource file in the target application and location information corresponding to each resource file;

[0007] Filtering a target resource index file from the first resource index file;

[0008] Based on the target resource index file and the resource index information, a second resource index file corresponding to the target application is generated; the second resource index file includes identification information of each resource file in the target application and location information corresponding to each resource file;

[0009] The second resource index file and the other first resource index files except the target resource index file are compiled to generate a first executable file; the first executable file is used to provide resource index information for the target application.

[0010] In an optional implementation, the obtaining of the first resource index file corresponding to at least one function module in the target application comprises:

[0011] The identification information of the resource files required by each function module in the target application is obtained.

[0012] For each function module, the initial resource index file corresponding to the function module is generated based on the identification information of the resource files required by the function module.

[0013] The target initial resource index file is filtered from the initial resource index files.

[0014] The target code for inheriting data in the target initial resource index file is added to the other initial index resource files except the target initial index resource file.

[0015] The initial resource index files to which the target code is added and the target initial resource index file are taken as the first resource index files.

[0016] In an optional implementation, the filtering of the target resource index file from the first resource index files comprises:

[0017] The target initial resource index file is filtered from the first resource index files, and the target initial resource file filtered is taken as the target resource index file.

[0018] In an optional implementation, the compiling of the second resource index file and the other first resource index files except the target resource index file to generate a first executable file comprises:

[0019] The second resource index file is compiled to obtain a second executable file corresponding to the second resource index file;

[0020] The other first resource index files are compiled to obtain third executable files corresponding to the other first resource index files;

[0021] The first executable file is generated based on the second executable file and the third executable files.

[0022] In an alternative implementation, the second executable file and the third executable file are bytecode files; and the generating the first executable file based on the first executable file and the second executable file comprises:

[0023] The second executable file and the third executable file written in bytecode are compressed to obtain the first executable file.

[0024] In an alternative implementation, the generating the second resource index file corresponding to the target application based on the target resource index file and the resource index information comprises:

[0025] The resource index information is written into the target resource index file to generate the second resource index file.

[0026] In an alternative implementation, the method further comprises:

[0027] obtaining a to-be-compiled file of the target application;

[0028] generating an installation package of the target application based on the first executable file and the to-be-compiled file of the target application.

[0029] In a second aspect, the embodiments of the present disclosure further provide a resource index file compiling apparatus, comprising:

[0030] an obtaining module configured to obtain a first resource index file corresponding to each functional module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the functional module; and the resource index information contains identification information of each resource file in the target application and position information corresponding to each resource file;

[0031] a screening module configured to screen a target resource index file from the first resource index file;

[0032] a first generating module configured to generate a second resource index file corresponding to the target application based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and position information corresponding to each resource file;

[0033] a second generating module configured to compile the second resource index file and other first resource index files except the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

[0034] In an alternative implementation, the obtaining module, when obtaining the first resource index file corresponding to at least one function module in the target application, is configured to:

[0035] obtain identification information of resource files required by each function module in the target application;

[0036] generate an initial resource index file corresponding to each function module based on the identification information of the resource files required by the function module;

[0037] select a target initial resource index file from the initial resource index files;

[0038] add a target code for inheriting data in the target initial resource index file to initial resource index files other than the target initial resource index file;

[0039] use the initial resource index files to which the target code is added and the target initial resource index file as the first resource index file.

[0040] In an alternative implementation, the selecting module, when selecting the target resource index file from the first resource index file, is configured to:

[0041] select the target initial resource index file from the first resource index file, and use the target initial resource file selected as the target resource index file.

[0042] In an alternative implementation, the second generating module, when compiling the second resource index file and the first resource index files other than the target resource index file to generate the first executable file, is configured to:

[0043] compile the second resource index file to obtain a second executable file corresponding to the second resource index file;

[0044] compile the first resource index files other than the target resource index file to obtain third executable files corresponding to the first resource index files other than the target resource index file;

[0045] generate the first executable file based on the second executable file and the third executable files.

[0046] In an alternative implementation, the second executable file and the third executable file are bytecode files; and the second generating module, when generating the first executable file based on the first executable file and the second executable file, is configured to:

[0047] The second executable file and the third executable file written by bytecodes are compressed to obtain the first executable file.

[0048] In an optional implementation, the first generating module generates a second resource index file corresponding to the target application based on the target resource index file and the resource index information, for:

[0049] The resource index information is written into the target resource index file to generate the second resource index file.

[0050] In an optional implementation, the apparatus further includes a third generating module configured to:

[0051] Obtain a to-be-compiled file of the target application;

[0052] Generate an installation package of the target application based on the first executable file and the to-be-compiled file of the target application.

[0053] In a third aspect, the embodiments of the present disclosure further provide an electronic device, including a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.

[0054] In a fourth aspect, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.

[0055] The resource index file compiling method and device provided by the embodiments of the present disclosure first acquire a first resource index file corresponding to each function module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the function module; the resource index information contains identification information of each resource file in the target application and position information corresponding to each resource file; then, a target resource index file is screened out from the first resource index file; subsequently, a second resource index file corresponding to the target application is generated based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and position information corresponding to each resource file; finally, the second resource index file and other first resource index files except the target resource index file are compiled to generate a first executable file; the first executable file is used to provide resource index information for the target application. The embodiments of the present disclosure filter out the target resource index file, generate the second resource index file containing all resource index information based on the target resource index file and the resource index information, and then compile the second resource index file and other first resource index files except the target index file, so that only the executable file corresponding to the second resource index file in the first executable file obtained after the compilation stores the resource index information, the storage space occupied by the first executable file is reduced, and the speed of compressing the first executable file and the speed of writing the first executable file to the disk are improved.

[0056] In order to make the above objectives, characteristics and advantages of the present disclosure more apparent, clear and easy to understand, the following will describe preferred embodiments in detail, and the accompanying drawings will be described as follows. BRIEF DESCRIPTION OF DRAWINGS

[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments. The drawings herein are incorporated into the description and form a part of the description, which show the embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the description. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be considered as a limitation to the scope, and other related drawings can also be obtained by those skilled in the art without any creative effort.

[0058] Figure 1 A flow chart of a resource index file compiling method provided by the embodiments of the present disclosure is shown;

[0059] Figure 2 A flow chart of another resource index file compiling method provided by the embodiments of the present disclosure is shown;

[0060] Figure 3 A schematic diagram of a resource index file compiling device provided by an embodiment of the present disclosure is shown;

[0061] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.

[0063] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.

[0064] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.

[0065] Research has found that since the application source code contains multiple functional modules, a corresponding R file needs to be generated for each module. However, different modules may use the same resource file, resulting in the resource index information of the same resource file existing in multiple R files. As a result, a large number of duplicate fields exist in the generated R files, making the R file compression process and disk writing process slower.

[0066] Based on the above research, the present disclosure provides a resource index file compiling method and device, by screening out the target resource index file, and based on the target resource index file and the resource index information, a second resource index file containing all resource index information is generated, and then the second resource index file and other first resource index files except the target index file are compiled, so that in the first executable file obtained after compilation, only the executable file corresponding to the second resource index file stores the resource index information, reducing the storage space occupied by the first executable file, thereby improving the speed of compressing the first executable file and the speed of writing the first executable file to the disk.

[0067] In order to facilitate the understanding of the present embodiment, first, a resource index file compiling method disclosed by the present embodiment is introduced in detail, and the execution subject of the resource index file compiling method provided by the present embodiment is generally a computer device with certain computing power. In some possible implementation manners, the resource index file compiling method can be realized by calling the computer readable instructions stored in the memory by the processor.

[0068] Referring to Figure 1 The resource index file compiling method provided by the present embodiment is shown in the flowchart, and the method comprises steps S101-S104, wherein:

[0069] S101, obtaining the first resource index file corresponding to each function module in the target application and the resource index information corresponding to the target application; the first resource index file contains the identification information of the resource file required by the function module; the resource index information contains the identification information of each resource file in the target application and the position information corresponding to each resource file.

[0070] The target application can be an Android application, and its storage form can be source code to be compiled. The target application can contain multiple function modules, and each function module is relatively independent. Each function module contains source code and a corresponding first resource index file. Before the resource index file is compiled, the first resource index file of each function module only contains the identification information of the resource file required by the function module, and does not include the position information of the resource file. If the first resource index file at this time is directly compiled, it cannot provide resource index information for the target application. The resource index information of the target application needs to be written into each first resource index file. In order to reduce the size of the first resource index file, only the resource index information required by each function module can be written into the corresponding first resource index file.

[0071] For example, there are resource index information of resource A, resource B, resource C and resource D, function module a needs resource index information of resource A, resource B and resource C, function module b needs resource index information of resource B, resource C and resource D, and function module c needs resource index information of resource C and resource D. Generally, the resource index information required by each function module is written into the corresponding first resource index file, which causes the resource index information of resource B and resource D to exist in the first resource index files of function module b and function module c at the same time, and the resource index information of resource C exists in the first resource index files of function module a, function module b and function module c at the same time. It can be seen that the same resource index information is written into different first index files multiple times, which causes the first index file to occupy a large amount of storage space in the whole, and there is a large amount of repeated information, which also limits the running speed of the target application to a certain extent.

[0072] Therefore, the first resource index file can be generated by the following steps:

[0073] Obtain the identification information of the resource files required by each function module in the target application;

[0074] For each function module, generate an initial resource index file corresponding to the function module based on the identification information of the resource files required by the function module;

[0075] Filter the target initial resource index file from the initial resource index file;

[0076] Add a target code for inheriting data in the target initial resource index file to other initial index resource files except the target initial index resource file;

[0077] The initial resource index file after adding the target code and the target initial resource index file are used as the first resource index file.

[0078] The identification information of the resource files required by each function module in the target application can be obtained by analyzing R.txt file, package aware file of each function module, etc. Then, the initial resource index file corresponding to each function module is generated. The initial resource index file can be an R file in the initial state or a java file conforming to the java language specification. In the initial resource index file, various logical codes required by the resource index file and the identification information of the resource files required by the function module can be included.

[0079] S102, filter the target resource index file from the first resource index file.

[0080] In the step, a target resource index file can be filtered from the first resource index file. The first resource index file can be an R file generated for the function module. Since most application programs have a main R file, the first resource index file of the main R file can be selected as the target resource index file.

[0081] In S103, a second resource index file corresponding to the target application is generated based on the target resource index file and the resource index information. The second resource index file contains the identification information of each resource file in the target application and the location information corresponding to each resource file.

[0082] After the target resource index file is determined, the resource index information can be written into the target resource index file. The file after the resource index information is written is the second resource index file. Since the resource index information is written into the second resource index file, the second resource index file contains the identification information of each resource file in the target application and the location information corresponding to each resource file. The identification information of each resource file and the location information corresponding to each resource file exist only in one copy.

[0083] In this way, the second resource index file containing all resource index information and the first resource index file containing only the resource file identification information required by each function module can be obtained. In all resource index files, there is no identical resource index information, and the resource index information does not need to be allocated to each first resource index file. The time required for compiling the resource index file is reduced, and the total storage space occupied by the resource index file is lower.

[0084] It should be noted that, in order to reduce the repeated information of the first resource index file, the resource index information can not be written into each first resource index file, but can be written into one first resource index file, i.e., the second resource index file. However, if the first resource index file without the resource index information is to have the function of the resource index file, the resource index information is also required. Therefore, the target code for inheriting the data in the target initial resource index file can be added to the other initial resource index files, so that the other initial resource index files can inherit the data in the target initial resource index file. After the resource index information is written into the target initial resource index file, i.e., the target resource index file, the other initial resource index files, i.e., the first resource index files other than the target resource index file, can inherit the resource index information in the target resource index file, thereby realizing the function of the resource index file.

[0085] S104, compiling the second resource index file and the other first resource index files except the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

[0086] After the second resource index file is obtained, the second resource index file and the other first resource index files except the target resource index file can be compiled to generate a first executable file.

[0087] Specifically, the second resource index file and each of the first resource index files except the target resource index file can be compiled to obtain a second executable file generated by compiling the second resource index file and a third executable file generated by compiling the first resource index file. Then, the second executable file and the third executable file can be compressed to generate the first executable file.

[0088] The second executable file and the third executable file can be class files, and the first executable file can be a jar file. The class file is a binary file (written by bytecode) that can run on any hardware platform and operating system supporting the Java virtual machine. The jar file is a file in a compressed package format, and R.class is compressed.

[0089] After the first executable file is obtained, the to-be-compiled file of the target application can be obtained, and the to-be-compiled file can be compiled to obtain an executable file corresponding to the to-be-compiled file. Then, the obtained executable file and the first executable file are packaged to obtain an installation package of the target application.

[0090] Referring to FIG. 6, Figure 2 As shown in FIG. 6, another resource index file compiling method provided by the embodiment of the present disclosure is provided. The method first reads resource index information in an R.txt file and an aware file, and then generates each first resource index file and a second resource index file according to the read resource index information. The first resource index file can be a lib1 R file and a lib2 R file, and the target second resource index file can be a main R file. The second resource index file contains resource index information read from the R.txt file, and the first resource index file can inherit the resource index information in the second resource index file. After the resource index file is obtained, each first resource index file and the second resource index file can be compressed to obtain an R file of the target application.

[0091] The resource index file compiling method and device provided by the embodiments of the present disclosure first acquire a first resource index file corresponding to each function module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the function module; the resource index information contains identification information of each resource file in the target application and position information corresponding to each resource file; then, a target resource index file is screened out from the first resource index file; subsequently, a second resource index file corresponding to the target application is generated based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and position information corresponding to each resource file; finally, the second resource index file and other first resource index files except the target resource index file are compiled to generate a first executable file; the first executable file is used to provide resource index information for the target application. The embodiments of the present disclosure filter out the target resource index file, generate the second resource index file containing all resource index information based on the target resource index file and the resource index information, and then compile the second resource index file and other first resource index files except the target index file, so that only the executable file corresponding to the second resource index file in the first executable file obtained after the compilation stores the resource index information, the storage space occupied by the first executable file is reduced, and the speed of compressing the first executable file and the speed of writing the first executable file to the disk are improved.

[0092] Those skilled in the art can understand that, in the above method of the specific implementation, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process, and the specific execution order of each step should be determined according to its function and possible internal logic.

[0093] Based on the same inventive concept, the embodiments of the present disclosure also provide a resource index file compiling device corresponding to the resource index file compiling method. Since the principle of solving problems by the device in the embodiments of the present disclosure is similar to the above-mentioned resource index file compiling method, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0094] Referring to Figure 3 As shown in FIG. 1, a resource index file compiling device provided by the embodiments of the present disclosure includes:

[0095] obtain a first resource index file corresponding to each function module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the function module; the resource index information contains identification information of each resource file in the target application and location information corresponding to each resource file;

[0096] a screening module configured to screen a target resource index file from the first resource index file;

[0097] a first generating module configured to generate a second resource index file corresponding to the target application based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and location information corresponding to each resource file;

[0098] a second generating module configured to compile the second resource index file and other first resource index files except the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

[0099] In an optional implementation, when the obtaining module 310 obtains the first resource index file corresponding to at least one function module in a target application, the obtaining module 310 is configured to:

[0100] obtain identification information of resource files required by each function module in the target application;

[0101] for each function module, generate an initial resource index file corresponding to the function module based on the identification information of resource files required by the function module;

[0102] screen a target initial resource index file from the initial resource index file;

[0103] add a target code for inheriting data in the target initial resource index file to other initial index resource files except the target initial index resource file;

[0104] use the initial resource index file to which the target code is added and the target initial resource index file as the first resource index file.

[0105] In an optional implementation, when the screening module 320 screens a target resource index file from the first resource index file, the screening module 320 is configured to:

[0106] screen the target initial resource index file from the first resource index file, and use the target initial resource file screened to be the target resource index file.

[0107] In an optional implementation, when the second generating module 340 compiles the second resource index file and other first resource index files except the target resource index file to generate the first executable file, it is configured to:

[0108] Compiling the second resource index file to obtain a second executable file corresponding to the second resource index file;

[0109] Compiling the other first resource index files except the first resource index files to obtain third executable files corresponding to the other first resource index files;

[0110] A first executable file is generated based on the second executable file and the third executable file.

[0111] In an optional implementation, the second executable file and the third executable file are bytecode files; when the second generation module 340 generates the first executable file based on the first executable file and the second executable file, it is configured to:

[0112] The second executable file and the third executable file written in bytecode are compressed to obtain the first executable file.

[0113] In an optional implementation, the first generation module 330 generates a second resource index file corresponding to the target application based on the target resource index file and the resource index information, for:

[0114] The resource index information is written into the target resource index file to generate the second resource index file.

[0115] In an optional implementation, the apparatus further includes a third generating module, configured to:

[0116] Obtaining the target application's files to be compiled;

[0117] An installation package of the target application is generated based on the first executable file and the files to be compiled of the target application.

[0118] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0119] Corresponding to Figure 1 The resource index file compilation method in the present disclosure embodiment also provides an electronic device 400, such as Figure 4 FIG. 4 is a schematic diagram of the structure of an electronic device 400 provided in an embodiment of the present disclosure, including:

[0120] The processor 41, the memory 42, and the bus 43; the memory 42 is used to store the execution instructions, including the internal memory 421 and the external memory 422; the internal memory 421 here is also called the internal memory, which is used to temporarily store the operation data in the processor 41 and the data exchanged with the external memory 422 such as a hard disk, and the processor 41 exchanges data with the external memory 422 through the internal memory 421; when the electronic device 400 is running, the processor 41 and the memory 42 communicate through the bus 43, so that the processor 41 executes the following instructions:

[0121] Obtain the first resource index file corresponding to each function module in the target application, and the resource index information corresponding to the target application; the first resource index file contains the identification information of the resource file required by the function module; the resource index information contains the identification information of each resource file in the target application and the position information corresponding to each resource file;

[0122] Filter the target resource index file from the first resource index file;

[0123] Based on the target resource index file and the resource index information, generate the second resource index file corresponding to the target application; the second resource index file contains the identification information of each resource file in the target application and the position information corresponding to each resource file;

[0124] Compile the second resource index file and other first resource index files except the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

[0125] In an optional implementation, the instructions executed by the processor 41, the first resource index file corresponding to at least one function module in the target application, includes:

[0126] Obtain the identification information of the resource file required by each function module in the target application;

[0127] For each function module, based on the identification information of the resource file required by the function module, generate an initial resource index file corresponding to the function module;

[0128] Filter the target initial resource index file from the initial resource index file;

[0129] Add a target code for inheriting data in the target initial resource index file to other initial index resource files except the target initial index resource file;

[0130] The initial resource index file after adding the target code and the target initial resource index file are taken as the first resource index file.

[0131] In an alternative embodiment, the instructions executed by the processor 41, wherein the target resource index file is filtered from the first resource index file, include:

[0132] The target initial resource index file is filtered from the first resource index file, and the filtered target initial resource file is taken as the target resource index file.

[0133] In an alternative embodiment, the instructions executed by the processor 41, wherein the second resource index file and the other first resource index files except the target resource index file are compiled to generate a first executable file, include:

[0134] The second resource index file is compiled to obtain a second executable file corresponding to the second resource index file;

[0135] The other first resource index files are compiled to obtain third executable files corresponding to the other first resource index files;

[0136] The first executable file is generated based on the second executable file and the third executable files.

[0137] In an alternative embodiment, the instructions executed by the processor 41, wherein the second executable file and the third executable file are bytecode files; and the first executable file is generated based on the first executable file and the second executable file, include:

[0138] The second executable file and the third executable file written by bytecode are compressed to obtain the first executable file.

[0139] In an alternative embodiment, the instructions executed by the processor 41, wherein the second resource index file corresponding to the target application is generated based on the target resource index file and the resource index information, include:

[0140] The resource index information is written into the target resource index file to generate the second resource index file.

[0141] In an alternative embodiment, the instructions executed by the processor 41 further include:

[0142] A to-be-compiled file of the target application is obtained;

[0143] Generate an installation package of the target application based on the first executable file and the to-be-compiled file of the target application.

[0144] The embodiment of the present disclosure further provides a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, the steps of the resource index file compiling method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer readable storage medium.

[0145] The embodiment of the present disclosure further provides a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the resource index file compiling method described in the above method embodiment. For details, refer to the above method embodiment, which will not be described here.

[0146] The computer program product can be specifically implemented by hardware, software or a combination thereof. In an optional embodiment, the computer program product is specifically embodied as a computer storage medium. In another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.

[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system and device can refer to the corresponding process in the foregoing method embodiment, which will not be described here. In several embodiments provided by the present disclosure, it should be understood that the disclosed system, device and method can be implemented by other ways. The above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can be another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.

[0148] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0149] In addition, each function unit in various embodiments of the present disclosure can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0150] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0151] Finally, it should be noted that: the above-described embodiments are merely specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limit them. The protection scope of the present disclosure is not limited thereto, although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: any person skilled in the art within the technical range disclosed by the present disclosure, can still modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A resource index file compiling method, characterized by, The method comprises the following steps: obtaining a first resource index file corresponding to each functional module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the functional module; the resource index information contains identification information of each resource file in the target application and position information corresponding to each resource file; screening a target resource index file from the first resource index file; generating a second resource index file corresponding to the target application based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and position information corresponding to each resource file, and a target code for inheriting data in the target resource index file is added to other first resource index files except the target resource index file; compiling the second resource index file and other first resource index files except the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

2. The method of claim 1, wherein, The method comprises the following steps: obtaining identification information of resource files required by each functional module in the target application; generating an initial resource index file corresponding to each functional module based on the identification information of resource files required by the functional module; screening a target initial resource index file from the initial resource index file; adding a target code for inheriting data in the target initial resource index file to other initial index resource files except the target initial index resource file; the initial resource index file after adding the target code and the target initial resource index file are used as the first resource index file.

3. The method of claim 2, wherein, The method comprises the following steps: screening the target initial resource index file from the first resource index file, and taking the screened target initial resource file as the target resource index file.

4. The method of claim 1, wherein, The method comprises the following steps: compiling the second resource index file to obtain a second executable file corresponding to the second resource index file; compiling the other first resource index files to obtain third executable files corresponding to the other first resource index files; generating a first executable file based on the second executable file and the third executable files.

5. The method of claim 4, wherein, The second executable file and the third executable file are bytecode files; the method comprises the following steps: compressing the second executable file and the third executable file written in bytecode to obtain the first executable file.

6. The method of claim 1, wherein, The generating the second resource index file corresponding to the target application based on the target resource index file and the resource index information comprises: writing the resource index information into the target resource index file to generate the second resource index file.

7. The method of claim 1, wherein, The method further comprises: obtaining a to-be-compiled file of the target application; generating an installation package of the target application based on the first executable file and the to-be-compiled file of the target application.

8. A resource index file compiling apparatus characterized by comprising: comprise: an obtaining module, configured to obtain a first resource index file corresponding to each functional module in a target application and resource index information corresponding to the target application; the first resource index file contains identification information of resource files required by the functional module; the resource index information contains identification information of each resource file in the target application and position information corresponding to each resource file; a screening module, configured to screen a target resource index file from the first resource index file; a first generating module, configured to generate a second resource index file corresponding to the target application based on the target resource index file and the resource index information; the second resource index file contains identification information of each resource file in the target application and position information corresponding to each resource file, and a target code for inheriting data in the target resource index file is added to each first resource index file other than the target resource index file; a second generating module, configured to compile the second resource index file and each first resource index file other than the target resource index file to generate a first executable file; the first executable file is used to provide resource index information for the target application.

9. An electronic device, comprising: comprise: a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to execute the steps of the resource index file compilation method in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to execute the steps of the resource index file compilation method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • File loading method and device, computing equipment and storage medium

    CN109901874A

  • Application updating method and device, storage medium, terminal and server

    CN111221559A