Resource management method and device
By configuring the storage path and dependencies of the resource library in the resource management configuration file, the problem of high management costs and repeated introduction of third-party resource library resource files in terminal application development is solved, achieving efficient management of resource files and reducing maintenance costs.
Patent Information
- Application Number
- CN202410781057.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-10-08
AI Technical Summary
In terminal application development, the resource file management cost of third-party resource libraries is high, and there is a risk of repeatedly introducing the same resources.
By configuring the storage path and dependencies of the resource library in the resource management configuration file, the resource files required for the target project are stored differently, reducing maintenance costs and avoiding the repeated introduction of the same resources.
It effectively reduces the maintenance cost of resource files and avoids the problem of repeatedly introducing the same resource files when the project is running.
Smart Images

Figure CN118747083A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a resource management method and device. Background Art
[0002] In projects for terminal application development (such as iOS projects), third-party resource libraries are usually introduced, such as network libraries, font libraries, pictures, etc., where the third-party resource libraries are provided by the provider in the form of resource files. Since the resource files in the third-party resource library are not published to the project-specific resource management platform, it is necessary to manage the resource files in the third-party resource library.
[0003] In the related technology, resource files are directly placed in the root directory of the project and a reference relationship is established. However, as the project continues to develop, the number of resource files increases. The above resource management method of directly placing resource files in the root directory of the project may lead to high maintenance costs for resource files, and there is a risk of repeatedly introducing the same resources when the project is running. Summary of the invention
[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.
[0005] To this end, the present disclosure proposes a resource management method and device, which configures the source resource files required for the target project by configuring the storage path of the resource library in the resource management configuration file, and distinguishes and stores the first target resource files obtained by compiling the target project according to the storage path of each source resource file and the dependency relationship corresponding to the non-independent resource library, thereby reducing the maintenance cost of the resource files and avoiding the problem of repeatedly introducing the same resource files when the project is running.
[0006] The first aspect of the present disclosure proposes a resource management method, including: obtaining a resource management configuration file associated with a target project from a directory at the same level as a root directory of a target project developed based on a target operating system; configuring, in the resource management configuration file, first storage paths of multiple first resource libraries required for the target project; in response to the presence of at least one non-independent resource library among the multiple first resource libraries, configuring, in the resource management configuration file, a second storage path of a second resource library on which the non-independent resource library depends; in the resource management configuration file, configuring a dependency relationship between a source resource file in the non-independent resource library and a source resource file in the second resource library; wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file.
[0007] The second aspect embodiment of the present disclosure proposes a resource management device, including: an acquisition module, used to acquire a resource management configuration file associated with a target project from a directory at the same level as the root directory of a target project developed based on a target operating system; a first configuration module, used to configure, in the resource management configuration file, a first storage path of multiple first resource libraries required for the target project; a second configuration module, used to configure, in response to the presence of at least one non-independent resource library among the multiple first resource libraries, a second storage path of a second resource library on which the non-independent resource library depends in the resource management configuration file; a third configuration module, used to configure, in the resource management configuration file, a dependency relationship between a source resource file in the non-independent resource library and a source resource file in the second resource library; wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file.
[0008] The third aspect of the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the resource management method described in the first aspect of the present disclosure is implemented.
[0009] The fourth aspect of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the resource management method as described in the first aspect of the present disclosure is implemented.
[0010] The fifth aspect of the present disclosure provides a computer program product. When an instruction processor in the computer program product executes, the resource management method as described in the first aspect of the present disclosure is implemented.
[0011] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0013] Figure 1 A schematic diagram of a resource management method provided by an embodiment of the present disclosure;
[0014] Figure 2 A flowchart of another resource management method provided by an embodiment of the present disclosure;
[0015] Figure 3A flowchart of another resource management method provided by an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of the structure of a resource management device provided by an embodiment of the present disclosure;
[0017] Figure 5 It is a block diagram of an electronic device for resource management according to an exemplary embodiment. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0019] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0020] In the related art, an independent resource dependency library (such as a Cocoapods library) is established to manage resource files in a third-party resource library. However, when there are a large number of third-party resource libraries or a large number of resource files in the third-party resource libraries, it is necessary to maintain multiple independent resource dependency libraries, which makes management decentralized and complex. In addition, the independent resource dependency library may not be in the project root directory, resulting in a search failure when the library imports resources, and the inability to import resources.
[0021] In view of the above problems, the present disclosure proposes a resource management method and device.
[0022] The resource management method and device according to the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0023] Figure 1 A flowchart of a resource management method provided by an embodiment of the present disclosure.
[0024] It should be noted that the embodiment of the present disclosure is illustrated by the resource management method being configured in a resource management device, and the resource management device can be applied to any electronic device so that the electronic device can perform resource management functions. The electronic device can be any device with computing capabilities, such as a personal computer (PC), a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens, and / or display screens.
[0025] For example, the resource management device may be provided in a third-party library management tool of a mobile terminal of iOS or OSX.
[0026] like Figure 1 As shown, the resource management method may include the following steps:
[0027] Step 101 , obtaining a resource management configuration file associated with a target project from a directory at the same level as a root directory of a target project developed based on a target operating system.
[0028] As a possible implementation method, the target project developed based on the target operating system may be, for example, an application project developed based on the iOS operating system. The operating environment of the embodiment of the present disclosure may be, for example, an Xcode development environment or a Cocoapods environment. In order to establish a dependency relationship between the resource files in the introduced third-party resource library and the target project, and to facilitate the effective management of the resource files in the third-party resource library introduced by the target project, as an example, a resource library that the target project depends on may be created in a directory at the same level as the root directory of the target project, wherein the resource library may include a resource management configuration file. Therefore, a resource management configuration file associated with the target project may be obtained in a directory at the same level as the root directory of the target project.
[0029] Step 102: configure, in a resource management configuration file, first storage paths of a plurality of first resource libraries required for a target project.
[0030] In order for the target project to reference resource files in a third-party resource library, as an example, the first storage paths of multiple first resource libraries required by the target project can be configured in the resource management configuration file. The source resource files in the first resource library may include, for example: image files, font files, video resource files, etc.
[0031] Step 103 : In response to the existence of at least one dependent resource library among the plurality of first resource libraries, a second storage path of a second resource library on which the dependent resource library depends is configured in the resource management configuration file.
[0032] In order for the target project to reference the resource files in the second resource library on which the non-independent resource library in the third-party resource library depends, as a possible implementation method, multiple first resource libraries can be judged to determine whether there is a non-independent resource library among the multiple first resource libraries. When there is at least one non-independent resource library among the multiple first resource libraries, the second storage path of the second resource library on which the non-independent resource library depends can be configured in the resource management configuration file.
[0033] Step 104, in the resource management configuration file, configure the dependency relationship between the source resource file in the non-independent resource library and the source resource file in the second resource library. The dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each first storage path, each second storage path and the dependency relationship in the resource management configuration file.
[0034] In order to enable the target project to correctly reference the resource files in the second resource library on which the resource files in the non-independent resource library depend, as a possible implementation method, the dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library is configured in the resource management configuration file.
[0035] In order to facilitate the management and maintenance of resource files required for the operation of the target project, as an example, the first target resource file obtained by compiling the target project can be stored differently based on the storage path of each source resource file and the dependency relationship corresponding to the non-independent resource library. For example, when the first target resource file has a corresponding dependency relationship and the first target resource file is a resource file that the source resource file in the non-independent resource library depends on, in order to allow the target project to reference the first target resource file, the first target resource file can be stored in the root directory of the target project; for another example, when the first target resource file does not have a corresponding dependency relationship, the first target resource file can be stored in a subdirectory of the target project.
[0036] In summary, a resource management configuration file associated with the target project is obtained from a directory at the same level as the root directory of the target project developed based on the target operating system; in the resource management configuration file, the first storage paths of multiple first resource libraries required for the target project are configured; in response to the presence of at least one non-independent resource library among the multiple first resource libraries, the second storage path of the second resource library on which the non-independent resource library depends is configured in the resource management configuration file; in the resource management configuration file, the dependency relationship between the source resource file in the non-independent resource library and the source resource file in the second resource library is configured; wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each first storage path, each second storage path and the dependency relationship in the resource management configuration file, thereby configuring the source resource files required for the target project by configuring the storage path of the resource library in the resource management configuration file, and distinguishing and storing the first target resource files obtained by compiling the target project according to the storage path of each source resource file and the dependency relationship corresponding to the non-independent resource library, thereby reducing the maintenance cost of the resource files and avoiding the problem of repeatedly introducing the same resource files when the project is running.
[0037] In order to clearly illustrate how the at least one target resource file obtained by compiling the target project is stored and managed according to the first storage paths, the second storage paths and the dependency relationships in the resource management configuration file in the above embodiment, the present disclosure proposes another resource management method.
[0038] Figure 2 A flowchart of another resource management method provided by an embodiment of the present disclosure.
[0039] like Figure 2 As shown, in Figure 1 Based on the illustrated embodiment, the dependency relationship is specifically used for:
[0040] Step 201: Acquire at least one first source resource file required for running a target project according to each first storage path and each second storage path in a resource management configuration file.
[0041] As a possible implementation method, when compiling the target project, at least one first source resource file required for the operation of the target project can be obtained based on the first storage paths of multiple first resource libraries configured in the resource management configuration file and the second storage paths of second resource libraries on which non-independent resource libraries among the multiple first resource libraries depend.
[0042] Step 202: during the process of compiling the target project, compile at least one first source resource file to obtain a first target resource file corresponding to each source resource file.
[0043] Furthermore, in the process of compiling the target project, at least one first source resource file needs to be compiled, so as to obtain first target resource files corresponding to each source resource file.
[0044] Step 203 , for any first target resource file, query each dependency according to any first target resource file to obtain a query result of any first target resource file.
[0045] In order to reduce the maintenance cost of resource files and avoid the problem of repeatedly introducing the same resource files when the project is running, as a possible implementation method, the first target resource file obtained by compiling the target project can be stored separately.
[0046] As an example, it may be queried whether there is a target dependency relationship associated with a first source resource file corresponding to any first target resource file in each dependency relationship, and the query results obtained by the query are stored separately.
[0047] Step 204: store any first target resource file according to the query result.
[0048] As an example, in response to the query result indicating that there is a target dependency relationship associated with the first source resource file corresponding to any first target resource file in each dependency relationship, determine whether the corresponding first source resource file is a file that the source resource file in the non-independent resource library depends on based on the target dependency relationship; if the corresponding first source resource file is a file that the source resource file in the non-independent resource library depends on, store any first target resource file in the root directory of the target project; if the corresponding first source resource file is not a file that the source resource file in the non-independent resource library depends on, store any first target resource file in a subdirectory of the target project.
[0049] That is to say, when the first target resource file is a file compiled from the source resource file in the second resource library that the non-independent resource library depends on, the first target resource file is stored in the root directory of the target project so that when the target project is running, the resources in the first target resource file can be referenced; when the first target resource file is a file compiled from the source resource file in the non-independent resource library, the first target resource file is stored in the subdirectory of the target project.
[0050] As another example, in response to the query result indicating that there is no target dependency associated with the first source resource file corresponding to any first target resource file in each dependency, any first target resource file is stored in a subdirectory of the target project.
[0051] That is, when the first target resource file is a file compiled from a source resource file in an independent resource library, the first target resource file may be stored in a subdirectory of the target project.
[0052] In addition, it should be explained that, as a possible implementation method, in response to the fact that there is no at least one non-independent resource library among the multiple first resource libraries, that is, the multiple first resource libraries are all independent resource libraries, at least one second source resource file required for the operation of the target project can be obtained according to each first storage path in the resource management configuration file; in the process of compiling the target project, at least one second source resource file is compiled to obtain second target resource files corresponding to each source resource file; and each second target resource file is stored in a subdirectory of the target project.
[0053] In summary, at least one first source resource file required for the operation of the target project is obtained according to each first storage path and each second storage path in the resource management configuration file; in the process of compiling the target project, at least one first source resource file is compiled to obtain a first target resource file corresponding to each source resource file; for any first target resource file, each dependency relationship is queried according to any first target resource file to obtain a query result of any first target resource file; according to the query result, the storage directory of any first target resource file is determined, thereby, the first target resource file compiled from at least one first source resource file required for the operation of the target project, the corresponding storage directory is determined according to the query result of the query dependency relationship, thereby realizing the differentiated storage of each first target resource file, reducing the maintenance cost of the resource file, and avoiding the problem of repeated introduction of the same resource file when the project is running.
[0054] In order to clearly explain how to obtain the resource management configuration file associated with the target project from the same-level directory of the root directory of the target project developed based on the target operating system in the above embodiment, the present disclosure proposes another resource management method.
[0055] Figure 3 A flowchart of another resource management method provided by an embodiment of the present disclosure.
[0056] like Figure 3 As shown, the resource management method may include the following steps:
[0057] Step 301: Create a third resource library associated with the target project in a directory at the same level as the root directory of the target project developed based on the target operating system.
[0058] As a possible implementation method, in order to establish a dependency relationship between the target project and a third-party resource library provided by a third party, a local dependency library of the target project, that is, a third resource library associated with the target project, can be created in the same directory as the root directory of the target project developed by the target operating system.
[0059] Step 302: Obtain a resource management configuration file from a third resource library.
[0060] It should be understood that the third resource library created and associated with the target project includes a resource management configuration file for managing resource configuration. Therefore, the resource management configuration file can be obtained from the third resource library.
[0061] Step 303: configure the first storage paths of the plurality of first resource libraries required by the target project in the resource management configuration file.
[0062] Furthermore, in the resource management configuration file of the local dependent library (third resource library), the first storage paths of multiple first resource libraries provided by a third party and required by the target project are configured.
[0063] Step 304: In response to the existence of at least one dependent resource library among the plurality of first resource libraries, a second storage path of a second resource library on which the dependent resource library depends is configured in the resource management configuration file.
[0064] Step 305, in the resource management configuration file, configure the dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library; wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each first storage path, each second storage path and the dependency relationship in the resource management configuration file.
[0065] It should be noted that in order to obtain the resource files required for the operation of the target project in a timely manner when the target project is compiled, and to reduce the maintenance cost of the resource files, as a possible implementation method, in the target project, a project configuration file for configuring the project information associated with the target project is created, and then the configuration information of the target project information and the resources required for the operation of the target project is configured in the project configuration file, wherein the configuration information is used to indicate that the storage path of the resources required for the operation of the target project is configured in the resource management configuration file, and then, an association relationship between the project configuration file and the resource management configuration file is created. Therefore, when the target project is compiled, the project configuration file can be compiled, and when the project configuration file is compiled In the process, according to the configuration information of the resources required for the operation of the target project in the project configuration file, it can be determined that the resources required for the operation of the target project are configured in the resource management configuration file. Therefore, based on the association relationship between the project configuration file and the resource management configuration file, the resource management configuration file associated with the target project can be obtained, so that according to the storage path of the resources required for the operation of the target project configured in the resource management configuration file, the source resource file required for the operation of the target project can be obtained. In this way, the resources required for the target project can be maintained independently, similar resources can be reused in different projects, duplication of work can be reduced, and the structure of the target project can be made clearer, and maintenance and updating of resources can become simpler and more convenient.
[0066] In summary, by creating a third resource library associated with the target project in the same directory as the root directory of the target project developed based on the target operating system; obtaining the resource management configuration file from the third resource library, thereby establishing a dependency relationship between the multiple first resource libraries configured by the resource management configuration file and the target project, so that when the target project is running, the resources required by the target project can be found in time.
[0067] On the basis of any embodiment of the present disclosure, taking the target operating system as the iOS operating system and the operating environment of the embodiment of the present disclosure as the Xcode development environment or the Cocoapods environment as an example, the resource management method of the embodiment of the present disclosure can be implemented based on the following steps:
[0068] 1. Create an iOS project through Xcode or in an existing iOS project, initialize the Cocoapods configuration file (project configuration file) through the "pod init" command:
[0069] 2. In the same directory as the iOS project root directory, create the Cocoapods resource management local dependency library JDUintDemo (the third resource library), such as JDUintDemo: pod lib create JDUnitDemo;
[0070] 3. In the created JDUnitDemo directory, find the JDUnitDemo.podspec file (resource management configuration file), and add the storage path (first storage path) of the class library that the iOS project needs to depend on, such as LibA, LibB, in the JDUnitDemo.podspec file; that is, in the resource management configuration file, configure the first storage path of multiple first resource libraries required by the target project;
[0071] 4. If LibA and LibB are both framework libraries or a library (independent resource library), store the resource files compiled by LibA and LibB in the subdirectory of the iOS project;
[0072] 5. If LibA and LibB depend on font files (such as .ttf files), various image files, and code files (such as bundle files), respectively, then in the resource management configuration file, configure the second storage path of the second resource library (such as LibARes and LibBRes) that the non-independent resource library depends on;
[0073] 6. In the resource management configuration file, configure the dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library, for example, LibA and LibB depend on LibARes and LibBRes;
[0074] 7. The resource files in the second resource library can act on the local dependency library JDUnitDemo, and the iOS compilation products corresponding to the resource files in the second resource library are in the root directory of the iOS project.
[0075] In order to implement the above embodiments, the present disclosure also proposes a resource management device.
[0076] Figure 4 A schematic diagram of the structure of a resource management device provided by an embodiment of the present disclosure.
[0077] like Figure 4 As shown, the resource management device 400 includes: an acquisition module 410 , a first configuration module 420 , a second configuration module 430 and a third configuration module 440 .
[0078] Among them, the acquisition module 410 is used to obtain the resource management configuration file associated with the target project from the same-level directory of the root directory of the target project developed based on the target operating system; the first configuration module 420 is used to configure the first storage paths of multiple first resource libraries required for the target project in the resource management configuration file; the second configuration module 430 is used to configure the second storage path of the second resource library on which the non-independent resource library depends in the resource management configuration file in response to the existence of at least one non-independent resource library among the multiple first resource libraries; the third configuration module 440 is used to configure the dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library in the resource management configuration file, wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to the first storage paths, the second storage paths and the dependency relationship in the resource management configuration file.
[0079] As a possible implementation of the embodiment of the present disclosure, the resource management device 400 further includes: a first compiling module, a query module and a storage module.
[0080] Among them, the acquisition module 410 is also used to obtain at least one first source resource file required for the operation of the target project according to each first storage path and each second storage path in the resource management configuration file; the first compilation module is used to compile at least one first source resource file in the process of compiling the target project to obtain a first target resource file corresponding to each source resource file; the query module is used to query each dependency relationship according to any first target resource file for any first target resource file to obtain a query result for any first target resource file; the storage module is used to store any first target resource file according to the query result.
[0081] As a possible implementation method of the embodiment of the present disclosure, a storage module is used to, in response to a query result indicating that there is a target dependency relationship associated with a first source resource file corresponding to any first target resource file in each dependency relationship, determine, based on the target dependency relationship, whether the corresponding first source resource file is a file that the source resource file in the non-independent resource library depends on; if the corresponding first source resource file is a file that the source resource file in the non-independent resource library depends on, store any first target resource file in the root directory of the target project; if the corresponding first source resource file is not a file that the source resource file in the non-independent resource library depends on, store any first target resource file in a subdirectory of the target project.
[0082] As a possible implementation method of the embodiment of the present disclosure, the storage module is also used to store any first target resource file in a subdirectory of the target project in response to the query result indicating that there is no target dependency associated with the first source resource file corresponding to any first target resource file in each dependency.
[0083] As a possible implementation manner of the embodiment of the present disclosure, the resource management device 400 further includes: a second compiling module and a second storage module.
[0084] Among them, the acquisition module 410 is also used to respond to the absence of at least one non-independent resource library in multiple first resource libraries, and to obtain at least one second source resource file required for the operation of the target project according to each first storage path in the resource management configuration file; the second compilation module is used to compile at least one second source resource file in the process of compiling the target project to obtain a second target resource file corresponding to each source resource file; the second storage module is used to store each second target resource file in a subdirectory of the target project.
[0085] As a possible implementation method of the embodiment of the present disclosure, the acquisition module 410 is used to create a third resource library associated with the target project in a directory at the same level as the root directory of the target project developed based on the target operating system; and obtain a resource management configuration file from the third resource library.
[0086] As a possible implementation manner of the embodiment of the present disclosure, the resource management device 400 further includes: a first creation module and a second creation module.
[0087] The first creation module is used to create a project configuration file for configuring project information associated with the target project in the target project; the second creation module is used to create an association relationship between the project configuration file and the resource management configuration file.
[0088] As a possible implementation manner of the embodiment of the present disclosure, the resource management device 400 further includes: a third compiling module and a determining module.
[0089] The third compiling module is used to compile the project configuration file; the determining module is used to determine the resource management configuration file associated with the target project according to the association relationship during the process of compiling the project configuration file.
[0090] The resource management device of the embodiment of the present disclosure obtains a resource management configuration file associated with the target project from a directory at the same level as the root directory of the target project developed based on the target operating system; in the resource management configuration file, first storage paths of multiple first resource libraries required for the target project are configured; in response to the existence of at least one non-independent resource library among the multiple first resource libraries, a second storage path of a second resource library on which the non-independent resource library depends is configured in the resource management configuration file; in the resource management configuration file, a dependency relationship between a source resource file in the non-independent resource library and a source resource file in the second resource library is configured; wherein the dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each first storage path, each second storage path and the dependency relationship in the resource management configuration file, thereby configuring the source resource files required for the target project by configuring the storage path of the resource library in the resource management configuration file, and distinguishing and storing the first target resource files obtained by compiling the target project according to the storage path of each source resource file and the dependency relationship corresponding to the non-independent resource library, thereby reducing the maintenance cost of the resource files and avoiding the problem of repeatedly introducing the same resource files when the project is running.
[0091] It should be noted that the above explanation of the resource management method embodiment is also applicable to the resource management device of this embodiment and will not be repeated here.
[0092] In order to implement the above embodiments, the present application also proposes an electronic device, such as Figure 5 As shown, Figure 5 It is a block diagram of an electronic device for resource management according to an exemplary embodiment.
[0093] like Figure 5 As shown, the electronic device 500 includes:
[0094] The memory 510 and the processor 520, a bus 530 connecting different components (including the memory 510 and the processor 520), the memory 510 stores a computer program, and when the processor 520 executes the program, the resource management method described in the embodiment of the present disclosure is implemented.
[0095] Bus 530 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0096] The electronic device 500 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 500, including volatile and non-volatile media, removable and non-removable media.
[0097] The memory 510 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 540 and / or cache memory 550. The electronic device 500 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 560 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 530 via one or more data medium interfaces. The memory 510 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0098] A program / utility 580 having a set (at least one) of program modules 570 may be stored, for example, in the memory 510, such program modules 570 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 570 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0099] The electronic device 500 may also communicate with one or more external devices 590 (e.g., keyboards, pointing devices, displays, etc.), one or more devices that enable a user to interact with the electronic device 500, and / or any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through an input / output (I / O) interface 592. Furthermore, the electronic device 500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 893. Figure 5 As shown, the network adapter 593 communicates with other modules of the electronic device 500 via the bus 530. It should be understood that although Figure 5Not shown, other hardware and / or software modules may be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0100] The processor 520 executes various functional applications and data processing by running the programs stored in the memory 510 .
[0101] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the resource management method of the embodiment of the present disclosure, and will not be repeated here.
[0102] In order to implement the above embodiments, the present disclosure further proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the resource management method described in the above embodiments is implemented.
[0103] In order to implement the above embodiments, the present disclosure further provides a computer program product. When an instruction processor in the computer program product is executed, the resource management method described in the above embodiments is executed.
[0104] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0105] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0106] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A resource management method, characterized in that: include: Obtaining a resource management configuration file associated with a target project developed based on the target operating system from a directory at the same level as the root directory of the target project; In the resource management configuration file, configure the first storage paths of the plurality of first resource libraries required by the target project; In response to the presence of at least one dependent resource library among the plurality of first resource libraries, configuring, in the resource management configuration file, a second storage path of a second resource library on which the dependent resource library depends; In the resource management configuration file, a dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library is configured; The dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file.
2. The method according to claim 1, characterized in that According to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file, storing and managing at least one target resource file obtained by compiling the target project, including: Acquire at least one first source resource file required for running the target project according to each of the first storage paths and each of the second storage paths in the resource management configuration file; In the process of compiling the target project, compiling the at least one first source resource file to obtain a first target resource file corresponding to each source resource file; For any first target resource file, query each dependency according to the any first target resource file to obtain a query result of the any first target resource file; According to the query result, any one of the first target resource files is stored.
3. The method according to claim 2, characterized in that The storing of any one of the first target resource files according to the query result includes: In response to the query result indicating that there is a target dependency relationship associated with the first source resource file corresponding to any of the first target resource files in each of the dependencies, determining, according to the target dependency relationship, whether the corresponding first source resource file is a file that the source resource file in the non-independent resource library depends on; In the case where the corresponding first source resource file is a file on which the source resource file in the non-independent resource library depends, storing any first target resource file in the root directory of the target project; In the case that the corresponding first source resource file is not a file that the source resource file in the non-independent resource library depends on, any first target resource file is stored in a subdirectory of the target project.
4. The method according to claim 2, characterized in that: The method further comprises: In response to the query result indicating that there is no target dependency relationship associated with the first source resource file corresponding to any first target resource file in each dependency relationship, the any first target resource file is stored in a subdirectory of the target project.
5. The method according to claim 1, characterized in that The method further comprises: In response to the absence of at least one dependent resource library among the plurality of first resource libraries, acquiring at least one second source resource file required for running the target project according to each of the first storage paths in the resource management configuration file; In the process of compiling the target project, compiling the at least one second source resource file to obtain a second target resource file corresponding to each source resource file; Each of the second target resource files is stored in a subdirectory of the target project.
6. The method according to claim 1, characterized in that The step of obtaining a resource management configuration file associated with a target project from a directory at the same level as a root directory of a target project developed based on a target operating system includes: Creating a third resource library associated with the target project in a directory at the same level as the root directory of the target project developed based on the target operating system; The resource management configuration file is obtained from the third resource library.
7. The method according to claim 1, characterized in that The method further comprises: In the target project, creating a project configuration file for configuring project information associated with the target project; An association relationship between the project configuration file and the resource management configuration file is created.
8. The method according to claim 7, characterized in that Before storing and managing at least one first target resource file obtained by compiling the target project according to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file, the method further includes: Compiling the project configuration file; In the process of compiling the project configuration file, a resource management configuration file associated with the target project is determined according to the association relationship.
9. A resource management device, characterized in that: include: An acquisition module, used to acquire a resource management configuration file associated with a target project from a directory at the same level as a root directory of a target project developed based on a target operating system; A first configuration module, configured to configure, in the resource management configuration file, first storage paths of a plurality of first resource libraries required by the target project; A second configuration module is configured to configure, in the resource management configuration file, a second storage path of a second resource library on which the dependent resource library depends in response to the presence of at least one dependent resource library among the plurality of first resource libraries; A third configuration module, configured to configure, in the resource management configuration file, a dependency relationship between the source resource files in the non-independent resource library and the source resource files in the second resource library; The dependency relationship is used to store and manage at least one first target resource file obtained by compiling the target project according to each of the first storage paths, each of the second storage paths and the dependency relationship in the resource management configuration file.
10. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the resource management method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the resource management method according to any one of claims 1 to 8 is implemented.
