A compiling method, a compiling device, an execution method and a computer device
By generating routing tables in the Flutter compilation method, communication between Native native components, Flutter native components and Flutter dynamic components is realized, which solves the problems of communication complexity and redundant code between components in the prior art, and simplifies the development process.
Patent Information
- Application Number
- CN202110323733.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-26
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-03-26
AI Technical Summary
The prior art is difficult to realize automatic communication between Native native components and Flutter components, resulting in a large amount of redundant coupled code required during the development process, affecting component design.
Provide a Flutter-based compilation method, which generates executable files by receiving configuration content, including Native native components, Flutter native components and Flutter dynamic components, and generates routing tables at runtime, so that components can communicate through routing tables, thereby realizing that Absolutely decoupled.
It realizes absolute decoupling between Native native components, Flutter native components and Flutter dynamic components, avoids redundant code in the main project and simplifies the development process.
Smart Images

Figure CN115129319B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to a compilation method, a compilation device, an execution method, a computer-readable storage medium, and a computer device based on Flutter. Background Art
[0002] With the ever-changing mobile demands, major companies have shown great interest in cross-platform development, especially after Google launched Flutter (a mobile user interface framework released by Google), more and more companies and teams have invested manpower and material resources in Flutter development. However, Flutter is a cross-platform solution after all, and some special Native (programming method based on the local operating system of smartphones) requirements still rely on native application programming interfaces (APIs), so how to automatically communicate between Native components and Flutter components is the problem we want to solve. Summary of the invention
[0003] In order to solve at least one of the above problems, the first aspect of the present invention provides a compilation method based on Flutter, including:
[0004] Receive configuration content;
[0005] Compile and generate an executable file in response to the configuration content, where the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component. The executable file generates a routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table.
[0006] In some optional embodiments, compiling and generating an executable file in response to the configuration content further includes:
[0007] In response to the configuration content, a preset project template is selected to establish a project;
[0008] Compile the project and generate an executable file.
[0009] In some optional embodiments, the executable file includes an executable file applicable to at least one application system;
[0010] Application systems include Windows, Android and IOS.
[0011] In some optional embodiments,
[0012] Native components are program codes written in a system language of one of multiple application systems. Native components include business components and functional components.
[0013] In some optional embodiments, the Native component, the Flutter native component, and the Flutter dynamic component each include at least one program module.
[0014] Compiling and generating an executable file in response to the configuration content, the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component, and the executable file generates a routing table at runtime so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table, further comprising:
[0015] The program modules of Native components, Flutter native components, and Flutter dynamic components call each other through the routing table.
[0016] A second aspect of the present invention provides a compiling device for implementing the compiling method described above, comprising:
[0017] A service configuration unit configured to receive configuration content;
[0018] A Flutter-based compiler is configured to compile and generate an executable file in response to configuration content, where the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component. The executable file generates a routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate with each other through the routing table.
[0019] A third aspect of the present invention provides a method for executing an executable file obtained using the above compiling method, comprising:
[0020] Start the executable file and generate a routing table according to the configuration content. The executable file includes at least two of the Native components, Flutter native components, and Flutter dynamic components.
[0021] Select an entry address from Native components, Flutter native components, and Flutter dynamic components based on the configuration content;
[0022] The program is executed according to the entry address, and communication is carried out between Native components, Flutter native components, and Flutter dynamic components through the routing table according to the configuration content.
[0023] In some optional embodiments,
[0024] The Native component, the Flutter native component, and the Flutter dynamic component each include at least one program module, and starting the executable file and generating a routing table according to the configuration content further includes:
[0025] Start the executable file and generate an execution configuration file in response to the configuration content. The execution configuration file includes entry options and the communication process between Native components, Flutter native components, and Flutter dynamic components.
[0026] Generate a routing table according to the execution configuration file, which includes the call identifiers of each program module of the Native component, Flutter native component, and Flutter dynamic component and the running identifiers corresponding to the call identifiers;
[0027] Selecting an entry address from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content further includes: selecting an entry address of a corresponding entry program module from the Native component, the Flutter native component, and the Flutter dynamic component according to an entry option of the execution configuration file;
[0028] Executing the program according to the entry address and communicating between Native components, Flutter native components, and Flutter dynamic components through the routing table according to the configuration content further includes:
[0029] Execute the corresponding program module according to the entry address and communication process;
[0030] Obtain the corresponding operation identifier through the routing table according to the call identifier of the communication process;
[0031] Call the corresponding Native component, Flutter native component or
[0032] Program module for Flutter dynamic components.
[0033] In some optional embodiments, the program module for calling the corresponding Native component, Flutter native component, or Flutter dynamic component according to the running identifier further includes:
[0034] The program module of the Native component calls the program module of the Flutter component according to the running identifier, or the program module of the Flutter component calls the program module of the Native component according to the running identifier;
[0035] or
[0036] The program module of the Flutter dynamic component calls the program module of the Flutter native component according to the running identifier, or the program module of the Flutter native component calls the program module of the Flutter dynamic component according to the running identifier;
[0037] or
[0038] The program module of the Native component calls the program module of the Flutter dynamic component according to the running identifier, or the program module of the Flutter dynamic component calls the program module of the Native component according to the running identifier.
[0039] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon.
[0040] When the program is executed by a processor, the compilation method described above is implemented; or
[0041] When the program is executed by a processor, the execution method described above is implemented.
[0042] A fifth aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor.
[0043] The processor implements the compilation method described above when executing the program; or
[0044] When the processor executes the program, the execution method described above is implemented.
[0045] The beneficial effects of the present invention are as follows:
[0046] In view of the existing problems, the present invention develops a compilation method, a compilation device, an execution method, a computer-readable storage medium and a computer device based on Flutter, which perform hybrid compilation in response to configuration content and generate an executable file, generate a routing table when running the executable file and realize communication between Native components, Flutter components and Flutter dynamic components, thereby realizing absolute decoupling between Native components, Flutter components and Flutter dynamic components, avoiding redundant codes in the main project, simplifying the development process, and having broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A schematic flow chart of a compiling method according to an embodiment of the present invention is shown.
[0049] Figure 2 A hardware system block diagram for compiling and executing an embodiment of the present invention is shown.
[0050] Figure 3 A functional framework diagram of a compilation and execution process according to an embodiment of the present invention is shown.
[0051] Figure 4 A schematic block diagram of a compiling device according to an embodiment of the invention is shown.
[0052] Figure 5 A schematic flow chart showing a method for executing an executable file obtained by using the compiling method of the present invention according to an embodiment of the present invention.
[0053] Figure 6 A schematic structural diagram of a computer device according to another embodiment of the present invention is shown. DETAILED DESCRIPTION
[0054] In order to more clearly illustrate the present invention, the present invention is further described below in conjunction with preferred embodiments and accompanying drawings. Similar components in the accompanying drawings are represented by the same reference numerals. It should be understood by those skilled in the art that the content specifically described below is illustrative rather than restrictive, and should not be used to limit the scope of protection of the present invention.
[0055] Currently, although Flutter provides developers with channels such as EventChannel and MethodChannel for communication between Native components and Flutter components, since the API is preset in advance, if communication is to be carried out, a large amount of coupling code needs to be written in the Flutter project and the native project when building the application. That is, a large amount of redundant code is coupled in the main project, which is not conducive to the design of a complete component solution.
[0056] For one of the above problems, such as Figure 1 As shown, an embodiment of the present invention provides a compilation method based on Flutter, including:
[0057] S101, receiving configuration content;
[0058] S103, compile and generate an executable file in response to the configuration content, where the executable file includes at least two of the Native component, the Flutter native component, and the Flutter dynamic component. The executable file generates a dynamic routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the dynamic routing table.
[0059] In this embodiment, hybrid compilation is performed in response to the configuration content and an executable file is generated, and the executable file can generate a routing table at runtime, thereby realizing communication between Native components, Flutter native components and Flutter dynamic components, thereby realizing absolute decoupling between Native components, Flutter native components and Flutter dynamic components, avoiding redundant code in the main project, simplifying the development process, and having broad application prospects.
[0060] In order to further understand the present invention, the method and apparatus of the present invention are described in detail below with reference to specific examples.
[0061] like Figure 2 As shown, the figure shows a typical hardware system block diagram of an executable file compiled and executed. The hardware system includes a compiling device 100 and terminal devices 200-1, 200-2, 200-3, ..., 200-n for executing the executable file generated by the compiling device.
[0062] In an embodiment of the present invention, the compilation device 100 may be a desktop, tablet computer, laptop computer, etc., on which a Jenkins service and a Flutter-based compiler are loaded. Terminal devices 200-1, 200-2, 200-3, ..., 200-n are terminal devices equipped with one or more of Windows system, Android system and IOS system, such as mobile phones, desktop computers, tablet computers, laptop computers, etc. Of course, the terminal device is equipped with multiple of the above systems, which refers to a terminal device that allows multi-system switching. When no distinction is required, the terminal device is represented by the reference numeral 200.
[0063] The compilation device 100 generates an executable file by hybrid compilation based on the developer's configuration, and the terminal device 200 downloads the executable file, installs and executes the executable file. The terminal device 200 can download the executable file directly or indirectly, that is, it can directly access the compilation device 100 to download the executable file; or when the compilation device 100 uploads the executable file to an application cloud server, such as APP Store, the terminal device 200 logs in to the application cloud server to indirectly download the executable file.
[0064] In a specific example, referring to Figure 1 and Figure 2 As shown, in step S101, the compilation device 100 receives configuration content input by the developer through the Jenkins service, such as application display name, project name, Bundle ID, Build number, CocoaPods source, public library name, public library version, private library name and other change items.
[0065] In step S103 , in response to the configuration content, the compiling device 100 compiles and generates an executable file.
[0066] Specifically, the compilation device 100 selects a preset project template in response to the configuration content to establish a template project. For example, the project template is assigned to the specified project folder through script execution, and the project name and external folder name are automatically modified according to the configuration content. The generated project folder .xcodeproj maintains the relationship between the Xcode project class and the project, determines the business components, functional components, and entry components introduced by the Pod library, and finds the AppDelegate of the main project, and binds the entry component to the AppDelegate. Here, the compilation device 100 selects whether the entry is a native component entry, a Flutter native component entry, or a Flutter dynamic component entry. In addition, at the AppDelegate of the main project, the communication flow of the project is instantiated and generated.
[0067] The compilation device 100 performs hybrid compilation based on the established project template and generates an executable file, which includes a cross-platform application file, that is, at least two of the Native component, the Flutter native component, and the Flutter dynamic component. In an embodiment of the present invention, the executable file generates a routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table.
[0068] Native components are program codes written in a system language of one of multiple application systems, that is, program development of multiple application systems is implemented using one programming language, thereby greatly reducing the workload of program development, improving development efficiency and saving development costs. Native components include business components and functional components, where business components are components with interfaces, such as audio and video playback, login, etc., and functional components are components with specific functions such as power query, GPS acquisition, etc. The executable file may include both business components and functional components, or may include only one of the business components and functional components. The business components or functional components included may be one or more, and the present invention is not limited. In addition, the Flutter dynamic component is the dynamic framework of Flutter, and the Flutter native component is the business component or functional component under the Flutter ecosystem.
[0069] According to the received configuration content, the compilation device 100 performs mixed compilation and generates executable files including executable files applicable to at least one application system, and the application systems include Windows system, Android system and IOS system. Specifically, according to the generation options of the executable files set in the configuration content, executable files applied to Windows system, Android system or IOS system are generated, and executable files of one of the systems can be generated separately, or executable files of multiple systems can be generated at the same time. For example, if only the executable file of the Android system is needed, the generation options of the executable files are set through the Jenkins service, and the Native code and Flutter code written in the development language of the IOS system are mixed compiled to generate an executable file applicable to the Android system; similarly, if it is necessary to generate executable files for multiple application systems, the generation options of the executable files are set in the Jenkins service to generate executable files applicable to multiple application systems.
[0070] The executable file generated by the embodiment of the present invention can generate a routing table during the execution process, so as to realize the mutual calling of Native components, Flutter native components and Flutter dynamic components in the hybrid compiled cross-platform executable file, avoid writing coupling codes for communication between Native components, Flutter native components and Flutter dynamic components in the executable file, that is, release the coupling relationship between program codes, and then realize absolute coupling between program components, thereby solving the problems existing in the prior art.
[0071] In an embodiment of the present invention, Figure 4 As shown, a compilation device 100 for implementing the above compilation method is provided, comprising:
[0072] A service configuration unit configured to receive configuration content;
[0073] A Flutter-based compiler is configured to compile and generate an executable file in response to configuration content, where the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component. The executable file generates a routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate with each other through the routing table.
[0074] In this embodiment, the compilation device performs hybrid compilation in response to the configuration content and generates an executable file, and the executable file can generate a routing table at runtime, thereby realizing communication between Native components, Flutter native components, and Flutter dynamic components, thereby realizing absolute decoupling between Native components, Flutter native components, and Flutter dynamic components, avoiding redundant code in the main project, simplifying the development process, and having broad application prospects.
[0075] In an embodiment of the present invention, according to the executable file generated by the above compiling method, an execution method executed on the terminal device 200 is also provided:
[0076] S501, start an executable file and generate a routing table according to the configuration content, where the executable file includes at least two of Native components, Flutter native components, and Flutter dynamic components;
[0077] S503: Select an entry address from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content;
[0078] S505: Execute the program according to the entry address, and communicate between the Native component, the Flutter native component, and the Flutter dynamic component through the routing table according to the configuration content.
[0079] In this embodiment, a routing table is generated when the executable file is executed, and communication between Native components, Flutter native components, and Flutter dynamic components is realized, thereby achieving absolute decoupling between Native components, Flutter native components, and Flutter dynamic components, avoiding redundant code in the main project, simplifying the development process, and having broad application prospects.
[0080] In a specific example, for example, assuming that the business requirement for writing the configuration content in the executable file is a navigation project, and assuming that the components included in the executable file are Native components, Flutter native components, and Flutter dynamic components, the following process will be followed when executing the executable file.
[0081] Combination Figure 5 and Figure 3 As shown, in step S501, after the mobile terminal device 200 downloads the executable file of the navigation project generated by the compiling apparatus 100, the executable file is started in the system of the terminal device 200, and a routing table is generated according to the configuration content.
[0082] Optionally, when starting the executable file, an execution configuration file is generated in response to the configuration content, the execution configuration file includes entry options, and the communication process between Native components, Flutter native components and Flutter dynamic components; and a routing table is generated according to the execution configuration file. The routing table includes the call identifiers of each program module of the Native component, Flutter native component and Flutter dynamic component and the running identifier corresponding to the call identifier, where the identifier can be a protocol string or other identifier, which is not specifically limited in this application.
[0083] It should be noted that Native components, Flutter native components and Flutter dynamic components all include multiple program modules, such as a program module for querying power, a program module for logging in, a program module for connecting to third-party payment, etc., that is, each component exists in the form of a program module. Specifically, Native components include multiple business components, and each business component is an independent program module.
[0084] In an embodiment of the present invention, calling each program module in any one of the Native component, the Flutter native component and the Flutter dynamic component is to communicate with the component, and the routing table includes a call identifier and a run identifier, wherein the call identifier is used by the running program module when calling another program module, and the run identifier corresponding to the call identifier is obtained by querying the routing table, and another program module is executed according to the run identifier.
[0085] Specifically, for example, a Native component is called from a Flutter native component through a routing table, a program module of the Flutter native component is the currently running program, and the running identifier of the pre-called Native component configured in the configuration content is obtained from the routing table, and the program module in the Native component is jumped to and run according to the running identifier.
[0086] It is understandable that there are calls between Native components, Flutter native components, and Flutter dynamic components.
[0087] For example, if a Flutter dynamic component is called from the currently running Native component, the program module of the Native component queries the routing table according to the call identifier of the Flutter dynamic component, obtains the running identifier of the Flutter dynamic component, and uses the running identifier to jump to the program module of the Flutter dynamic component, and vice versa.
[0088] Similarly, calling a Flutter native component from a Native native component is also manifested as the running Native native component program module querying the routing table according to the call identifier of the Flutter native component, obtaining the running identifier of the Flutter native component, and using the running identifier to jump to the program module of the Flutter native component, and vice versa.
[0089] Similarly, calling a Flutter native component from a Flutter dynamic component is also manifested as the running Flutter dynamic component program module querying the routing table according to the call identifier of the Flutter native component, obtaining the running identifier of the Flutter native component, and using the running identifier to jump to the program module of the Flutter native component, and vice versa.
[0090] It should be noted that the present application does not limit the specific formats of the call identifier and the operation identifier of the routing table. Those skilled in the art should select an appropriate format according to actual application requirements, which will not be elaborated here.
[0091] In this embodiment, because the string parameter formats referenced by each program module in the Native component, the Flutter native component, and the Flutter dynamic component are different, the formats of the running identifiers of the program modules in the corresponding components are also different.
[0092] In a specific example:
[0093] If the Flutter native component and Flutter dynamic component communicate with the Native component, the parameters are received through the underlying MethodChannel and sent to the parameter settings matched by the native route, thereby completing the communication with the Native component.
[0094] If the Native component communicates with the Flutter dynamic component, the protocol string format is formulated for the Flutter dynamic component's widget and dynamic plug-in to reference string parameters:
[0095] platform: / / path? param1=xx¶m2=xx&…¶mn=xx.
[0096] If the Native component and the Flutter dynamic component communicate with the Flutter native component, since the Flutter dynamic component can directly locate the fixed JSON page according to the path, the page of the Flutter native component needs to be instantiated for parsing. Therefore, for the Flutter native component, a set of native routing string protocols needs to be manually designed.
[0097] Specifically, we introduced the Fluro open source framework, injected the routing distribution code into main.dart through the script, introduced the entry configuration plug-in of the Flutter framework into main.dart, and bound the callback distributed by the dynamic plug-in to our entry configuration plug-in. The entry configuration plug-in forwarded the dynamic information we obtained, and our communication plug-in forwarded the obtained fixed-format protocol string to a fixed page through the routing table. The protocol string format is, for example:
[0098] flutter: / / / path? param1=xx¶m2=xx&…¶mn=xx.
[0099] It should be noted that the communication protocol strings of Flutter native and Flutter dynamic components are different, and routing communication of the routing table is also required when calling the program modules of Flutter native and Flutter dynamic components.
[0100] Based on the above communication principles, specifically in this example, according to the configuration content, if the navigation project is a project based on Native components, and is entered and executed from the entry program module of the Native component, the Native component needs to communicate with the Flutter native component and the Flutter dynamic component to call the various program modules of the Flutter native component and the Flutter dynamic component. Accordingly, the routing table will include the call identifier for calling the Flutter native component and the Flutter dynamic component and the run identifier corresponding to the call identifier.
[0101] According to the configuration content, if the navigation project is a project based on Flutter native components, the Flutter native component is used as the main running component, and it is entered and executed from the entry program module of the Flutter native component. At the same time, the Flutter native component needs to communicate with the Native component and the Flutter dynamic component to call the various program modules of the Flutter native component and the Flutter dynamic component. Accordingly, the routing table will include the call identifier for calling the Native component and the Flutter dynamic component and the run identifier corresponding to the call identifier.
[0102] According to the configuration content, if the navigation project is a project based on the Flutter dynamic component, the Flutter dynamic component is used as the main running component, and is entered and executed from the entry program module of the Flutter dynamic component. At the same time, the Flutter dynamic component needs to communicate with the Native component and the Flutter native component to call the various program modules of the Native component and the Flutter native component. Accordingly, the routing table will include a call identifier for calling the Native component and the Flutter native component and a run identifier corresponding to the call identifier.
[0103] In step S503, an entry address is selected from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content. Specifically, the entry address of the corresponding entry program module is selected from the Native component, the Flutter native component, and the Flutter dynamic component according to the entry option of the execution configuration file. In an embodiment of the present invention, the entry program module can be the native entry component of the native component, the main.dart of the Flutter native component, or the main.dart of the Flutter dynamic component. Among them, the entry program modules of the Flutter dynamic component and the Flutter native component are both main.dart.
[0104] For example, if the navigation project is set as a project based on Native components in the configuration content, the executable file is started from the entry program module of the Native component. Thus, in step S503, the executable file will automatically select the entry address of the Native entry component.
[0105] If the configuration content has set the navigation project as a project based on Flutter dynamic components, for example, a large number of dynamic components need to be used in the navigation project and a small number of Native components and Flutter native components need to be embedded therein, then in step S503, the executable file will automatically select the address of main.dart of the Flutter dynamic component.
[0106] In another case, if the navigation project has been set as a project based on Flutter native components in the configuration content, in step S503, the executable file will automatically select the address of main.dart of the Flutter native component.
[0107] In step S505, the program is executed according to the entry address, and communication is performed among the Native component, the Flutter native component, and the Flutter dynamic component through the routing table according to the configuration content.
[0108] Specifically, the corresponding program module is executed according to the entry address and the communication process; the corresponding running identifier is obtained through the routing table according to the call identifier of the communication process; and the program module of the corresponding Native component or Flutter dynamic component is called according to the running identifier.
[0109] It should be noted that although the above example describes the process of executing the method with a specific navigation project, those skilled in the art should understand that this is only exemplary, and the present invention is not intended to limit the project type to which the executable file belongs, nor is it intended to limit the scope of application of the executable file, and other application types are also possible.
[0110] In addition, the above example assumes that the executable file is an executable file generated by simultaneously mixing and compiling Native components, Flutter native components, and Flutter dynamic components, but the embodiments of the present invention are not limited to this. In addition, the executable file may be an executable file generated only by mixing and compiling Native components and Flutter dynamic components; or the executable file may be an executable file generated only by mixing and compiling Native components and Flutter native components; or the executable file may be an executable file generated by mixing and compiling Flutter dynamic components and Flutter native components.
[0111] In these optional embodiments, the execution method of the executable file is similar to the above examples, and the only difference is that the routing table generated according to the configuration content when the executable file is started in step S501 is different according to the different types of components included. Because the composition of the executable file is different, the entry options and communication processes included in the generated configuration file are different, and thus the call identifier and the run identifier included in the generated routing table are different; the entry address selected in step S503 is different due to the different composition of the executable file; and the object of calling the program module in the specific step of step S505 is different due to the different composition of the executable file.
[0112] Those skilled in the art can understand that the relationship between the above entry address, communication process, call identifier and running identifier included in the routing table, entry address, and object of the calling program module will be changed from the relationship between the three to the relationship between the two. The specific execution process and communication process are similar to the above example and will not be repeated here.
[0113] With the above settings, the executable file generates a routing table according to the preset configuration when it is running, and uses the routing table to implement routing communication between different platform program modules in the executable file, thereby achieving absolute decoupling between Native components, Flutter native components, and Flutter dynamic components, avoiding redundant code in the main project, and simplifying the development process.
[0114] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements: receiving configuration content; compiling and generating an executable file in response to the configuration content, the executable file including at least two of a Native component, a Flutter native component, and a Flutter dynamic component, and the executable file generates a routing table at runtime, so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table.
[0115] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements: starting an executable file and generating a routing table according to configuration content, the executable file including at least two of a Native component, a Flutter native component, and a Flutter dynamic component; selecting an entry address from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content; executing the program according to the entry address, and communicating between the Native component, the Flutter native component, and the Flutter dynamic component through the routing table according to the configuration content.
[0116] In practical applications, the computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0117] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0118] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0119] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] like Figure 6As shown, a structural schematic diagram of a computer device provided by another embodiment of the present invention. Figure 6 The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0121] like Figure 6 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0122] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0123] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0124] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0125] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0126] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 20. Figure 6 As shown, the network adapter 20 communicates with other modules of the computer device 12 via the bus 18. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with computer device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0127] The processor unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing a Flutter-based compilation method or an execution method of an executable file obtained using the compilation method provided in an embodiment of the present invention.
[0128] It should be noted that the sequence of steps of the eye tracking method provided in the embodiment of the present invention can be appropriately adjusted, and the steps can be increased or decreased accordingly according to the circumstances. Any technical personnel familiar with the technical field can easily come up with changes within the technical scope disclosed in this invention, and these changes should be covered within the scope of protection of the present invention, so they will not be described in detail.
[0129] In view of the existing problems, the present invention develops a compilation method, a compilation device, an execution method, a computer-readable storage medium and a computer device based on Flutter, generates an executable file by performing mixed compilation in response to configuration content, generates a routing table when running the executable file, and realizes communication between Native components, Flutter components and Flutter dynamic components, thereby realizing absolute decoupling between Native components, Flutter components and Flutter dynamic components, avoiding redundant codes in the main project, simplifying the development process, and having broad application prospects.
[0130] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not limitations on the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation methods here. All obvious changes or modifications derived from the technical solution of the present invention are still within the protection scope of the present invention.
Claims
1. A compilation method based on Flutter, characterized in that: include: Receive configuration content; Compiling and generating an executable file in response to the configuration content, the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component, and the executable file generates a routing table at runtime so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table; further comprising: In response to the configuration content, a preset project template is selected to establish a project, including: assigning the project template to a specified project folder through script execution, automatically modifying the project name and the external folder name according to the configuration content, and generating a project folder .xcodeproj that maintains the relationship between the class and the project of the Xcode project, determines the business components, functional components, and entry components introduced by the Pod library, and finds the AppDelegate of the main project, binds the entry component to the AppDelegate, and selects the entry as one of the native component entry, the Flutter native component entry, and the Flutter dynamic component entry by the compilation device; Compile the project and generate an executable file.
2. The compiling method according to claim 1, characterized in that: The executable file includes an executable file applicable to at least one application system; The application systems include Windows system, Android system and IOS system.
3. The compiling method according to claim 2, characterized in that: The Native component is a program code written in a system language of one of the multiple application systems, and the Native component includes a business component and a functional component.
4. The compiling method according to claim 1, characterized in that: The Native component, Flutter native component and Flutter dynamic component each include at least one program module. The step of compiling and generating an executable file in response to the configuration content, wherein the executable file includes at least two of a Native component, a Flutter native component, and a Flutter dynamic component, and the executable file generates a routing table at runtime so that the Native component, the Flutter native component, and the Flutter dynamic component communicate through the routing table, further includes: The program modules of the Native component, the Flutter native component, and the Flutter dynamic component call each other through the routing table.
5. A compiling device for implementing the compiling method according to any one of claims 1 to 4, characterized in that: include A service configuration unit configured to receive configuration content; A Flutter-based compiler is configured to compile and generate an executable file in response to the configuration content, wherein the executable file includes at least two of a Native component, a Flutter component, and a Flutter dynamic component. The executable file generates a routing table at runtime so that the Native component, the Flutter component, and the Flutter dynamic component communicate with each other through the routing table; further comprising: configuring to select a preset project template to establish a project in response to the configuration content, including: assigning a project template to a specified project folder through script execution, automatically modifying the project name and the external folder name according to the configuration content, and generating a project folder .xcodeproj that maintains the relationship between the class and the project of the Xcode project, determines the business components, functional components, and entry components introduced by the Pod library, and finds the AppDelegate of the main project, binds the entry component to the AppDelegate, and the compilation device selects the entry as one of the native component entry, the Flutter native component entry, and the Flutter dynamic component entry; and configuring to compile the project and generate an executable file.
6. A method for executing an executable file obtained by using the compiling method according to any one of claims 1 to 4, characterized in that: include: Start an executable file and generate a routing table according to the configuration content, wherein the executable file includes at least two of Native components, Flutter native components, and Flutter dynamic components; Selecting an entry address from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content; A program is executed according to the entry address, and communication is performed between the Native component, the Flutter native component, and the Flutter dynamic component through the routing table according to the configuration content.
7. The execution method according to claim 6, characterized in that: The Native component, the Flutter native component, and the Flutter dynamic component each include at least one program module, and the starting the executable file and generating a routing table according to the configuration content further includes: Starting the executable file and generating an execution configuration file in response to the configuration content, wherein the execution configuration file includes entry options and a communication process between the Native component, the Flutter native component, and the Flutter dynamic component; Generate the routing table according to the execution configuration file, wherein the routing table includes a call identifier of each program module of the Native component, the Flutter native component, and the Flutter dynamic component and a run identifier corresponding to the call identifier; The selecting an entry address from one of the Native component, the Flutter native component, and the Flutter dynamic component according to the configuration content further includes: selecting an entry address of a corresponding entry program module from the Native component, the Flutter native component, and the Flutter dynamic component according to the entry option of the execution configuration file; The executing a program according to the entry address and communicating between the Native component, the Flutter native component, and the Flutter dynamic component through the routing table according to the configuration content further includes: Execute the corresponding program module according to the entry address and the communication process; Acquire a corresponding operation identifier through the routing table according to the call identifier of the communication process; The program module of the corresponding Native component, Flutter native component or Flutter dynamic component is called according to the running identifier.
8. The execution method according to claim 7, characterized in that: The program module for calling the corresponding Native component, Flutter native component or Flutter dynamic component according to the running identifier further includes: The program module of the Native component calls the program module of the Flutter component according to the running identifier, or the program module of the Flutter component calls the program module of the Native component according to the running identifier; or The program module of the Flutter dynamic component calls the program module of the Flutter native component according to the running identifier, or the program module of the Flutter native component calls the program module of the Flutter dynamic component according to the running identifier; or The program module of the Native component calls the program module of the Flutter dynamic component according to the running identifier, or the program module of the Flutter dynamic component calls the program module of the Native component according to the running identifier.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented; or When the program is executed by a processor, the method according to any one of claims 6 to 8 is implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented; or When the processor executes the program, the method according to any one of claims 6 to 8 is implemented.
Citation Information
Patent Citations
Method and device for dynamically adjusting routing, medium and electronic equipment
CN110489621A
Adaptation method and device based on iOS
CN111651194A
Flutter mixed mode compiling method and device, equipment and medium
CN111694564A
Mini program application compiling method, operating method, storage medium and electronic equipment
CN111736840A
Data packet publishing method and device, dynamic updating method and device, equipment and medium
CN111740948A
