CN112650529B - System and method for configurable generation of mobile terminal APP codes - Google Patents
System and method for configurable generation of mobile terminal APP codes Download PDFInfo
- Publication number
- CN112650529B CN112650529B CN202011637486.1A CN202011637486A CN112650529B CN 112650529 B CN112650529 B CN 112650529B CN 202011637486 A CN202011637486 A CN 202011637486A CN 112650529 B CN112650529 B CN 112650529B
- Authority
- CN
- China
- Prior art keywords
- key
- code
- file
- configuration
- value pairs
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 238000004458 analytical method Methods 0.000 claims abstract description 38
- 238000013461 design Methods 0.000 claims abstract description 28
- 238000004590 computer program Methods 0.000 claims description 14
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 238000012423 maintenance Methods 0.000 abstract description 5
- 230000000875 corresponding effect Effects 0.000 description 39
- 238000012545 processing Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 210000001503 joint Anatomy 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003032 molecular docking Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000005316 response function Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to a system and a method for configurable generation of a mobile terminal APP code, comprising the following steps: respectively acquiring configuration elements corresponding to the formats of the key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of an object code structure; finding out corresponding keys and values in configuration elements according to definition rules and writing the keys and the values into a configuration file; circularly reading in each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result; and converting the analysis result into a file directory structure list and a code framework structure, and obtaining the target code structure under the same directory of the configuration file. The invention simplifies the division workload, realizes the unification of multi-terminal APP codes, has unified logic, is convenient for maintenance and management, and improves the working efficiency.
Description
Technical Field
The application relates to the technical field of mobile terminal code generation, in particular to a system and a method for configurable generation of mobile terminal APP codes.
Background
The main smart phones in the current market mainly comprise two systems, iOS and Android. There are three main division forms of APP for smart phone division: the primary split, the H5 split and the mixed split.
The first native language is split, iOS is split using the object-c and swift languages, and Android is split using Java. The primary division has the advantages of complete functions, high running speed, high performance, interface flow and good user experience. The disadvantage is that each end needs to be separated by a person independently, and the labor cost is relatively high.
The second is pure H5 division, page division based on web page technology, and javascript language division. The method has the advantages of being capable of crossing platforms, and has the defect of being incapable of completely realizing the capability, performance and experience of the equipment.
The third is that the mixing is split, the heald uses the native and H5, the webview is used for realizing the page, and the equipment capability is interactively called with the webview to make up the defect that the H5 can not realize the equipment. Performance and experience are relatively worse than native.
In three forms, each fits the scene, and in most cases the native score is still chosen for use. The prior primary splitting has the main problems of complex technology and low splitting efficiency; the different division personnel of different ends cause the code structure of a plurality of ends to be different, have increased later maintenance and management degree of difficulty. Therefore, how to improve the efficiency of primary splitting is a major problem at present.
There are many repetitive tasks in the overall project division, e.g., most codes share, and similarity, and repeated execution of the same type of work content during the division consumes many unnecessary costs. Aiming at the problems of low primary division efficiency and different code structures of a plurality of terminals, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the application provides a system and a method for configurable generation of mobile terminal APP codes, which are used for at least solving the problems of low primary division efficiency and different code structures of a plurality of terminals in the related technology, being capable of unifying frame designs aiming at different operation platforms and automatically generating the mobile terminal APP codes, thereby not only effectively improving the working efficiency, reducing the division cost, but also improving the management and maintenance effects of APP division.
In a first aspect, an embodiment of the present application provides a method for configurable generating a mobile end APP code, including: respectively acquiring configuration elements corresponding to the formats of the key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of an object code structure; finding out corresponding keys and values in configuration elements according to definition rules and writing the keys and the values into a configuration file; circularly reading in each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result; and converting the analysis result into a file directory structure list and a code framework structure, and obtaining the target code structure under the same directory of the configuration file.
In some of these embodiments, "obtaining configuration elements corresponding to the format of the key-value pairs from the interface document and the UI design drawing, respectively" includes: acquiring an interface document and a UI design drawing from outside; extracting content of item information for each interface describing an object code structure from an interface document, comprising: request mode, request path, request parameters, and parameter types; extracting content of a file layout for describing the object code structure for each layer from the UI design drawing includes: layer type, UI elements, location information of each UI element, and necessary parameter information.
In some of these embodiments, "find corresponding key and value write configuration files in configuration elements according to definition rules" is specifically: dividing the key value pairs into first-level key value pairs, second-level key value pairs and third-level key value pairs according to key rights; writing key value pairs in rows: writing the first-level key value pair into any row in the configuration file; writing a second level key value pair in a row behind the first level key value pair; the third level key pair is written to the row following the second level key pair.
In some of these embodiments, the "split key-value pairs into first-level key-value pairs, second-level key-value pairs, and third-level key-value pairs" include: key-value pairs whose keys are character strings "project", "copy right", "author", "folder", "in" are defined as first-level key-value pairs; defining key value pairs with keys as character strings of 'api', 'entity', 'mvc' as second-level key value pairs; key value pairs other than the first-level key value pair and the second-level key value pair are defined as third-level key value pairs.
In some embodiments, the "loop reads in each row of content of the configuration file, and parses the content according to key=value to obtain a parsing result" includes: each row of content of the configuration file is circularly read in, and the key values of the key as character strings of 'API', 'entity', 'MVC', 'folder' are respectively transferred into an API module, an entity module, an MVC module and an auxiliary module; if the key is character string "api", "entity" and "mvc", resolving the key value pair to obtain a corresponding value, storing the value in the ccFileInfo object and storing the value in the ccFileList array; if the key is a character string 'folder', analyzing the key value pair to obtain a corresponding value, storing the corresponding value in a ccFolderInfo object and storing the corresponding value in a ccFolderList array.
In some embodiments, the ccFileInfo object includes a file name attribute, a path attribute, a type attribute, a ccClassList array in which the ccClassInfo object is stored, "convert the parsing result into a file directory structure list and a code frame structure, obtain the object code structure under the same directory of the configuration file" includes: traversing the ccFolderInfo object in the ccFolderList array to generate a file directory structure list; traversing the CCFileInfo object in the CCFileList array, and dividing the CCFileInfo object into corresponding jinjia modes according to different type attributes to generate a file structure; grouping the file structures results in the object code structure under the same directory of the configuration file.
In a second aspect, an embodiment of the present application provides a system for configurable generating a mobile terminal APP code, including: an acquisition unit for acquiring configuration elements corresponding to formats of key value pairs from the interface document and the UI design drawing, respectively, wherein the configuration elements are used for describing project information and file layout of the object code structure; the writing unit is used for finding out corresponding key and value writing configuration files in the configuration elements according to the definition rules; the analysis unit is used for circularly reading each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result; and the code generating unit is used for converting the analysis result into a file directory structure list and a code framework structure, and obtaining an object code structure under the same directory of the configuration file.
In some of these embodiments, the parsing unit and the code generation unit are configured in a GenCode system comprising: the API module is configured to be responsible for analysis and code generation of the API interface class; the entity module is configured to be responsible for analysis of entity classes and code generation; the MVC module is configured to be responsible for analysis and code generation of the UI interface class; and the auxiliary module is configured to be responsible for the analysis of header information and directory file information and code generation.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements a method for configurable generating a mobile end APP code according to the first aspect described above when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a storage medium having stored thereon a computer program which, when executed by a processor, implements a method for configurable generating a mobile-side APP code as described in the first aspect above.
Compared with the related art, the method for configurable generation of the mobile terminal APP codes solves the problems that in the related art, the primary division efficiency is low and the code structures of a plurality of terminals are different. Corresponding key and value writing configuration files can be found in the configuration elements according to the split interface and the UI design drawing. And resolving and converting the configuration item into a corresponding structure, and writing code contents into a corresponding path by combining a jinjia module and a file directory module to form a final file directory and mobile terminal codes comprising codes of an iOS terminal and an Android terminal. Through the method, the frame design aiming at different operation platforms can be unified, the APP codes of the mobile terminal can be automatically generated, the working efficiency is effectively improved, the dividing cost is reduced, and the management and maintenance effects of APP dividing can be improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a schematic diagram of a method for configurable generation of mobile-side APP code, according to an embodiment of the application;
FIG. 2 is a flow chart of a method of configurable generation of mobile-side APP code in accordance with an embodiment of the present application;
FIG. 3 is an internal flow diagram of a system that is configurable to generate mobile-side APP code;
FIG. 4 is a key definition specification diagram of a key of a method for configurable generation of mobile side APP code;
FIG. 5 is a schematic diagram of a system that is configurable to generate mobile-side APP code;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with aspects of one or more embodiments of the present description as detailed in the accompanying claims.
It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. Furthermore, individual steps described in this specification, in other embodiments, may be described as being split into multiple steps; while various steps described in this specification may be described as a single step in other embodiments.
The embodiment provides a method for configurable generation of mobile terminal APP codes, and the flow of the method is shown in fig. 1, and the method comprises the following steps:
step 101, respectively acquiring configuration elements corresponding to the formats of key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of an object code structure;
step 102, corresponding keys and value writing configuration files are found in configuration elements according to definition rules;
step 103, circularly reading in each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result;
and 104, converting the analysis result into a file directory structure list and a code framework structure, and obtaining the target code structure under the same directory of the configuration file.
In step 101, the configuration elements in the split interface and UI design drawing are obtained.
Specifically, extracting the content of item information for describing the object code structure for each interface from the interface document includes: request mode, request path, request parameters, and parameter types;
extracting content of a file layout for describing the object code structure for each layer from the UI design drawing includes: layer type, UI elements, location information of each UI element, and necessary parameter information.
In an embodiment, key-Value pairs in the interface document and UI design drawing store data, and item information describing an object code structure and contents of a file layout are acquired by extracting configuration elements corresponding to the format of Key-Value.
In step 102, the configuration file is in an ini format, key and Value are separated by an equal sign (=), key is a predefined keyword, value can be added with a plurality of attributes, and the Key is marked by a semicolon "; "separate different attributes, each row can define only one key=value key value pair. The content of the configuration file can be manually written by a splitting person according to the rear-end interface document and the design diagram; the method can also be used for capturing derived contents in a mature third-party API document specification tool such as a swagger so as to automatically convert the derived contents into relevant configuration information; and related information can be captured from a system for storing the UI design drawing by a third party such as a blue lake to be automatically converted into related configuration information.
In step 103, the system divides into different module resolutions according to specific configuration content. The GenCode system is realized by a python script language, and the inside of the GenCode system mainly comprises three main modules and one auxiliary module.
As shown in fig. 3, in one embodiment, each row of content of the configuration file is circularly read, and the key values of the key as the character strings "API", "entity", "MVC", "folder" are respectively transferred to the API module, the entity module, the MVC module and the auxiliary module, and in this step, the content may be analyzed by a conventional analysis method, for example, character string comparison, or according to a regular expression.
In this embodiment, the API module is responsible for parsing and code generation of API interface classes; the Entity module is responsible for analyzing Entity classes and generating codes; the MVC module is responsible for analysis and code generation of the UI interface class; the auxiliary module is responsible for analyzing and generating folders and general information and comprises a file directory sub-module and a global information generation sub-module, wherein head information of each file comprises authors, project information, head authors and the like.
In step 104, the GenCode system divides the storage object content into different modules according to the specific type of the storage object content to perform conversion processing, and writes codes into corresponding paths by combining the jinjia module and the file directory sub-module to form final file directory and mobile terminal codes, including codes of an IOS terminal and an Android terminal. Specifically, the type attribute type is a type for distinguishing file content, such as an interface class file, an entity class file or an mvc class file, and different types of attribute types, and the modes of subsequent references are different.
The technical solution shown in the above steps 101 to 104 will be described in detail with reference to fig. 2 by way of a specific example.
Step 201, an interface document and a UI design drawing are obtained from the outside.
Step 202, extracting configuration elements from the interface document and the UI design drawing, respectively. According to the interface document and the UI design diagram, the division personnel can fix project information and file layout on the whole; in specific details, the content of each interface is extracted from the interface document, including the manner of request received by the interface, the server request path, the server request parameters, and the type of parameters. Wherein the layer structure element composition of each page is extracted from the UI design drawing, including the type, region, text size of the layer, and possible attributes under different types, such as title, action response function, etc.
Step 203, generating a configuration file: a blank file is generated under any folder, and the configuration elements extracted in step 202 are extracted. And finding a key-value of a corresponding type according to rule definition and writing the key-value into the configuration file. The predetermined key is divided into three levels of authority, the key=value of the first level of authority can be independently configured, the key=value of the second level can only follow the corresponding line behind the first level of key=value, and the key=value of the first level of authority can not be independently configured. The third level key=value can only follow the corresponding second level key=value pair for the following row. The definition rules of specific key and value are described in the following, and refer to fig. 5, in which header information and directory file information are used as authority definitions, mvc of UI class, api of interface class, entity of entity class are used as secondary authority definitions, elements contained in mvc, api, entity are used as tertiary authority definitions, and in particular,
rule 1: item global information such as item names, copyrights and author names is set. The key words are respectively 'project', 'copy', 'author' character strings, and are all primary authority definitions.
Rule 2: the project file directory layout is represented by a key "folder" string, with the latter value being the path to be created. The operation that follows under the folder of the value path is represented by a string with a key of "in". "folder", "in" are also primary rights definitions.
Rule 3: and the service interface is in butt joint with a key as a character string 'api' as an entry for processing, and the key of the 'api' is a secondary authority definition. The value corresponding to the key "api" will be the final generated file name and at the same time the class name of the final generated code layer. One class may need to contain multiple functionally related interfaces therein, each interface corresponding to a function implementation in the class, each function beginning with a string "api-" prefix. The key included in each function content is defined as: the annotation character string "comment" is added, the service request path character string "url", the request mode character string "method", the parameter data character string "param" function name character string "func" uploaded in the body form, the data return analysis object processing character string "model" and the like, and the keys of the information defining the function are all third-level authorities.
Rule 4: the different data structures returned by each interface are provided with a corresponding process of the entity class after analysis, the character string 'entity' is used as a key to be used for starting judgment processing, the 'entity' is used as a value corresponding to the key, the corresponding value is the finally generated entity class file name and the class name of the code layer, and the keyword 'entity' is positioned at the second level authority. Each entity class content contains two class elements, annotation content of one entity class and attributes of the entity class. The annotation key is defined as a character string "comment", the key of the attribute is defined as a character string "prop", and "prop" is a third level authority.
Rule 5: the definition rule of the UI layer starts with a key character string name of 'mvc' as each UI processing module, and the 'mvc' keyword is defined in the second level authority. For a value corresponding to 'mvc', generating a folder with the value under the iOS environment, wherein the folder contains 3 subfolders which respectively correspond to m-v-c model design ideas, and storing corresponding file modules under each subfolder; for the Andorid environment, a folder with the value is generated, two classes are stored in the folder, a corresponding activity and a corresponding model class are stored in the folder, and the layout file is placed in a layout folder of a public folder res. The next level key in mvc is a string "sub" that can further specify which specific class into mvc to edit next.
Step 204, after the configuration file is completed, the system GenCode processing is imported. Illustratively, a command line window of the desktop system (cmd window of windows system; end program of mac system) is opened, and the program catalog of GenCode is transferred to input the complete path of python GenCode.py+ configuration file. The GenCode reads the contents of each row of the configuration file circularly, and the key value pairs key=value, and resolves specific values. The value is further disassembled according to different keys, and different attribute contents are taken out.
The GenCode system mainly comprises three main modules and one auxiliary module. The three main modules are respectively an API module, an entity module, an MVC module and an auxiliary module. And (3) transferring to different module processes according to the current row key name of the configuration file (wherein the keyword is "API" to be transferred to the API module, the keyword is "Entity" to be transferred to the Entity module, and the keyword is "MVC" to be transferred to the MVC module). The three main modules analyze the corresponding values, store the values in the ccFileInfo object and store the values in the ccFileList array for unified management. The ccFileInfo object contains a filename attribute name, a path attribute path, a type attribute type, and a ccClassList array. ccClassList is an array of generated classes, each member being a ccClassInfo object. The ccClassInfo object contains a class name attribute name, an attribute list object ccproplist, and a function list object ccfuncllist. The members of the ccPropList array are ccPorpInfo objects. The ccPropInfo object contains a name attribute name, a type attribute type, a comment attribute, and other additional dictionary objects. The members of the ccfuncinlist array are ccFuncInfo objects. The ccFuncInfo object contains a function name attribute name, an additional dictionary object. Other global information, like keywords "project", "copy", "author", individually store the value content. Folder information, like the keyword "folder", is stored in the ccFolderList array structure.
Step 205, a transcoding procedure is entered. After the content of the analysis configuration file is processed, the two obtained storage structures ccFileList arrays and ccFolderList arrays are transmitted into a code generation module. The auxiliary module generates a file directory structure list according to the ccFolderList in advance. Traversing the ccFileList member, dividing the ccFileList member into different modules in turn according to different type field values, reading corresponding jinjia file model objects, and primarily generating a code frame structure. And then reading the ccClassList in the storage structure ccFileInfo object, obtaining the name of the class, the member list ccFuncList of the class and the attribute list ccPropList of the class, and further entering code content conversion.
And 206, obtaining a final target code structure under the same directory of the configuration file after the conversion is completed.
Through the technical scheme, the invention provides a configurable method for generating the mobile terminal APP code, which can generate configuration items according to an opening interface and a UI design diagram, realize a GenCode system by utilizing the script capability of quick opening of python language, convert the configuration items into corresponding structures, call a Jinja layout mode to fix the whole structure, and further fill specific contents of each attribute in configuration contents to derive codes of each terminal. In a first aspect, the configuration file adopts an ini configuration file format, and is composed of keys and values, wherein the keys and the values are separated by an equal number "=", key=value, and key is a predefined keyword, and value can be added with a plurality of attributes and is marked with a semicolon "; "separate different attributes, each row can define only one key=value key value pair. In a second aspect, the system is divided into different module analyses according to specific configuration content, including a file and directory management module, a network interface entity class docking module, and an mvc view module, and finally stored in an object in a unified manner. In the third aspect, after the analysis of the configuration file is completed, the system performs conversion processing by uniformly dividing the configuration file into different modules according to the specific type of the content of the storage object, and writes the code content into corresponding paths by combining the jinjia module and the file directory module to form final file directory and mobile terminal codes, including codes of an iOS terminal and an Android terminal. The invention simplifies the division workload, realizes the unification of multi-terminal APP codes, has unified logic, is convenient for maintenance and management, and improves the working efficiency.
Based on the same conception, the application provides a system for configurable generation of a mobile terminal APP code, which comprises the following steps:
an obtaining unit 401, configured to obtain configuration elements corresponding to formats of key value pairs from an interface document and a UI design drawing, where the configuration elements are used to describe item information and file layout of an object code structure;
a writing unit 402, configured to find corresponding key and value writing configuration files in the configuration elements according to a definition rule;
an parsing unit 403, configured to circularly read in each row of content of the configuration file, parse according to key=value to obtain a parsing result;
the code generating unit 404 is configured to convert the analysis result into a file directory structure list and a code frame structure, and obtain the target code structure under the same directory of the configuration file.
In one embodiment, the parsing unit and the code generating unit are configured in a GenCode system, the GenCode system comprising:
the API module is configured to be responsible for analysis and code generation of the API interface class;
the entity module is configured to be responsible for analysis of entity classes and code generation;
the MVC module is configured to be responsible for analysis and code generation of the UI interface class;
and the auxiliary module is configured to be responsible for the analysis of header information and directory file information and code generation.
The present embodiment also provides an electronic device comprising a memory 304 and a processor 302, the memory 304 having stored therein a computer program, the processor 302 being arranged to run the computer program to perform the steps of any of the method embodiments described above.
In particular, the processor 302 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured to implement one or more integrated circuits of embodiments of the present application.
The processor 302 implements the method of transmitting data in one-way communication between any of the servers in the above-described embodiments by reading and executing the computer program instructions stored in the memory 304.
Optionally, the electronic apparatus may further comprise a transmission device 306, wherein the transmission device 306 is connected to the processor 302.
The transmission device 306 may be used to receive or distribute data via a network. Specific examples of the network described above may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through the base station to communicate with the internet. In one example, the transmission device 306 may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
Alternatively, in the present embodiment, the above-mentioned processor 302 may be configured to execute the following steps by a computer program:
s101, respectively acquiring configuration elements corresponding to formats of key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of an object code structure.
S102, corresponding keys and values are found in the configuration elements according to the definition rules and written into the configuration files.
S103, circularly reading in each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result.
S104, converting the analysis result into a file directory structure list and a code frame structure, and obtaining an object code structure under the same directory of the configuration file.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and this embodiment is not repeated herein.
In addition, in connection with the method for generating the mobile terminal APP code in the foregoing embodiments, the embodiments of the present application may be implemented by providing a storage medium. The storage medium has a computer program stored thereon; the computer program, when executed by a processor, implements any of the configurable methods of generating mobile-side APP code in the above embodiments.
It will be appreciated by those skilled in the art that any arbitrary set of technical features of the above embodiments may be made, and that for brevity of description, all possible sets of technical features of the above embodiments will not be described, however, as long as there is no contradiction between the sets of technical features, they should be considered as the scope of the description. The foregoing examples merely represent several embodiments of the present application, the description of which is more specific and detailed and which should not be construed as limiting the scope of the present application in any way. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.
Claims (10)
1. A method for configurable generation of mobile terminal APP codes is characterized in that,
respectively acquiring configuration elements corresponding to the formats of key value pairs from an interface document and a UI design drawing, wherein the configuration elements are used for describing project information and file layout of an object code structure;
finding corresponding keys and values in the configuration elements according to definition rules and writing the keys and the values into a configuration file;
circularly reading each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result;
converting the analysis result into a file directory structure list and a code frame structure, obtaining the target code structure under the same directory of the configuration file, after the content of the analysis configuration file is processed, transmitting the two obtained storage structures ccFileList array and ccFolderList array into a code generation module, generating a file directory structure list by an auxiliary module in advance according to the ccFolderList, traversing ccFileList members, sequentially distributing the file directory structure list into different modules according to different type field values, reading corresponding jinjia file template objects, initially generating a code frame structure, reading ccClasst in the storage structure ccFileInfo object, obtaining the names of classes and the member list ccFuncList of the classes and the attribute list PropList of the classes, further entering code content conversion, and obtaining a final target code structure under the same directory of the configuration file after the conversion is completed.
2. The method for configurable generation of mobile terminal APP codes according to claim 1, wherein "obtaining configuration elements corresponding to formats of key-value pairs from an interface document and a UI design drawing, respectively" comprises:
acquiring an interface document and a UI design drawing from outside;
extracting content of item information for each interface describing an object code structure from the interface document, comprising: request mode, request path, request parameters, and parameter types;
extracting content of a file layout of each layer for describing the object code structure from the UI design drawing, including: layer type, UI elements, location information and parameter information of each UI element.
3. The method for configurable generation of mobile terminal APP codes according to claim 1, wherein "find corresponding key and value write configuration files in the configuration elements according to defined rules" is specifically:
dividing the key value pairs into first-level key value pairs, second-level key value pairs and third-level key value pairs according to key rights;
writing the key value pairs in rows:
writing the first-level key value pair into any row in the configuration file;
writing the second level key value pair to a row following the first level key value pair;
and writing the third-level key value pair into a row behind the second-level key value pair.
4. The method for configurable generation of mobile terminal APP codes of claim 2, wherein "the key-value pairs are divided into first-level key-value pairs, second-level key-value pairs, and third-level key-value pairs according to key permissions" includes:
key-value pairs whose keys are character strings "project", "copy right", "author", "folder", "in" are defined as first-level key-value pairs;
defining key value pairs with keys as character strings of 'api', 'entity', 'mvc' as second-level key value pairs;
and defining the key value pairs except the first-level key value pair and the second-level key value pair as third-level key value pairs.
5. The method for configurable generation of mobile terminal APP codes according to claim 4, wherein "cyclically reading each row of content of the configuration file, and resolving according to key=value to obtain a resolved result" includes:
circularly reading each row of content of the configuration file, and respectively transferring key values of key as character strings 'API', 'entity', 'MVC', 'folder' to an API module, an entity module, an MVC module and an auxiliary module;
if the key is character string "api", "entity" and "mvc", resolving the key value pair to obtain a corresponding value, storing the corresponding value in the ccFileInfo object and storing the corresponding value in the ccFileList array;
if the key is a character string 'folder', analyzing the key value pair to obtain a corresponding value, storing the corresponding value in a ccFolderInfo object, and storing the corresponding value in a ccFolderList array.
6. The method for configurable generation of mobile side APP code of claim 5, wherein the ccFileInfo object includes a filename attribute, a path attribute, a type attribute, a ccClassList array in which the ccClassInfo object is stored,
"convert the parsing result into a file directory structure list and a code framework structure, obtain the target code structure under the same directory of the configuration file" includes:
traversing the ccFolderInfo object in the ccFolderList array to generate a file directory structure list;
traversing the ccFileInfo object in the ccFileList array, and distributing the ccFileInfo object to a corresponding jinjia template according to different type attributes to generate a file structure;
and combining the file structures to obtain the target code structure under the same directory of the configuration file.
7. A system for configurable generation of mobile-side APP codes, comprising:
an obtaining unit, configured to obtain configuration elements corresponding to formats of key value pairs from an interface document and a UI design drawing, where the configuration elements are used to describe project information and file layout of an object code structure;
the writing unit is used for finding out corresponding key and value writing configuration files in the configuration elements according to the definition rules;
the analysis unit is used for circularly reading each row of content of the configuration file, and analyzing according to key=value to obtain an analysis result;
the code generating unit is used for converting the analysis result into a file directory structure list and a code frame structure, obtaining the target code structure under the same directory of the configuration file, after the content of the analysis configuration file is processed, transmitting the two obtained storage structures ccFileList array and ccFolderList into the code generating module, generating a file directory structure list by the auxiliary module in advance according to the ccFolderList, traversing the ccFileList members, sequentially distributing the file directory structure list into different modules according to different type field values, reading the corresponding jinjia file template object, primarily generating a code frame structure, then reading the ccClassList in the storage structure ccfileInfo object, obtaining the name of a class and the member list ccfurciclist of the class and the attribute list ccPropList of the class, further entering the code content conversion, and obtaining the final target code structure under the same directory of the configuration file after the conversion is completed.
8. The system for configurable generation of mobile end APP code of claim 7 wherein said parsing unit and said code generation unit are configured in a GenCode system comprising:
the API module is configured to be responsible for analysis and code generation of the API interface class;
the entity module is configured to be responsible for analysis of entity classes and code generation;
the MVC module is configured to be responsible for analysis and code generation of the UI interface class;
and the auxiliary module is configured to be responsible for the analysis of header information and directory file information and code generation.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of configurable generation of mobile-side APP code of any one of claims 1 to 6.
10. A storage medium having stored therein a computer program, wherein the computer program is arranged to perform the method of configurable generating a mobile-side APP code of any of claims 1 to 6 when run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011637486.1A CN112650529B (en) | 2020-12-31 | 2020-12-31 | System and method for configurable generation of mobile terminal APP codes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011637486.1A CN112650529B (en) | 2020-12-31 | 2020-12-31 | System and method for configurable generation of mobile terminal APP codes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112650529A CN112650529A (en) | 2021-04-13 |
CN112650529B true CN112650529B (en) | 2023-06-06 |
Family
ID=75366881
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011637486.1A Active CN112650529B (en) | 2020-12-31 | 2020-12-31 | System and method for configurable generation of mobile terminal APP codes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112650529B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112799670B (en) * | 2021-04-14 | 2021-08-03 | 盛威时代科技集团有限公司 | Method and system for unified multi-terminal logic development |
CN113791845B (en) * | 2021-09-17 | 2024-08-09 | 京东方科技集团股份有限公司 | Board function adaptation method, storage medium and electronic equipment |
CN114691161A (en) * | 2022-04-08 | 2022-07-01 | 上海柯林布瑞信息技术有限公司 | Key-Value-based software system configuration method and device and electronic equipment |
CN114866451B (en) * | 2022-04-29 | 2023-10-03 | 深圳依时货拉拉科技有限公司 | iOS end route communication improvement method, device, storage medium and equipment |
CN118018586B (en) * | 2024-03-19 | 2024-11-29 | 全通金信控股(广东)有限公司 | A starter and start method based on Dubbo-go server |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9424003B1 (en) * | 2014-10-24 | 2016-08-23 | Emc Corporation | Schema-less system output object parser and code generator |
CN108469952A (en) * | 2018-03-16 | 2018-08-31 | 祖龙(天津)科技有限公司 | A kind of code generating method and kit of management game configuration |
US10169035B1 (en) * | 2017-09-06 | 2019-01-01 | International Business Machines Corporation | Customized static source code analysis |
CN109885298A (en) * | 2019-02-20 | 2019-06-14 | 百度在线网络技术(北京)有限公司 | A kind of UI component generation method, device and terminal device |
CN112114807A (en) * | 2020-09-28 | 2020-12-22 | 腾讯科技(深圳)有限公司 | Interface display method, device, equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109032662B (en) * | 2018-06-19 | 2021-03-23 | 未鲲(上海)科技服务有限公司 | Code file generation method and device, computer equipment and storage medium |
-
2020
- 2020-12-31 CN CN202011637486.1A patent/CN112650529B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9424003B1 (en) * | 2014-10-24 | 2016-08-23 | Emc Corporation | Schema-less system output object parser and code generator |
US10169035B1 (en) * | 2017-09-06 | 2019-01-01 | International Business Machines Corporation | Customized static source code analysis |
CN108469952A (en) * | 2018-03-16 | 2018-08-31 | 祖龙(天津)科技有限公司 | A kind of code generating method and kit of management game configuration |
CN109885298A (en) * | 2019-02-20 | 2019-06-14 | 百度在线网络技术(北京)有限公司 | A kind of UI component generation method, device and terminal device |
CN112114807A (en) * | 2020-09-28 | 2020-12-22 | 腾讯科技(深圳)有限公司 | Interface display method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112650529A (en) | 2021-04-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112650529B (en) | System and method for configurable generation of mobile terminal APP codes | |
CN109582909B (en) | Webpage automatic generation method and device, electronic equipment and storage medium | |
US11146286B2 (en) | Compression of JavaScript object notation data using structure information | |
US20140122535A1 (en) | Extracting Semantic Relationships from Table Structures in Electronic Documents | |
US8990148B1 (en) | System and method for dynamic hierarchical data parsing | |
CN109582647B (en) | Unstructured evidence file oriented analysis method and system | |
CN111683066B (en) | Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium | |
CN111177113B (en) | Data migration method, device, computer equipment and storage medium | |
CN111552838A (en) | Data processing method and device, computer equipment and storage medium | |
CN111831384A (en) | Language switching method and device, equipment and storage medium | |
CN108509658A (en) | An XML file parsing method and device | |
CN111191079B (en) | Document content acquisition method, device, equipment and storage medium | |
CN107341014A (en) | Electronic equipment, the generation method of technical documentation and device | |
CN114328276A (en) | Test case generation method and device, and test case display method and device | |
CN108664546B (en) | XML data structure conversion method and device | |
CA3061623C (en) | File sending in instant messaging applications | |
CN108959294B (en) | Method and device for accessing search engine | |
CN113094355A (en) | Model instantiation method, device, equipment and medium based on domestic communication protocol | |
CN109446496A (en) | A kind of conversion method, device, equipment and the storage medium of test language file | |
CN106776779B (en) | Method for generating entity file by JSON data based on Mac platform | |
CN115221437A (en) | Font file loading method and device, electronic equipment and storage medium | |
JP6723976B2 (en) | Test execution device and program | |
CN118193567B (en) | Method, device, equipment and medium for generating query statements and querying business data | |
CN109543122B (en) | Content synchronization method, device, storage medium and electronic device | |
CN109614592B (en) | Text processing method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |