CN114443053A - Target application program packaging method and device and electronic equipment - Google Patents

Target application program packaging method and device and electronic equipment Download PDF

Info

Publication number
CN114443053A
CN114443053A CN202210088672.7A CN202210088672A CN114443053A CN 114443053 A CN114443053 A CN 114443053A CN 202210088672 A CN202210088672 A CN 202210088672A CN 114443053 A CN114443053 A CN 114443053A
Authority
CN
China
Prior art keywords
component
target
file
information
target view
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
CN202210088672.7A
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.)
Hanyun Technology Co Ltd
Original Assignee
Hanyun Technology 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 Hanyun Technology Co Ltd filed Critical Hanyun Technology Co Ltd
Priority to CN202210088672.7A priority Critical patent/CN114443053A/en
Publication of CN114443053A publication Critical patent/CN114443053A/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
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a packaging method, a packaging device, electronic equipment and a storage medium of a target application program, wherein the packaging method comprises the following steps: acquiring at least one target view file in a target application program; searching storage path information of a component configuration file of a target component from a component directory aiming at a component name of any target component required by any target view file, and writing the storage path information of the target component configuration file of the target component into position information of the component name of the target component in the target view file so as to complete the registration of the target component in the target view file; and packaging the target application program based on each target view file which completes the registration of the components. The method and the device can independently register the components required by each target view file, only load the used components when the target views are loaded, improve the loading speed and reduce the resource consumption of the registered components.

Description

Target application program packaging method and device and electronic equipment
Technical Field
The present application relates to the field of program development technologies, and in particular, to a method and an apparatus for packaging a target application program, an electronic device, and a storage medium.
Background
With the development and popularization of internet information technology, more and more application programs which affect and change people's lives are developed, however, in the process of front-end development of the application programs, after the front-end framework of the application programs is constructed, a large number of components are needed to support each function of the application program development framework.
In the prior art, a developer or a programmer is required to register used components used by a developed application program, a conventional registration method is to perform global registration on all functional components required by the application program first, and then construct an interface framework of the application program after the global registration is completed, so that after the construction is completed, all components in the application program can be loaded when a background program is loaded for the first time, but some components are not required to be used in a current interface, so that redundant loading of component resources is caused, the loading speed is reduced, and a large amount of template codes need to be written by the developer when the components are registered, thereby causing resource consumption.
Disclosure of Invention
In view of this, an object of the present application is to provide a method and an apparatus for packaging a target application, an electronic device, and a storage medium, which can perform individual registration on components required by each target view file, and can only load the used components when a target view is loaded, thereby increasing the loading speed and reducing the resource consumption of the registered components.
The embodiment of the application provides a packaging method of a target application program, which comprises the following steps:
acquiring a component directory of a component required by a target application program, at least one target view file and a preset calling information analysis rule;
analyzing the target view file according to the preset calling information analysis rule aiming at any one target view file to obtain component calling information of a component required by the target view file; the component calling information comprises a component name of each component and position information of each component name;
searching storage path information of a component configuration file of any target component from the component directory aiming at the component name of any target component required by any target view file, and writing the storage path information of the target component configuration file of the target component into the position information of the component name of the target component in the target view file so as to finish the registration of the target component in the target view file;
and packaging the target application program based on each target view file which completes the registration of the components.
Further, the packaging method according to claim 1, wherein the analyzing the target view file according to the preset invoking information analyzing rule for any one of the target view files to obtain the component invoking information of the component required by the target view file includes:
for any target view file, carrying out format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file;
aiming at any one target format file, judging whether preset file processing completion information exists in any one target format file or not;
and if no preset file processing completion information exists in any target format file, screening the calling information of the component of any target format file according to a preset calling rule formula in the preset calling information analysis rule to obtain the component calling information of the component required by the target view file.
Further, after the determining whether there is preset file processing completion information in any of the target format files, for any of the target format files, the packaging method further includes:
and if the preset file processing completion information exists in any one of the target format files, ending the analysis of the target view file corresponding to the target format file.
Further, the searching, from the component directory, storage path information of a target component configuration file of the target component for the component name of any target component required by any target view file includes:
aiming at the component name of any target component required by any target view file, judging whether the component name of the component matched with the component name of any target component exists in a component directory;
if the component directory exists, determining that the storage path information of the component configuration file of the component in the component directory is the storage path information of the target component configuration file of the target component;
if the component directory does not exist, updating the component directory of the component of the target application program, and searching the storage path information of the target component configuration file of the target component from the updated component directory; the updated component directory includes storage path information of a target component configuration file of the target component.
Further, the determining, for the component name of any target component required by any target view file, whether a component name of a component matching the component name of any target component exists in the component directory includes:
respectively performing preset format conversion on the component name of a component in a component directory and the component name of any target component required by any target view file to generate a standard component name of the component in the component directory and a standard target component name of any target component required by any target view file;
and aiming at the standard target component name of any target component required by any target view file, judging whether the component directory has the standard component name of the component matched with the standard target component name of any target component.
Further, before packaging the target application based on each target view file for which registration of a component is completed, the packaging method further includes:
adding preset file processing completion information at a first designated position of a target view file for completing the registration of the component; the preset file processing completion information is used for representing that the target view file completes the registration of the component;
adding file import information at a second designated position of the target view file where the registration of the component is completed; the file import information includes standard component names of components in the component directory.
An embodiment of the present application further provides a packaging apparatus for a target application, where the packaging apparatus includes:
further, the parsing module is specifically configured to:
for any target view file, carrying out format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file;
aiming at any one target format file, judging whether preset file processing completion information exists in any one target format file or not;
if no preset file processing completion information exists in any target format file, screening calling information of components of any target format file according to a preset calling rule formula in a preset calling information analysis rule to obtain component calling information of the components required by the target view file; the calling rule formula is used for characterizing a rule expression of calling information of the component.
An embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of the packing method as described above.
Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the packaging method as described above.
Compared with the prior art, the packaging method, the packaging device, the electronic equipment and the storage medium provided by the embodiment of the application have the advantages that the target view file is divided for the target application program, the storage path information of the target component configuration file required by the target view file is acquired from the configured component directory according to the component calling information of any target view file, the components required by each target view file can be independently registered, only the used components can be loaded when the target view is loaded, the loading speed can be increased, and the resource consumption of the registered components is reduced; the development efficiency is improved, and meanwhile, the follow-up development modification and reconstruction are facilitated.
In order to make the aforementioned objects, features and advantages of the present application comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a flowchart illustrating a packaging method of a target application according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for packaging a target application according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram illustrating a packaging apparatus for a target application according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of another packaging apparatus for a target application provided in an embodiment of the present application;
fig. 5 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
In the figure:
300-a packing device; 310-an acquisition module; 320-a resolution module; 330-a search module; 340-a packing module; 350-a first adding module; 360-a second adding module; 500-an electronic device; 510-a processor; 520-a memory; 530-bus.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. Every other embodiment that can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present application falls within the protection scope of the present application.
First, an application scenario to which the present application is applicable will be described. Research shows that in the prior art, developers or programmers are required to register used components used by a developed application program, and a traditional registration method is to perform global registration on all functional components required by the application program firstly, and then construct an interface framework of the application program after the global registration is completed, so that after the construction is completed, all components in the application program can be loaded when a background program is loaded for the first time, but some components do not need to be used in a current interface, so that redundant loading of component resources is caused, the loading speed is reduced, and the developers need to write a large amount of template codes when registering the components, and resource consumption is caused.
Based on this, the embodiment of the application provides a method and an apparatus for a target application program, an electronic device, and a storage medium, which avoid redundant loading of component resources, increase loading speed, and further improve user experience.
Referring to fig. 1, fig. 1 is a flowchart illustrating a packaging method of an object application according to an embodiment of the present disclosure. As shown in fig. 1, a packaging method for an object application provided in an embodiment of the present application includes the following steps:
s101, acquiring a component directory of a component required by a target application program, at least one target view file and a preset calling information analysis rule.
In this step, when a target application program is developed, first, it is necessary to determine a function location of the target application program, and on this basis, a front-end architecture of the target application program is constructed based on a static module packaging tool, for example, webpack, at least one target view file of the target application program is compiled according to the front-end architecture of the target application program, a component directory of a required component is configured for the target view file, and a preset call information parsing rule for any target view file is set.
Here, the embodiment provided by the application is equivalent to inserting a plug-in into an original webpack, then transferring the configured component directory into the plug-in, and the preset calling information parsing rule is to insert a new rule into a construction rule in the original webpack, so as to form a compiling selection component rule for a component in any target view file, and the preset calling information parsing rule is used for coding and parsing each target view file; an object view file (vue file) which is a progressive scripting language (javascript) framework; the component of the target view file is a reusable target view file instance, that is, the target view file can be understood as an interface file displayed in an interface form in the target application program.
Here, the registration of a required component in any target view file may be understood as that after the interface framework of the target application program is constructed, the path storage information of the target component required by the target view file in the target application program is stored in the target component from the component directory, the process of obtaining and storing is equivalent to the registration process of the component, and the reference of the component refers to the process of marking the component standard component name of the target component required by the target view file in the component directory to the specified position of the target view file.
The preset calling information analysis rule provided by the application includes, but is not limited to, a specific coding expression as follows:
{ include [/\\ vue $/,/\ vue? vue/], equation: "post", use: [ LOADER: LOADER ]; wherein include is a computer professional term, and a command for including header files in programming language is used for embedding specified header files into a source file; the two instruction include includes a static file in the programming language, and analyzes the JavaServer Pages (JSP) statement in the file.
The construction rules in webpack provided by the application include, but are not limited to, specific coding expressions;
compiler.options.module.rules;
a plug-in is a program written by a target application program interface that complies with a specification, and can only run on the system platform specified by the target application program (possibly supporting multiple platforms simultaneously), and cannot run separately from the specified platform. Because the plug-in needs to call a function library or data provided by the original pure system, many application software has plug-ins, and the number of the plug-ins is infinite. For example, in the IE, after installing the relevant plug-in, the Web browser can directly call the plug-in for processing a specific type of file.
webpack is a static modular packaging tool for modern scripting language (JavaScript, JS) applications. When the webpack processes the application, it builds a dependency graph (dependency graph) internally from one or more entry points, and then combines each module needed in your project into one or more bundles, which are static resources, for exposing your content; JS is a dynamic scripting language based on prototype programming and multi-paradigm, and supports object-oriented, command-oriented, declarative and functional programming paradigms; dependency graphs (dependency graphs), a graphical representation of a program, are labeled directed multi-graphs. The program dependency graph can represent control dependency and data dependency of a program; bundles is an executable file.
S102, aiming at any one target view file, analyzing the target view file according to the preset calling information analysis rule to obtain component calling information of a component required by the target view file; the component calling information includes a component name of each component and location information of each component name.
In this step, for a target view file in each target application program, a preset calling information analysis rule analyzes the target view file, obtains component calling information of components required by the target view file, and generates a component calling list corresponding to the target view file based on the component information of all the required components.
Here, the component calling information and the component calling list include a component name of each component and location information of each component name, and the location information of each component name includes, but is not limited to, start location information of each component name string and end location information of each component name string in the code after the target view file is parsed.
S103, aiming at the component name of any target component required by any target view file, searching the storage path information of the component configuration file of the target component from the component directory, and writing the storage path information of the target component configuration file of the target component into the position information of the component name of the target component in the target view file so as to complete the registration of the target component in the target view file.
In the step, according to the component name of any target component in any target view file, the storage path information of the component configuration file of the target component is searched from the configured component directory, the storage path information of the component configuration file of the target component is written into any target component in any target view file based on the name character string starting position information and the name character string ending position information in the position information of the component name, then other target components except the target component in a component calling list in any target view file are searched in the component directory in sequence, the registration of the searched target component is completed, and the registration of the target view file is completed.
Preferably, the searching, for the component name of any target component required by any target view file, of the storage path information of the target component configuration file of the target component from the component directory includes:
and aiming at the component name of any target component required by any target view file, judging whether the component name of the component matched with the component name of any target component exists in the component directory.
Here, the component name of the component in the component directory and the component name of any target component required by any target view file are respectively subjected to preset format conversion, and a standard component name of the component in the component directory and a standard target component name of any target component required by any target view file are generated.
Here, when performing the preset format conversion on the component name of the component in the catalog and the component name of any target component required by any target view file, specific formats of the preset format conversion include, but are not limited to: the component name of the component and the resolution code of the component name of any target component required by any target view file are converted into the format of camelCase.
And aiming at the standard target component name of any target component required by any target view file, judging whether the component directory has the standard component name of the component matched with the standard target component name of any target component.
Here, after the conversion of the preset format of the camelCase is performed, it is determined whether or not a code of a standard component name of a component matching the code of the standard target component name of any target component exists in the component directory, that is, whether or not a character string of the same camelCase preset format is included therebetween.
If the storage path information exists, the storage path information of the component configuration file of the component in the component directory is determined to be the storage path information of the target component configuration file of the target component.
Here, if a character string in the camelCase preset format identical to a character string in the camelCase preset format of the standard target component name of any target component exists in the component directory, it is determined that the storage path information of the component configuration file of the component in the component directory is the storage path information of the target component configuration file of the target component.
If the component directory does not exist, updating the component directory of the component of the target application program, and searching the storage path information of the target component configuration file of the target component from the updated component directory; the updated component directory includes storage path information of a target component configuration file of the target component.
If the component directory does not exist, the component directory is divided into two cases, wherein one case is that the component needed by the target application program in the component directory is configured wrongly, and at the moment, the storage path of the configuration file of the component in the component directory is updated again; and in the other situation, the target view file is analyzed according to a preset calling information analysis rule, if the component calling information of the component is obtained to be an error, the target view file is analyzed again to see whether the error can be solved or not.
S104, packaging the target application program based on each target view file which completes the registration of the components.
In the step, after the registration of the required components of any target view file in the target application program is completed, the registration of the required components of all the target view files in the target application program is continuously completed according to a preset development frame, and then the target application program is packaged to further realize the release.
Here, the place of the release has no internet platform of each type, and may be a mobile terminal or a computer, and there is no particular limitation, and a specific released application scenario needs a developer or a programmer to determine and select according to actual requirements of development.
Preferably, before packaging the target application based on each target view file for which registration of a component is completed, the packaging method further includes:
adding preset file processing completion information at a first designated position of a target view file for completing the registration of the component; the preset file processing completion information is used for representing that the target view file completes the registration of the component.
After all the components in the component call list aiming at any target view file are completely registered, adding preset file processing completion information at a first specified position of the target view file; wherein the first specified location is a location specified in the code of the target view file by a developer or programmer.
As such, the first specified location includes, but is not limited to, a header or trailer of the code of the target view file.
Meanwhile, the code of the preset file processing completion information is a character string specially set by a developer or a programmer, including but not limited to: "// overload auto import component by hy-vue-auto-import".
Adding file import information at a second designated position of a target view file for completing the registration of the component; the file import information includes standard component names of components in the component directory.
After all the components in the component call list of any target view file are completely registered, file introduction information is added at a second designated position of the target view file, storage path information of the components in the component directory is referred to the target components required by the target view file, and component reference is achieved.
Wherein the introduction information includes but is not limited to: import hy _ auto _ import _ + name from "component directory + standard component name".
A specific embodiment for the configuration of the components is given below, comprising the following steps:
the developer introduces the plug-in developed by the technology into the webpack configuration file, registers the plug-in and transmits the component catalog of the component to the plug-in.
Launching webpack builds a framework for the target application.
And inserting a preset calling information analysis rule in the webpack framework construction rule by using a plug-in, and performing format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file.
And judging whether preset file processing completion information exists in any target format file or not aiming at any target format file.
If no preset file processing completion information exists in any target format file, analyzing a regular expression in a rule according to preset calling information: "/_ c \ ([ \ s \ n \ t ] ['" ] (. +.
And respectively carrying out preset format conversion on the component name of the component in the component directory and the component name of any target component required by any target view file related in the calling information, converting the component name into a camelCase format, and generating the standard component name of the component in the component directory and the standard target component name of any target component required by any target view file in the camelCase format.
And aiming at the standard target component name of any target component in the camelCase format required by any target view file, judging whether the component directory has the standard component name of the component matched with the standard target component name of any target component in the camelCase format.
And if the component calling list does not comprise the component name of the target component, adding preset file processing completion information in the target view file.
And if the component calling list comprises the component name of the target component, writing the storage path information of the target component configuration file of the target component into the position information of the component name of the target component in the target view file according to start, end and name in the component calling information, "_ c (+ _ hy _ auto _ input _ + name)".
And traversing the component call list, determining all target components of the target view file, and finishing the registration of the target components.
Adding preset file processing completion information at a first designated position of the target view file, and adding file introduction information at a second designated position of the target view file, wherein the file introduction information comprises standard component names of components in the component directory, namely 'component directory + standard component names'.
Compared with the prior art, the packaging method provided by the embodiment of the application divides the target view file for the target application program, and acquires the storage path information of the target component configuration file required by the target view file from the configured component directory according to the component calling information of any target view file, so that the components required by each target view file can be independently registered, only the used components can be loaded when the target view is loaded, the loading speed can be increased, and the resource consumption of the registered components can be reduced; the development efficiency is improved, and meanwhile, the follow-up development modification and reconstruction are facilitated.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for packaging a target application according to another embodiment of the present application. As shown in fig. 2, the method for packaging a markup program provided in the embodiment of the present application includes the following steps:
s201, obtaining a component directory of a component required by the target application program, at least one target view file and a preset calling information analysis rule.
S202, carrying out format conversion on any target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file.
In the step, for any target view file, format conversion is carried out on the target view file according to a format conversion rule in a preset calling information analysis rule, and a target format file with the same format as the preset file processing completion information format is obtained.
S203, aiming at any one of the target format files, judging whether preset file processing completion information exists in any one of the target format files.
In this step, the preset file processing completion information includes, but is not limited to: "// overload auto import component by hy-vue-auto-import".
Here, the preset file processing completion information is used for representing that the target view file completes the registration of the component, so that the performance waste caused by multiple processing of the target view file, analysis errors and the like are avoided.
S204, if no preset file processing completion information exists in any target format file, screening calling information of components of any target format file according to a preset calling rule formula in a preset calling information analysis rule to obtain component calling information of the components required by the target view file; the component calling information includes a component name of each component and location information of each component name.
In this step, if there is no preset file processing completion information in any of the target format files, it is indicated that the required component in the target view file corresponding to the target format file is not processed, and at this time, the calling information of the component is screened for any of the target format files according to a preset calling rule formula in a preset calling information parsing rule, so as to obtain the component calling information of the component required by the target view file.
Here, the preset calling information parsing rule includes, but is not limited to, using a regular expression, and the obtaining manner of the calling information of the component is specifically: by calling an Application Programming Interface (API) in the code of the object format file.
The regular expression, also called regular expression, is a logic formula for operating character strings in codes, i.e. a "regular character string" is formed by using some specific characters defined in advance and the combination of the specific characters, and the "regular character string" is used for expressing a filtering logic for the character string.
Thus, regular expressions include, but are not limited to, specifically: "/_ c \ ([ \ s \ n \ t ] ['" ] (. +.
Preferably, if preset file processing completion information exists in any one of the target format files, the analysis of the target view file corresponding to the target format file is ended.
Here, if there is preset file processing completion information in any of the object format files, it indicates that the object component required in the object view file corresponding to the object format file is already registered and processed, and there is no need to repeatedly perform parsing, registration, and reference on the object component.
S205, for the component name of any target component required by any target view file, searching the storage path information of the component configuration file of the target component from the component directory, and writing the storage path information of the target component configuration file of the target component into the location information of the component name of the target component in the target view file, so as to complete registration of the target component in the target view file.
S206, packaging the target application program based on each target view file which completes the registration of the component.
The descriptions of S201 and S205 to S206 may refer to the descriptions of S101 and S103 to S104, and the same technical effects can be achieved, which are not described in detail.
Compared with the prior art, the method for packaging the target application program provided by the embodiment of the application program divides the target view file of the target application program, acquires the storage path information of the target component configuration file required by the target view file from the configured component directory according to the component calling information of any target view file, can realize the independent registration of the components required by each target view file, can only load the used components when the target view is loaded, can improve the loading speed, and reduces the resource consumption of the registered components; the development efficiency is improved, and meanwhile, the follow-up development modification and reconstruction are facilitated.
Referring to fig. 3 and 4, fig. 3 is a schematic structural diagram of a packaging apparatus for a target application according to an embodiment of the present disclosure, and fig. 4 is a schematic structural diagram of another packaging apparatus for a target application according to an embodiment of the present disclosure. As shown in fig. 3, the packing apparatus 300 includes:
the obtaining module 310 is configured to obtain a component directory of a component required by the target application, at least one target view file, and a preset invoking information parsing rule.
The analysis module 320 is configured to analyze, according to the preset analysis rule for the calling information, any one of the target view files to obtain component calling information of a component required by the target view file; the component calling information includes a component name of each component and location information of each component name.
Preferably, the parsing module 320 is specifically configured to:
and for any target view file, carrying out format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file.
And judging whether preset file processing completion information exists in any target format file or not aiming at any target format file.
And if no preset file processing completion information exists in any target format file, screening the calling information of the component of any target format file according to a preset calling rule formula in the preset calling information analysis rule to obtain the component calling information of the component required by the target view file.
Preferably, after the determining whether there is preset file processing completion information in any of the target format files, for any of the target format files, the packaging method further includes:
and if the preset file processing completion information exists in any one of the target format files, ending the analysis of the target view file corresponding to the target format file.
The searching module 330 is configured to search, for a component name of any target component required by any target view file, storage path information of a component configuration file of the target component from the component directory, and write the storage path information of the component configuration file of the target component into location information of the component name of the target component in the target view file, so as to complete collection of the target component in the target view file.
A packaging module 340, configured to package the target application based on each target view file that completes the collection of the components.
Compared with the prior art, the packaging device 300 for the target application program provided by the embodiment of the application program divides the target view file of the target application program, and obtains the storage path information of the target component configuration file required by the target view file from the configured component directory according to the component calling information of any target view file, so that the components required by each target view file can be independently registered, only the used components can be loaded when the target view is loaded, the loading speed can be increased, and the resource consumption of the registered components can be reduced; the development efficiency is improved, and meanwhile, the follow-up development modification and reconstruction are facilitated.
Further, as shown in fig. 4, the packing apparatus 300 includes:
the obtaining module 310 is configured to obtain a component directory of a component required by the target application, at least one target view file, and a preset invoking information parsing rule.
The analysis module 320 is configured to analyze, according to the preset analysis rule for the calling information, any one of the target view files to obtain component calling information of a component required by the target view file; the component calling information includes a component name of each component and location information of each component name.
The searching module 330 is configured to search, for a component name of any target component required by any target view file, storage path information of a component configuration file of the target component from the component directory, and write the storage path information of the component configuration file of the target component into location information of the component name of the target component in the target view file, so as to complete collection of the target component in the target view file.
Preferably, the search module 330 is specifically configured to:
and aiming at the component name of any target component required by any target view file, judging whether the component name of the component matched with the component name of any target component exists in the component directory.
Preferably, the determining, for the component name of any target component required by any target view file, whether a component name of a component matching the component name of any target component exists in the component directory includes:
and respectively carrying out preset format conversion on the component name of the component in the component directory and the component name of any target component required by any target view file to generate the standard component name of the component in the component directory and the standard target component name of any target component required by any target view file.
And judging whether the standard target component name of the component matched with the standard target component name of any target component exists in the component directory or not aiming at the standard target component name of any target component required by any target view file.
If the storage path information exists, the storage path information of the component configuration file of the component in the component directory is determined to be the storage path information of the target component configuration file of the target component.
If the component directory does not exist, updating the component directory of the component of the target application program, and searching the storage path information of the target component configuration file of the target component from the updated component directory; the updated component directory includes storage path information of a target component configuration file of the target component.
A packaging module 340, configured to package the target application based on each target view file that completes the collection of the components.
Preferably, the packing device 300 further comprises:
a first adding module 350, configured to add preset file processing completion information at a first specified location of a target view file for completing registration of a component; the preset file processing completion information is used for representing that the target view file completes the registration of the component.
A second adding module 360, configured to add file import information at a second specified location of the target view file where the registration of the component is completed; the file import information includes standard component names of components in the component directory.
Compared with the prior art, the packaging device 300 for the target application program provided by the embodiment of the application program divides the target view file of the target application program, and obtains the storage path information of the target component configuration file required by the target view file from the configured component directory according to the component calling information of any target view file, so that the components required by each target view file can be independently registered, only the used components can be loaded when the target view is loaded, the loading speed can be increased, and the resource consumption of the registered components can be reduced; the development efficiency is improved, and meanwhile, the follow-up development modification and reconstruction are facilitated.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 5, the electronic device 500 includes a processor 510, a memory 520, and a bus 530.
The memory 520 stores machine-readable instructions executable by the processor 510, when the electronic device 500 runs, the processor 510 communicates with the memory 520 through the bus 530, and when the machine-readable instructions are executed by the processor 510, the steps of the packing method in the method embodiments shown in fig. 1 and fig. 2 may be performed.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the packing method in the method embodiments shown in fig. 1 and fig. 2 may be executed.
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 several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and 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 of devices or units through some communication interfaces, 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 application 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 non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several 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 methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A packaging method for a target application, the packaging method comprising:
acquiring a component directory of a component required by a target application program, at least one target view file and a preset calling information analysis rule;
analyzing the target view file according to the preset calling information analysis rule aiming at any one target view file to obtain component calling information of a component required by the target view file; the component calling information comprises a component name of each component and position information of each component name;
searching storage path information of a component configuration file of any target component from the component directory aiming at the component name of any target component required by any target view file, and writing the storage path information of the target component configuration file of the target component into the position information of the component name of the target component in the target view file so as to finish the registration of the target component in the target view file;
and packaging the target application program based on each target view file which completes the registration of the components.
2. The packaging method according to claim 1, wherein the analyzing the target view file according to the preset invoking information analyzing rule for any one of the target view files to obtain the component invoking information of the component required by the target view file includes:
for any target view file, carrying out format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file;
aiming at any one target format file, judging whether preset file processing completion information exists in any one target format file or not;
and if no preset file processing completion information exists in any target format file, screening the calling information of the component of any target format file according to a preset calling rule formula in the preset calling information analysis rule to obtain the component calling information of the component required by the target view file.
3. The packaging method according to claim 2, wherein after said determining whether there is preset file processing completion information in any of the object format files for any of the object format files, the packaging method further comprises:
and if the preset file processing completion information exists in any one of the target format files, ending the analysis of the target view file corresponding to the target format file.
4. The packaging method according to claim 1, wherein the searching for the storage path information of the target component configuration file of the target component from the component directory for the component name of any target component required by any target view file comprises:
aiming at the component name of any target component required by any target view file, judging whether the component name of the component matched with the component name of any target component exists in a component directory;
if the component directory exists, determining that the storage path information of the component configuration file of the component in the component directory is the storage path information of the target component configuration file of the target component;
if the component directory does not exist, updating the component directory of the component of the target application program, and searching the storage path information of the target component configuration file of the target component from the updated component directory; the updated component directory includes storage path information of a target component configuration file of the target component.
5. The packaging method according to claim 4, wherein the determining whether the component name of the component matching the component name of any target component exists in the component directory for the component name of any target component required by any target view file comprises:
respectively performing preset format conversion on the component name of a component in a component directory and the component name of any target component required by any target view file to generate a standard component name of the component in the component directory and a standard target component name of any target component required by any target view file;
and aiming at the standard target component name of any target component required by any target view file, judging whether the component directory has the standard component name of the component matched with the standard target component name of any target component.
6. The packaging method of claim 5, wherein before packaging the target application based on each of the target view files for which registration of a component is completed, the packaging method further comprises:
adding preset file processing completion information at a first designated position of a target view file for completing the registration of the component; the preset file processing completion information is used for representing that the target view file completes the registration of the component;
adding file import information at a second designated position of the target view file where the registration of the component is completed; the file import information includes standard component names of components in the component directory.
7. An apparatus for packaging an object application, the apparatus comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a component directory of a component required by a target application program, at least one target view file and a preset calling information analysis rule;
the analysis module is used for analyzing the target view file according to the preset calling information analysis rule aiming at any one target view file to obtain component calling information of a component required by the target view file; the component calling information comprises a component name of each component and position information of each component name;
a searching module, configured to search, for a component name of any target component required by any target view file, storage path information of a component configuration file of the target component from the component directory, and write the storage path information of the component configuration file of the target component into location information of the component name of the target component in the target view file, so as to complete collection of the target component in the target view file;
and the packaging module is used for packaging the target application program based on each target view file which completes the collection of the components.
8. The packaging apparatus according to claim 7, wherein the parsing module is specifically configured to:
for any target view file, carrying out format conversion on the target view file according to a format conversion rule in the preset calling information analysis rule to obtain a target format file corresponding to the converted target view file;
aiming at any one target format file, judging whether preset file processing completion information exists in any one target format file or not;
if no preset file processing completion information exists in any target format file, screening calling information of components of any target format file according to a preset calling rule formula in a preset calling information analysis rule to obtain component calling information of the components required by the target view file; the calling rule formula is used for characterizing a rule expression of calling information of the component.
9. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the packaging method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the packaging method according to any one of claims 1 to 6.
CN202210088672.7A 2022-01-25 2022-01-25 Target application program packaging method and device and electronic equipment Pending CN114443053A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210088672.7A CN114443053A (en) 2022-01-25 2022-01-25 Target application program packaging method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210088672.7A CN114443053A (en) 2022-01-25 2022-01-25 Target application program packaging method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114443053A true CN114443053A (en) 2022-05-06

Family

ID=81369118

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210088672.7A Pending CN114443053A (en) 2022-01-25 2022-01-25 Target application program packaging method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114443053A (en)

Similar Documents

Publication Publication Date Title
CN110580147B (en) Application program development method and device
US6003095A (en) Apparatus and method for demand loading a dynamic link library
US8347272B2 (en) Call graph dependency extraction by static source code analysis
CN111680253B (en) Page application data packet generation method and device, computer equipment and storage medium
US9841953B2 (en) Pluggable components for runtime-image generation
US7987454B2 (en) System and method for emulating the processing of java server pages
CN110888645A (en) Method, device and storage medium for converting into small program
CN111880801A (en) Application program dynamic method and device and electronic equipment
CN112612502A (en) Patch generation method, device, equipment and storage medium
US8606766B2 (en) Method and system to handle java class versioning
CN111736812A (en) Document code execution method and device, computer equipment and storage medium
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development
US20110167415A1 (en) Language processing apparatus, language processing method, and computer program product
CN115794214B (en) Application module metadata management method, device, storage medium and apparatus
Blagodarov et al. Tool demo: Raincode assembler compiler
CN114443053A (en) Target application program packaging method and device and electronic equipment
CN113568678B (en) Method and device for dynamically loading resources and electronic equipment
CN115048082A (en) Micro front-end system construction method and device, server and readable storage medium
CN115098158A (en) SDK packaging method and device, computer equipment and storage medium
CN117270962B (en) Method and device for processing coloring language, storage medium and electronic equipment
CN115543486B (en) Server-free computing oriented cold start delay optimization method, device and equipment
CN116955209B (en) WebAsssembly virtual machine testing method and device
CN112764732B (en) Code generation method and device applied to loading target resource
CN111045657B (en) Program code operation method and device, and compiling method and device
CN110716746B (en) Method and device for converting RN style code into applet style code

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