Information Processing Method, Apparatus, Computing Device, and Medium
By obtaining the class information of the class file during the application packaging process and comparing it with the configuration file, identifying and deleting the redundant configuration information, the risk of crash caused by redundant configuration information in the application is solved, and the stability and efficiency of the application are improved.
Patent Information
- Application Number
- CN202110601696.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-31
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-05-31
AI Technical Summary
During the application packaging process, configuration information is prone to duplication or failure, resulting in redundant configuration information and increasing the risk of program crash.
During the compilation stage, obtain the class information of the application's class file, compare the class information with the configuration information in the configuration file, identify and delete redundant configuration information, and use a whitelist to filter the configuration information of specific class files to ensure the accuracy of the configuration file.
Effectively remove redundant configuration information, avoid the risk of crashes during program runtime, and improve application stability and efficiency.
Smart Images

Figure CN113342347B_ABST
Abstract
Description
Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] With the development of software technology, various applications have emerged, such as shopping applications, music applications, and information applications, and the functions and configurations of the applications have become more and more complex.
[0004] In order to enable the developed application to run on the terminal device, the application needs to be packaged. Taking the Android system as an example, when packaging an application running on the Android system, it is usually necessary to declare the configuration information of the application, such as component information, through a configuration file, such as an XML format configuration file. Summary of the invention
[0005] However, in the above technical solution, since there is a lot of configuration information of the application, it is easy to have the configuration information repeated or invalid.
[0006] Therefore, an improved information processing method is needed to meet the high-concurrency data processing requirements.
[0007] In this context, embodiments of the present disclosure are intended to provide an information processing method, an information processing apparatus, a computing device, and a medium.
[0008] In a first aspect of an embodiment of the present disclosure, an information processing method is provided, comprising: in a compilation stage of converting multiple class files of an application into an executable file, obtaining a configuration file of the application, the configuration file including configuration information corresponding to the multiple class files of the application; obtaining class information of each class file in the multiple class files of the application; and determining whether there is redundant configuration information in the configuration file based on the class information and the configuration information.
[0009] According to the first aspect, in some example embodiments, determining whether there is redundant configuration information in the configuration file based on the class information and the configuration information includes: based on the class information, searching the configuration file for the configuration information of the class file corresponding to the class information; if the configuration information of the class file corresponding to the class information is found, filtering out the found configuration information from the configuration file; after searching for the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration file, using the remaining configuration information as a redundant configuration information set.
[0010] According to a first aspect, in some example embodiments, determining whether there is redundant configuration information in the configuration file based on the class information and the configuration information includes: converting the configuration information in the configuration file into a set of configuration information; based on the class information, looking up the configuration information of the class file corresponding to the class information in the set of configuration information; if the configuration information of the class file corresponding to the class information is found, screening out the found configuration information from the set of configuration information; after looking up the configuration information corresponding to the multiple class files, if there is remaining configuration information in the set of configuration information, using the set of configuration information including the remaining configuration information as a redundant configuration information set.
[0011] According to a first aspect, in some example embodiments, the method further includes: determining whether each target configuration information in the redundant configuration information set belongs to a whitelist, where the whitelist includes the configuration information of class files that do not exist during the compilation phase but exist during the runtime of the application; if it belongs to the whitelist, removing the target configuration information from the redundant configuration information set.
[0012] According to a first aspect, in some example embodiments, determining whether each target configuration information in the redundant configuration information set belongs to a whitelist includes: reading the configuration information of the class files in the whitelist; matching the target configuration information in the redundant configuration information set with the read configuration information, and determining whether the target configuration information belongs to the whitelist based on the matching result.
[0013] According to a first aspect, in some example embodiments, the format of the whitelist is the domain-specific language DSL format.
[0014] According to a first aspect, in some example embodiments, the method further includes: if it is determined that there is redundant configuration information in the configuration file, stopping the packaging process of the application and issuing a warning message; if it is determined that there is no redundant configuration information in the configuration file, performing the packaging process on the application.
[0015] According to a first aspect, in some example embodiments, the method further includes: obtaining the file configuration information of multiple file sources of the application; performing a merging process on the file configuration information of the multiple file sources to generate the configuration file of the application.
[0016] According to a first aspect, in some example embodiments, the method further includes: performing a verification process on the merged configuration file of the application to determine whether the configuration file includes the file configuration information of each of the file sources.
[0017] According to a first aspect, in some example embodiments, obtaining class information of each class file among the multiple class files of the application includes: obtaining class information of each class file among the multiple class files of the application in a callback manner.
[0018] In a second aspect of the embodiments of the present disclosure, an information processing apparatus is provided, including: a configuration information obtaining module, configured to obtain a configuration file of the application during a compilation stage of converting multiple class files of the application into an executable file, where the configuration file includes configuration information corresponding to the multiple class files of the application; a class information obtaining module, configured to obtain class information of each class file among the multiple class files of the application; and a redundant information determining module, configured to determine whether there is redundant configuration information in the configuration file based on the class information and the configuration information.
[0019] According to the second aspect, in some example embodiments, the redundant information determining module is further configured to: based on the class information, search in the configuration file for configuration information of the class file corresponding to the class information; if the configuration information of the class file corresponding to the class information is found, then screen out the found configuration information from the configuration file; after searching for the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration file, then use the remaining configuration information as a redundant configuration information set.
[0020] According to the second aspect, in some example embodiments, the redundant information determining module is further configured to: convert the configuration information in the configuration file into a configuration information set; based on the class information, search in the configuration information set for configuration information of the class file corresponding to the class information; if the configuration information of the class file corresponding to the class information is found, then screen out the found configuration information from the configuration information set; after searching for the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration information set, then use the configuration information set including the remaining configuration information as a redundant configuration information set.
[0021] According to the second aspect, in some example embodiments, the apparatus further includes: a whitelist determining module, configured to determine whether each target configuration information in the redundant configuration information set belongs to a whitelist, where the whitelist includes configuration information of class files that do not exist during the compilation stage but exist during the running of the application; and a whitelist removing unit, configured to, if it belongs to the whitelist, remove the target configuration information from the redundant configuration information set.
[0022] According to a second aspect, in some exemplary embodiments, the whitelist determination module is further configured to: read the configuration information of the class files in the whitelist; match the target configuration information in the redundant configuration information set with the read configuration information, and determine whether the target configuration information belongs to the whitelist based on the matching result.
[0023] According to a second aspect, in some exemplary embodiments, the format of the whitelist is a domain-specific language (DSL) format.
[0024] According to a second aspect, in some exemplary embodiments, the apparatus further includes: a warning processing module, configured to stop the packaging process of the application program and issue a warning message if it is determined that there is redundant configuration information in the configuration file; a packaging processing module, configured to perform a packaging process on the application program if it is determined that there is no redundant configuration information in the configuration file.
[0025] According to a second aspect, in some exemplary embodiments, the apparatus further includes: a file configuration acquisition module, configured to acquire the file configuration information of multiple file sources of the application program; a configuration file generation module, configured to perform a merging process on the file configuration information of the multiple file sources to generate a configuration file of the application program.
[0026] According to a second aspect, in some exemplary embodiments, the apparatus further includes: a verification processing module, configured to perform a verification process on the merged configuration file of the application program to determine whether the configuration file contains the file configuration information of each of the file sources.
[0027] According to a second aspect, in some exemplary embodiments, the class information acquisition module is further configured to: obtain the class information of each class file in the multiple class files of the application program through a callback method.
[0028] According to the technical solution of the embodiments of the present disclosure, on the one hand, during the packaging process of the application program, obtaining the class information of the class files of the application program can obtain the class information of the actually existing class files of the application program; on the other hand, based on the class information of the class files and the configuration information in the configuration file, determining whether there is redundant configuration information in the configuration file can obtain the redundant configuration information after screening out the actually existing class information, so as to be able to detect and delete the redundant configuration information and avoid risks such as program crashes caused by the existence of redundant configuration information during program operation.
[0029] After introducing the basic principles of the present disclosure, the following specifically introduces various non-limiting implementation manners of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present disclosure will become readily understandable. In the drawings, several embodiments of the present disclosure are shown in an exemplary rather than restrictive manner, where:
[0031] Figure 1 A schematic diagram showing an application scenario of an information processing method according to some embodiments of the present disclosure;
[0032] Figure 2 A flowchart schematically showing an information processing method according to some embodiments of the present disclosure;
[0033] Figure 3 A flowchart schematically showing an information processing method according to some other embodiments of the present disclosure;
[0034] Figure 4 A flowchart schematically showing an information processing method according to some further embodiments of the present disclosure;
[0035] Figure 5 A schematic diagram showing a computer-readable storage medium according to some embodiments of the present disclosure;
[0036] Figure 6 A schematic diagram showing the structure of an information processing device according to some embodiments of the present disclosure;
[0037] Figure 7 A schematic diagram showing the structure of a computing device according to some embodiments of the present disclosure.
[0038] In the drawings, the same or corresponding reference numerals denote the same or corresponding parts. Detailed Embodiments
[0039] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and then implement the present disclosure, and not to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to be able to fully convey the scope of the present disclosure to those skilled in the art.
[0040] Those skilled in the art know that the embodiments of the present disclosure can be implemented as a system, apparatus, device, method, or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: completely hardware, completely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0041] According to the embodiments of the present disclosure, an information processing method, apparatus, computing device, and medium are provided.
[0042] In this text, it should be understood that the terms involved:
[0043] Compilation stage: In the packaging process of an application, it includes the stage of converting the class files of the application into executable files, and this stage can also be referred to as the compilation stage or the Transform stage.
[0044] Configuration file: It can also be called a manifest file, including configuration information corresponding to multiple class files of the application. Taking an Android application as an example, the configuration file can be the AndroidManifest.xml file.
[0045] Redundant configuration information: It includes useless configuration information that has expired but not been deleted, as well as configuration information with duplicate configurations, etc.
[0046] Whitelist: The whitelist is used to filter some specific class files, and the whitelist contains the configuration information of class files that do not exist in the compilation stage but exist when the application is running.
[0047] In addition, the number of any elements in the drawings is for illustration rather than limitation, and any naming is only for distinction and does not have any limiting meaning.
[0048] Next, with reference to several representative embodiments of the present disclosure, the principles and spirit of the present disclosure will be elaborated in detail. Summary of the Invention
[0050] The inventor of the present invention found that in order to solve the problem of how to configure the configuration information of each class file of the application, in the related technical solutions, a project construction tool such as Gradle is used to configure the configuration information of the application. However, in this technical solution, due to the large amount of configuration information of the application, it is easy to have the situation of duplicate configuration information or invalid configuration information, resulting in redundant configuration information.
[0051] Based on the above content, the basic idea of the embodiments of the present disclosure is as follows: During the packaging process of the application, obtain the class information of the class files of the application, and based on the class information of the class files and the configuration information in the configuration file, determine whether there is redundant configuration information in the configuration file. On the one hand, during the packaging process of the application, obtaining the class information of the class files of the application can obtain the class information of the actually existing class files of the application; on the other hand, based on the class information of the class files and the configuration information in the configuration file, determining whether there is redundant configuration information in the configuration file can obtain the redundant configuration information after screening out the actually existing class information, so as to be able to detect and delete the redundant configuration information and avoid risks such as program crashes caused by the existence of redundant configuration information during program operation.
[0052] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure will be specifically introduced below.
[0053] Overview of Application Scenarios
[0054] It should be noted that the following application scenarios are only shown for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not restricted in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0055] Figure 1 A block diagram of an application scenario of an information processing method according to an embodiment of the present disclosure is schematically shown.
[0056] Referring to Figure 1 As shown, the application scenario may include: an application module 110, an SDK (Software Development Kit) module 120, a compiler 130, an executable file 140, and an application packaging module 150. Among them, the application module 110 includes source code 112 and resource files 114. The source code 112 includes source code for implementing various functions of the application program, such as Java code, and the resource files 114 include files in XML format such as manifest files and layout files. The SDK module 120 includes a library module 122 and an interface module 124. The library module 122 includes library files for generating the SDK, and the interface module 124 includes interface files between the SDK and third-party libraries.
[0057] The compiler 130 is used to compile the source files in the application module 110 and the SDK module 120 to generate corresponding class files, i.e., class files, and convert the class files into an executable file 140, such as a.dex file. The application packaging module 150 is used to package the executable file 140 to generate an APK (Application Package) file, and the APK file contains the compiled executable file (such as a.dex file) and a configuration file (manifest file).
[0058] It should be noted that the above application scenario is only shown for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not restricted in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0059] Exemplary Method
[0060] Next, in combination with the above application scenario, referring to Figure 2To describe an information processing method according to an exemplary embodiment of the present disclosure. The information processing method can be executed by a general computing device, which can be a device such as a tablet computer, a desktop computer, a portable notebook computer, etc.
[0061] Referring to Figure 2 As shown, in step S210, during the compilation stage of converting multiple class files of an application into an executable file, obtain the configuration file of the application, where the configuration file includes configuration information corresponding to the multiple class files of the application.
[0062] In an exemplary embodiment, in the packaging process of an application, there is a stage of converting the class files of the application into an executable file, and this stage can also be referred to as the compilation stage or the Transform stage. Taking the Android operating system as an example, in the compilation stage, multiple class files of the application, that is, class files, are converted into an executable file, that is, a dex file.
[0063] In the compilation stage, obtain the configuration file of the application from the project files of the application. The configuration file includes configuration information corresponding to the multiple class files of the application. Taking an Android application as an example, the configuration file can be the AndroidManifest.xml file, and the AndroidManifest.xml file includes the configuration information of multiple class files. Further, the configuration file can be parsed to obtain the configuration information of the multiple class files in the configuration file.
[0064] In step S220, obtain the class information of each class file among the multiple class files of the application.
[0065] In an exemplary embodiment, in the compilation stage, after the compiler compiles the source code of the application into class files, for example, compiles java code into class files, obtain the class information of each class file among the various class files of the application.
[0066] For example, in the compilation stage, the class information acquisition method can be inserted into the compilation stage by means of aspect-oriented programming, and the type of each class file can be obtained through this class information acquisition method. For example, the Gradle Transform API (Application Programming Interface) can be used to traverse and process multiple class files of the application in an aspect-oriented programming manner to obtain the class information of each class file.
[0067] In step S230, based on the class information and the configuration information, determine whether there is redundant configuration information in the configuration file.
[0068] In an exemplary embodiment, the redundant configuration information includes useless configuration information that has expired but not been deleted and configuration information with duplicate configurations. Further, based on the class information of the class file, the configuration information of the class file corresponding to the class information is searched for in the configuration file; if the configuration information of the class file corresponding to the class information is found, the found configuration information is screened out from the configuration file; after searching for the configuration information corresponding to multiple class files, if there is remaining configuration information in the configuration file, it is determined that there is redundant configuration information; if there is no configuration information in the configuration file, it is determined that there is no redundant configuration information.
[0069] For example, assume that there are two configuration information with duplicate configurations of a class file, such as the MainActivity class file, in the configuration file. If, based on the class information of the MainActivity class file, the first corresponding configuration information is found in the configuration file, the found first configuration information is screened out from the configuration file. After searching for the configuration information corresponding to multiple class files, the second configuration information among the two configuration information is determined to be redundant configuration information.
[0070] According to Figure 2 the technical solution in the exemplary embodiment of, on the one hand, during the packaging process of the application, obtaining the class information of the class files of the application can obtain the class information of the actually existing class files of the application; on the other hand, based on the class information of the class file and the configuration information in the configuration file, determining whether there is redundant configuration information in the configuration file can obtain the redundant configuration information after screening out the actually existing class information, so as to be able to detect and delete the redundant configuration information and avoid risks such as program crashes caused by the existence of redundant configuration information during program operation.
[0071] Figure 3 Schematically shows a flowchart of an information processing method according to some other embodiments of the present disclosure.
[0072] Referring to Figure 3 as shown, in step S310, a configuration file is obtained.
[0073] In an exemplary embodiment, the configuration file is obtained according to the path information of the configuration file. For example, assume that the configuration file is saved in the temp file of the project file of the application, and the temp file is saved in the build directory of the project file of the application. The configuration file is obtained according to the build directory path, and various configuration items or configuration information of the application are saved in the configuration file.
[0074] In step S320, the configuration information in the configuration file is converted into a configuration information set.
[0075] In an exemplary embodiment, each configuration information in the configuration file is read, and the read configuration information is converted into a configuration information set. For example, it is assumed that each configuration item in the configuration file is separated by a "\n" delimiter, and the configuration file is parsed through this delimiter, and each obtained configuration information is added to the configuration information set.
[0076] It should be noted that the configuration information set can be implemented by using a Collection data structure, or can be implemented by using other appropriate data structures such as a MAP data structure or a List data structure. The embodiments of the present disclosure do not make special limitations on this.
[0077] In step S330, the class information of the class file is obtained, and the configuration information in the configuration information set is filtered.
[0078] In an exemplary embodiment, the class information of the class file is obtained by means of a callback. Based on the class information, the configuration information of the class file corresponding to the class information is found from the configuration information set; if the configuration information of the class file corresponding to the class information is found, the found configuration information is filtered out from the configuration information set; after finding the configuration information corresponding to multiple class files, if there is remaining configuration information in the configuration information set, the configuration information set including the remaining configuration information is used as a redundant configuration information set.
[0079] In step S340, filtering and screening are performed through a whitelist.
[0080] In an exemplary embodiment, the whitelist is used to screen some specific class files. The whitelist includes the configuration information of class files that do not exist during the compilation stage but exist during the running of the application program. For example, the whitelist may include some shadow files. Shadow files are class files that do not exist statically and truly during the compilation stage but are dynamically generated during the running of the application program. For example, when pluginizing a Shadow file, some shadow files may be generated, and these shadow files must be declared in the configuration file.
[0081] Further, in an exemplary embodiment, it is determined whether each target configuration information in the redundant configuration information set belongs to the whitelist; if it belongs to the whitelist, the target configuration information is removed from the redundant configuration information set. For example, the configuration information of the class files in the whitelist is read; the target configuration information in the redundant configuration information set is matched with the read configuration information, and based on the matching result, it is determined whether the target configuration information belongs to the whitelist. If it belongs to the whitelist, the target configuration information is removed from the redundant configuration information set.
[0082] For example, a whitelist such as WhiteList information can be configured in the gradle file in DSL (Domain Specified Language) format, and the configuration information of the class files in the whitelist can be obtained by reading the WhiteList information in the Gradle file through a validator.
[0083] According to Figure 3 the technical solution in the example embodiment, on the one hand, during the process of packaging an application, based on the class information of the class files of the application and the configuration information in the configuration file, it is determined whether there is redundant configuration information in the configuration file. After screening out the actually existing class information, the redundant configuration information can be obtained, so that the redundant configuration information can be detected and deleted, avoiding risks such as program crashes caused by the existence of redundant configuration information during program operation; on the other hand, by setting a whitelist to screen some specific class files in the redundant configuration information, the risk of erroneously deleting configuration information that is valid during program operation can be avoided.
[0084] Figure 4 Schematically shows a flowchart of an information processing method according to still some embodiments of the present disclosure.
[0085] Referring to Figure 4 as shown, in step S410, the file configuration information of multiple file sources of the application is obtained and merged to generate a configuration file of the application.
[0086] In the example embodiment, the file configuration information of multiple file sources is merged to generate a configuration file of the application. For example, multiple data sources may include the source code of the application, SDK files, and resource files, etc. The file configuration information of multiple file sources of the application is obtained through a bytecode compiler, and the file configuration information of multiple file sources is merged to generate a configuration file or manifest file of the application.
[0087] In step S415, the files of multiple file sources are converted into class files.
[0088] In the example embodiment, files such as java files in the source code and SDK and xml in the resource files are converted into class files, that is, class files. For example, by compiling Java source files, SDK files, and resource files through a Java compiler, the Java source files, SDK files, and resource files are uniformly compiled into class files, that is, class files.
[0089] Further, during the compilation stage, through APT (Advanced Packaging Tool) operations, the Transform API (Application Programming Interface) can be used to implement aspect programming, and subsequent operations can be inserted into this compilation stage. For example, the screening method for configuration information can be inserted into the compilation stage before converting class files into executable files.
[0090] In step S420, the configuration information in the configuration information set is verified.
[0091] In the exemplary embodiment, the configuration file of the merged application is verified to determine whether the file configuration information of each file source is included in the configuration file.
[0092] In step S425, the merged configuration file is obtained.
[0093] In the exemplary embodiment, the configuration file is obtained according to the path information of the configuration file. For example, it is assumed that the configuration file is saved in the temp file of the project file of the application, and the temp file is saved in the build directory of the project file of the application. The configuration file is obtained according to the build directory path, and each configuration item or configuration information of the application is saved in the configuration file.
[0094] In step S430, the configuration information in the configuration information set is read.
[0095] In the exemplary embodiment, each configuration information in the configuration file is read, and the read configuration information is converted into a configuration information set. For example, it is assumed that each configuration item in the configuration file is separated by a "\n" delimiter. The configuration file is parsed through this delimiter, and the obtained configuration information is added to the configuration information set.
[0096] In step S435, the class information of the class file is obtained, and the configuration information in the configuration information set is screened.
[0097] In the exemplary embodiment, the class information of the class file is obtained in a callback manner. Based on the class information, the configuration information of the class file corresponding to the class information is found from the configuration information set. For example, in the Transform stage, the class Class information of all class files is obtained through a callback. These Class information represents real class information and can be mapped to the configuration items or configuration information in the configuration file.
[0098] In step S440, the found configuration information is screened out from the configuration information set.
[0099] In an exemplary embodiment, if the configuration information of the class file corresponding to the class information is found, the found configuration information is screened out from the set of configuration information; in the configuration file, the configuration information of these actually existing class files can be screened out one by one, and the remaining configuration information are all invalid configuration items.
[0100] In step S445, the set of configuration information after the search is completed is obtained.
[0101] In an exemplary embodiment, after searching for and screening the configuration information corresponding to multiple class files, the set of configuration information after the search is completed is obtained.
[0102] In step S450, it is determined whether there is any remaining configuration information.
[0103] In an exemplary embodiment, if there is remaining configuration information in the set of configuration information, the set of configuration information containing the remaining configuration information is used as the redundant configuration information set, and the process proceeds to step S455; if the set of configuration information is an empty set, there is no redundant configuration information, and the process proceeds to step S460.
[0104] In step S455, the packaging is stopped and a warning message is issued.
[0105] In an exemplary embodiment, when there is configuration information in the redundant configuration information set, it is determined that there are invalid configuration items, and the program will throw a ProcessClassException, prompting that "the AndroidManifest (configuration file) verification fails, the following classes do not exist", and prompting the relevant redundant configuration information.
[0106] In step S460, the packaging process is performed.
[0107] In an exemplary embodiment, the executable file of the application program is packaged by a packaging tool such as gradle to generate an APK (Application Package) file, and the APK file contains the compiled executable file (such as a.dex file) and the configuration file (such as a manifest file).
[0108] According to Figure 4 the technical solution in the exemplary embodiment of, on the one hand, during the packaging process of the application program, by obtaining the class information of the class files of the application program, the class information of the actually existing class files of the application program can be obtained; on the other hand, based on the class information of the class files and the configuration information in the configuration file, it is determined whether there is redundant configuration information in the configuration file. After screening out the actually existing class information, the redundant configuration information can be obtained, so that the redundant configuration information can be detected and deleted, avoiding risks such as program crashes caused by the existence of redundant configuration information during program operation.
[0109] Exemplary Medium
[0110] After introducing the method of the exemplary embodiments of the present disclosure, next, the medium of the exemplary embodiments of the present disclosure will be described.
[0111] In some possible embodiments, various aspects of the present disclosure can also be implemented as a medium having program code stored thereon, which is used to implement the steps in the information processing method according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of this specification when the program code is executed by a processor of a device.
[0112] In some possible embodiments, when the processor of the device executes the program code, it is used to implement the following steps: Step S210, in the compilation stage of converting multiple class files of an application program into an executable file, obtain the configuration file of the application program, where the configuration file includes configuration information corresponding to the multiple class files of the application program; Step S220, obtain the class information of each class file among the multiple class files of the application program; Step S230, based on the class information and the configuration information, determine whether there is redundant configuration information in the configuration file.
[0113] Reference Figure 5 As shown, a program product 500 for implementing the above information processing method according to an embodiment of the present disclosure is described. It can adopt a portable compact disc read-only memory and include program code, and can run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto.
[0114] It should be noted that: the above medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disc read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0115] The readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the readable program code. Such a propagated data signal can take various forms, including but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable signal medium can also be any readable medium other than the readable storage medium, and this readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device.
[0116] The program code contained on a readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wired, optical fiber cables, radio frequency signals, etc., or any suitable combination of the above.
[0117] The program code for performing the operations of the present disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network or a wide area network, or can be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0118] Exemplary Apparatus
[0119] After introducing the medium of the exemplary embodiments of the present disclosure, next, reference is made to Figure 6 to describe the information processing apparatus of the exemplary embodiments of the present disclosure.
[0120] Figure 6 The structural diagram of an information processing apparatus according to some embodiments of the present disclosure is schematically shown.
[0121] Referring to Figure 6 As shown, the information processing apparatus 600 includes: a configuration information acquisition module 610, configured to acquire the configuration file of the application program during the compilation stage of converting multiple class files of the application program into an executable file, where the configuration file includes configuration information corresponding to the multiple class files of the application program; a class information acquisition module 620, configured to acquire the class information of each class file among the multiple class files of the application program; and a redundant information determination module 630, configured to determine whether there is redundant configuration information in the configuration file based on the class information and the configuration information.
[0122] In some exemplary embodiments, the redundant information determination module 630 is further configured to: based on the class information, search for the configuration information of the class file corresponding to the class information in the configuration file; if the configuration information of the class file corresponding to the class information is found, then screen out the found configuration information from the configuration file; after searching for the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration file, then use the remaining configuration information as a redundant configuration information set.
[0123] In some example embodiments, the redundant information determination module 630 is further configured to: convert the configuration information in the configuration file into a set of configuration information; based on the class information, find the configuration information of the class file corresponding to the class information from the set of configuration information; if the configuration information of the class file corresponding to the class information is found, then screen out the found configuration information from the set of configuration information; after finding the configuration information corresponding to the multiple class files, if there is remaining configuration information in the set of configuration information, then use the set of configuration information including the remaining configuration information as the redundant configuration information set.
[0124] In some example embodiments, the apparatus 600 further includes: a whitelist determination module, configured to determine whether each target configuration information in the redundant configuration information set belongs to a whitelist, where the whitelist includes the configuration information of class files that do not exist during the compilation stage but exist during the runtime of the application; a whitelist removal unit, configured to, if it belongs to the whitelist, remove the target configuration information from the redundant configuration information set.
[0125] In some example embodiments, the whitelist determination module is further configured to: read the configuration information of the class files in the whitelist; match the target configuration information in the redundant configuration information set with the read configuration information, and determine whether the target configuration information belongs to the whitelist based on the matching result.
[0126] In some example embodiments, the format of the whitelist is the domain-specific language DSL format.
[0127] In some example embodiments, the apparatus 600 further includes: a warning processing module, configured to, if it is determined that there is redundant configuration information in the configuration file, stop the packaging process of the application and issue a warning message; a packaging processing module, configured to, if it is determined that there is no redundant configuration information in the configuration file, perform a packaging process on the application.
[0128] In some example embodiments, the apparatus 600 further includes: a file configuration acquisition module, configured to acquire the file configuration information of multiple file sources of the application; a configuration file generation module, configured to perform a merging process on the file configuration information of the multiple file sources to generate the configuration file of the application.
[0129] In some example embodiments, the apparatus 600 further includes: a verification processing module, configured to perform a verification process on the merged configuration file of the application to determine whether the configuration file includes the file configuration information of each of the file sources.
[0130] In some example embodiments, the class information acquisition module 620 is further configured to: obtain the class information of each class file in the multiple class files of the application program in a callback manner.
[0131] Since Figure 6 Each functional module of the information processing device in the example embodiment corresponds to the steps of the example embodiment of the above information processing method. Therefore, for details not disclosed in the device embodiment of the present disclosure, please refer to the embodiment of the above information processing method of the present disclosure.
[0132] Exemplary Computing Device
[0133] After introducing the methods, media, and devices of the exemplary embodiments of the present disclosure, next, a computing device according to another exemplary embodiment of the present disclosure will be introduced.
[0134] Those skilled in the art can understand that various aspects of the present disclosure can be implemented as a system, method, or program product. Therefore, various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuitry", "module", or "system" here.
[0135] In some possible embodiments, the computing device according to the embodiment of the present disclosure may at least include at least one processor and at least one memory. Among them, the memory stores program code, and when the program code is executed by the processor, the processor executes the steps in the information processing method according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of this specification. For example, the processor may execute steps such as Figure 2 shown in: Step S210, at the compilation stage of converting multiple class files of an application program into an executable file, obtain the configuration file of the application program, where the configuration file includes configuration information corresponding to the multiple class files of the application program; Step S220, obtain the class information of each class file in the multiple class files of the application program; Step S230, based on the class information and the configuration information, determine whether there is redundant configuration information in the configuration file. Another example is that the processor may also execute steps such as Figure 3 shown in.
[0136] Next, refer to Figure 7 to describe the electronic device 700 according to the example embodiment of the present disclosure. Figure 7 The electronic device 700 shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.
[0137] As Figure 7As shown, the electronic device 700 is presented in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one of the above-mentioned processing units 710, at least one of the above-mentioned storage units 720, and a bus 730 that connects different system components (including the storage unit 720 and the processing unit 710).
[0138] The bus 730 includes a data bus, an address bus, and a control bus.
[0139] The storage unit 720 may include a readable medium in the form of volatile memory, such as RAM (Random Access Memory) 721 and / or a cache memory 722, and may further include a ROM (Read-Only Memory) 723.
[0140] The storage unit 720 may also include a program / utility 725 having a set (at least one) of program modules 724. Such program modules 724 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.
[0141] The electronic device 700 may also communicate with one or more external devices 740 (such as a keyboard, a pointing device, a Bluetooth device, etc.), and such communication may be carried out through an input / output (I / O) interface 750. Moreover, the electronic device 700 may also communicate with one or more networks (such as a local area network, a wide area network, and / or a public network, such as the Internet) through a network adapter 760. As shown in the figure, the network adapter 760 communicates with other modules of the electronic device 700 through the bus 730. It should be understood that although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems, etc.
[0142] It should be noted that although several units or subunits of the information processing device are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more of the above-described modules or units may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above may be further divided and embodied by multiple modules or units.
[0143] Moreover, although the operations of the methods of the present disclosure are depicted in the drawings in a particular order, this is not required or implied to perform these operations in that particular order, or to perform all of the illustrated operations to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step and performed, and / or one step may be decomposed into multiple steps and performed.
[0144] Although the spirit and principles of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the specific embodiments disclosed, and the division of each aspect does not mean that the features in these aspects cannot be combined for benefit. This division is only for convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. An information processing method, characterized in that, Including: At the compilation stage of converting multiple class files of an application into an executable file, obtain the configuration file of the application, where the configuration file includes configuration information corresponding to the multiple class files of the application; Obtain the class information of each class file among the multiple class files of the application; Based on the class information, find the configuration information of the class file corresponding to the class information from the configuration file or the configuration information set; the configuration information set is obtained based on the configuration information in the configuration file; If the configuration information of the class file corresponding to the class information is found, screen out the found configuration information from the configuration file or the configuration information set; After finding the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration file or the configuration information set, use the remaining configuration information or the configuration information set including the remaining configuration information as the redundant configuration information set; where the redundant configuration information includes useless configuration information that has expired but not been deleted and repeatedly configured configuration information.
2. The method according to claim 1, characterized in that, The method further includes: Determine whether each target configuration information in the redundant configuration information set belongs to a whitelist, where the whitelist contains configuration information of class files that do not exist during the compilation stage but exist during the runtime of the application; If it belongs to the whitelist, remove the target configuration information from the redundant configuration information set.
3. The method according to claim 2, characterized in that, The determining whether each target configuration information in the redundant configuration information set belongs to the whitelist includes: Read the configuration information of the class files in the whitelist; Match the target configuration information in the redundant configuration information set with the read configuration information, and determine whether the target configuration information belongs to the whitelist based on the matching result.
4. The method according to claim 3, wherein The format of the whitelist is in DSL (Domain Specific Language) format.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: If it is determined that there is redundant configuration information in the configuration file, stop the packaging process of the application and issue a warning message; If it is determined that there is no redundant configuration information in the configuration file, perform the packaging process on the application.
6. The method according to claim 5, wherein The method further includes: Obtain the file configuration information of multiple file sources of the application; Perform a merging process on the file configuration information of the multiple file sources to generate the configuration file of the application.
7. The method according to claim 6, characterized in that, The method further includes: Perform a verification process on the merged configuration file of the application to determine whether the configuration file contains the file configuration information of each file source.
8. The method according to claim 6, wherein The obtaining the class information of each class file among the multiple class files of the application includes: Obtain the class information of each class file among the multiple class files of the application through a callback method.
9. An information processing apparatus, characterized in that, Including: A configuration information acquisition module, configured to obtain the configuration file of the application at the compilation stage of converting multiple class files of the application into an executable file, where the configuration file includes configuration information corresponding to the multiple class files of the application; A class information acquisition module, configured to obtain the class information of each class file among the multiple class files of the application; A redundant information determination module, configured to find the configuration information of the class file corresponding to the class information from the configuration file or the configuration information set based on the class information; the configuration information set is obtained based on the configuration information in the configuration file; if the configuration information of the class file corresponding to the class information is found, the found configuration information is screened out from the configuration file or the configuration information set; After finding the configuration information corresponding to the multiple class files, if there is remaining configuration information in the configuration file or the configuration information set, the remaining configuration information or the configuration information set including the remaining configuration information is used as a redundant configuration information set; wherein, the redundant configuration information includes useless configuration information that has expired but not been deleted and configuration information with duplicate configurations.
10. The device according to claim 9, wherein The apparatus further includes: A whitelist determination module, configured to determine whether each target configuration information in the redundant configuration information set belongs to a whitelist, the whitelist including the configuration information of class files that do not exist during the compilation stage but exist during the runtime of the application program; A whitelist removal unit, configured to remove the target configuration information from the redundant configuration information set if it belongs to the whitelist.
11. The device according to claim 10, characterized in that, The whitelist determination module is further configured to: Read the configuration information of the class files in the whitelist; Match the target configuration information in the redundant configuration information set with the read configuration information, and determine whether the target configuration information belongs to the whitelist based on the matching result.
12. The device according to claim 11, characterized in that, The format of the whitelist is in DSL (Domain-Specific Language) format.
13. The device according to any one of claims 9 to 12, characterized in that The apparatus further includes: A warning processing module, configured to stop the packaging process of the application program and send a warning message if it is determined that there is redundant configuration information in the configuration file; A packaging processing module, configured to perform a packaging process on the application program if it is determined that there is no redundant configuration information in the configuration file.
14. The device according to claim 13, characterized in that, The apparatus further includes: A file configuration acquisition module, configured to acquire the file configuration information of multiple file sources of the application program; A configuration file generation module, configured to perform a merging process on the file configuration information of the multiple file sources to generate a configuration file of the application program.
15. The device according to claim 14, characterized in that, The apparatus further includes: A verification processing module, configured to perform a verification process on the merged configuration file of the application program to determine whether the configuration file contains the file configuration information of each of the file sources.
16. The device according to claim 14, characterized in that, The class information acquisition module is further configured to: Obtain the class information of each class file in the multiple class files of the application program in a callback manner.
17. A computing device, comprising: A processor and a memory, the memory stores executable instructions, and the processor is configured to call the executable instructions stored in the memory to execute the method according to any one of claims 1 to 8.
18. A medium, on which a program is stored, and the program, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
File processing method and device, equipment and medium
CN111240738A
Compiling detection method and device, equipment and storage medium
CN112748930A