[go: up one dir, main page]

CN113094040B - Applet compiling method and device - Google Patents

Applet compiling method and device Download PDF

Info

Publication number
CN113094040B
CN113094040B CN202110249631.7A CN202110249631A CN113094040B CN 113094040 B CN113094040 B CN 113094040B CN 202110249631 A CN202110249631 A CN 202110249631A CN 113094040 B CN113094040 B CN 113094040B
Authority
CN
China
Prior art keywords
code
compiling
tag
codes
style
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.)
Active
Application number
CN202110249631.7A
Other languages
Chinese (zh)
Other versions
CN113094040A (en
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.)
Nanjing Weiyou Information Technology Co ltd
Original Assignee
Nanjing Weiyou Information 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 Nanjing Weiyou Information Technology Co ltd filed Critical Nanjing Weiyou Information Technology Co ltd
Priority to CN202110249631.7A priority Critical patent/CN113094040B/en
Publication of CN113094040A publication Critical patent/CN113094040A/en
Application granted granted Critical
Publication of CN113094040B publication Critical patent/CN113094040B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention belongs to the field of computers, and provides a method and a device for compiling small program codes, aiming at solving the problems of repeated input of the same function in source codes and low code multiplexing rate in the compiling process of the small program codes in the prior art, wherein the method comprises the following steps: acquiring source codes of the applets; selecting compiled target standards; the target standard is a code standard operated by a target APP container; respectively compiling the tag code, the style code, the logic code and the configuration file in the source code according to the target standard, respectively storing the compiled tag code, style code, logic code and configuration file, and integrally processing the compiled tag code, style code, logic code and configuration file into a standard compiling package; outputting the standard compiling package. And storing the compiling result of each part, so that when the part of the new source code is the same as the pre-stored part in the next use, the compiling result is directly compiled into the stored compiling completion part.

Description

Applet compiling method and device
Technical Field
The invention belongs to the field of computers, and particularly relates to a method and a device for compiling an applet.
Background
With the rapid development of internet technology, smartphones are becoming more popular, and users often install various applets in smartphones according to their own needs. The standards corresponding to the various applets on the market are different, and the applet standard provider provides the APP container to run the applet using the applet standard, so that the standards used among the various applets on the market are different. The applet developer may not be able to run into the target APP container after getting its own initial code, for which reason it needs to compile.
A compiler is a computer program that translates computer code written in one programming language (source language) into another language (target language). The compiler is mainly used to convert source code from a high-level language to a low-level language (e.g., assembly language, object code, or machine code) to create an executable program. The current method for compiling the applet in the market is to directly convert the initial code of the applet developer into the standard code operated in the target APP container; for this reason, it is necessary that the code of each function module in the original code itself is sufficiently complete, that is, in the face of repeating the same function, the applet developer still needs to repeatedly write the corresponding code according to the operation order. Therefore, in the prior art, when the applet developer faces to APP containers with different standards, the applet developer needs to repeatedly write codes which can correspond to the codes; the existing applet compiling method has the problems that codes with the same function need to be repeatedly input and the code multiplexing rate is low, so that the whole applet development period is prolonged and the cost is increased.
Disclosure of Invention
The invention provides a method and a device for compiling small program codes, which are used for solving the problems that the same function in source codes needs to be repeatedly input and the code multiplexing rate is low in the compiling process of the small program codes in the prior art.
The basic scheme of the invention is as follows: a method of applet compilation, comprising the steps of:
Acquiring source codes of the applets;
selecting compiled target standards; the target standard is a code standard operated by a target APP container;
Respectively compiling the tag code, the style code, the logic code and the configuration file in the source code according to the target standard, respectively storing the compiled tag code, style code, logic code and configuration file, and integrally processing the compiled tag code, style code, logic code and configuration file into a standard compiling package;
Outputting the standard compiling package.
The beneficial effects are that: in the scheme, the source code of the applet is split into the tag code, the style code, the logic code and the configuration file, and then the split sub-packets are compiled respectively, so that the compiling speed is increased compared with the whole compiling, the condition that compiling confusion occurs among all parts of the source code is avoided after the split compiling, and the accuracy of the compiling whole is improved. And the compiling result of each part is stored, so that when the part of the new source code is the same as the pre-stored part in the next use, the compiling result is directly compiled into the stored compiling completion part.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, wherein the method comprises the following steps:
reading a tag file in the source code;
acquiring a dom object in a tag file, recursively taking out attribute values and tag types of all tag nodes in the dom object, correlating the tag file, the tag nodes, the attribute values and the tag types, and storing the tag file, the tag nodes, the attribute values and the tag types in a first storage unit;
recursively analyzing a tag file where the tag node is located according to the name of the tag node and the tag type;
and merging the results of all the tag files after parsing into one JSON object and storing the JSON object into a second storage unit.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, and further comprising:
if the label node is named import or inlude,
And recursively analyzing the label file corresponding to the label node according to the src attribute of the label node.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, and further comprising:
if the label node is named template,
And analyzing the dom object corresponding to the label node by using a recursion method according to the name attribute of the label node.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, wherein the method comprises the following steps:
screening out a style file in the source code;
Searching a corresponding style rule from a style sheet according to the style file;
The style rule is circulated, names and numerical values of the style rule are converted into first character strings, the converted first character strings are used as first data sets, and the first data sets are style rule data sets;
the first string of the first data set is stored in a third storage unit.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, wherein the method comprises the following steps:
Screening logic files containing logic codes in the source codes;
Carrying out grammar conversion, confusion and encryption processing on the logic codes in the logic file, wherein the processed character strings are second character strings, and the second character string set is a second data set;
The second data set is stored in a fourth storage unit.
Further, according to the target standard, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and then respectively storing the compiled tag code, the style code, the logic code and the configuration file, wherein the method comprises the following steps:
splitting the source code into a plurality of page files;
Reading configuration files in each page file, and collecting the configuration files of all pages into a first data set;
The first data set is stored in a fifth storage unit.
Further, the compiled tag code, style code, logic code and configuration file are integrally processed into a standard compiling package, which comprises the following steps:
Reading the compiled tag codes, style codes, logic codes and configuration files, and collecting the compiled tag codes, style codes, logic codes and configuration files into a third data set;
the third data set is compressed to form a standard compilation package.
Further, the method, prior to obtaining the source code of the applet, further comprises:
confirming whether the applet is input;
after the applet confirms the input, the source code of the acquisition applet is executed.
Further, the outputting the standard compilation package includes:
obtaining a target address corresponding to a target standard;
and storing the standard compiling packet in a fifth storage unit corresponding to the target address according to the target address.
Further, the obtaining the target address corresponding to the target storage module includes:
Acquiring an input address input by a user;
Updating a default address in the target address to the input address.
Further, compiling the tag code, the style code, the logic code and the configuration file in the source code respectively includes:
comparing the tag code with a pre-stored tag code,
When the label code is consistent with the pre-stored label code, directly setting the compiling result of the label code as a pre-stored label code compiling result corresponding to the pre-stored label code;
And/or the number of the groups of groups,
Comparing the pattern code with a pre-stored pattern code,
When the style codes are consistent with the pre-stored style codes, directly setting the compiling result of the tag codes to be the pre-stored style code compiling result corresponding to the pre-stored style codes;
And/or the number of the groups of groups,
Comparing the logical code with a pre-stored logical code,
When the logic codes are consistent with the pre-stored logic codes, directly setting the compiling result of the tag codes to be the pre-stored logic code compiling result corresponding to the pre-stored logic codes;
And/or the number of the groups of groups,
Comparing the configuration file with a pre-stored configuration file,
And when the configuration file is consistent with the pre-stored configuration file, directly setting the compiling result of the tag code to be the compiling result of the pre-stored configuration file corresponding to the pre-stored configuration file.
The embodiment of the invention also provides an applet compiling device, comprising:
The storage module is used for storing the tag codes, the style codes, the logic codes and the configuration files in the source codes and storing the compiled tag codes, style codes, logic codes and configuration files;
The receiving module is used for receiving the source code of the applet input by the requester;
the selection module is used for selecting compiled target standards;
The compiling module is used for compiling the tag codes, the style codes, the logic codes and the configuration files in the source codes respectively according to the source codes sent by the receiving module and the target standards sent by the selecting module, sending the tag codes, the style codes, the logic codes and the configuration files before and after compiling to the storage module, and sending the compiled tag codes, the style codes, the logic codes and the configuration files to the processing module;
the processing module is used for integrally processing the compiled tag codes, the style codes, the logic codes and the configuration files sent by the compiling module into standard compiling packages and sending the standard compiling packages to the output module;
and the output module is used for outputting the standard compiling packet sent by the processing module.
Further, the compiling module comprises a tag code compiling unit, a style code compiling unit, a logic code compiling unit and a configuration file compiling unit, wherein the tag code compiling unit, the style code compiling unit, the logic code compiling unit and the configuration file compiling unit respectively compile tag codes, style codes, logic codes and configuration files in the source codes;
The storage module comprises a first storage unit, a second storage unit, a third storage unit, a fourth storage unit and a fifth storage unit; the first storage unit is used for storing the tag file, the tag node, the attribute value and the tag type which are related to each other, the second storage unit is used for storing the parsed tag file, the third storage unit is used for storing the style codes before and after compiling, the fourth storage unit is used for storing the logic codes before and after compiling, and the fifth storage unit is used for storing the configuration files before and after compiling.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings.
FIG. 1 is a flow chart of an applet compiling method according to a first embodiment of the invention;
fig. 2 is a schematic block diagram of an applet compiling apparatus according to a second embodiment of the invention.
Detailed Description
The following is a further detailed description of the embodiments:
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings. However, those of ordinary skill in the art will understand that in various embodiments of the present application, numerous technical details have been set forth in order to provide a better understanding of the present application. The claimed application may be practiced without these specific details and with various changes and modifications based on the following embodiments.
First embodiment:
A first embodiment of the present invention provides an applet compiling method, including the steps of:
s1, acquiring a source code of an applet;
S2, selecting compiled target standards; the target standard is a code standard operated by a target APP container;
S3, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code according to the target standard, respectively storing the compiled tag code, style code, logic code and configuration file, and integrally processing the compiled tag code, style code, logic code and configuration file into a standard compiling package;
s4, outputting the standard compiling package.
Splitting the source code of the applet into a tag code, a style code, a logic code and a configuration file, and then compiling the split sub-packets respectively. And the compiling result of each part is stored, so that when the part of the new source code is the same as the pre-stored part in the next use, the compiling result is directly compiled into the stored compiling completion part.
The implementation details of the applet compiling method according to the present embodiment are specifically described below, and the following is only implementation details provided for facilitating understanding, but not required for implementing the present embodiment, and a specific flow of the present embodiment is shown in fig. 1, and the present embodiment is applied to a server side on a network side.
S1, acquiring source codes of the applets.
Specifically, step S1 further includes: s1-1, confirming whether an applet is input; s1-2, after the applet confirms input, acquiring the source code of the applet.
Before step S1 is executed, a compiling device is installed in a Visual Studio Code editor, and the applet code directory is imported into a working directory, which is a root directory. In step S1-1, whether the applet is input is checked by detecting whether a project. Config. Json file exists in the root directory, if so, it is determined that there is an applet input, and if not, it is determined that there is no applet input. In step S1-2, the applet source code is obtained by reading a project. Config. Json file in the root directory.
S2, selecting compiled target standards; the target standard is a code standard operated by the target APP container.
Specifically, a handset manufacturer on the market will generally set up its own APP container, and rules applied in different APP containers are different. The scheme aims at compiling the source code of the applet written by the user into the code capable of running in the target APP container. Therefore, in step S2, the target standard is selected as the code standard operated by the target APP container, and the selection mode may be to select one of the standards of the APP container for input, or may be to directly input the standard in the target APP container as the target standard.
S3, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code according to the target standard, respectively storing the compiled tag code, style code, logic code and configuration file, and integrally processing the compiled tag code, style code, logic code and configuration file into a standard compiling package.
Specifically, the implementation of step S3 includes the following steps:
S3-1, respectively reading a tag code, a style code, a logic code and a configuration file in a source code;
S3-2, judging whether the tag code, the style code, the logic code and the configuration file read by the source code are consistent with the pre-stored tag code, style code, logic code and configuration file, if so, executing S3-3, and if not, executing S3-4;
S3-3, setting the compiling results of the tag codes, the style codes, the logic codes or the logic codes in the source codes as corresponding pre-stored compiling results;
S3-4, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and storing the codes before and after compiling;
S3-5, sorting the compiled tag codes, style codes, logic codes and configuration files to form a standard compiling package.
In S3-1, the process of reading the tag codes in the source codes is to read the tag files in the source codes, obtain the dom objects in the tag files, recursively take out the attribute values and tag types of all tag nodes in the dom objects, correlate the tag files, the tag nodes, the attribute values and the tag types, store the tag files, the tag nodes, the attribute values and the tag types in a first storage unit, and compare the tag codes in the source codes with the pre-stored tag codes in S3-2, wherein the adopted method is to compare the features of the tag files in the source codes acquired in S3-1, so as to ensure accurate comparison.
In addition, in S3-1, reading a style code in the source code, wherein the style code is a style file in the source code; and reading the logic codes in the source codes, wherein the logic codes are logic files containing the logic codes in the source codes, and the comparison of the logic codes in the S3-2 corresponds to the comparison of the logic files. In S3-1, the mode of obtaining the configuration file in the source code is as follows: splitting the source code into a plurality of page files; reading a json configuration file in each page file, wherein the json configuration file is a json format object; the json files for all pages are combined into a first data set, which is then stored in a fifth storage unit, which is a folder named app.config.
Step S3-3, setting the compiling result of the tag code, the style code, the logic code or the logic code in the source code to be corresponding to a pre-stored compiling result, wherein the compiling result specifically comprises the following steps:
S3-3-1, when the label code is consistent with the pre-stored label code, directly setting the compiling result of the label code to be a pre-stored label code compiling result corresponding to the pre-stored label code;
S3-3-2, when the style codes are consistent with the pre-stored style codes, directly setting the compiling result of the tag codes to be a pre-stored style code compiling result corresponding to the pre-stored style codes;
S3-3-3, when the logic code is consistent with the pre-stored logic code, directly setting the compiling result of the tag code to be a pre-stored logic code compiling result corresponding to the pre-stored logic code;
S3-3-4, when the configuration file is consistent with the pre-stored configuration file, directly setting the compiling result of the tag code to be the compiling result of the pre-stored configuration file corresponding to the pre-stored configuration file.
After the source code is split into each part, if some parts are the same as the code parts which have been compiled in the same target standard before, the compiled content is directly used as the result after the compiling, so that the compiling time is saved, the repeated compiling is avoided as much as possible, and the integral compiling efficiency is improved. For example, when compiling for the nth time, the compiler stores the target standard of compiling the a-part code as A, then k is a positive integer after the subsequent n+k times of compiling, if the a-part code with the same target standard exists, the compiling result can be directly set as A for the a-part in the a-part code, and the process of repeatedly compiling the a-part code as A is avoided.
Step S3-4, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and storing the codes before and after compiling, specifically:
S3-4-1, the label codes in the source codes are compiled independently, and the method comprises the following steps: s3-4-1-1, recursively analyzing a tag file where the tag node is located according to the name of the tag node and the tag type; s3-4-1-2, merging the results after all the tag files are parsed into one JSON object, and storing the JSON object into a second storage unit. The implementation of the step S3-4-1-1 is specifically that if the name of the tag node is import or inlude, the tag file corresponding to the tag node is recursively analyzed according to the src attribute of the tag node; if the name of the label node is template, analyzing the dom object corresponding to the label node by using a recursion method according to the name attribute of the label node.
S3-4-2, compiling the style codes in the source codes independently, wherein the compiling comprises the following steps: s3-4-2-1, searching a corresponding style rule from a style sheet according to the style file; s3-4-2-2, cycling the style rule, converting the name and the number of the style rule into a first character string, and taking the converted first character string as a first data set, wherein the first data set is a style rule data set; the first string of the first data set is stored in a third storage unit. Wherein the third storage unit is a folder ending with css; the style sheet in the step S3-4-3-1 is stylessheet, the style sheet is preset, each style file in the style sheet corresponds to a style rule, and each style rule has a name and a value.
S3-4-3, compiling logic codes in the source codes independently, wherein the compiling comprises the following steps: s3-4-3-1, performing grammar conversion, confusion and encryption on the logic codes in the logic file, wherein the processed character strings are second character strings, and the second character string set is a second data set; s3-4-3-2, storing the second data set into a fourth storage unit. Wherein the fourth storage unit is a folder ending with js.
S3-4-4, compiling the configuration files in the source codes independently, wherein the compiling comprises directly copying the configuration files read in the step S3-1 into a compiling output catalogue. Wherein the configuration file is a resource file, and comprises formats of pictures, music, videos and the like.
S3-5, sorting the compiled tag codes, style codes, logic codes and configuration files to form a standard compiling package, wherein the standard compiling package comprises the following specific steps: s3-5-1, reading the compiled tag codes, style codes, logic codes and configuration files, and collecting the compiled tag codes, style codes, logic codes and configuration files into a third data set; s3-5-2, compressing the third data set to form a standard compiling package. The compression in the step S3-5-2 adopts zip compression, the expression form of the third dataset is a compiling catalog, the compiling catalog comprises a label code compiled by S3-4-1, a style code compiled by S3-4-2, a logic code compiled by S3-4-3 and a configuration file independently copied by S3-4-4 (which is equivalent to the configuration file compiled), and the compressed compiling catalog is a standard compiling package, namely the output of compiling completion.
S4, outputting the standard compiling package.
Specifically, the implementation of step S4 has the following various scenarios:
case 1: the implementation of S4 includes the following steps: s4-1, obtaining a target address corresponding to a target standard; s4-2, storing the standard compiling packet in a fifth storage unit corresponding to the target address according to the target address. In consideration of different target standards, the storage formats are different, and in this example, the standard compiling package after compiling is directly sent and stored into the fifth storage unit according to the target standard.
The implementation of case 2, S4 relies on an output port through which standard compilation packets are transmitted to a mobile device, such as a cell phone, computer, USB memory, etc., connected to the output port.
The implementation of case 3, S4, includes the steps of: s4-1, acquiring an input address input by a user; s4-2, setting an input address as a target address, and updating; s4-3, storing the standard compiling packet in a fifth storage unit corresponding to the target address according to the target address. The case is that based on the situation 1, the more modifiable target addresses corresponding to the target standards are added, the target address corresponding to each target standard is a default address, if no user input of S4-1 exists, S4-3 is directly executed, if input of an input address in S4-1 exists, S4-2 is executed, and the default address in the target address corresponding to the target standard is updated to be the input address input by S4-1.
The above steps of the methods are divided, for clarity of description, and may be combined into one step or split into multiple steps when implemented, so long as they include the same logic relationship, and they are all within the protection scope of this patent; it is within the scope of this patent to add insignificant modifications to the algorithm or flow or introduce insignificant designs, but not to alter the core design of its algorithm and flow.
Second embodiment:
The second embodiment of the present invention provides an applet compiling apparatus, which includes a storage module 201, a receiving module 202, a selecting module 203, a compiling module 204, a processing module 205 and an output module 206.
Specifically, the storage module 201 is configured to store a tag code, a style code, a logic code and a configuration file in a source code, and store a compiled tag code, style code, logic code and configuration file;
a receiving module 202, configured to receive source code of an applet input by a requester;
A selection module 203, configured to select compiled target criteria;
The compiling module 204 is configured to compile the tag code, the style code, the logic code and the configuration file in the source code according to the source code sent by the receiving module 202 and the target standard sent by the selecting module 203, send the tag code, the style code, the logic code and the configuration file before and after compiling to the storage module, and send the compiled tag code, style code, logic code and configuration file to the processing module 205;
the processing module 205 is configured to integrally process the compiled tag code, style code, logic code and configuration file sent by the compiling module 204 into a standard compiling package, and send the standard compiling package to the output module;
and an output module 206, configured to output the standard compiled packet sent by the processing module 205.
Further, the compiling module 204 includes a tag code compiling unit, a style code compiling unit, a logic code compiling unit and a configuration file compiling unit, where the tag code compiling unit, the style code compiling unit, the logic code compiling unit and the configuration file compiling unit compile the tag code, the style code, the logic code and the configuration file in the source code respectively; the storage module 201 includes a first storage unit, a second storage unit, a third storage unit, a fourth storage unit, and a fifth storage unit; the first storage unit is used for storing the tag file, the tag node, the attribute value and the tag type which are related to each other, the second storage unit is used for storing the parsed tag file, the third storage unit is used for storing the style codes before and after compiling, the fourth storage unit is used for storing the logic codes before and after compiling, and the fifth storage unit is used for storing the configuration files before and after compiling.
It is to be noted that this embodiment is a system example corresponding to the first embodiment, and can be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and in order to reduce repetition, a detailed description is omitted here. Accordingly, the related art details mentioned in the present embodiment can also be applied to the first embodiment.
It should be noted that each module in this embodiment is a logic module, and in practical application, one logic unit may be one physical unit, or may be a part of one physical unit, or may be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, units that are not so close to solving the technical problem presented by the present invention are not introduced in the present embodiment, but this does not indicate that other units are not present in the present embodiment.
The foregoing is merely an embodiment of the present application, and a specific structure and characteristics of common knowledge in the art, which are well known in the scheme, are not described herein, so that a person of ordinary skill in the art knows all the prior art in the application date or before the priority date, can know all the prior art in the field, and has the capability of applying the conventional experimental means before the date, and a person of ordinary skill in the art can complete and implement the present embodiment in combination with his own capability in the light of the present application, and some typical known structures or known methods should not be an obstacle for a person of ordinary skill in the art to implement the present application. It should be noted that modifications and improvements can be made by those skilled in the art without departing from the structure of the present application, and these should also be considered as the scope of the present application, which does not affect the effect of the implementation of the present application and the utility of the patent. The protection scope of the present application is subject to the content of the claims, and the description of the specific embodiments and the like in the specification can be used for explaining the content of the claims.

Claims (10)

1. A method of applet compilation, comprising the steps of:
Acquiring source codes of the applets;
selecting compiled target standards; the target standard is a code standard operated by a target APP container;
splitting the source code of the applet into a tag code, a style code, a logic code and a configuration file according to the target standard, then compiling the split sub-packets respectively, and then storing the sub-packets respectively, so that when the new source code is the same as a pre-stored part in the next use, the new source code is directly compiled into a stored compiling completion part;
The compiled tag codes, style codes, logic codes and configuration files are integrally processed into standard compiling packages;
wherein, forming the standard compiling package specifically comprises the following steps:
S3-1, respectively reading a tag code, a style code, a logic code and a configuration file in a source code;
S3-2, judging whether the tag code, the style code, the logic code and the configuration file read by the source code are consistent with the pre-stored tag code, style code, logic code and configuration file, if so, executing S3-3, and if not, executing S3-4;
S3-3, setting the compiling results of the tag codes, the style codes, the logic codes or the logic codes in the source codes as corresponding pre-stored compiling results;
S3-4, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and storing the codes before and after compiling;
S3-5, sorting the compiled tag codes, style codes, logic codes and configuration files to form a standard compiling package;
Outputting the standard compiling package.
2. The applet compiling method according to claim 1, wherein compiling the tag code, the style code, the logic code and the configuration file in the source code respectively according to the target standard, and then storing respectively, comprises:
reading a tag file in the source code;
acquiring a dom object in a tag file, recursively taking out attribute values and tag types of all tag nodes in the dom object, correlating the tag file, the tag nodes, the attribute values and the tag types, and storing the tag file, the tag nodes, the attribute values and the tag types in a first storage unit;
recursively analyzing a tag file where the tag node is located according to the name of the tag node and the tag type;
and merging the results of all the tag files after parsing into one JSON object and storing the JSON object into a second storage unit.
3. The applet compiling method according to claim 2, wherein the tag code, the style code, the logic code and the configuration file in the source code are compiled separately according to the target standard and then stored separately, further comprising:
if the label node is named import or inlude,
And recursively analyzing the label file corresponding to the label node according to the src attribute of the label node.
4. The applet compiling method according to claim 2, wherein the tag code, the style code, the logic code and the configuration file in the source code are compiled separately according to the target standard and then stored separately, further comprising:
if the label node is named template,
And analyzing the dom object corresponding to the label node by using a recursion method according to the name attribute of the label node.
5. The applet compiling method according to claim 1, wherein compiling the tag code, the style code, the logic code and the configuration file in the source code respectively according to the target standard, and then storing respectively, comprises:
screening out a style file in the source code;
Searching a corresponding style rule from a style sheet according to the style file;
The style rule is circulated, names and numerical values of the style rule are converted into first character strings, the converted first character strings are used as first data sets, and the first data sets are style rule data sets;
the first string of the first data set is stored in a third storage unit.
6. The applet compiling method according to claim 1, wherein compiling the tag code, the style code, the logic code and the configuration file in the source code respectively according to the target standard, and then storing respectively, comprises:
Screening logic files containing logic codes in the source codes;
Carrying out grammar conversion, confusion and encryption processing on the logic codes in the logic file, wherein the processed character strings are second character strings, and the second character string set is a second data set;
The second data set is stored in a fourth storage unit.
7. The applet compiling method according to claim 1, wherein compiling the tag code, the style code, the logic code and the configuration file in the source code respectively according to the target standard, and then storing respectively, comprises:
splitting the source code into a plurality of page files;
Reading configuration files in each page file, and collecting the configuration files of all pages into a first data set;
The first data set is stored in a fifth storage unit.
8. The applet compiling method according to claim 1, wherein the processing of the compiled tag code, style code, logic code and configuration file as a whole into a standard compilation package comprises:
Reading the compiled tag codes, style codes, logic codes and configuration files, and collecting the compiled tag codes, style codes, logic codes and configuration files into a third data set;
the third data set is compressed to form a standard compilation package.
9. The applet compiling method according to claim 1, wherein compiling the tag code, the style code, the logic code and the configuration file in the source code respectively comprises:
comparing the tag code with a pre-stored tag code,
When the label code is consistent with the pre-stored label code, directly setting the compiling result of the label code as a pre-stored label code compiling result corresponding to the pre-stored label code;
And/or the number of the groups of groups,
Comparing the pattern code with a pre-stored pattern code,
When the style codes are consistent with the pre-stored style codes, directly setting the compiling result of the tag codes to be the pre-stored style code compiling result corresponding to the pre-stored style codes;
And/or the number of the groups of groups,
Comparing the logical code with a pre-stored logical code,
When the logic codes are consistent with the pre-stored logic codes, directly setting the compiling result of the tag codes to be the pre-stored logic code compiling result corresponding to the pre-stored logic codes;
And/or the number of the groups of groups,
Comparing the configuration file with a pre-stored configuration file,
And when the configuration file is consistent with the pre-stored configuration file, directly setting the compiling result of the tag code to be the compiling result of the pre-stored configuration file corresponding to the pre-stored configuration file.
10. An applet compiling apparatus, comprising:
The storage module is used for storing the tag codes, the style codes, the logic codes and the configuration files in the source codes and storing the compiled tag codes, style codes, logic codes and configuration files;
The receiving module is used for receiving the source code of the applet input by the requester;
the selection module is used for selecting compiled target standards;
the compiling module is used for splitting the source code of the applet into a tag code, a style code, a logic code and a configuration file according to the source code sent by the receiving module and the target standard sent by the selecting module, then compiling the split sub-packets respectively, and then storing the split sub-packets respectively, so that when the source code is used next time, a part of the new source code is the same as a pre-stored part, the compiling is directly compiled into a stored compiling completion part; the method comprises the steps of sending a tag code, a style code, a logic code and a configuration file before and after compiling to a storage module, and sending the tag code, the style code, the logic code and the configuration file after compiling to a processing module;
the processing module is used for integrally processing the compiled tag codes, the style codes, the logic codes and the configuration files sent by the compiling module into standard compiling packages and sending the standard compiling packages to the output module;
wherein, forming the standard compiling package specifically comprises the following steps:
S3-1, respectively reading a tag code, a style code, a logic code and a configuration file in a source code;
S3-2, judging whether the tag code, the style code, the logic code and the configuration file read by the source code are consistent with the pre-stored tag code, style code, logic code and configuration file, if so, executing S3-3, and if not, executing S3-4;
S3-3, setting the compiling results of the tag codes, the style codes, the logic codes or the logic codes in the source codes as corresponding pre-stored compiling results;
S3-4, respectively compiling the tag code, the style code, the logic code and the configuration file in the source code, and storing the codes before and after compiling;
S3-5, sorting the compiled tag codes, style codes, logic codes and configuration files to form a standard compiling package;
and the output module is used for outputting the standard compiling packet sent by the processing module.
CN202110249631.7A 2021-03-08 2021-03-08 Applet compiling method and device Active CN113094040B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110249631.7A CN113094040B (en) 2021-03-08 2021-03-08 Applet compiling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110249631.7A CN113094040B (en) 2021-03-08 2021-03-08 Applet compiling method and device

Publications (2)

Publication Number Publication Date
CN113094040A CN113094040A (en) 2021-07-09
CN113094040B true CN113094040B (en) 2024-06-28

Family

ID=76666739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110249631.7A Active CN113094040B (en) 2021-03-08 2021-03-08 Applet compiling method and device

Country Status (1)

Country Link
CN (1) CN113094040B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327431A (en) * 2021-12-31 2022-04-12 网易(杭州)网络有限公司 Compiling method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656736A (en) * 2017-09-28 2018-02-02 上海鼎为电子科技(集团)有限公司 Improve the method and device of Android system compilation speed
CN110532029A (en) * 2019-09-04 2019-12-03 深圳前海微众银行股份有限公司 Small routine generation method, device, equipment and computer readable storage medium

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH096606A (en) * 1995-06-19 1997-01-10 Nec Corp Re-engineering verification system
CA2698066A1 (en) * 2009-07-31 2011-01-31 Nitobi Software Inc. System and method for remotely compiling multi-platform native applications for mobile devices
US8789026B2 (en) * 2011-08-02 2014-07-22 International Business Machines Corporation Technique for compiling and running high-level programs on heterogeneous computers
US9342285B2 (en) * 2012-11-30 2016-05-17 Huawei Technologies Co., Ltd. Method and apparatus for detecting code change
KR101694291B1 (en) * 2014-01-28 2017-01-10 한국전자통신연구원 Apparatus and method for accelerating java script engine
US10762199B2 (en) * 2015-12-11 2020-09-01 International Business Machines Corporation Compiler assisted protection against arbitrary code execution
CN106561030A (en) * 2016-12-11 2017-04-12 天津汉铭科技发展有限公司 Remote sensing image processing Web service dynamic generation method
CN106844096A (en) * 2016-12-27 2017-06-13 北京五八信息技术有限公司 The treating method and apparatus of program code
CN106980504B (en) * 2017-03-28 2022-07-01 腾讯科技(深圳)有限公司 Application program development method and tool and equipment thereof
EP3432149A1 (en) * 2017-07-20 2019-01-23 Fujitsu Limited A computer-implemented method and system of compiling a modified source code at a plurality of target machines
CN108897545A (en) * 2018-06-29 2018-11-27 南昌华勤电子科技有限公司 Code compiling method and device
CN109799988B (en) * 2018-12-13 2022-03-15 深圳壹账通智能科技有限公司 iOS page layout method, terminal device and computer readable storage medium
CN111736840B (en) * 2019-09-19 2024-07-16 北京沃东天骏信息技术有限公司 Method for compiling applet application, method for running applet application, storage medium and electronic device
CN110764791B (en) * 2019-10-25 2023-10-27 网易(杭州)网络有限公司 Channel adaptation method and device for applet and electronic equipment
CN111045683A (en) * 2019-12-13 2020-04-21 深圳前海微众银行股份有限公司 Small program code compilation method, device, device and medium
CN111222062B (en) * 2020-01-09 2021-06-01 百度在线网络技术(北京)有限公司 Applet running method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656736A (en) * 2017-09-28 2018-02-02 上海鼎为电子科技(集团)有限公司 Improve the method and device of Android system compilation speed
CN110532029A (en) * 2019-09-04 2019-12-03 深圳前海微众银行股份有限公司 Small routine generation method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN113094040A (en) 2021-07-09

Similar Documents

Publication Publication Date Title
CN108628635B (en) Method, device, equipment and storage medium for acquiring parameter name and local variable name
CN110502227B (en) Code complement method and device, storage medium and electronic equipment
CN110675256A (en) Method and device for deploying and executing intelligent contracts
CN107885501B (en) Method and device for obtaining mutual reference relationship of components in Android
CN110264361B (en) A data analysis method and device for blockchain
CN113986241B (en) Configuration method and device of business rules based on knowledge graph
CN115639980A (en) Draggable front-end logic arrangement method and device for low-code platform
Currier Protocol buffers
CN112379917A (en) Browser compatibility improving method, device, equipment and storage medium
CN113094040B (en) Applet compiling method and device
CN112187713A (en) Message conversion method, device, computer equipment and storage medium
CN118245050B (en) Front end frame assembly automatic conversion method, system, electronic device and storage medium
CN117785213B (en) Front-end construction tool and construction method based on Rust development
US7409619B2 (en) System and methods for authoring domain specific rule-driven data generators
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN115826968A (en) VUE-based method, device and application for dynamically compiling cross-platform component
JP2019179383A (en) API processing method, terminal, API processing program
CN114579141A (en) Method and device for converting require frame into VUE frame
CN114065197A (en) Call sequence generation method and device, electronic equipment, storage medium and product
Lavorato et al. LL (k) optimization of a network protocol parser generator.
CN114003317B (en) Inline implementation method and device, electronic equipment, storage medium and program product
CN115469848A (en) Method for realizing multi-file compiler at front end
CN114625377A (en) Framework item conversion method, frame item conversion device, device and storage medium
CN118820122A (en) Maven project dependency static analysis method, device, equipment and storage medium
CN114003211A (en) A sun code generation and analysis method, device, electronic device and medium

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
GR01 Patent grant
GR01 Patent grant