An intermediate file acquisition method and device, electronic equipment and storage medium
By using a global cache path to manage intermediate files in the Clang Module mechanism and using component names for lookup and naming, the problem of long component compilation time is solved, and compilation efficiency is improved.
Patent Information
- Application Number
- CN202110745532.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-06-30
AI Technical Summary
Under the Clang Module mechanism, the compilation of components in a project takes a long time to generate intermediate files, resulting in low compilation efficiency and affecting the overall project compilation efficiency.
A global cache path is used to uniformly manage the intermediate files of each component. The intermediate files can be reused by searching and naming them by component name, thus avoiding real-time generation.
It improves the compilation efficiency of components and projects, saves time in generating intermediate files, and increases the overall compilation speed.
Smart Images

Figure CN113590128B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for acquiring intermediate files. Background Technology
[0002] The Clang Module mechanism is a solution introduced to address the problems of repeated copying of header files and "code pollution" in C language preprocessing. Its main idea is to compile independently based on components.
[0003] Under the Clang Module mechanism, if there are multiple components in a project, the compiler can compile each component independently. During the compilation of any component, intermediate files for that component are generated and cached. This allows the intermediate files of that component to be used in later stages of the compilation process to complete the compilation of that component.
[0004] However, the inventors discovered that the process of generating intermediate files for components during the compilation of components in a project takes a long time. Furthermore, since intermediate files for each component need to be generated during the compilation of each component in the project, the compilation efficiency of the components is low, which in turn leads to the compilation efficiency of the entire project. Summary of the Invention
[0005] This application discloses a method, apparatus, electronic device, and storage medium for obtaining intermediate files.
[0006] In a first aspect, this application discloses a method for obtaining intermediate files, the method comprising:
[0007] During the compilation of multiple components in a project, if it is necessary to obtain an intermediate file of a preset format for the first component among the multiple components, the intermediate file of the preset format shall be searched in the global cache path of the project at least according to the component name of the first component.
[0008] If an intermediate file in a preset format is found based on at least the component name of the first component, the found intermediate file in the preset format is determined as the intermediate file in the preset format of the first component.
[0009] The intermediate file in the preset format that is found is generated during the compilation of the first component in the project or during the compilation of the second component in the project that references the first component. After it is generated, the intermediate file in the preset format is named according to the component name of the first component and cached in the global cache path.
[0010] In an optional implementation, the method further includes:
[0011] In cases where it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component, the file name of the intermediate file of the first component in a preset format is generated based at least on the component name of the first component and the global cache path.
[0012] In an optional implementation, generating the filename of the intermediate file of the first component in a preset format based on the component name of the first component and the global cache path includes:
[0013] Generate the hash value of the global cache path;
[0014] The component name is combined with the hash value to obtain the file name of the intermediate file of the first component in a preset format.
[0015] In an optional implementation, the method further includes:
[0016] In cases where it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component, the component name of the first component shall be determined as the file name of the intermediate file in the preset format of the first component.
[0017] In an optional implementation, the method further includes:
[0018] Once all components in the project have been compiled, delete the intermediate files cached in the global cache path.
[0019] Secondly, this application discloses an intermediate document acquisition apparatus, the apparatus comprising:
[0020] The lookup module is used to, during the compilation of multiple components in a project, when it is necessary to obtain an intermediate file of a preset format for the first component among the multiple components, search for the intermediate file of the preset format in the global cache path of the project, at least based on the component name of the first component.
[0021] The determining module is used to determine the found intermediate file of the preset format as the intermediate file of the preset format of the first component, provided that an intermediate file of the preset format is found based at least on the component name of the first component.
[0022] The intermediate file in the preset format that is found is generated during the compilation of the first component in the project or during the compilation of the second component in the project that references the first component. After it is generated, the intermediate file in the preset format is named according to the component name of the first component and cached in the global cache path.
[0023] In an alternative implementation, the apparatus further includes:
[0024] A generation module is used to generate the file name of the intermediate file of the first component in a preset format, based at least on the component name of the first component and the global cache path, when it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component.
[0025] In one optional implementation, the generation module includes:
[0026] A generation unit is used to generate the hash value of the global cache path;
[0027] A combination unit is used to combine the component name with the hash value to obtain the file name of the intermediate file of the first component in a preset format.
[0028] In an alternative implementation, the apparatus further includes:
[0029] The determining module is used to determine the component name of the first component as the file name of the intermediate file of the first component in a preset format when it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component.
[0030] In an alternative implementation, the apparatus further includes:
[0031] The delete module is used to delete intermediate files cached in the global cache path after all components in the project have been compiled.
[0032] Thirdly, this application discloses an electronic device comprising:
[0033] processor;
[0034] Memory used to store processor-executable instructions;
[0035] The processor is configured to execute the intermediate file acquisition method as described in the first aspect.
[0036] Fourthly, this application discloses a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the intermediate file acquisition method as described in the first aspect.
[0037] Fifthly, this application discloses a computer program product in which, when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is able to perform the intermediate file acquisition method as described in the first aspect.
[0038] The technical solution provided in this application may include the following beneficial effects:
[0039] In this application, during the compilation of multiple components in a project, when a preset format intermediate file for the first component is required, the project's global cache path searches for the preset format intermediate file based at least on the component name of the first component. If the preset format intermediate file is found based on at least the component name of the first component, it is identified as the preset format intermediate file for the first component and directly applied to the preset format intermediate file for the first component found in the project's global cache path. Through this application, when the preset format intermediate file for the first component is needed during compilation, a previously generated preset format intermediate file for the first component can be directly called, eliminating the need to generate the preset format intermediate file in real time. This achieves the reuse of preset format intermediate files, saving time, improving the efficiency of obtaining the preset format intermediate file for the first component, and consequently improving the compilation efficiency of the project. Attached Figure Description
[0040] Figure 1 This is a flowchart illustrating the steps of an intermediate file acquisition method shown in this application.
[0041] Figure 2 This is a structural block diagram of an intermediate document acquisition device shown in this application.
[0042] Figure 3 This is a block diagram of an electronic device shown in this application.
[0043] Figure 4 This is a block diagram of an electronic device shown in this application. Detailed Implementation
[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] The inventors discovered that during the compilation of a component in a project, when intermediate files for that component are needed, if the intermediate files for that component are not generated in real time, but are already generated and cached, and the cached intermediate files can be directly called, the time required to generate the intermediate files for that component can be saved, thereby improving the compilation efficiency of that component and, consequently, the compilation efficiency of the entire project.
[0046] However, the inventors discovered that under the Clang Module mechanism, for multiple components within the same project, the cache paths for intermediate files generated during the compilation of different components are often different. This causes the compiler to cache the intermediate files generated during the compilation of different components in different cache paths. The names of the intermediate files generated during the compilation of different components are related to the cache paths of the intermediate files generated during the compilation of different components. For example, the filenames of the intermediate files generated during the compilation of different components contain hash values generated based on the cache paths of the intermediate files generated during the compilation of different components.
[0047] Since the tasks of compiling each component are independent of each other, when the compiler compiles any component, it does not know the task of compiling "other components", nor does it know the cache path of intermediate files generated when compiling other components. Consequently, it cannot know the file names of intermediate files generated when compiling other components cached in the cache path of intermediate files generated when compiling other components.
[0048] Because the cache path and file name are unknown, during the compilation of a component, if an intermediate file is needed, even if the intermediate file is stored in the cache path of intermediate files generated when compiling other components, the intermediate file cannot be called during the compilation of this component. The intermediate file needs to be generated in real time, but the process of generating the intermediate file in real time takes a long time, resulting in low compilation efficiency for this component, and consequently, low compilation efficiency for the entire project.
[0049] Therefore, referring to Figure 1This application illustrates a flowchart of a method for obtaining intermediate files.
[0050] This method allows you to set a unified cache path for the intermediate files of each component generated during the compilation of the project, such as setting a unified global cache path.
[0051] Furthermore, the file names of intermediate files generated during the compilation of each component in the project can be set to be strongly related only to the component name. For example, cache paths can be excluded, such as hash values generated based on cache paths.
[0052] Alternatively, the filenames of intermediate files generated during the compilation of each component in the project can be strongly correlated with the component name and the global cache path, where the global cache path is uniform. For example, this could involve hash values generated based on the global cache path.
[0053] In this application, the global cache path for the project is located in the compiler's default directory "~ / Library / Developer / Xcode / DerivedData". The project's directory can be created in "DerivedData", and the directory name can be named according to the project name, etc.
[0054] By default, the ModuleCache.noindex directory in this project's directory is the global cache path. Intermediate files generated during the compilation of each component in this project can be cached in the global cache path.
[0055] The global cache path of the project can be accessed during the compilation of each component in the project.
[0056] Thus, for any given component, when the compiler compiles the component, it can know the unified cache path, such as the global cache path of the project, as well as the component name and the component names of other components referenced by the component. Therefore, through improvements to the compiler, when the compiler compiles the component, if it needs to obtain the intermediate files of the component or the intermediate files of other components referenced by the component, it can search for the intermediate files of the component or the intermediate files of other components referenced by the component in the unified cache path based on the component name or the component names of other components referenced by the component.
[0057] A compiler is a program that translates one language (usually a high-level language) into another language (usually a low-level language). The main workflow of a compiler is: source code → preprocessor → compiler → object code → linker → executables.
[0058] Compilers include LLVM (Low Level Virtual Machine), and front-end compilers for C / C++ / Objective-C (an object-oriented programming language extended from C) based on LLVM, such as front-end compilers like Clang.
[0059] The front-end component Clang Module contains a library that exposes the library's API (Application Programming Interface) and the library's implementation.
[0060] This method, when applied to electronic devices, may specifically include the following steps:
[0061] In step S101, during the compilation of multiple components in the project, if it is necessary to obtain the intermediate file of the first component in the preset format, the intermediate file in the preset format is searched in the global cache path of the project at least according to the component name of the first component.
[0062] In this application, the project includes multiple components. During the compilation process, some components can be compiled simultaneously, but not all components. Therefore, the components in the project need to be compiled in multiple batches. That is, the compilation process of the components in the project has a specific order.
[0063] For example, if a project contains 100 components, all 100 components in the project need to be compiled when compiling the project. However, if the compiler only supports compiling a maximum of 5 components at a time, then the 100 components in the project need to be compiled in at least 20 batches.
[0064] The components in this project may have reference relationships (dependencies), for example, one component in the project may reference other components in the project. Therefore, when compiling one of the components in the project, in addition to generating intermediate files in a preset format for that component, it is also necessary to generate intermediate files in preset formats for the other components referenced by that component. This results in both the preset format intermediate files for the component and the preset format intermediate files for the referenced components being used in later stages of the compilation process to complete the compilation of that component.
[0065] The preset formats include PCM format, etc.
[0066] Intermediate files include temporary files generated during the compilation of a component. These temporary files have no effect on the compilation of the component after the compilation is complete, and therefore can be discarded for this component.
[0067] When generating intermediate files in a preset format for one of the components and intermediate files in a preset format for the other components referenced by that component, the intermediate files in a preset format for one of the components and intermediate files in a preset format for the other components referenced by that component can be cached in the global cache path of the project.
[0068] This allows for the direct access to the default format intermediate file of one of the components or the default format intermediate file of the other component referenced by one of the components in the global cache path when compiling other components in the project that reference "one of the components" or other components referenced by one of the components, without the need to generate the default format intermediate file of one of the components or the default format intermediate file of the other component referenced by one of the components in real time.
[0069] Since the time required to directly call the preset format intermediate file of one of the components or the preset format intermediate file of another component referenced by one of the components in the global cache path is less than the time required to generate the preset format intermediate file of one of the components or the preset format intermediate file of another component referenced by one of the components in real time, directly calling the preset format intermediate file of one of the components or the preset format intermediate file of another component referenced by one of the components in the global cache path can save time, thereby improving the efficiency of compiling other components in the project that reference "one of the components" and improving the efficiency of compiling other components in the project that reference "one of the components", thus improving the efficiency of project compilation.
[0070] In one embodiment of this application, during the compilation of the first component in the project, it is necessary to obtain an intermediate file of the first component in a preset format so that the intermediate file of the first component in the preset format can be applied in the later processes of compiling the first component, thereby completing the compilation of the first component.
[0071] The first component is one of the multiple components included in the project.
[0072] In one scenario, before compiling the first component in the project, a second component that references the first component has already been compiled. Because the second component references the first component, during the compilation of the second component, both a pre-formatted intermediate file for the first component and a pre-formatted intermediate file for the second component were generated. Then, the pre-formatted intermediate file for the first component is named at least according to the component name of the first component, and this pre-formatted file is cached in the project's global cache path. Similarly, the pre-formatted intermediate file for the second component is named at least according to the component name of the second component, and this pre-formatted file is cached in the project's global cache path.
[0073] Thus, during the compilation of the first component in the project, if it is necessary to obtain the intermediate file of the first component in the preset format, the intermediate file of the preset format can be found in the global cache path of the project, at least according to the component name of the first component. The intermediate file of the preset format found is the intermediate file of the first component in the preset format.
[0074] In another embodiment of this application, the second component in the project references the first component in the project. During the compilation of the second component in the project, it is necessary to obtain the intermediate files of the first component in a preset format and the intermediate files of the second component in a preset format, so that the intermediate files of the first component in a preset format and the intermediate files of the second component in a preset format can be applied in the later process of compiling the second component, thereby completing the compilation of the second component.
[0075] The second component is one of the multiple components included in the project, excluding the first component.
[0076] In one scenario, the first component of the project has already been compiled before the second component is compiled. During the compilation of the first component, an intermediate file in a preset format for the first component was generated. The intermediate file in the preset format for the first component is named according to the component name of the first component, and the preset format file of the first component is cached in the global cache path of the project.
[0077] Alternatively, in another scenario, a third component that references the first component in the project is compiled before the second component is compiled. During the compilation of the third component, intermediate files in a pre-defined format for both the first and third components are generated. The intermediate files in the first component's pre-defined format are then named at least according to the component name of the first component and cached in the project's global cache path. Similarly, the intermediate files in the third component's pre-defined format are named at least according to the component name of the third component and cached in the project's global cache path.
[0078] Thus, during the compilation of the second component in the project, if it is necessary to obtain the intermediate file of the first component in the preset format, the intermediate file of the preset format can be found in the global cache path of the project, at least according to the component name of the first component. The intermediate file of the preset format found is the intermediate file of the first component in the preset format.
[0079] In one embodiment, if it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component, the file name of the intermediate file of the first component in the preset format can be generated based at least on the component name of the first component and the global cache path.
[0080] For example, in one instance, a hash value for the global cache path can be generated, and then the component name of the first component can be combined with this hash value to determine the file name of the intermediate file in the preset format of the first component.
[0081] Thus, for any component, during the compilation process, if it is necessary to obtain the intermediate file of the component in its default format or the intermediate file of other components in the project referenced by the component, the default format intermediate file of the component or the intermediate file of other components in the project referenced by the component can be found in the global cache path.
[0082] In the task of compiling this component, the compiler knows the global cache path of the project and can generate a hash value of the global cache path. Secondly, the compiler also knows the component name. Therefore, it can combine the component name with the generated hash value of the global cache path to get a new name, and search for a preset format intermediate file in the global cache path based on the new name. The found preset format intermediate file is then used as the preset format intermediate file of this component.
[0083] In another embodiment, when it is necessary to name intermediate files of the first component in a preset format according to at least the component name of the first component, the naming parameters of the project can be determined.
[0084] The naming parameters of the project can be set in advance by the technician in the compiler, for example, in the compilation command entered in the compiler (such as the xcodebuild command). The naming parameters of the project include preset hash prohibition parameters and preset hash allow parameters.
[0085] Hash-disallowed parameters can include DisableModuleHash, etc.
[0086] In one scenario, the naming parameters for the project are preset hash-allowed parameters. In this case, after naming the intermediate file of the first component in a preset format, the filename of the intermediate file of the first component in a preset format needs to include a hash value, which can be generated based on the cache path (global cache path) of the intermediate file of the first component in a preset format.
[0087] In another case, the naming parameter of the project is a preset hash prohibition parameter. In this case, after naming the intermediate file of the first component in a preset format, the file name of the intermediate file of the first component in a preset format does not include a hash value, for example, it does not include a hash value generated according to the cache path of the intermediate file of the first component in a preset format.
[0088] In one embodiment of this application, the naming parameter of the project can be a preset hash prohibition parameter. In this way, when naming the intermediate file of the first component in a preset format, the hash value can be omitted, and the component name of the first component can be determined as the file name of the intermediate file in the preset format of the first component.
[0089] Thus, for any component, during the compilation process, if it is necessary to obtain the intermediate file of the component in its default format or the intermediate file of other components in the project referenced by the component, the default format intermediate file of the component or the intermediate file of other components in the project referenced by the component can be found in the global cache path.
[0090] In the task of compiling this component, the compiler can know the component name. Therefore, it can search for the intermediate file in the global cache path based on the component name of the first component, and use the found intermediate file in the preset format as the intermediate file in the preset format of this component.
[0091] In step S102, if an intermediate file of a preset format is found based on at least the component name of the first component, the found intermediate file of the preset format is determined as the intermediate file of the preset format of the first component.
[0092] The intermediate files in the preset format that are found are either generated during the compilation of the first component in the project or during the compilation of the second component in the project that references the first component. After they are generated, the intermediate files in the preset format are named according to the component name of the first component and cached in the global cache path.
[0093] In this application, during the compilation of multiple components in a project, when a preset format intermediate file for the first component is required, the project's global cache path searches for the preset format intermediate file based at least on the component name of the first component. If the preset format intermediate file is found based on at least the component name of the first component, it is identified as the preset format intermediate file for the first component and directly applied to the preset format intermediate file for the first component found in the project's global cache path. Through this application, when the preset format intermediate file for the first component is needed during compilation, a previously generated preset format intermediate file for the first component can be directly called, eliminating the need to generate the preset format intermediate file in real time. This achieves the reuse of preset format intermediate files, saving time, improving the efficiency of obtaining the preset format intermediate file for the first component, and consequently improving the compilation efficiency of the project.
[0094] Furthermore, once all components in the project have been compiled, the intermediate files cached in the global cache path will no longer be used. Therefore, to save storage space, the intermediate files cached in the project's global cache path can be deleted. For example, the intermediate files in the default format of the first component can be deleted, the intermediate files in the default format of other components in the project can be deleted, and other intermediate files in other formats generated during the compilation of the project can be deleted from the project's global cache path.
[0095] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by this application.
[0096] Reference Figure 2 The diagram illustrates a structural block diagram of an intermediate document acquisition device according to this application, which is applied to an electronic device. Specifically, the device may include the following modules:
[0097] The lookup module 11 is used to, during the compilation of multiple components in a project, when it is necessary to obtain an intermediate file of a preset format for the first component among the multiple components, search for the intermediate file of the preset format in the global cache path of the project, at least based on the component name of the first component.
[0098] The determining module 12 is used to determine the found intermediate file of the preset format as the intermediate file of the preset format of the first component, provided that an intermediate file of the preset format is found at least according to the component name of the first component.
[0099] The intermediate file in the preset format that is found is generated during the compilation of the first component in the project or during the compilation of the second component in the project that references the first component. After it is generated, the intermediate file in the preset format is named according to the component name of the first component and cached in the global cache path.
[0100] In an alternative implementation, the apparatus further includes:
[0101] A generation module is used to generate the file name of the intermediate file of the first component in a preset format, based at least on the component name of the first component and the global cache path, when it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component.
[0102] In one optional implementation, the generation module includes:
[0103] A generation unit is used to generate the hash value of the global cache path;
[0104] A combination unit is used to combine the component name with the hash value to obtain the file name of the intermediate file of the first component in a preset format.
[0105] In an alternative implementation, the apparatus further includes:
[0106] The determining module is used to determine the component name of the first component as the file name of the intermediate file of the first component in a preset format when it is necessary to name the intermediate file of the first component in a preset format based at least on the component name of the first component.
[0107] In an alternative implementation, the apparatus further includes:
[0108] The delete module is used to delete intermediate files cached in the global cache path after all components in the project have been compiled.
[0109] In this application, during the compilation of multiple components in a project, when a preset format intermediate file for the first component is required, the project's global cache path searches for the preset format intermediate file based at least on the component name of the first component. If the preset format intermediate file is found based on at least the component name of the first component, it is identified as the preset format intermediate file for the first component and directly applied to the preset format intermediate file for the first component found in the project's global cache path. Through this application, when the preset format intermediate file for the first component is needed during compilation, a previously generated preset format intermediate file for the first component can be directly called, eliminating the need to generate the preset format intermediate file in real time. This achieves the reuse of preset format intermediate files, saving time, improving the efficiency of obtaining the preset format intermediate file for the first component, and consequently improving the compilation efficiency of the project.
[0110] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0111] Optionally, embodiments of the present invention also provide an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described intermediate file acquisition method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0112] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described intermediate file acquisition method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0113] Figure 3 This is a block diagram illustrating an electronic device 800. For example, the electronic device 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0114] Reference Figure 3 The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0115] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0116] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, images, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0117] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0118] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0119] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0120] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0121] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0122] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0123] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0124] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0125] Figure 4This is a block diagram of an electronic device 1900 shown in this application. For example, the electronic device 1900 can be provided as a server.
[0126] Reference Figure 4 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.
[0127] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output (I / O) interface 1958. Electronic device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0128] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0129] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0130] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
[0131] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0132] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0133] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0134] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0135] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0136] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0137] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method of acquiring an intermediate file, characterized by, The method comprises: In the process of compiling a plurality of components in an engineering, in the case of needing to obtain an intermediate file in a preset format of a first component in the plurality of components, at least according to a component name of the first component, searching for an intermediate file in a preset format in a global cache path of the engineering; wherein the global cache path is a unified cache path of intermediate files generated by each component in the compilation engineering, and the file name of the intermediate file of each component corresponds to the component name of the component; In the case of searching for an intermediate file in a preset format, the searched intermediate file in a preset format is determined as the intermediate file in a preset format of the first component; In the case of needing to name the intermediate file in a preset format of the first component at least according to the component name of the first component, generating a file name of the intermediate file in a preset format of the first component at least according to the component name of the first component and the global cache path; The searched intermediate file in a preset format is generated previously in the process of compiling the first component in the engineering or is generated previously in the process of compiling a second component referencing the first component in the engineering, and is named at least according to the component name of the first component after generation and cached in the global cache path.
2. The method of claim 1, wherein, The generation of the file name of the intermediate file in a preset format of the first component according to the component name of the first component and the global cache path comprises: Generating a hash value of the global cache path; Combining the component name and the hash value to obtain the file name of the intermediate file in a preset format of the first component.
3. The method of claim 1, wherein, The method further comprises: In the case of needing to name the intermediate file in a preset format of the first component at least according to the component name of the first component, determining the component name of the first component as the file name of the intermediate file in a preset format of the first component.
4. The method of claim 1, wherein, The method further comprises: In the case of having compiled all components in the engineering, deleting the intermediate files cached in the global cache path.
5. An apparatus for acquiring an intermediate file, characterized by comprising: The device comprises: A searching module, configured to, in the process of compiling a plurality of components in an engineering, in the case of needing to obtain an intermediate file in a preset format of a first component in the plurality of components, at least according to a component name of the first component, searching for an intermediate file in a preset format in a global cache path of the engineering; wherein the global cache path is a unified cache path of intermediate files generated by each component in the compilation engineering, and the file name of the intermediate file of each component corresponds to the component name of the component; A determining module, configured to, in the case of searching for an intermediate file in a preset format, determining the searched intermediate file in a preset format as the intermediate file in a preset format of the first component; The generating module is configured to generate a file name of the intermediate file in the preset format of the first component according to at least the component name of the first component and the global cache path, if it is required to name the intermediate file in the preset format of the first component according to at least the component name of the first component. The found intermediate file in the preset format is generated previously in a process of compiling the first component in the project or generated previously in a process of compiling a second component in the project which references the first component, and is named according to at least the component name of the first component after being generated and cached in the global cache path.
6. The apparatus of claim 5, wherein, The generating module comprises: A generating unit is configured to generate a hash value of the global cache path; A combining unit is configured to combine the component name and the hash value to obtain the file name of the intermediate file in the preset format of the first component.
7. The apparatus of claim 5, wherein, The apparatus further comprises: A determining module is configured to determine the component name of the first component as the file name of the intermediate file in the preset format of the first component, if it is required to name the intermediate file in the preset format of the first component according to at least the component name of the first component.
8. The apparatus of claim 5, wherein, The apparatus further comprises: A deleting module is configured to delete the intermediate file cached in the global cache path, if all components in the project have been compiled.
9. An electronic device, comprising: The apparatus comprises: A processor, a memory, and a computer program stored in the memory and executable in the processor, wherein the computer program is executed by the processor to implement the steps of the intermediate file obtaining method according to any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the intermediate file obtaining method according to any one of claims 1 to 4.