CN118642702B - Cross-platform code generation method, device, equipment and storage medium - Google Patents
Cross-platform code generation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN118642702B CN118642702B CN202411117169.5A CN202411117169A CN118642702B CN 118642702 B CN118642702 B CN 118642702B CN 202411117169 A CN202411117169 A CN 202411117169A CN 118642702 B CN118642702 B CN 118642702B
- Authority
- CN
- China
- Prior art keywords
- platform
- information
- configuration information
- function
- interface
- 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
Classifications
-
- 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/35—Creation or generation of source code model driven
-
- 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/36—Software reuse
-
- 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/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/436—Semantic checking
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computational Linguistics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a cross-platform code generation method, a device, equipment and a storage medium, relating to the technical field of low-code development and comprising the steps of determining a functional interface running on a first platform; the method comprises the steps of extracting parameters of function information of a function interface to obtain corresponding function configuration information, converting the function configuration information based on a preset semantic model to obtain corresponding converted information, enabling the preset semantic model to be a model which has no dependency relationship with any platform and is used for describing the configuration information, analyzing the converted information by utilizing an adapter corresponding to a second platform, and operating the function interface on the second platform based on codes corresponding to the function interface obtained through analysis. The application converts the functional interface of the first platform into the information which has no dependency relationship with the platform by utilizing the semantic model, analyzes and operates the corresponding functional interface based on the adapter in the second platform, writes the code logic once by a developer, can operate in multiple platforms and improves the code reusability.
Description
Technical Field
The present invention relates to the field of low code development technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a cross-platform code.
Background
At present, cross-terminal and cross-platform deployed applications are developed based on low-code technology, and the current technical route mainly relates to using a cross-platform framework (such as REACT NATIVE, flutter and other application development frameworks) to realize the running of a set of codes on a plurality of operating systems (iOS, android and other operating systems), combining cloud services and APIs (Application Programming Interface, application programming interfaces) to process back-end logic and data storage, and using a visual design tool and a pre-construction module to accelerate the development of a front-end interface. The method can be used for solving the cross-platform development problem of iOS and android, and can greatly improve the development efficiency, but in the digital transformation business of enterprises, a large number of applications of the computer end and the mobile phone end coexist, and the compatibility and development problems of functions at the computer end and the mobile phone end cannot be solved by the current technology.
It follows that how to implement cross-platform running of applications is a problem to be solved in the art.
Disclosure of Invention
In view of the above, the present invention aims to provide a method, an apparatus, a device and a storage medium for generating a cross-platform code, which utilize a semantic model to convert a functional interface of a first platform into information having no dependency relationship with a platform, analyze and operate a corresponding functional interface on the basis of an adapter in a second platform, write code logic once by a developer, and operate on multiple platforms, thereby improving code reusability. The specific scheme is as follows:
in a first aspect, the present application provides a method for generating a cross-platform code, including:
determining a functional interface running on a first platform;
Extracting parameters of the function information of the function interface to obtain corresponding function configuration information;
Converting the functional configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information;
And analyzing the converted information by using an adapter corresponding to the second platform, and operating the functional interface on the second platform based on the code corresponding to the functional interface obtained by analysis.
Optionally, the determining the functional interface running on the first platform includes:
Displaying a plurality of assemblies, a plurality of business logics and a plurality of data models for building a functional interface through a preset visual designer of a first platform, and acquiring corresponding functional interface building instructions;
and constructing a target function interface corresponding to the function interface construction instruction on the first platform by utilizing the plurality of assemblies, the plurality of business logics and the data model.
Optionally, the extracting parameters from the function information of the function interface to obtain corresponding function configuration information includes:
Extracting parameters of the function information of the target function interface to obtain first configuration information corresponding to the component, second configuration information corresponding to the business logic and third configuration information corresponding to the data model;
and packaging the first configuration information, the second configuration information and the third configuration information based on a preset data format to obtain the function configuration information of the target function interface corresponding to the first platform.
Optionally, the converting the function configuration information based on the preset semantic model to obtain corresponding converted information includes:
And describing components, business logic and a data model in the function configuration information based on a preset semantic model so as to convert the function configuration information to obtain corresponding converted information.
Optionally, the analyzing the converted information by using an adapter corresponding to the second platform includes:
And determining a target adapter corresponding to the platform type of the second platform from preset platform adapters so as to process the converted information by using the target adapter, wherein the preset platform adapter is a preset adapter and is used for analyzing the converted information corresponding to a preset semantic model to obtain program codes matched with the platform type of the second platform.
Optionally, the analyzing the converted information by using an adapter corresponding to a second platform, and running the functional interface on the second platform based on the code corresponding to the functional interface obtained by analysis, including:
analyzing the converted information by using the target adapter corresponding to the second platform to obtain corresponding analyzed information;
And filling the analyzed information into a code generation template in the target adapter to obtain a code corresponding to the functional interface, and operating the functional interface on the second platform based on the code.
Optionally, the running the functional interface on the second platform based on the code includes:
and running the codes through the code compiling templates and the code running frame information corresponding to the second platform in the target adapter so as to run the functional interface on the second platform.
In a second aspect, the present application provides a cross-platform code generating apparatus, including:
the function interface determining module is used for determining a function interface running on the first platform;
The parameter extraction module is used for extracting parameters of the function information of the function interface to obtain corresponding function configuration information;
The conversion module is used for converting the function configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information;
And the analysis module is used for analyzing the converted information by using an adapter corresponding to the second platform and running the functional interface on the second platform based on the codes corresponding to the functional interface obtained by analysis.
In a third aspect, the present application provides an electronic device, comprising:
A memory for storing a computer program;
and a processor for executing the computer program to implement the cross-platform code generation method as described above.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements a cross-platform code generation method as described above.
Therefore, the method comprises the steps of firstly determining a functional interface running on a first platform, extracting parameters of functional information of the functional interface to obtain corresponding functional configuration information, then converting the functional configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information, analyzing the converted information by using an adapter corresponding to a second platform, and running the functional interface on the second platform based on codes corresponding to the functional interface obtained through analysis. The method and the system can extract parameters of the functional interface operated by the first platform, convert the functional configuration information of the related functional interface into converted information which has no dependency relationship with the platform by utilizing the semantic model, further analyze the converted information into codes corresponding to the second platform through the adapter corresponding to the second platform, and then operate the corresponding functional interface on the basis of the codes analyzed by the adapter on the second platform.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a cross-platform code generation method disclosed by the application;
FIG. 2 is a flowchart of a specific cross-platform code generation method disclosed in the present application;
FIG. 3 is a schematic diagram of a cross-platform code generating device according to the present application;
Fig. 4 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, the embodiment of the invention discloses a cross-platform code generation method, which comprises the following steps:
Step S11, determining a functional interface running on the first platform.
In the embodiment of the application, the functional interface running on the first platform is transferred to another platform, and the functional interface running on the first platform is required to be determined at first, for example, the construction of the related functional interface can be completed through rich interfaces and functional design programs at a computer end. In a specific embodiment, the determining the functional interface running on the first platform may include displaying, by a preset visual designer of the first platform, a plurality of components, a plurality of service logics, and a plurality of data models for building the functional interface, and obtaining corresponding functional interface building instructions, wherein the data models are data structures and relationships, and building a target functional interface corresponding to the functional interface building instructions on the first platform by using the plurality of components, the plurality of service logics, and the data models. Specifically, a visual designer may be preset on the first platform, where the visual designer includes a rich UI (User Interface) component library, and the visual designer may be built by dragging, and by arranging front and rear end functions through a visual method, binding service logic with Interface components, providing structures and relationships of data model definition data, providing data support for the Interface, and implementing quick building of a functional Interface through a visual operation mode.
And step S12, extracting parameters of the function information of the function interface to obtain corresponding function configuration information.
In the embodiment of the application, after the functional interface is determined, parameter extraction is required to be carried out on the functional information of the functional interface, and the functional interface is converted into corresponding functional configuration information. In a specific embodiment, the parameter extracting the function information of the function interface to obtain corresponding function configuration information may include extracting the parameter of the function information of the target function interface to obtain first configuration information corresponding to a component, second configuration information corresponding to service logic, and third configuration information corresponding to a data model, and packaging the first configuration information, the second configuration information, and the third configuration information based on a preset data format to obtain the function configuration information of the target function interface corresponding to the first platform. Specifically, extracting corresponding configuration information for a UI component, service logic, a data model and the like in the functional interface respectively can include extracting configuration information required by deployment of an application corresponding to the functional interface, and after all the functional configuration information corresponding to the functional interface is extracted, the information can be packaged for convenient storage and transmission, and the functional configuration information can be specifically described based on JSON (JavaScript Object Notation, a data exchange format) or XML (eXtensible Markup Language ).
And step S13, converting the function configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information.
Furthermore, in the embodiment of the present application, the function configuration information obtained in the above step is in a form of a relationship with the first platform, on the basis of which the obtained function configuration information can be converted by using a preset semantic model, where the semantic model is a preset model for describing UI components, layouts, styles, business logic and data models, and the function configuration information is converted into an intermediate representation that has no dependency with any platform by using the semantic model, so as to obtain corresponding converted information.
In a specific embodiment, the converting the function configuration information based on the preset semantic model to obtain corresponding converted information may include describing components, service logic and data models in the function configuration information based on the preset semantic model to convert the function configuration information to obtain corresponding converted information. And respectively converting the components, the business logic and the data model in the functional configuration information by a preset semantic model, so as to obtain converted information which has no dependency relationship with any platform. In particular embodiments, the semantic model may include 1. Component (Component): basic UI building blocks such as buttons, text boxes, lists, and the like. 2. Property (Property) features of the component, such as color, size, text content, etc. 3. Events (Event) are actions triggered when a user interacts with a component, such as clicks, touches, inputs, etc. 4. Behavior (Behavior) the response of a component to an event may be a change in internal state or a call to a backend service. 5. Layout (Layout) defines the location and arrangement of components on an interface. 6. Style (Style) rules of visual presentation such as fonts, color schemes, animation, etc. 7. Data Model (Data Model) the Data structure and Data flow of an application define the type, source and interaction of Data. For example, the intermediate representation obtained by processing a button component through a semantic model is as follows:
{
"component": "Button",
"properties": {
"text": "Click Me",
"backgroundColor": "#FF5733",
"fontSize": "14px"
},
"events": {
"onClick": "submitForm"
},
"style": {
"hover": {
"backgroundColor": "#FF7E66"
}
},
"layout": {
"position": "center",
"size": {
"width": "200px",
"height": "50px"
}
},
"dataBindings": {
"disabled": "form.isSubmitting"
}
}
Wherein the button assembly has text, background color, font size, etc., a click event is bound to submitForm (submit form) behavior, the style defines background color change upon hover, the layout specifies the location and size of the button, and the data binding specifies that the disabled state of the button is associated with the form submit state.
And S14, analyzing the converted information by using an adapter corresponding to a second platform, and running the functional interface on the second platform based on the codes corresponding to the functional interface obtained by analysis.
In the embodiment of the application, the converted information of the functional interface corresponding to the first platform and having no dependency relationship with any platform can be obtained through the steps, then the converted information is analyzed through the adapter corresponding to the second platform, and the adapter is a development tool seamlessly integrated with the second platform, can analyze the converted information to obtain the code of the functional interface matched with the second platform, and then the functional interface is operated on the second platform.
In a specific embodiment, the analyzing the converted information by using the adapter corresponding to the second platform may include determining a target adapter corresponding to the platform type of the second platform from preset platform adapters so as to process the converted information by using the target adapter, where the preset platform adapter is a preset adapter, and is used for analyzing the converted information corresponding to the preset semantic model to obtain program code adapted to the platform type of the preset adapter. It can be understood that the second platform can comprise multiple platforms, each platform has its own platform adapter, and in a specific embodiment, the converted information is processed by the target adapter corresponding to the second platform to obtain the program code adapted by the corresponding platform.
In another specific embodiment, the analyzing the converted information by using the adapter corresponding to the second platform and running the function interface on the second platform based on the code corresponding to the function interface obtained by analysis may include analyzing the converted information by using the target adapter corresponding to the second platform to obtain corresponding analyzed information, filling the analyzed information into a code generation template in the target adapter to obtain the code corresponding to the function interface, and running the function interface on the second platform based on the code. Specifically, the target adapter corresponding to the second platform includes information such as a code generating template, a compiling template, an operation frame and the like, the converted information of the intermediate representation can be analyzed and understood, the analyzed information is filled into the corresponding code generating template to obtain codes corresponding to the function interfaces, and then the corresponding function interfaces can be operated on the second platform based on the codes, so that platform migration of the codes is realized. Correspondingly, the running of the functional interface on the second platform based on the code can comprise running the code on the second platform through a code compiling template and code running frame information corresponding to the second platform in the target adapter. Specifically, the code corresponding to the functional interface can be obtained through operation analysis through the code compiling template and the code operation frame information of the target adapter, and the corresponding functional interface can be operated on the second platform.
Therefore, the method and the device can enable a developer to rapidly design the functional interface through the visual designer, reduce the code quantity written manually, extract parameters of the functional interface operated by the first platform, convert the functional configuration information of the related functional interface into converted information which has no dependency relationship with the platform by utilizing the semantic model, further analyze the converted information into codes corresponding to the second platform through the adapter corresponding to the second platform, so that the corresponding functional interface can be operated on the basis of the codes analyzed by the adapter on the second platform, write code logic once by the developer, operate on multiple platforms, improve code reusability, and enable the converted information to be more easily migrated to a new platform without depending on the semantic model of any platform.
As shown in fig. 2, the embodiment of the application discloses a cross-platform code generation method, which comprises the following steps:
In the embodiment of the application, a user can build a functional interface through a visual designer, then an intermediate interpretation layer converts parameters corresponding to the functional interface into a unified functional representation, and then a code conversion layer finishes packaging and deployment of the functional interface by means of different platform adapters.
Specifically, a user can design the interface and the function of the functional interface through the visual designer, and the functional interface meeting the service requirement is designed by means of the UI component and the front-end and back-end function arrangement built in the visual designer. Specifically, a basic framework of the interface is quickly built in a drag-and-drop mode by utilizing a rich UI component library provided by the visual designer, and meanwhile, the properties and the styles of the components, such as the text, the color and the size of a button, and the placeholder and the verification rule of an input box, are set. And when the interface is designed, front-end and back-end functions are arranged in a visual mode, business logic such as data deletion, correction and check operation, workflow triggering and the like are bound with the interface component, so that seamless integration of functions and interfaces is realized. The data model is designed through a visual designer, the structure and the relation of the data in the application are defined, and data support is provided for the interface.
The designer may then extract the user-designed functions as parameters that represent configuration information such as layout, style, interaction logic, parameters, etc. of the interfaces and functions. First, the designer will identify all UI components on the interface, capturing their respective attributes, such as text, color, size of the buttons, and placeholders and validation rules of the input box. The designer then parameterizes the layout and style information, detailing the location, size, spacing, and alignment of the components, typically in the form of CSS (CASCADING STYLE SHEETS, cascading style sheet) styles or layout parameters. Event binding and interaction logic for the component, such as a mapping of button click events to backend API calls, is also recorded and parameterized in detail. At the same time, user-defined data models, as well as data binding information, including data sources, field types, data validation rules, etc., are also extracted and serialized. The configuration of business logic, such as workflow, condition judgment, circulation, etc., is converted into executable logic configuration parameters after being arranged by the visualization tool. The definition of the front-end and back-end interactions, including the request and response formats of the data, the API call mode, the parameters of the data transfer, etc., will also be explicitly defined and parameterized. The security and authority settings, such as user authentication, authorization rules, data access authorities, etc., are also extracted as parameters, so as to ensure the security of the application. In addition, configuration information required for application deployment, such as server settings, environment variables, third party service integration, etc., may also be collected and serialized. All of these parameters and configuration information will be packaged into a format that can be stored and transmitted, such as JSON or XML, for further processing. Is a high-level description of an application that contains all the logic and structural information of the application, but has not yet been converted to platform-specific code.
Further, on the basis of the above steps, the intermediate interpretation of the present embodiment may output a unified and abstract code representation (i.e. the converted information in the above embodiment) through a preset semantic model, and the intermediate representation may be understood by different platform converters. Specifically, cross-platform semantic definition, namely defining a cross-platform semantic model, and describing UI components, layouts, styles, business logic and data models. Intermediate representation generation-the high-level description of the interpretation layer is converted into an intermediate representation, ensuring that it contains enough information to support multi-platform development. Platform independence-ensuring that the intermediate representation is not dependent on any platform-specific development language or framework.
Code for the corresponding platform is then generated through the adapter, and standardized UI components, layouts, styles, events, data models, and business logic are first parsed and then mapped into the platform's development environment. For example, UI components are converted into Android views and controls, layout descriptions are converted into XML layout files, and corresponding styles and topics are applied. The event processing logic is bound to the Android event listener, while the data model is adapted to a local database or web service. The implementation of business logic invokes an Android API or integrates a third party service. It should be noted that the seamless integration of the adapter with popular Android IDEs (e.g., android Studio), provides a consistent and efficient development experience. Through the design, the Android code adapter can effectively convert standardized parameters of a low-code platform into high-quality codes capable of running on the Android platform, and rapid and reliable cross-platform application development is realized. In this way, the converted information of the intermediate representation generated in the above step can be converted into the code of the specific platform (Web, iOS, android) by the adapter, and specifically, in the code conversion layer, the step can comprise 3 adapters at the pc (personal computer ) end, an Zhuoduan and ios end, and the adapters comprise a code generation template, a code compiling template and code running frame information. On the basis of the unified representation, the adapter can analyze and understand the intermediate representation provided by the intermediate interpretation layer, and generate source codes of the corresponding platform by combining template driving and dynamic generation methods. And filling the analyzed codes into a code generation template, and compiling the converted information of the intermediate representation into the codes of the target operation platform according to the compiling template.
Therefore, the method and the system can extract parameters of the functional interface operated by the first platform, convert the functional configuration information of the related functional interface into converted information which has no dependency relationship with the platform by utilizing a semantic model in an intermediate interpretation layer, enable an application program not to directly depend on a technical stack of a specific platform, enable the application to be more easily migrated to a trust platform, further analyze the converted information into codes corresponding to the second platform through an adapter corresponding to the second platform, so that the second platform can operate the corresponding functional interface based on the codes obtained through analysis of the adapter, write code logic once by a developer, operate on multiple platforms, improve code reusability, and enable the converted information to be more easily migrated to a new platform without depending on the semantic model of any platform.
As shown in fig. 3, an embodiment of the present application discloses a cross-platform code generating device, which includes:
a functional interface determining module 11, configured to determine a functional interface that operates on the first platform;
The parameter extraction module 12 is configured to perform parameter extraction on the function information of the function interface to obtain corresponding function configuration information;
The conversion module 13 is used for converting the function configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information;
And the analysis module 14 is configured to analyze the converted information by using an adapter corresponding to a second platform, and operate the functional interface on the second platform based on a code corresponding to the functional interface obtained by analysis.
Therefore, the method and the system can extract parameters of the functional interface operated by the first platform, convert the functional configuration information of the related functional interface into converted information which has no dependency relationship with the platform by utilizing the semantic model, further analyze the converted information into codes corresponding to the second platform through the adapter corresponding to the second platform, so that the corresponding functional interface can be operated on the basis of the codes analyzed by the adapter on the second platform, a developer writes code logic once, the operation can be performed on multiple platforms, the code reusability is improved, and the converted information can be more easily migrated to a new platform without depending on the semantic model of any platform.
In a specific embodiment, the functional interface determining module 11 may include:
The instruction acquisition unit is used for displaying a plurality of components, a plurality of business logics and a plurality of data models for building the functional interface through a preset visual designer of the first platform and acquiring corresponding functional interface building instructions;
And the functional interface building unit is used for building a target functional interface corresponding to the functional interface building instruction on the first platform by utilizing the plurality of assemblies, the plurality of business logics and the data model.
In a specific embodiment, the parameter extraction module 12 may include:
The parameter extraction unit is used for extracting parameters of the function information of the target function interface respectively to obtain first configuration information corresponding to the component, second configuration information corresponding to the service logic and third configuration information corresponding to the data model;
and the information packaging unit is used for packaging the first configuration information, the second configuration information and the third configuration information based on a preset data format to obtain the function configuration information of the target function interface corresponding to the first platform.
In a specific embodiment, the conversion module 13 may include:
And the information conversion unit is used for describing components, business logic and data models in the function configuration information based on a preset semantic model so as to convert the function configuration information to obtain corresponding converted information.
In a specific embodiment, the parsing module 14 may include:
The adapter determining unit is used for determining a target adapter corresponding to the platform type of the second platform from preset platform adapters so as to process the converted information by using the target adapter, wherein the preset platform adapter is a preset adapter and is used for analyzing the converted information corresponding to a preset semantic model to obtain program codes matched with the platform type of the adapter.
In another specific embodiment, the parsing module 14 may include:
the information analysis unit is used for analyzing the converted information by utilizing the target adapter corresponding to the second platform to obtain corresponding analyzed information;
And the information filling unit is used for filling the analyzed information into the code generation template of the target adapter to obtain codes corresponding to the function interfaces, and running the function interfaces on the second platform based on the codes.
In yet another specific embodiment, the parsing module 14 may include:
And the code running unit is used for running the codes through the code compiling templates and the code running frame information corresponding to the second platform in the target adapter so as to run the functional interface on the second platform.
Further, the embodiment of the present application further discloses an electronic device, and fig. 4 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the diagram is not to be considered as any limitation on the scope of use of the present application.
Fig. 4 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may include, in particular, at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input-output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement relevant steps in the cross-platform code generation method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide working voltages for each hardware device on the electronic device 20, the communication interface 24 is capable of creating a data transmission channel with an external device for the electronic device 20, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein, and the input/output interface 25 is configured to obtain external input data or output data to the external device, and the specific interface type of the input/output interface may be selected according to the specific application needs and is not specifically limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further comprise a computer program capable of performing other specific tasks in addition to the computer program capable of performing the cross-platform code generation method performed by the electronic device 20 as disclosed in any of the preceding embodiments.
Furthermore, the application also discloses a computer readable storage medium for storing a computer program, wherein the computer program realizes the cross-platform code generation method when being executed by a processor. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
While the foregoing has been provided to illustrate the principles and embodiments of the present application, specific examples have been provided herein to assist in understanding the principles and embodiments of the present application, and are intended to be in no way limiting, for those of ordinary skill in the art will, in light of the above teachings, appreciate that the principles and embodiments of the present application may be varied in any way.
Claims (4)
1. A method for generating cross-platform code, comprising:
determining a functional interface running on the first platform through a visual designer;
extracting parameters of the function information of the function interface through the visual designer to obtain corresponding function configuration information;
Converting the functional configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information;
Analyzing the converted information by using a target adapter corresponding to the platform type of a second platform, which is determined from a preset platform adapter, and running the functional interface on the second platform based on a code corresponding to the functional interface obtained by analysis, wherein the preset platform adapter is a preset adapter and is used for analyzing the converted information corresponding to a preset semantic model to obtain a program code matched with the platform type of the target adapter, and the target adapter and a development tool of the second platform are seamlessly integrated;
Wherein the determining, by the visual designer, the functional interface running on the first platform includes:
Displaying a plurality of assemblies, a plurality of business logics and a plurality of data models for building a functional interface through a preset visual designer of a first platform, and acquiring corresponding functional interface building instructions;
Building a target function interface corresponding to the function interface building instruction on the first platform by utilizing the plurality of assemblies, the plurality of business logics and the data model;
The step of extracting parameters of the function information of the function interface through the visual designer to obtain corresponding function configuration information comprises the following steps:
extracting parameters of the function information of the target function interface through the visual designer to obtain first configuration information corresponding to the component, second configuration information corresponding to the service logic and third configuration information corresponding to the data model;
Packaging the first configuration information, the second configuration information and the third configuration information based on a preset data format to obtain functional configuration information of the target functional interface corresponding to the first platform, wherein the functional configuration information comprises security authority information corresponding to the target functional interface obtained through extraction and environment configuration information required by deployment;
the converting the function configuration information based on the preset semantic model to obtain corresponding converted information includes:
Describing components, business logic and a data model in the function configuration information based on a preset semantic model so as to convert the function configuration information to obtain corresponding converted information;
the target adapter comprises a code generation template, a code compiling template and code running frame information;
Correspondingly, the analyzing the converted information by using the target adapter corresponding to the platform type of the second platform, which is determined from the preset platform adapter, and running the functional interface on the second platform based on the code corresponding to the functional interface obtained by analysis, including:
analyzing the converted information by using the target adapter corresponding to the second platform to obtain corresponding analyzed information;
and filling the parsed information into the code generation template in the target adapter to obtain codes corresponding to the function interfaces, and running the codes through the code compiling template and the code running frame information corresponding to the second platform in the target adapter so as to run the function interfaces on the second platform.
2. A cross-platform code generation apparatus, comprising:
the function interface determining module is used for determining a function interface running on the first platform through the visual designer;
The parameter extraction module is used for extracting parameters of the function information of the function interface through the visual designer to obtain corresponding function configuration information;
The conversion module is used for converting the function configuration information based on a preset semantic model to obtain corresponding converted information, wherein the preset semantic model is a model which has no dependency relationship with any platform and is used for describing the configuration information;
The analysis module is used for analyzing the converted information by utilizing a target adapter corresponding to the platform type of the second platform, which is determined from the preset platform adapters, and running the functional interface on the second platform based on codes corresponding to the functional interface obtained by analysis; the preset platform adapter is a preset adapter and is used for analyzing converted information corresponding to a preset semantic model to obtain program codes adapted to the type of the platform of the user, and the target adapter and a development tool of the second platform are seamlessly integrated;
wherein, the functional interface determining module includes:
The instruction acquisition unit is used for displaying a plurality of components, a plurality of business logics and a plurality of data models for building the functional interface through a preset visual designer of the first platform and acquiring corresponding functional interface building instructions;
the functional interface building unit is used for building a target functional interface corresponding to the functional interface building instruction on the first platform by utilizing the plurality of assemblies, the plurality of business logics and the data model;
wherein, the parameter extraction module includes:
the parameter extraction unit is used for respectively extracting parameters of the function information of the target function interface through the visual designer to obtain first configuration information corresponding to the component, second configuration information corresponding to the business logic and third configuration information corresponding to the data model;
the information packaging unit is used for packaging the first configuration information, the second configuration information and the third configuration information based on a preset data format to obtain the function configuration information of the target function interface corresponding to the first platform, wherein the function configuration information comprises the extracted security authority information corresponding to the target function interface and the environment configuration information required by deployment;
Wherein, the conversion module includes:
The information conversion unit is used for describing components, business logic and data models in the function configuration information based on a preset semantic model so as to convert the function configuration information to obtain corresponding converted information;
The target adapter comprises a code generation template, a code compiling template and code running frame information, and the corresponding analysis module comprises:
the information analysis unit is used for analyzing the converted information by utilizing the target adapter corresponding to the second platform to obtain corresponding analyzed information;
And the information filling unit is used for filling the parsed information into the code generation template in the target adapter to obtain the code corresponding to the functional interface, and running the code through the code compiling template and the code running frame information corresponding to the second platform in the target adapter so as to run the functional interface on the second platform.
3. An electronic device, comprising:
A memory for storing a computer program;
A processor for executing the computer program to implement the cross-platform code generation method of claim 1.
4. A computer readable storage medium storing a computer program which when executed by a processor implements the cross-platform code generation method of claim 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411117169.5A CN118642702B (en) | 2024-08-15 | 2024-08-15 | Cross-platform code generation method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411117169.5A CN118642702B (en) | 2024-08-15 | 2024-08-15 | Cross-platform code generation method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118642702A CN118642702A (en) | 2024-09-13 |
CN118642702B true CN118642702B (en) | 2025-01-03 |
Family
ID=92667790
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411117169.5A Active CN118642702B (en) | 2024-08-15 | 2024-08-15 | Cross-platform code generation method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118642702B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116774993A (en) * | 2022-03-11 | 2023-09-19 | 华为技术有限公司 | Code conversion method, device and storage medium |
CN118312167A (en) * | 2024-06-11 | 2024-07-09 | 冠骋信息技术(苏州)有限公司 | Method and system for realizing suite mechanism based on low-code platform |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102006038876A1 (en) * | 2006-08-18 | 2008-02-21 | Giesecke & Devrient Gmbh | Automatic generation of executable application code |
CN113220280A (en) * | 2020-01-21 | 2021-08-06 | 北京搜狗科技发展有限公司 | Application generation method and device for generating application |
CN111427583A (en) * | 2020-04-12 | 2020-07-17 | 中信银行股份有限公司 | Component compiling method and device, electronic equipment and computer readable storage medium |
CN113778445A (en) * | 2021-09-15 | 2021-12-10 | 树根互联股份有限公司 | Cross-platform component generation method and device, electronic equipment and storage medium |
CN118093016B (en) * | 2024-04-26 | 2024-07-26 | 浙江金网信息产业股份有限公司 | A software cross-platform transplantation method |
-
2024
- 2024-08-15 CN CN202411117169.5A patent/CN118642702B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116774993A (en) * | 2022-03-11 | 2023-09-19 | 华为技术有限公司 | Code conversion method, device and storage medium |
CN118312167A (en) * | 2024-06-11 | 2024-07-09 | 冠骋信息技术(苏州)有限公司 | Method and system for realizing suite mechanism based on low-code platform |
Also Published As
Publication number | Publication date |
---|---|
CN118642702A (en) | 2024-09-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111241454B (en) | Method, system and device for generating webpage codes | |
CN104636139B (en) | One kind visualizes cross-platform mobile application exploitation and generation system | |
CN108984172B (en) | Interface file generation method and device | |
US20220391221A1 (en) | Providing a different configuration of added functionality for each of the stages of predeployment, deployment, and post deployment using a layer of abstraction | |
Ahmed et al. | Model-based user interface engineering with design patterns | |
US20060123345A1 (en) | Platform-independent markup language-based gui format | |
US20240160410A1 (en) | Application Development Platform, Micro-program Generation Method, and Device and Storage Medium | |
CN104199647A (en) | Visualization system and implementation method based on IBM host | |
CN102314358A (en) | Method for deploying conventional applications on cloud platform in SOA (service oriented architecture) way | |
CN114860205A (en) | Application extension system, method and device of low-code development platform | |
KR101552914B1 (en) | Web server application framework web application processing method using the framework and computer readable medium processing the method | |
CN115857926A (en) | Method and device for constructing front-end code engineering based on low-code application | |
CN111596905A (en) | Method, device, storage medium and terminal for generating java object | |
US9075891B2 (en) | Method and device for editing an object represented in a web page | |
CN118642702B (en) | Cross-platform code generation method, device, equipment and storage medium | |
CN102411498A (en) | Method for realizing data model and graphical designer | |
CN114911468A (en) | Application platform generation method and device | |
CN113296759A (en) | User interface processing method, user interface processing system, user interface processing device, and storage medium | |
CN101303663A (en) | Simulation test method for digital set-top box software development | |
JP4686117B2 (en) | Source code conversion apparatus, source code conversion method, and program | |
CN116643745A (en) | Code development method, device and equipment | |
CN115373731A (en) | Public code resource sharing method, device, equipment and storage medium | |
WO2023128793A1 (en) | System and method for dynamically visualizing software elements | |
CN117251231B (en) | Animation resource processing method, device and system and electronic equipment | |
JP4942144B2 (en) | Information processing apparatus, control method therefor, program, and storage 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 |