CN113590128A - Method and device for acquiring intermediate file, electronic equipment and storage medium - Google Patents

Method and device for acquiring intermediate file, electronic equipment and storage medium Download PDF

Info

Publication number
CN113590128A
CN113590128A CN202110745532.8A CN202110745532A CN113590128A CN 113590128 A CN113590128 A CN 113590128A CN 202110745532 A CN202110745532 A CN 202110745532A CN 113590128 A CN113590128 A CN 113590128A
Authority
CN
China
Prior art keywords
component
intermediate file
preset format
name
project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110745532.8A
Other languages
Chinese (zh)
Inventor
曾庆隆
彭飞
邓竹立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuba Co Ltd
Original Assignee
Wuba Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN202110745532.8A priority Critical patent/CN113590128A/en
Publication of CN113590128A publication Critical patent/CN113590128A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention provides an intermediate file acquisition method and device, electronic equipment and a storage medium. When an intermediate file in a preset format of a first component in a plurality of components needs to be obtained in the process of compiling the plurality of components in a project, the intermediate file in the preset format is searched in a global cache path of the project at least according to the component name of the first component, and the searched intermediate file in the preset format is determined as the intermediate file in the preset format of the first component under the condition that the intermediate file in the preset format is searched. By the aid of the method and the device, when the intermediate file in the preset format of the first component needs to be obtained in the compiling process, the generated intermediate file in the preset format of the first component can be directly called, the intermediate file in the preset format of the first component does not need to be generated in real time, so that time can be saved, efficiency of obtaining the intermediate file in the preset format of the first component is improved, and compiling efficiency of a project can be improved.

Description

Method and device for acquiring intermediate file, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring an intermediate file, an electronic device, and a storage medium.
Background
The Clang Module mechanism is a scheme aiming at repeated copy header files preprocessed by C language and the problem of code pollution, and the theme is independently compiled by taking components as dimensions.
Under the Clang Module mechanism, if a plurality of components exist in a project, a compiler can compile the plurality of components independently, generate an intermediate file of the component in the process of compiling any one component, and cache the intermediate file of the component, so that a later compiling process in the process of compiling the component applies the intermediate file of the component to complete the compiling of the component.
However, the inventor finds that the process of generating the intermediate file of the component in the process of compiling the component in the project takes a long time, and the intermediate file of each component needs to be generated in the process of compiling each component in the project, so that the compiling efficiency of the component is low, and further the compiling efficiency of the project is low.
Disclosure of Invention
The application discloses an intermediate file acquisition method and device, electronic equipment and a storage medium.
In a first aspect, the present application shows a method for acquiring an intermediate file, where the method includes:
in the process of compiling a plurality of components in a project, under the condition that an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, in a global cache path of the project, the intermediate file in the preset format is searched at least according to the component name of the first component;
determining the intermediate file in the preset format as the intermediate file in the preset format of the first assembly under the condition that the intermediate file in the preset format is found at least according to the assembly name of the first assembly;
the found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after being generated is named and cached in the global cache path.
In an optional implementation, the method further includes:
and under the condition that the intermediate file in the preset format of the first component needs to be named at least according to the component name of the first component, generating the file name of the intermediate file in the preset format of the first component at least according to the component name of the first component and the global cache path.
In an optional implementation manner, the generating a file name of an intermediate file in a preset format of the first component according to the component name of the first component and the global cache path includes:
generating a hash value of the global cache path;
and combining the component name and the hash value to obtain the file name of the intermediate file of the first component in the preset format.
In an optional implementation, the method further includes:
and under the condition that the intermediate file in the preset format of the first component needs to be named 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 the preset format of the first component.
In an optional implementation, the method further includes:
deleting the intermediate file cached in the global cache path in the case that all components in the project have been compiled.
In a second aspect, the present application shows an apparatus for acquiring an intermediate file, the apparatus comprising:
the system comprises a searching module, a compiling module and a processing module, wherein the searching module is used for searching an intermediate file in a preset format according to at least the component name of a first component in a global cache path of a project under the condition that the intermediate file in the preset format of the first component in the multiple components needs to be obtained in the process of compiling the multiple components in the project;
the determining module is used for determining the found intermediate file in the preset format as the intermediate file in the preset format of the first assembly under the condition that the intermediate file in the preset format is found at least according to the assembly name of the first assembly;
the found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after being generated is named and cached in the global cache path.
In an optional implementation, the apparatus further comprises:
and the generating module is used for generating the file name of the intermediate file in the preset format of the first component at least according to the component name of the first component and the global cache path under the condition that the intermediate file in the preset format of the first component is named at least according to the component name of the first component.
In an optional implementation manner, the generating module includes:
the generation unit is used for generating a hash value of the global cache path;
and the combining unit is used for combining the component name and the hash value to obtain the file name of the intermediate file of the first component in the preset format.
In an optional implementation, the apparatus further comprises:
the 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 when the intermediate file in the preset format of the first component needs to be named at least according to the component name of the first component.
In an optional implementation, the apparatus further comprises:
and the deleting module is used for deleting the intermediate file cached in the global cache path under the condition that all the components in the project are compiled.
In a third aspect, the present application shows an electronic device comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the method for acquiring an intermediate file according to the first aspect.
In a fourth aspect, the present application shows a non-transitory computer-readable storage medium, wherein instructions of the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method for obtaining an intermediate file according to the first aspect.
In a fifth aspect, the present application shows a computer program product, wherein instructions of the computer program product, when executed by a processor of an electronic device, enable the electronic device to perform the method for acquiring an intermediate file according to the first aspect.
The technical scheme provided by the application can comprise the following beneficial effects:
in the application, in the process of compiling a plurality of components in a project, under the condition that an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, the intermediate file in the preset format is searched for in a global cache path of the project at least according to a component name of the first component, and under the condition that the intermediate file in the preset format is searched for at least according to the component name of the first component, the searched intermediate file in the preset format is determined to be the intermediate file in the preset format of the first component and is directly applied to the intermediate file in the preset format of the first component searched for in the global cache path of the project. By the aid of the method and the device, when the intermediate file in the preset format of the first component needs to be obtained in the compiling process, the generated intermediate file in the preset format of the first component can be directly called, the intermediate file in the preset format of the first component does not need to be generated in real time, multiplexing of the intermediate file in the preset format is achieved, time can be saved, efficiency of obtaining the intermediate file in the preset format of the first component is improved, and compiling efficiency of engineering can be improved.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for acquiring an intermediate file according to the present application.
Fig. 2 is a block diagram illustrating a configuration of an apparatus for acquiring an intermediate file according to the present application.
Fig. 3 is a block diagram of an electronic device shown in the present application.
Fig. 4 is a block diagram of an electronic device shown in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The inventor finds that, in the process of compiling a certain component in a project, if the intermediate file of the component needs to be obtained, if the intermediate file of the component is not generated in real time, but if the intermediate file of the component is generated and cached before, the cached intermediate file of the component can be called directly, the time consumed in the process of generating the intermediate file of the component can be saved, so that the efficiency of compiling the component can be improved, and the efficiency of compiling the project can be improved.
However, the inventor has found that under the Clang Module mechanism, the cache paths of the intermediate files generated when different components are compiled are often different for a plurality of components in the same project, so that the compiler caches the intermediate files generated when different components are compiled in different cache paths for different components in the process of compiling different components in the same project. The names of the intermediate files generated when different components are compiled respectively relate to cache paths of the intermediate files generated when different components are compiled, and for example, the file names of the intermediate files generated when different components are compiled have hash values generated from the cache paths of the intermediate files generated when different components are compiled.
Since the tasks of compiling the components are independent of each other, for any one component, when the compiler compiles the component, the compiler does not know the task of compiling "other components" and the cache path of the intermediate file generated when compiling other components, and further cannot know the file name of the intermediate file generated when compiling other components cached in the cache path of the intermediate file generated when compiling other components.
Since the cache path and the file name are unknown, if an intermediate file needs to be obtained in the process of compiling one component, even if the intermediate file is stored in the cache path of the intermediate file generated when compiling other components, the intermediate file cannot be called in the cache path of the intermediate file generated when compiling other components in the process of compiling one component, the intermediate file needs to be generated in real time, but the process of generating the intermediate file in real time consumes a lot of time, so that the compiling efficiency of one component is low, and further the compiling efficiency of a project is low.
To this end, with reference to fig. 1, the present application shows a flow chart of the steps of a method for acquiring an intermediate file.
By the method, the cache path of the intermediate file of each component generated when each component in the project is compiled can be set to be a uniform cache path, for example, a uniform global cache path is set.
And, the file name of the intermediate file of each component generated when compiling each component in the project may be set to be strongly related only to the component name of the component, for example, the cache path may not be involved, for example, the hash value generated from the cache path or the like may not be involved.
Alternatively, the file names of the intermediate files of the respective components generated when the respective components in the project are compiled may be set to be strongly correlated with the component names of the components and the global cache path, which is uniform. For example, hash values generated from the global cache path, etc. may be involved.
In this application, the global cache path of the project is located under the default directory "-/Library/Developer/Xcode/DerivedData" of the compiler, the directory of the project may be created in the "DerivedData", and the directory name may be named according to the name of the project, etc.
The normal directory of the project is a global cache path, and intermediate files generated in the process of compiling each component in the project can be cached in the global cache path.
The global cache path of the project may be accessed during compilation of each component in the project.
Thus, for any one component, when the compiler compiles the component, a unified cache path may be known, for example, a global cache path of the project, and also a component name of the component and component names of other components referenced by the component may be known, so that by improving the compiler, when the compiler compiles the component, if an intermediate file of the component or an intermediate file of other components referenced by the component needs to be obtained, the intermediate file of the component or an intermediate file of other components referenced by the component may be searched in the unified cache path according to the component name of the component or the component names of other components referenced by the component.
A compiler is a program that translates "one language (usually a high-level language)" into "another language (usually a low-level language)". The main work flow of the compiler is as follows: source code → preprocessor → compiler → object code → Linker → executable program executables.
The compiler includes LLVM (Low Level Virtual Machine) and the like, and may be a front-end compiler based on C language/C + + language of LLVM/object-oriented programming language-C of augmented C, for example, front-end Clang and the like.
Front end component Clang Module: it contains a library, an Application Programming Interface (API) for externally exposing the library, and the implementation of the library.
The method is applied to the electronic equipment, and specifically comprises the following steps:
in step S101, in the process of compiling a plurality of components in a project, when an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, in a global cache path of the project, the intermediate file in the preset format is searched at least according to a component name of the first component.
In the present application, the project includes a plurality of components, and in the process of compiling the project, some components in the project may be compiled simultaneously, but all components in the project cannot be compiled simultaneously, so that multiple batches of compiling may be performed on the components in the project. That is, there is a precedence order for the process of compilation of components in the project.
For example, the project includes 100 components, and when the project is compiled, 100 components in the project need to be compiled, but the compiler only supports compiling 5 components at most simultaneously, and then compiling at least 20 batches of 100 components in the project needs to be performed.
There may be reference relationships (dependencies) between components in the project, e.g., one component in the project references other components in the project, etc. Thus, when one of the components in the project is compiled, in addition to the intermediate file in the preset format of the one of the components, an intermediate file in the preset format of the other component referred to by the one of the components needs to be generated to obtain the intermediate file in the preset format of the one of the components and the intermediate file in the preset format of the other component referred to by the one of the components, so that the intermediate file in the preset format of the one of the components and the intermediate file in the preset format of the other component referred to by the one of the components are applied in a later process in the process of compiling the one of the components to complete the compiling of the one of the components.
The preset format includes a PCM format and the like.
The intermediate file comprises a temporary file generated in the process of compiling the component, and the temporary file has no effect on the compiling of the component after the component is compiled, so that the temporary file can not be used for the component.
In a case where the intermediate file in the preset format of the one of the components and the intermediate file in the preset format of the other component referred to by the one of the components are generated, the intermediate file in the preset format of the one of the components and the intermediate file in the preset format of the other component referred to by the one of the components may be cached in the global cache path of the project.
The intermediate file in the preset format of the one component or the intermediate file in the preset format of the other component referenced by the one component can be directly called in a global cache path later in the case of compiling the other component in the project referencing the "the one component" or in the case of compiling the other component in the project referencing the "the other component referenced by the one component", without generating the intermediate file in the preset format of the one component in real time and without generating the intermediate file in the preset format of the other component referenced by the one component in real time.
Since the time duration required for the process of directly calling the intermediate file in the preset format of the one component or the intermediate file in the preset format of the other component referred to by the one component in the global cache path is less than the time duration required for the process of generating the intermediate file in the preset format of the one component or the intermediate file in the preset format of the other component referred to by the one component in real time, the time duration required for directly calling the intermediate file in the preset format of the one component or the intermediate file in the preset format of the other component referred to by the one component in the global cache path can save time, thereby improving the efficiency of compiling the other component referring to the "the one component" in the project and the efficiency of compiling the other component referring to the "the other component referred to by the one component" in the project, and further improve the efficiency of engineering compilation.
In an embodiment of the present application, in the process of compiling the first component in the project, the intermediate file in the preset format of the first component needs to be obtained, so that the intermediate file in the preset format of the first component is applied in a later process in the process of compiling the first component, and the compiling of the first component is completed.
Wherein the first component is one of a plurality of components included in the project.
In one case, before the first component in the project is compiled, the second component in the project, which refers to the first component, is compiled, and since the second component refers to the first component, in the process of compiling the second component in the project, an intermediate file in a preset format of the first component and an intermediate file in a preset format of the second component are generated. And then naming the intermediate file with the preset format of the first component according to at least the component name of the first component, and caching the file with the preset format of the first component in a global cache path of the project. And naming the intermediate file with the preset format of the second component at least according to the component name of the second component, and caching the file with the preset format of the second component in the global cache path of the project.
Therefore, in the process of compiling the first component in the project, if the intermediate file in the preset format of the first component needs to be obtained, the intermediate file in the preset format can be searched in the global cache path of the project at least according to the component name of the first component, and the intermediate file in the preset format can be searched, and the searched intermediate file in the preset format is the intermediate file in the preset format of the first component.
In another embodiment of the present application, a first component in the project is referred to by a second component in the project, and in a process of compiling the second component in the project, an intermediate file in a preset format of the first component and an intermediate file in a preset format of the second component need to be obtained, so that the intermediate file in the preset format of the first component and the intermediate file in the preset format of the second component are applied in a later process in a process of compiling the second component, and thus, the compiling of the second component is completed.
Wherein the second component is one of the components included in the project except the first component.
In one case, before the second component in the project is compiled, the first component in the project is compiled, in the process of compiling the first component in the project, an intermediate file in a preset format of the first component is generated, then the intermediate file is named according to at least the component name of the first component as the intermediate file in the preset format of the first component, and the file in the preset format of the first component is cached in the global cache path of the project.
Or, in another case, before the second component in the project is compiled, the third component in the project, which refers to the first component, is already compiled, and in the process of compiling the third component in the project, the intermediate file in the preset format of the first component and the intermediate file in the preset format of the third component are generated. And then naming the intermediate file with the preset format of the first component according to at least the component name of the first component, and caching the file with the preset format of the first component in a global cache path of the project. And naming the intermediate file in the preset format of the third component at least according to the component name of the third component, and caching the file in the preset format of the third component in the global cache path of the project.
Therefore, in the process of compiling the second component in the project, if the intermediate file in the preset format of the first component needs to be obtained, the intermediate file in the preset format can be searched in the global cache path of the project at least according to the component name of the first component, and the intermediate file in the preset format can be searched, and the searched intermediate file in the preset format is the intermediate file in the preset format of the first component.
In one embodiment, in a case that the intermediate file name in the preset format of the first component needs to be named at least according to the component name of the first component, the file name of the intermediate file in the preset format of the first component may be generated at least according to the component name of the first component and the global cache path.
For example, in one example, a hash value of the global cache path may be generated, and then the component name of the first component is combined with the hash value, and the combined data is determined as the file name of the intermediate file in the preset format of the first component.
Thus, for any one component, in the process of compiling the component, if the intermediate file in the preset format of the component or the intermediate file in the preset format of another component in the project referred by the component needs to be obtained, the intermediate file in the preset format of the component or the intermediate file in the preset format of another component in the project referred by the component may be searched in the global cache path.
For the task of compiling the component, the compiler can know the global cache path of the project, so that a hash value of the global cache path can be generated, and secondly, the compiler can also know the component name of the component, so that the component name of the component and the generated hash value of the global cache path can be combined to obtain a new name, an intermediate file in a preset format is searched in the global cache path according to the new name, and the searched intermediate file in the preset format is used as an intermediate file in the preset format of the component.
In another embodiment, the naming parameter for the project may be determined in case an intermediate file naming according to at least a preset format of the first component is required based on the component name of the first component.
The naming parameter of the project may be set in advance by a technician in a compiler, for example, in a compiling command (e.g., xcodebuild command) input in the compiler, where the naming parameter of the project includes a preset hash prohibition parameter and a preset hash permission parameter.
The hash disable parameter may comprise DisableModuleHash, etc.
In one case, the naming parameter of the project is a preset hash permission parameter, in which case, after naming the intermediate file in the preset format of the first component, the file name of the intermediate file in the preset format of the first component needs to include a hash value, and the hash value may be generated according to a cache path (global cache path) of the intermediate file in the preset format of the first component.
In another case, the naming parameter of the project is a preset hash prohibition parameter, in which case, after naming the intermediate file of the preset format of the first component, the file name of the intermediate file of the preset format of the first component does not include a hash value, for example, a hash value generated according to the cache path of the intermediate file of the preset format of the first component.
In an embodiment of the present application, the naming parameter of the project may be a preset hash prohibition parameter, so that when naming the intermediate file in the preset format of the first component, the component name of the first component may be determined as the file name of the intermediate file in the preset format of the first component without using a hash value.
Thus, for any one component, in the process of compiling the component, if the intermediate file in the preset format of the component or the intermediate file in the preset format of another component in the project referred by the component needs to be obtained, the intermediate file in the preset format of the component or the intermediate file in the preset format of another component in the project referred by the component may be searched in the global cache path.
For the task of compiling the component, the compiler can know the component name of the component, so that the intermediate file in the preset format can be searched in the global cache path according to the component name of the first component, and the searched intermediate file in the preset format is used as the intermediate file in the preset format of the component.
In step S102, when the intermediate file in the preset format is found at least according to 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.
The found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after the intermediate file is generated is named and cached in the global cache path.
In the application, in the process of compiling a plurality of components in a project, under the condition that an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, the intermediate file in the preset format is searched for in a global cache path of the project at least according to a component name of the first component, and under the condition that the intermediate file in the preset format is searched for at least according to the component name of the first component, the searched intermediate file in the preset format is determined to be the intermediate file in the preset format of the first component and is directly applied to the intermediate file in the preset format of the first component searched for in the global cache path of the project. By the aid of the method and the device, when the intermediate file in the preset format of the first component needs to be obtained in the compiling process, the generated intermediate file in the preset format of the first component can be directly called, the intermediate file in the preset format of the first component does not need to be generated in real time, multiplexing of the intermediate file in the preset format is achieved, time can be saved, efficiency of obtaining the intermediate file in the preset format of the first component is improved, and compiling efficiency of engineering can be improved.
Further, in the case that all components in the project have been compiled, the intermediate files cached in the global cache path are not used any more, and therefore, in order to save the storage space, the intermediate files cached in the global cache path of the project may be deleted, for example, the intermediate file in the preset format of the first component may be deleted, the intermediate files in the preset format of other components in the project may be deleted, and the intermediate files in other formats generated in the compilation project and cached in the global cache path of the project may be deleted.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders and concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are exemplary and that no action is necessarily required in this application.
Referring to fig. 2, a block diagram of a structure of an apparatus for acquiring an intermediate file according to the present application is shown, and the apparatus is applied to an electronic device, and specifically may include the following modules:
the searching module 11 is configured to search, in a global cache path of a project, an intermediate file in a preset format according to at least a component name of a first component in a plurality of components when the intermediate file in the preset format of the first component in the plurality of components needs to be obtained in a process of compiling the plurality of components in the project;
a determining module 12, configured to determine, when an intermediate file in a preset format is found at least according to the component name of the first component, the found intermediate file in the preset format as the intermediate file in the preset format of the first component;
the found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after being generated is named and cached in the global cache path.
In an optional implementation, the apparatus further comprises:
and the generating module is used for generating the file name of the intermediate file in the preset format of the first component at least according to the component name of the first component and the global cache path under the condition that the intermediate file in the preset format of the first component is named at least according to the component name of the first component.
In an optional implementation manner, the generating module includes:
the generation unit is used for generating a hash value of the global cache path;
and the combining unit is used for combining the component name and the hash value to obtain the file name of the intermediate file of the first component in the preset format.
In an optional implementation, the apparatus further comprises:
the 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 when the intermediate file in the preset format of the first component needs to be named at least according to the component name of the first component.
In an optional implementation, the apparatus further comprises:
and the deleting module is used for deleting the intermediate file cached in the global cache path under the condition that all the components in the project are compiled.
In the application, in the process of compiling a plurality of components in a project, under the condition that an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, the intermediate file in the preset format is searched for in a global cache path of the project at least according to a component name of the first component, and under the condition that the intermediate file in the preset format is searched for at least according to the component name of the first component, the searched intermediate file in the preset format is determined to be the intermediate file in the preset format of the first component and is directly applied to the intermediate file in the preset format of the first component searched for in the global cache path of the project. By the aid of the method and the device, when the intermediate file in the preset format of the first component needs to be obtained in the compiling process, the generated intermediate file in the preset format of the first component can be directly called, the intermediate file in the preset format of the first component does not need to be generated in real time, multiplexing of the intermediate file in the preset format is achieved, time can be saved, efficiency of obtaining the intermediate file in the preset format of the first component is improved, and compiling efficiency of engineering can be improved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Optionally, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, and the computer program stored in the memory and capable of running on the processor, when executed by the processor, implement each process of the above-mentioned method for acquiring an intermediate file, and can achieve the same technical effect, and are not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements each process of the above-mentioned method for acquiring an intermediate file, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated 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.
Fig. 3 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 3, 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.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, images, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices 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 memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a 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 touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The 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, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. 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.
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, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the electronic device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 4 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 may be provided as a server.
Referring to fig. 4, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (12)

1. A method for acquiring an intermediate file is characterized by comprising the following steps:
in the process of compiling a plurality of components in a project, under the condition that an intermediate file in a preset format of a first component in the plurality of components needs to be obtained, in a global cache path of the project, the intermediate file in the preset format is searched at least according to the component name of the first component;
determining the intermediate file in the preset format as the intermediate file in the preset format of the first assembly under the condition that the intermediate file in the preset format is found at least according to the assembly name of the first assembly;
the found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after being generated is named and cached in the global cache path.
2. The method of claim 1, further comprising:
and under the condition that the intermediate file in the preset format of the first component needs to be named at least according to the component name of the first component, generating the file name of the intermediate file in the preset format of the first component at least according to the component name of the first component and the global cache path.
3. The method according to claim 2, wherein the generating a file name of an 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;
and combining the component name and the hash value to obtain the file name of the intermediate file of the first component in the preset format.
4. The method of claim 1, further comprising:
and under the condition that the intermediate file in the preset format of the first component needs to be named 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 the preset format of the first component.
5. The method of claim 1, further comprising:
deleting the intermediate file cached in the global cache path in the case that all components in the project have been compiled.
6. An apparatus for acquiring an intermediate file, the apparatus comprising:
the system comprises a searching module, a compiling module and a processing module, wherein the searching module is used for searching an intermediate file in a preset format according to at least the component name of a first component in a global cache path of a project under the condition that the intermediate file in the preset format of the first component in the multiple components needs to be obtained in the process of compiling the multiple components in the project;
the determining module is used for determining the found intermediate file in the preset format as the intermediate file in the preset format of the first assembly under the condition that the intermediate file in the preset format is found at least according to the assembly name of the first assembly;
the found intermediate file in the preset format is generated in the process of compiling the first component in the project or generated in the process of compiling the second component which refers to the first component in the project, and the intermediate file in the preset format which is generated at least according to the component name of the first component after being generated is named and cached in the global cache path.
7. The apparatus of claim 6, further comprising:
and the generating module is used for generating the file name of the intermediate file in the preset format of the first component at least according to the component name of the first component and the global cache path under the condition that the intermediate file in the preset format of the first component is named at least according to the component name of the first component.
8. The apparatus of claim 7, wherein the generating module comprises:
the generation unit is used for generating a hash value of the global cache path;
and the combining unit is used for combining the component name and the hash value to obtain the file name of the intermediate file of the first component in the preset format.
9. The apparatus of claim 6, further comprising:
the 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 when the intermediate file in the preset format of the first component needs to be named at least according to the component name of the first component.
10. The apparatus of claim 6, further comprising:
and the deleting module is used for deleting the intermediate file cached in the global cache path under the condition that all the components in the project are compiled.
11. An electronic device, comprising: processor, memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method of acquiring an intermediate file according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that a computer program is stored thereon, which, when being executed by a processor, carries out the steps of the method of acquiring an intermediate file according to any one of claims 1 to 5.
CN202110745532.8A 2021-06-30 2021-06-30 Method and device for acquiring intermediate file, electronic equipment and storage medium Pending CN113590128A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110745532.8A CN113590128A (en) 2021-06-30 2021-06-30 Method and device for acquiring intermediate file, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110745532.8A CN113590128A (en) 2021-06-30 2021-06-30 Method and device for acquiring intermediate file, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113590128A true CN113590128A (en) 2021-11-02

Family

ID=78245422

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110745532.8A Pending CN113590128A (en) 2021-06-30 2021-06-30 Method and device for acquiring intermediate file, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113590128A (en)

Similar Documents

Publication Publication Date Title
CN109032606B (en) Native application compiling method and device and terminal
CN111221559B (en) Application updating method, device, storage medium, terminal and server
CN107463372B (en) Data-driven page updating method and device
CN111580824B (en) Program optimization method, device and storage medium
CN111913756B (en) Application program optimizing method, device and system, electronic equipment and storage medium
CN112114814A (en) Compiled file determining method and device and application program generating method and device
CN114528037B (en) Application starting method and device, electronic equipment and storage medium
CN113590128A (en) Method and device for acquiring intermediate file, electronic equipment and storage medium
CN113590091A (en) Data processing method and device, electronic equipment and storage medium
CN114020694B (en) Header file address acquisition method and device, electronic equipment and storage medium
CN112631695A (en) Data verification method and device, electronic equipment and storage medium
CN111597106A (en) Point burying management method and device
CN113934452B (en) Data processing method and device, electronic equipment and storage medium
CN112445484A (en) Register processing method and device, electronic equipment and storage medium
CN111596949B (en) Method and device for developing application program
CN112083981A (en) Method and device for creating page view component
CN116126320B (en) Data processing method and device, electronic equipment and storage medium
CN114020693B (en) Header file address acquisition method and device, electronic equipment and storage medium
CN114489641B (en) Data processing method and device, electronic equipment and storage medium
CN114416218B (en) Data processing method and device, electronic equipment and storage medium
CN113946346B (en) Data processing method and device, electronic equipment and storage medium
CN113535183B (en) Code processing method, device, electronic equipment and storage medium
CN115809054A (en) Data processing method and device, electronic equipment and storage medium
CN114020504B (en) Data processing method and device, electronic equipment and storage medium
CN110659081B (en) File processing method and device for program object and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination