Application program processing method and apparatus, computer device and storage medium
By adjusting the application resource package to adapt to different development frameworks, the compatibility problem caused by framework dependence in cross-platform application development is solved, and seamless adaptation and functional alignment of cross-platform applications under different frameworks is achieved.
Patent Information
- Application Number
- PCT/CN2024/137074
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-04
- Filing Date
- 2024-12-05
- Publication Date
- 2025-07-10
AI Technical Summary
In the prior art, when developing cross-platform application, the code editor cannot be directly used under other frameworks due to its strong dependence on specific application development frameworks. The existing solutions usually have functions downgraded or require a lot of development work, so they cannot be aligned with the experience of the industry general editor.
By determining the first resource package and the second resource package of the application, adjusting the first resource package according to the matching conditions of the second application development framework, generating a second resource package suitable for the second framework, solving the differences between cross-platform application development frameworks, including the adaptation of startup resources, operating environment, communication resources, etc.
It realizes seamless adaptation of cross-platform applications under different development frameworks, avoids the cost of redevelopment, maintains the user experience of the original editor, and enhances functional compatibility and plug-in market support.
Smart Images

Figure CN2024137074_10072025_PF_FP_ABST
Abstract
Description
Application processing method, device, computer equipment and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2024100112481, filed on January 4, 2024, entitled “Application Processing Method, Apparatus, Computer Device, and Storage Medium,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to an application processing method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0004] In the field of cross-platform application development, a commonly used application, such as a powerful and versatile code editor, often has a strong dependency on the application development framework it uses, preventing businesses using other application development frameworks from directly using the code editor. In related technologies, adapting the code editor to other application development frameworks often requires using a simplified version of the code editor with lower capabilities, or developing a new, complex editor tool based on the original framework with extensive development effort.
[0005] However, the simplified editor not only had downgraded functionality, but also lacked a plugin marketplace and relied more heavily on the underlying system and file capabilities. The user experience of the newly developed editor couldn't match that of standard editors in the industry. Summary of the Invention
[0006] The present application provides an application processing method, apparatus, computer device, computer-readable storage medium, and computer program product.
[0007] In one aspect, the present application provides an application processing method, which is executed by a computer device and includes:
[0008] determining a first application development framework, an application program, and a second application development framework;
[0009] Obtaining a first resource package of the application, where the first resource package is applicable to the first application development framework and includes application resources used by the application during its use;
[0010] Determining an application resource condition that matches the second application development framework, adjusting the first resource package according to the application resource condition to obtain a second resource package for the application, where the second resource package is suitable for the second application development framework; and
[0011] The application program is run in the second application development framework through the second resource package.
[0012] On the other hand, the present application also provides an application processing device, comprising:
[0013] A determination module, configured to determine a first application development framework, an application program, and a second application development framework;
[0014] an acquisition module, configured to acquire a first resource package of the application, wherein the first resource package is applicable to the first application development framework and includes application resources used by the application during its use;
[0015] an adjustment module, configured to determine an application resource condition matching the second application development framework, and adjust the first resource package according to the application resource condition to obtain a second resource package for the application, wherein the second resource package is suitable for the second application development framework; and
[0016] A running module is used to run the application program in the second application development framework through the second resource package.
[0017] On the other hand, the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned application processing method when executing the computer program.
[0018] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the above-mentioned application processing method when executed by a processor.
[0019] On the other hand, the present application also provides a computer program product, including a computer program, which implements the above-mentioned application processing method when executed by a processor.
[0020] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0022] FIG1 is an application environment diagram of an application processing method according to an embodiment;
[0023] FIG2 is a schematic diagram of a flow chart of an application processing method in one embodiment;
[0024] FIG3 is an example diagram of an operation interface for application processing in one embodiment;
[0025] FIG4 is a schematic flow chart of a resource adjustment method for a first resource package in one embodiment;
[0026] FIG5 is a flow chart of a method for adjusting resources of a startup resource type according to an embodiment;
[0027] FIG6 is an example diagram of resources of the first sub-environment type in an application development framework in one embodiment;
[0028] FIG7 is a schematic flow chart of a resource adjustment method for the second sub-communication type in one embodiment;
[0029] FIG8 is a diagram illustrating an example of an application method of a second resource package in one embodiment;
[0030] FIG9 is a diagram illustrating an example of an application method of a second resource package in another embodiment;
[0031] FIG10 is an example diagram of an adjustment method of an operating environment module in one embodiment;
[0032] FIG11 is a diagram illustrating an example structure of a general inter-process communication module according to an embodiment;
[0033] FIG12 is a block diagram of the structure of an application processing device according to an embodiment;
[0034] FIG13 is a diagram illustrating the internal structure of a computer device that executes an application processing method in one embodiment. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0036] The application processing method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. In which, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal interface displays an adjustment function item for the application. In response to the trigger operation for the adjustment function item, an application processing request for the application is sent to the server. The application processing request is used to request the server to adjust the first resource package of the application to obtain a second resource package suitable for the second application development framework. The server receives and parses the application processing request, determines the first application development framework, the application, and the second application development framework; obtains the first resource package of the application, the first resource package is suitable for the first application development framework, and contains application resources used by the application during its use; determines the application resource conditions that match the second application development framework, adjusts the first resource package according to the application resource conditions, obtains the second resource package of the application, and the second resource package is suitable for the second application development framework; runs the application in the second application development framework through the second resource package. Terminal 102 may include, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Server 104 may be implemented as a standalone server or a server cluster consisting of multiple servers.
[0037] In some embodiments, as shown in FIG2 , a method for processing an application is provided, which is described by taking the method applied to a computer device (the computer device may be a terminal or server in FIG1 ) as an example, and includes the following steps 202 to 208 . Among them:
[0038] Step 202: Determine a first application development framework, an application program, and a second application development framework.
[0039] Determining the first application development framework, the application program, and the second application development framework may specifically include determining an identifier of the first application development framework, an identifier of the application program, and an identifier of the second application development framework. The identifier may be a name or a character string in a prescribed format.
[0040] In actual implementation, an application development framework refers to an application development framework that implements cross-platform application development. It is a tool or framework that allows developers to build cross-platform applications using a unified code base or language. The application development framework in this application mainly refers to a cross-platform application development framework based on Web technology. This framework uses Web front-end technologies such as HTML (Hypertext Markup Language), CSS (Cascading Style Sheets), and JavaScript (a scripting language, abbreviated as JS) to build applications. The implementation principles of different application development frameworks are different. For ease of explanation, the application development framework that the application to be processed depends on is called the first application development framework, and the application development framework that the processed application is applicable to is called the second application development framework. Applications developed using the first application development framework are applications that depend on the first application development framework. Applications that depend on the first application development framework meet the application resource conditions that match the first application development framework and need to run in the environment of the first application development framework. The implementation principle of the first application development framework is different from that of the second application development framework. Applications that depend on the first application development framework cannot be applied to the second application development framework before the application processing in this application is performed. Common application development frameworks include at least the Electron framework, the NW.js framework, the QT framework, etc. The first application development framework may be a first desktop application development framework, the application may be a desktop application, and the second application development framework may be a second desktop application development framework.
[0041] In some embodiments, the first application development framework, the application program, and the second application development framework may be determined in response to a user input operation.
[0042] Exemplarily, the different implementation principles of different application development frameworks are illustrated by taking the Electron framework as the first application development framework and the NW.js framework as the second application development framework. Electron is an application development framework based on Node.js (a JavaScript interpreter running on the server, a JavaScript runtime environment based on the Chrome V8 engine) and Chromium (a browser kernel). The implementation principle is to call Chromium as a separate component, and the working mechanism is more like the runtime of Node.js. Cross-platform desktop applications can be created with HTML, CSS and JavaScript. NW.js is also a framework based on Node.js, but unlike the Electron framework, the implementation principle of the NW.js framework is to integrate Node.js into Chromium and modify the Chromium kernel, which is equivalent to a browser with Node capabilities. It allows applications to be written in JavaScript, HTML and CSS, and provides integration with the operating system.
[0043] In actual implementation, the computer device determines the application to be processed based on an operable input interface or reads it from a preset configuration file. For example, as shown in Figure 3, Figure 3 is an example diagram of an operation interface for application processing in one embodiment. The visual input interface shown in the figure includes a function item shown by number 1 for selecting the first application development framework, a function item shown by number 2 for selecting an application that needs to be adjusted based on the first application development framework, a function item shown by number 3 for selecting the second application development framework to which the adjusted application needs to be adapted, and a determination function item shown by number 4 for executing application processing. The application to be processed that depends on the development of the first application development framework is obtained through the function items shown by number 1 and number 2. The second application development framework that needs to be applied is determined through the function item shown by number 3. Based on the trigger operation for the determination function item, the computer device determines the application that needs to be processed in this application processing that depends on the development of the first application development framework.
[0044] Step 204 : Acquire a first resource package of the application program. The first resource package is applicable to a first application development framework and includes application resources used by the application program during its use.
[0045] Obtaining the first resource package of the application can specifically be obtaining the first resource package corresponding to the application's identifier. After determining the first application development framework and the application, the first resource package of the application and applicable to the first application development framework can be determined. The first resource package corresponding to the application's identifier can specifically be the first resource package stored in the storage location corresponding to the application's identifier, or it can be the first resource package whose resource package identifier contains the application's identifier, and the resource package identifier is used to uniquely identify the first resource package.
[0046] In actual implementation, after determining the application to be processed, the computer device obtains the first resource package of the application to be processed. The first resource package is the resource package used by the application to be processed to run in the environment of the first application development framework. The first resource package includes all application resources used by the application to be processed during the entire life cycle of the application. The application processing of the application to be processed by the computer device is essentially an adjustment operation on the application resources included in the first resource package so that the adjusted first resource package can be applied to the second application development framework. In addition, the application resources included in the first resource package can be viewed in the form of a file directory.
[0047] Among them, the first resource package is suitable for the first application development framework, which means that the application can be run in the environment of the first application development framework through the first resource package. At least a part of the application resources used by the application contained in the first resource package during its use needs to be supported by the environment of the first application development framework, for example, it is necessary to read specific files adapted to the first application development framework, or it is necessary to read data in a specific format adapted to the first application development framework, or it is necessary to call an interface adapted to the first application development framework, etc.
[0048] The application resources in the first resource package are explained. In some embodiments, the application resources in the first resource package include at least one of the following: startup resources used by the application to be processed during its startup phase, operating environment resources used by the application to be processed during its running phase, and communication resources used by the application to be processed during its running phase.
[0049] In actual implementation, the application to be processed that relies on the environment of the first application development framework requires different application resources at different stages of its use, such as corresponding startup resources at the startup stage of the life cycle, corresponding operating environment resources at the running stage of the life cycle, and communication resources that can interact with the operating system.
[0050] Step 206 , determining application resource conditions that match the second application development framework, adjusting the first resource package according to the application resource conditions, and obtaining a second resource package of the application, the second resource package being suitable for the second application development framework.
[0051] During actual implementation, when the computer device adjusts the application resources included in the first resource package, it needs to meet the application resource conditions that match the second application development framework. The application resource conditions that match the second application development framework refer to the conditions that need to be met by the application resources of the application that can rely on the environment of the second application development framework to run. For the first resource package, the computer device determines the application resource conditions that match the second application development framework, adjusts the first resource package according to the application resource conditions, and obtains the second resource package of the application, and the second resource package is suitable for the second application development framework. Since the first resource package includes startup resources, operating environment resources and communication resources, in some embodiments, the computer device can adjust the startup resources, operating environment resources and communication resources in the first resource package according to the application resource conditions that match the second application development framework to obtain a second resource package suitable for the second application development framework.
[0052] In actual implementation, since the application resources in the resource package can exist in the form of at least one file format, the resource package can be regarded as a folder, which can include subfolders and files of multiple different file formats. In this case, the adjustment of the first resource package by the computer device can be to adjust the folders or files in the folders according to the application resource conditions that match the second application development framework based on the target order, such as adjusting each folder in a file-by-file manner. Specifically, the computer device can read the content in the file or folder, and if the read content is related to the first application development framework, obtain the application resource conditions in the second application development framework that are compatible with the read content, and adjust the read content according to the requirements. In addition, the application resources can also be divided into types based on the characteristics of different stages of their use. Specifically, the resource types of the application resources can include at least a startup resource type, a communication resource type, and an environment resource type. At this time, the computer device can adjust the application resources in the first resource package according to the resource type based on the resource type, obtain the adjusted application resources corresponding to each resource type, and integrate the adjusted application resources corresponding to each resource type as a second resource package suitable for the second application development framework.
[0053] Step 208: Run the application program in the second application development framework using the second resource package.
[0054] In actual implementation, the adjusted second resource package of the application to be processed is applicable to the second application development framework, that is, the computer device can run in the second application development framework through the second resource package, and perform application processing on the application to be processed. It can be understood that there are two resource packages for the same application, namely the first resource package applicable to the first application development framework and the second resource package applicable to the second application development framework. The computer device performs application processing on the application corresponding to the first resource package, that is, it can obtain the application corresponding to the second resource package. The second resource package can be run directly in the form of a desktop application in the environment of the second application development framework, and the application corresponding to the second resource package can be run in the environment of the second application development framework, that is, the second resource package is used as an installation package and is directly installed and started in the computer device. It is also possible to integrate the second resource package with other applications that depend on the second application development framework, that is, to use the second resource package as a plug-in and call the second resource package in the form of a plug-in in the target application running in the second application development framework.
[0055] In the above-mentioned application processing method, the first resource package of the application that depends on the first application development framework is adjusted according to the application resource conditions that match the second application development framework to obtain the second resource package of the application that is suitable for the second application development framework. In this way, the absolute dependence of the first resource package on the first application development framework can be removed, and the second resource package that can adapt to the second application development framework can be obtained. Then, the application is run in the second application development framework through the second resource package. In this way, the application that depends on the second application development framework can integrate the functions of the application to meet the editing functions of the desktop application based on the NW.js framework, while avoiding the cost of redeveloping the application that is suitable for the second application development framework, and can align the user experience of the application that depends on the second application development framework after the adjustment with the user experience of the application that depends on the first application development framework before the adjustment.
[0056] In some embodiments, as shown in FIG4 , the computer device determines an application resource condition that matches the second application development framework, adjusts the first resource package according to the application resource condition, and obtains a second resource package of the application, the second resource package being suitable for the second application development framework, including steps 402 to 408. Among them:
[0057] Step 402: Determine the resource type of the application resources used by the application during its use.
[0058] During actual implementation, when the application is running in the environment provided by the first application development framework, the application resources used by the application can be divided according to resource types throughout the entire life cycle of the application. The resource types may include at least startup resource types, communication resource types, and dependent resource types. Among them, the startup resource type refers to the type of application resource used when the application depends on the application development framework to start during the startup phase of the life cycle. The environment resource type refers to the type of operating environment resource required for the application to run during the running phase of the life cycle. The communication resource type refers to the type of application resource used when the application depends on the application development framework to communicate with the operating system during the running phase of the life cycle. For each resource type, the first resource package includes application resources that match the resource type. For the application to be processed, the computer device determines the resource type of the application resources used at each stage of the life cycle, such as the resource type of the application resources used by the application to be processed during the startup phase is the startup resource type.
[0059] Step 404: For each resource type, determine the application resource conditions that match the second application development framework.
[0060] In actual implementation, for each resource type, the application developed based on the second application development framework also includes the application resources that match the resource type. When the computer device processes the application to be processed, it will first determine the application resource conditions that match the resource type with the second application development framework for each resource type. In order to match the resource type, the computer device determines the application resource conditions that match the resource type in the second application development framework. The application resource conditions are used to indicate the direction of adjustment of the application resources of the resource type in the first resource package so that the adjusted application resources corresponding to the resource type are suitable for the second application development framework.
[0061] Exemplarily, taking the resource type as the startup resource type as an example, the application resource condition that matches the startup resource type in the application development framework can be a requirement for the format of the file that serves as the startup entry for the startup resource in the startup phase. The format of the startup entry corresponding to different application development frameworks may be different. For example, the format of the startup entry of the startup resource that matches the startup resource type in the first application development framework is a js file. For example, if the index.js file is used as the startup entry, then all first resource packages of applications developed based on the first application development framework must include an index.js file in order to start normally. The format of the startup entry of the startup resource that matches the startup resource type in the second application development framework is an html file. For example, if the index.html file is used as the startup entry, then all resource packages of applications developed based on the second application development framework must include an index.html file in order to start normally. It can be understood that, for the startup resource type, the application resource condition that matches the second application development framework is that the startup file must be an index.html file.
[0062] Step 406 : For any resource type, adjust the resources of the targeted resource type in the first resource package according to the application resource conditions of the targeted resource type to obtain adjusted resources.
[0063] In actual implementation, for each resource type, after the computer device determines the application resource conditions for the resource type in the second application development framework, it will adjust the resources of the resource type indicated by the application resource conditions in the first resource package based on the application resource conditions to obtain the adjusted resources.
[0064] Continuing with the previous example, using the startup resource type as an example, the computer device determines that the first resource package of the application to be processed includes an index.js file, but does not include the index.html file required by the second application development framework's application resource conditions for the startup resource type. Based on this, the computer device can adjust the relevant resources in the first resource package so that the resources associated with the adjusted startup resource type meet the second application development framework's application resource conditions for the startup resource type. At this point, the computer device can create a new index.html file and integrate it with the index.js file in the first resource package.
[0065] Step 408 : Determine a second resource package suitable for a second application development framework based on the adjusted resources of each resource type.
[0066] In actual implementation, after the computer device adjusts the resources corresponding to each resource type in the first resource package according to the resource type, the adjusted first resource package can be directly used as the second resource package suitable for the second application development framework, or other resources required by the second application development framework can be added to the adjusted first resource package and repackaged to obtain the second resource package. The specific operations on the adjusted resources in the embodiment of the present application include any form of operations that can obtain the second resource package suitable for the second application development framework.
[0067] In this embodiment, the adjustment operation on the application resources is converted into adjustment operations on resources associated with different resource types. The adjustment operation on the application resources associated with each resource type can be executed in parallel to improve resource adjustment efficiency.
[0068] In some embodiments, when the resource type includes a startup resource type, the computer device adjusts the application resource of the startup resource type in a manner as shown in FIG5 , including steps 502 to 506 .
[0069] Step 502: for the startup resource type, obtain a first startup file in a first resource package, where the first startup file corresponds to a first format.
[0070] In actual implementation, startup resources may refer to resources corresponding to the startup method of an application when it is started by an application development framework. Resources corresponding to the startup method are typically represented by files in a target format, which serve as the startup entry file for applications developed based on the corresponding application development framework. The startup resource type in the first resource package is a first startup file in a first format, such as if the first format is js, and the first startup file is index.js.
[0071] Step 504 : constructing an initial startup file in a second format that matches the second application development framework according to the application resource condition of the startup resource type.
[0072] In actual implementation, to obtain a second resource package suitable for the second application development framework, the second application development framework includes an application resource condition corresponding to the startup resource type. This application resource condition can be used to indicate the second format of the startup file corresponding to the startup entry matching the second application development framework. For example, the application resource condition for the startup resource type can be an initial startup file index.html in the second format of HTML.
[0073] Step 506 : Reference the first startup file in the initial startup file to generate a target startup file suitable for the second application development framework, where the target startup file is the adjusted resource.
[0074] During actual implementation, the computer device adds the first startup file as a reference file to the initial startup file to obtain a target startup file adapted to the second application development framework.
[0075] For example, if the first application development framework is the Electron framework and the second application development framework is the NW.js framework, the first startup file of the Electron framework is a file in the js format, and the startup file required by the NW.js framework is in the html format. The computer device adds an index.html file as the initial startup file and adds the tag <script>< / script> The first startup file bundle.js is introduced in the computer device, and the computer device performs the introduction operation by calling the setTimeout function with a timeout. The pseudo code of the introduction operation is shown in the following pseudo code snippet 1:
[0076] The computer device can introduce the first startup file into the initial startup file based on the above pseudo code, thereby implementing resource adjustment for the startup resource type and obtaining new startup resources that match the NW.js framework.
[0077] In this embodiment, the adaptability of the startup resource in the second application development framework is achieved by adjusting the startup file according to the startup resource type.
[0078] In some embodiments, the resource type includes an environment resource type, and the environment resource type includes a first sub-environment type and a second sub-environment type. The first sub-environment type is used to indicate a folder of the running environment of the application, and the second sub-environment type is used to indicate a first compilation product used when the application is running through a first application development framework. The first compilation product is implemented based on a general programming language. Based on this, the computer device adjusts the resources of the environment resource type in the first resource package according to the application resource conditions for the environment resource type to obtain adjusted resources, including: for the environment resource type, according to the application resource conditions of the environment resource type, adjusting the resources of the first sub-environment type in the first resource package and adjusting the resources of the second sub-environment type in the first resource package; based on the adjusted resources of the first sub-environment type and the adjusted resources of the second sub-environment type, determining the resources of the adjusted environment resource type.
[0079] In actual implementation, for each sub-environment type, the computer device filters the application resource conditions of the corresponding sub-environment type from the application resource conditions of the environment type to obtain the resources of the adjusted sub-environment type. The computer device performs a complete operation on the resources of the adjusted sub-environment type to obtain the resources of the adjusted environment resource type.
[0080] In this embodiment, resources of the environmental resource type are divided into finer-grained resources, and resource adjustments of the environmental resource type are converted into adjustments to resources related to each sub-environment type. This can improve the efficiency and accuracy of resource adjustments.
[0081] In some embodiments, adjusting the resources of the first sub-environment type in the first resource package includes: determining a first folder in the first resource package that is related to the operating environment; determining a second folder that matches the second application development framework and is related to the operating environment; deleting the folder in the first folder that is related to the first application development framework, and adding the second folder to the first resource package.
[0082] In actual implementation, the environmental resources of the first sub-environment type are usually represented in the form of a folder. The computer device determines the first folder in the first resource package that is related to the operating environment indicated by the first sub-environment type, and at the same time determines the second folder that matches the second application development framework and is related to the operating environment. Resource adjustment is performed based on the first folder and the second folder. The specific resource adjustment operation is to delete the folder related to the first application development framework in the first folder and add the second folder to the first resource package.
[0083] For example, as shown in FIG6 , FIG6 is an example diagram of resources of the first sub-environment type in an application development framework in an embodiment. As shown in FIG6 , taking the first application development framework as the Electron framework and the second application development framework as the NW.js framework as an example, FIG6 shows the first folder electron-browser folder and the electron-main folder related to the operating environment indicated by the first sub-environment type in the Electron framework indicated by number 1. FIG6 shows the second folder Nw.js folder related to the operating environment indicated by the first sub-environment type in the NW.js framework indicated by number 2. The computer device deletes the first folder electron-browser folder and the electron-main folder, and adds the second folder Nw.js folder to the first resource package.
[0084] In this embodiment, the adjustment operation on the resources of the first sub-environment type is directly converted into a replacement operation on the folder and the files under the folder, thereby improving the adjustment efficiency of the resources of the first sub-environment type.
[0085] In some embodiments, a computer device adjusts resources of the second sub-environment type in a first resource package, including: determining a first compilation product in the first resource package; obtaining source code of the first compilation product, recompiling the source code through a compilation component corresponding to a second application development framework, and generating a second compilation product compatible with the second application development framework; and replacing the first compilation product in the first resource package with the second compilation product.
[0086] In actual implementation, the resources of the second sub-environment type refer to the first compilation product used when the application is running, and the first compilation product is implemented based on a general programming language. Because different application development frameworks compile resources of the second sub-environment type differently, the computer device's adjustment of the resources of the second sub-environment type is essentially to recompile the resources of the second sub-environment type using an editing component that matches the second application development framework, thereby obtaining a second compilation product that is compatible with the second application development framework. Finally, the first compilation product in the first resource package is replaced with the second compilation product.
[0087] For example, in the case where the first application development framework is the Electron framework, the second application development framework is the NW.js framework, and the application that depends on the first application development framework is vscode, vscode, as an application developed based on the Electron framework, is a modern lightweight code editor with features such as syntax highlighting, intelligent code completion, custom hotkeys, bracket matching, code snippets, and code comparison that support almost all mainstream development languages, supports plug-in extensions, and is optimized for web development and cloud application development. The first resource package of vscode includes native resources implemented based on C++ (C++ Plus, a high-level computer programming language), and a first cross-platform compilation product (at least one binary file) such as vscode-ripgrep, vscode-oniguruma, and vscode-textmate is generated by a node-gyp tool compatible with the Electron framework. The first compilation product cannot be directly applied to the NW.js framework. Specifically, the computer device adjusts the first compilation product by calling the nw-gyp compilation tool compatible with the NW.js framework to recompile the code of the first compilation product to generate a second compilation product. nw-gyp is a modified version of node-gyp that allows users to build native modules for the NW.js framework. Compared to node-gyp, it compiles the modules by adding header files and other dependencies required by NW.js, enabling them to run within the NW.js framework.
[0088] In this embodiment, the adjustment operation for the resources of the second sub-environment type is directly converted into a recompilation operation for the source code, which can reduce the complexity of the adjustment operation, directly operate the source code, ensure the interference-free nature of the adjustment operation, and improve the efficiency of the adjustment operation and the accuracy of the adjustment results.
[0089] In some embodiments, the resource type includes a communication resource type, and the communication resource type includes a first sub-communication type and a second sub-communication type. The first sub-communication type is used to indicate resources used for cross-process communication, and the second sub-communication type is used to indicate resources used for calling system interfaces related to the operating system. The computer device adjusts resources of the communication resource type in the first resource package, including: adjusting the resources of the first sub-communication type in the first resource package and adjusting the resources of the second sub-communication type in the first resource package based on application resource conditions of the communication resource type; and determining resources of the adjusted communication resource type based on the adjusted resources of the first sub-communication type and the adjusted resources of the second sub-communication type.
[0090] In practice, the first sub-communication type refers to resource types that enable cross-process communication. Because different application development frameworks employ different implementation principles, the principles for communication between these frameworks and the operating system also differ. For ease of illustration, let's use Electron as the first application development framework and NW.js as the second application development framework to illustrate the principles of communication between these frameworks and the operating system.
[0091] The Electron framework treats Chromium as a separate component. Due to security concerns, browsers cannot communicate directly with the operating system. Therefore, the desktop application processes supported by the Electron framework are divided into a renderer process and a main process. The renderer process renders user pages, while the main process manages window creation and communicates with the operating system, invoking system capabilities. An Electron-based application consists of one main process (one and only one) and multiple renderer processes. This is because only the main process can invoke operating system capabilities and is responsible for managing all windows and their corresponding renderer processes.
[0092] The NW.js framework integrates Node.js into Chromium and modifies the Chromium kernel, creating a browser with Node capabilities. It can render and invoke system capabilities in a separate process.
[0093] It is understandable that there are differences between the first application development framework and the second application development framework in terms of process communication. That is, the first application development framework often interacts with the operating system through cross-process communication, while in the second application development framework, each process independently interacts with the operating system. The type of resources associated with this process communication difference is referred to as the first sub-communication type. In addition, different application development frameworks may also provide different system interfaces when interacting with the operating system. The type of resources associated with this system interface is referred to as the second sub-communication type. The computer device performs adjustment operations on the resources of the first sub-communication type and the resources of the second sub-communication type to meet the application resource conditions of the communication resource type that matches the second application development framework. Finally, based on the adjusted resources of the first sub-communication type and the adjusted resources of the second sub-communication type, the computer device determines the resources of the adjusted communication resource type.
[0094] In this embodiment, resources of the environmental resource type are divided into finer-grained resources, and resource adjustments of the environmental resource type are converted into adjustments to resources related to each sub-environment type. This can improve the efficiency and accuracy of resource adjustments.
[0095] In some embodiments, a computer device adjusts resources of a first sub-communication type in a first resource package, including: determining that code of a rendering process for cross-process communication exists in the first resource package; cross-process communication is used to implement communication between the rendering process and an operating system; and adjusting the code of the rendering process so that the rendering process after the code adjustment can communicate with the operating system directly through context calls.
[0096] In actual implementation, the computer device adjusts the resources of the first sub-communication type in the first resource package as follows: All rendering processes in the first resource package that interact with the operating system must be implemented via cross-process communication. That is, these rendering processes must interact with the operating system by calling the main process running in the first application development framework. However, each process in the second application development framework can interact with the operating system, and no cross-process communication is required. Therefore, the computer device first determines that the rendering process in the first resource package that is involved in cross-process communication can be referred to as the target rendering process. It then determines the code for the target rendering process and adjusts the code within that code that calls the main thread to implement the process via a context call.
[0097] For example, if the first application development framework is Electron and the second application development framework is NW.js, the first resource package contains a rendering process withSharedProcessConnecton for cross-process communication. When interacting with the operating system, this needs to be implemented through the main process mainProcessService. The computer device obtains the rendering process withSharedProcessConnecton and directly modifies the code implemented by mainProcessService to be called by the current process. The pseudocode for inter-process communication in the Electron framework is shown in the following pseudocode snippet 2:
[0098] In this embodiment, the adjustment operation on the resources of the first sub-communication type is essentially an adjustment of the process instance corresponding to the relevant resources in the first resource package with cross-process communication. In this way, the adjusted process communication only needs to be carried out independently by each process, reducing the overhead of process communication and improving the interaction efficiency with the operating system.
[0099] In some embodiments, as shown in FIG7 , the computer device adjusts the resources of the second sub-communication type in the first resource package, including steps 702 to 706 , wherein:
[0100] Step 702: Determine a first system interface called by the first resource package.
[0101] In actual implementation, the first system interface is an interface provided by the first application development framework for interaction between the application and the operating system. The first system interface includes at least one of the following: creating a system menu, clipboard, and file system processing. Examples of system interfaces include those related to using the system clipboard's read / write capabilities, opening a file location at a specified path, and using functions such as file selection pop-up windows.
[0102] For example, taking the Electron framework as the first application development framework, the first system interface provided by the Electron framework is a system interface that supports system clipboard reading and writing capabilities, including writeClipboardText and readClipboardText.
[0103] Step 704: Determine a second system interface having the same function as the first system interface from the system interfaces provided by the second application development framework.
[0104] During actual implementation, the second application development framework will also provide multiple system interfaces for interacting with the operating system, so that applications that rely on the second application development framework can interact with the operating system. Among them, the system interfaces provided by the second application development framework include a second system interface that is consistent with the function of the first system interface, that is, the second system interface provided by the second application development framework is consistent with the function implemented by the first system interface provided by the first application development framework. The computer device can pre-set the matching relationship between the first system interface and the second system interface. Since the interface name of the first system interface may be different from the interface name of the second system interface, the matching relationship between the first system interface and the second system interface can be pre-set. In this way, the computer device can determine the target second system interface that is consistent with the function of the first system interface through the matching relationship. It should be noted that the creation of the matching relationship can also be implemented based on an artificial intelligence model.
[0105] For example, taking the case where the first application development framework is the Electron framework and the second application development framework is the NW.js framework, a matching relationship between the first system interface of the Electron framework and the second system interface of the NW.js framework is pre-set, as shown in Table 1:
[0106] Table 1
[0107] As can be seen from Table 1, the second system interface provided by the NW framework that supports the system clipboard reading and writing capabilities is nw.Clipboard. That is, the nw.Clipboard system interface provided by the NW framework and the nativeHostService.writeClipboardTex system interface provided by the Electron framework implement the same functions.
[0108] Step 706: Based on the second system interface, adjust the code in the first resource package that calls the first system interface.
[0109] In actual implementation, the computer device identifies the first system interface in the first resource package and adjusts the code of the first system interface based on the implementation code of the second system interface that matches the first system interface. In this way, the computer device can determine the target second system interface that has the same functionality as the first system interface based on the matching relationship between the system interfaces, and modify the code of the first system interface to match the code of the target second system interface.
[0110] Continuing with the above example, let's take the writeText function of writing to the system clipboard as an example. The pseudo code for implementing writeText based on the Electron framework is shown in the following pseudo code snippet 4: async writeText(parameter type):Promise<void>{ / / Call the first system interface writeClipboardText provided by the Electron framework to implement the write operation return this.nativeHostService.writeClipboardText(text,type);}
[0111] Among them, for the first system interface nativeHostService.writeClipboardText, according to the matching relationship shown in Table 1, it can be determined that the second system interface provided by the NW.js framework that matches the first system interface is nw.Clipboard. The computer device adjusts the code snippet that references writeClipboardText in the first resource package to a code snippet that matches nw.Clipboard.get().set(). The pseudo code of the adjusted writeText is shown in the following pseudo code snippet 5:
[0112] Based on the pseudo code snippet 5 above, the computer device adjusts the writeText-related code in the first resource package to obtain a writeText function suitable for the NW.js framework.
[0113] Continuing with the above example, taking the implementation of the readText function of reading the system clipboard as an example, the pseudo code for implementing readText based on the Electron framework is shown in the following pseudo code snippet 6: async readText(type?:"clioboard Promisesstrino> / / Call the first system interface readClipboardText of the Electron framework to implement the read operation return this.nativeHostservice.readClipboardText(type);}
[0114] Among them, for the first system interface readClipboardText, according to the matching relationship shown in Table 1, it can be determined that the second system interface provided by the NW.js framework that matches the first system interface is nw.Clipboard.get().get(), and the computer device adjusts the code snippet that references writeClipboardText in the first resource package to a code snippet that matches nw.Clipboard.get().get(), wherein the adjusted pseudocode of readText is shown in the following pseudocode snippet 7: async readText(parameter type):Promise <void>{ / / Call the second system interface of the NW.js framework, nw.Clipboard.get().get, to implement the write operation. return nw.Clipboard.get().get('text')}
[0115] Based on the pseudo code snippet 7 above, the computer device adjusts the readText-related code in the first resource package to obtain the writeText function applicable to the NW.js framework.
[0116] In actual implementation, in addition to the differences in system interfaces related to the system clipboard reading and writing capabilities shown above, there are also differences in other system interfaces.
[0117] Continuing with the above example, let's take the function of opening a file location at a specified path in the operating system as an example. The function name of this function can be revealResourcesInOS. The first system interface provided by the first application development framework Electron for this function is nativeHostService.showItemInFoler, and the second system interface provided by the second application development framework NW framework is nw.Shell.showItemInFoler. Therefore, the pseudo code for the revealResourcesInOS function in the first resource package is shown in the following pseudo code snippet 8.
[0118] Among them, for the first system interface showItemInFolder, according to the matching relationship shown in Table 1, it can be determined that the second system interface provided by the NW.js framework that matches the first system interface is nw.Shell.showItemInFolder. The computer device adjusts the code snippet that references showItemInFolder in the first resource package to a code snippet that matches nw.Shell.showItemInFolder. The pseudo code of the adjusted revealResourcesInOS is shown in the following pseudo code snippet 9:
[0119] Based on the pseudo code snippet 9 above, the computer device adjusts the code related to revealResourcesInOS in the first resource bundle to obtain the revealResourcesInOS function applicable to the NW.js framework.
[0120] Continuing with the previous example, let's take the function of opening a file selection pop-up window as an example. The first system interface provided by the first application development framework Electron is the dialog.showSaveDialog method, and the second system interface provided by the second application development framework NW framework is nw.Shell.showItemInFoler. Therefore, the pseudo code for the revealResourcesInOS function in the first resource package is shown in the following pseudo code snippet 10.
[0121] The function of opening the file selection pop-up window is supported in the NW.js framework by using the input tag to set the corresponding NW-specific attributes such as nwworkingdir\nwsaves. The corresponding pseudo code is shown in the following pseudo code snippet 11:
[0122] Based on the pseudo code snippet 11 , the computer device adjusts the resources in the first resource package related to the function of pulling up the file selection pop-up window to make them suitable for the NW.js framework.
[0123] In this embodiment, the adjustment operation for the resources of the second sub-communication type is essentially to replace the first system interface with which it has a matching relationship with the second system interface. In this way, using the system interface as the adjustment unit can improve the integrity of the system interface adjustment and the resource adjustment. The adjustment based on the matching relationship of the system interface can improve the universality of this method and effectively adapt to the connection scenarios between various different application development frameworks.
[0124] In some embodiments, the computer device can perform the following operations on the second resource package applicable to the second application development framework: directly run the application as a desktop application in the second application development framework through the second resource package, or call the second resource package through the target application running in the second application development framework to run the application in the target application as a plug-in.
[0125] In actual implementation, the second resource package is obtained by adjusting the first resource package of the application applicable to the first application development framework. The second resource package is applicable to the second application development framework. The second resource package can be run in the environment of the second application development framework directly in the form of a desktop application, and the application corresponding to the second resource package can be run in the environment of the second application development framework, that is, the second resource package is used as an installation package and directly installed and started in the computer device. It is also possible to integrate the second resource package with other applications that depend on the second application development framework, that is, to use the second resource package as a plug-in and call the second resource package in the form of a plug-in in the target application running in the second application development framework.
[0126] For example, the first application development framework is the Electron framework, the second application development framework is the NW.js framework, and the application that depends on the first application development framework is vscode. As shown in Figure 8, the existing developer tools that rely on the NW.JS application development framework directly use the second resource package of the adjusted vscode, and perform related operations on the resources of the application developed by the NW.JS application development framework through the adjusted vscode, such as viewing the file content of the specified file as shown in the figure. As shown in Figure 9, the adjusted vscode is encapsulated as a plug-in in the existing developer tools that rely on the NW.js framework, so that the plug-in can be installed when needed, thereby using the capabilities of the adjusted vscode to operate on the resource packages of the application developed by the NW.js framework.
[0127] In this embodiment, there are multiple different operating modes for the second resource package based on the environment of the second application development framework, so that the application scenarios of the second resource package can be increased.
[0128] In some embodiments, the application developed based on the first application development framework includes a code editing application, and the application running through the second resource package is used to edit resources of the application running in the second application development framework.
[0129] In actual implementation, an application developed based on the first application development framework can be a code editing application. Taking the Electron framework as an example, a code editing application developed based on the Electron framework can be the vscode called above. In order to enable the code editing application to perform editing operations on the application resources of an application developed based on the second application development framework, the computer device executes the application processing method provided in the embodiment of the present application on the first resource package of the code editing application to obtain a second resource package corresponding to the code editing application. The second resource package can be applied to the second application development framework, such as the NW.js framework.
[0130] In this embodiment, by adjusting a code editing application developed based on a first application development framework, a code editing application suitable for a second application development framework is obtained. This allows applications based on the second application development framework to integrate and use the code editing application. This satisfies the editing functionality of desktop applications based on the second application development framework, avoiding the need to downgrade functionality or incur development costs to implement a single code editing application.
[0131] To further illustrate the application processing method in this solution, we'll use an example implementation. In this implementation, the first application development framework is Electron, the second is NW.js, and the application developed with the first framework is the aforementioned code editing tool, VSCode. A specific application scenario involves modifying VSCode, developed with Electron, to work with NW.js.
[0132] vscode is a code editor based on the Electron framework. Due to its strong dependence on the Electron framework, businesses that use other underlying application development frameworks (such as NW.js and QT) cannot directly use a powerful and versatile editor like vscode. Applications using other application development frameworks can usually only use the web version of vscode, which has less capabilities, or they themselves have to carry out a lot of development work to maintain complex editor tools. However, using a web version editor with downgraded functions. Not only is the functionality downgraded, but it also lacks a plug-in market and editing capabilities that rely more on the underlying capabilities of the system and files. In addition, an editor can be developed based solely on the NW.js framework, but the editor development work is very tedious and complicated. And it cannot be aligned with the industry-wide vscode experience. Based on this, the embodiment of the present application provides an application processing method for vscode, an application based on the Electron framework, which can remove vscode's absolute dependence on the Electron framework, making vscode compatible with the NW.js framework. Of course, vscode can also be adjusted based on the application resource conditions of other application development frameworks to make it compatible with the corresponding application development framework.
[0133] In actual implementation, based on the above description, it can be seen that the Electron framework and the NW.js framework have similarities in technical implementation. In the embodiment of the present application, the application processing is performed on the vscode that is strongly dependent on the Electron framework. In essence, the resource package (i.e., the first resource package in the foregoing text) of the vscode that is applicable to the Electron framework is adjusted based on the application resource conditions that match the NW.js framework, so that the resource package (i.e., the second resource package in the foregoing text) of the vscode after adjustment can be used depending on the NW.js framework. In the process of adjusting the resources, at least the differences in cross-process communication, startup mode, system capability interface calls, and application required file paths between the Electron application development framework and the NW.js framework need to be solved. Thus, the absolute dependence of the first resource package of vscode on the Electron framework is removed, and the second resource package of vscode that can be applied to the NW.js framework is obtained. In this way, not only can the cost investment of redeveloping the vscode applicable to the NW.js framework be avoided, but also the user experience of the vscode that depends on the NW.js framework after adjustment can be aligned with the user experience of the vscode that depends on the Electron framework before adjustment.
[0134] It is understood that the application processing method provided in the embodiments of this application primarily removes vscode's absolute dependency on the Electron framework in the following five technical aspects, thereby achieving an adjusted vscode compatible with the NW.js framework. Specifically, these include: 1) removing unnecessary environment module code; 2) resolving differences in system capability call communication; 3) resolving differences in application development framework capability API interfaces; 4) resolving differences in vscode's dependencies on the two application development frameworks; and 5) resolving differences in startup methods between different application development frameworks.
[0135] To illustrate the specific implementation method for removing unnecessary environment module code, as shown in Figure 7, VSCode divides the entire function into five runtime environment modules according to different runtime environment modules. Each runtime environment module is essentially a folder. The common module includes common JS methods, the browser module includes code that only uses the browser application programming interface (API), the node module only uses the Node.js API, the electron-browser module is code that uses the electron rendering thread and browser API, and the electron-main module is code that uses the electron main process and the Node.js API. However, as shown in Figure 6, the electron-browser module and electron-main module are not included in the NW.js framework. Therefore, the computer device can directly remove the electron-browser module and electron-main module and the associated code, and add the runtime environment module adapted for NW.js. For example, as shown in Figure 10, Figure 10 is an example diagram of the adjustment method of the operating environment module in one embodiment. The electron-browser / extensionService in the electron-browser module of the electron-related operating environment module in vscode shown by number 1 in Figure 10 is removed, and the "nw / extensionService" operating environment module related to the NW.js framework shown by number 2 in Figure 10 is added.
[0136] The specific implementation method for resolving the differences in system capability call communication will be explained. As can be seen from the previous description, the implementation principles of the Electron framework and the nw.js framework differ. The Electron desktop framework involves cross-process communication when interacting with the operating system. To facilitate this cross-process communication, Electron specifically implements a general inter-process communication module, referred to as IPC, which is responsible for handling cross-process communication between the rendering process and the main process. As shown in Figure 11, which illustrates an example of the structure of the general inter-process communication module in one embodiment, the structure of the IPC general communication module is shown. It is understandable that the two application development frameworks differ in their use of system capability calls. Therefore, the computer device can simply call the rendering process in VSCode, which calls the main process service via an IPC channel, instead of calling it separately for each process context. For example, as shown in the pseudo-code snippet 2 above, VSCode based on the Electron framework uses the MainProcessService instance to obtain an IPC channel for cross-process communication with the main process. System interface commands are then sent through this channel to the main process, enabling interaction with the operating system through the main process. When running in the NW.js application development framework, there is no need to rely on MainProcessService and system capabilities can be called directly in the own process, as shown in the pseudo-code snippet 3 above.
[0137] The specific implementation method for solving the differences in system interfaces of application development framework capabilities is explained. In actual implementation, both Electron and NW.js application development frameworks provide multiple APIs for interacting with the operating system (i.e., the system interfaces mentioned above). Such as creating system menus, clipboards, file system processing, etc. Since desktop applications running on the NW.js framework cannot call the system interfaces supported by the Electron framework, the computer device converts the system interface supported by the Electron framework (i.e., the first system interface mentioned above) into the system interface supported by the NW.js framework (i.e., the second system interface mentioned above). During the interface conversion process, a system interface matching relationship as shown in Table 1 can usually be preset. Based on the system interface matching relationship, the computer device adjusts the first system interface supported by the Electron framework in vscode to the second system interface supported by the NW.js framework. As shown in the aforementioned pseudo-code snippets 4 to 7, there are examples of adjusting the system interface for using the system clipboard read and write capabilities, as shown in the aforementioned pseudo-code snippets 8 and 9, there are examples of adjusting the system interface for opening a file location of a specified path, and as shown in the aforementioned pseudo-code snippets 10 and 11, there are examples of adjusting the system interface for pulling up a file selection pop-up window.
[0138] This article explains how to resolve the differences in vscode's dependencies between the two application development frameworks. In practice, vscode relies on native components implemented in general-purpose programming languages (such as C++). These components are built using the node-gyp tool, which is compatible with the Electron application development framework, to generate cross-platform binaries such as vscode-ripgrep, vscode-oniguruma, vscode-textmate, vscode-fsevents, node-pty, and spdlog. These compiled components are not directly applicable to the NW.js application development framework. The computer uses the nw-gyp compilation tool, which is compatible with the NW.js application development framework, to recompile the code for these compiled components. The specific compilation steps include: first, obtaining the source code for each native module; second, using the nw-gyp compilation tool to recompile the compiled components into the required binary format for the NW.js environment; and finally, replacing the binary compiled components of the native modules compiled using node-gyp that vscode relies on.
[0139] This section describes a specific implementation method for resolving the differences in startup methods between different application development frameworks. In practice, the entry point for Electron applications is a JS file, while the entry point for NW.js is HTML. Therefore, the computer device performs a new operation: adding an HTML-formatted startup file as the entry point and loading the VSCode editor's JS file into this HTML-formatted startup file. The specific code modification process is shown in the pseudo-code snippet 1 above.
[0140] In actual implementation, after the computer device resolves the differences in the above five aspects, the adjusted vscode obtained is compatible with and applicable to the NW.js application development framework, that is, the adjusted vscode can be used in the form of a plug-in in an application that relies on the NW.JS application development framework. For example, as shown in Figure 8, the editor capabilities of the adjusted vscode are directly used in an existing developer tool developed based on the NW.js application development framework. As shown in Figure 9, the adjusted vscode is encapsulated as a plug-in in an existing developer tool developed based on the NW.js application development framework, so that the plug-in can be installed when needed, thereby using the editing capabilities of vscode.
[0141] By using the embodiments of this application, applications that rely on the NW.js application development framework can integrate the VSCode editor module. This satisfies the editing functions of NW.js-based desktop applications, avoiding the need to implement them by downgrading functions or incurring development costs to implement a dedicated editor.
[0142] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0143] Based on the same inventive concept, embodiments of the present application also provide an application processing device for implementing the aforementioned application processing method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations in one or more application processing device embodiments provided below can be found in the above-mentioned limitations on the application processing method and will not be further elaborated here.
[0144] In some embodiments, as shown in FIG. 12 , an application processing device 1200 is provided, including: a determination module 1210 , an acquisition module 1220 , an adjustment module 1230 , and an execution module 1240 , wherein:
[0145] The determination module 1210 is configured to determine a first application development framework, an application program, and a second application development framework.
[0146] The acquisition module 1220 is configured to acquire a first resource package of the application program. The first resource package is applicable to a first application development framework and includes application resources used by the application program during its use.
[0147] The adjustment module 1230 is used to determine the application resource conditions that match the second application development framework, adjust the first resource package according to the application resource conditions, and obtain a second resource package of the application, which is suitable for the second application development framework.
[0148] The running module 1240 is configured to run the application program in the second application development framework using the second resource package.
[0149] In some embodiments, the application resources in the first resource package include at least one of the following: startup resources used by the application during its startup phase, runtime environment resources used by the application during its runtime phase, and communication resources used by the application during its runtime phase.
[0150] In some embodiments, the adjustment module is also used to determine the resource type of application resources used by the application during its use; for each resource type, determine the application resource conditions that match the second application development framework; for any resource type, adjust the resources of the targeted resource type in the first resource package based on the application resource conditions of the targeted resource type to obtain adjusted resources; based on the adjusted resources of each resource type, determine a second resource package suitable for the second application development framework.
[0151] In some embodiments, the resource type includes a startup resource type, and the adjustment module is also used to obtain a first startup file in a first resource package for the startup resource type; the first startup file corresponds to a first format; based on the application resource conditions of the startup resource type, an initial startup file corresponding to a second format that matches the second application development framework is constructed; the first startup file is referenced in the initial startup file to generate a target startup file suitable for the second application development framework; the target startup file is the adjusted resource.
[0152] In some embodiments, the resource type includes an environment resource type, and the environment resource type includes a first sub-environment type and a second sub-environment type. The first sub-environment type is used to indicate a folder of the running environment of the application, and the second sub-environment type is used to indicate a first compilation product used when the application is running through a first application development framework. The first compilation product is implemented based on a general programming language. The adjustment module is also used to adjust the resources of the first sub-environment type in the first resource package and the resources of the second sub-environment type in the first resource package according to the application resource conditions of the environment resource type; based on the adjusted resources of the first sub-environment type and the adjusted resources of the second sub-environment type, determine the resources of the adjusted environment resource type.
[0153] In some embodiments, the adjustment module is also used to determine a first folder in the first resource package that is related to the operating environment; determine a second folder that matches the second application development framework and is related to the operating environment; delete the folder in the first folder that is related to the first application development framework, and add the second folder to the first resource package.
[0154] In some embodiments, the adjustment module is further used to determine a first compilation product in the first resource package; obtain the source code of the first compilation product, recompile the source code through the compilation component corresponding to the second application development framework, and generate a second compilation product compatible with the second application development framework; and replace the first compilation product in the first resource package with the second compilation product.
[0155] In some embodiments, the resource type includes a communication resource type, and the communication resource type includes a first sub-communication type and a second sub-communication type. The first sub-communication type is used to indicate the resources used for cross-process communication, and the second sub-communication type is used to indicate the resources used for calling the system interface related to the operating system. The adjustment module is also used to adjust the resources of the first sub-communication type in the first resource package and the resources of the second sub-communication type in the first resource package according to the application resource conditions of the communication resource type; based on the adjusted resources of the first sub-communication type and the adjusted resources of the second sub-communication type, determine the resources of the adjusted communication resource type.
[0156] In some embodiments, the adjustment module is further used to determine whether there is code for a rendering process for cross-process communication in the first resource package; cross-process communication is used to implement communication between the rendering process and the operating system; and the code of the rendering process is adjusted so that the rendering process after the code adjustment can communicate with the operating system directly through context calls.
[0157] In some embodiments, the adjustment module is also used to determine the first system interface called by the first resource package; determine a second system interface that has the same function as the first system interface from the system interface provided by the second application development framework; and adjust the code in the first resource package that calls the first system interface based on the second system interface.
[0158] In some embodiments, the running module is also used to run the application directly as a desktop application in the second application development framework through the second resource package, or to call the second resource package through the target application running in the second application development framework to run the application in the target application in the form of a plug-in.
[0159] In some embodiments, the application used by the application processing apparatus includes a code editing application, an application running through the second resource package, and is used to edit resources of an application running in the second application development framework.
[0160] Each module in the above-mentioned application processing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0161] In an exemplary embodiment, a computer device is provided, which may be the server or terminal in FIG1 , and whose internal structure diagram may be shown in FIG13 . The computer device includes a processor, a memory, an input / output (I / O) interface, and a communication interface. The processor, the memory, and the I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store resource data of application programs. The I / O interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an application processing method is implemented.
[0162] Those skilled in the art will understand that the structure shown in FIG13 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0163] In some embodiments, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0164] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0165] In some embodiments, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0166] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0167] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0168] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0169] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.< / void> < / void>
Claims
1. An application processing method, executed by a computer device, the method comprising: Determine a first application development framework, an application, and a second application development framework; Obtain a first resource package of the application, the first resource package being applicable to the first application development framework and containing application resources used by the application during its use; Determine application program resource conditions matching the second application development framework, and adjust the first resource package according to the application program resource conditions to obtain a second resource package of the application, the second resource package being applicable to the second application development framework; And Run the application in the second application development framework through the second resource package.
2. The method according to claim 1, wherein the application resources in the first resource package include at least one of the following: Startup resources required by the application during its startup phase, Runtime environment resources required by the application during its runtime phase, Communication resources required by the application during its runtime phase.
3. The method according to claim 1 or 2, wherein the determining application program resource conditions matching the second application development framework and adjusting the first resource package according to the application program resource conditions to obtain the second resource package of the application comprises: Determine the resource types of the application resources used by the application during its use; For each of the resource types, determine application program resource conditions matching the second application development framework; For any one of the resource types, adjust the resources of the targeted resource type in the first resource package according to the application program resource conditions of the targeted resource type to obtain adjusted resources; Based on the adjusted resources of each resource type, determine a second resource package applicable to the second application development framework.
4. The method according to claim 3, wherein the resource type includes a startup resource type, and for any one of the resource types, adjusting the resources of the targeted resource type in the first resource package according to the application program resource conditions of the targeted resource type to obtain adjusted resources comprises: For the startup resource type, obtain a first startup file in the first resource package; The first startup file corresponds to a first format; According to the application program resource conditions of the startup resource type, construct an initial startup file corresponding to a second format that matches the second application development framework; Reference the first startup file in the initial startup file to generate a target startup file applicable to the second application development framework; The target startup file is the adjusted resource.
5. The method according to claim 3 or 4, wherein the resource type includes an environment resource type, the environment resource type includes a first sub-environment type and a second sub-environment type, the first sub-environment type is used to indicate a folder of the runtime environment of the application, and the second sub-environment type is used to indicate a first compilation product used by the application when running through the first application development framework, and the first compilation product is implemented based on a general-purpose programming language.
6. The method according to claim 5, wherein for any resource type, adjusting the resources of the targeted resource type in the first resource package according to the application program resource conditions of the targeted resource type to obtain adjusted resources includes: For the environmental resource type, adjusting the resources of the first sub - environmental type in the first resource package and adjusting the resources of the second sub - environmental type in the first resource package according to the application program resource conditions of the environmental resource type; Based on the adjusted resources of the first sub - environmental type and the adjusted resources of the second sub - environmental type, determining the adjusted resources of the environmental resource type.
7. The method according to claim 6, wherein adjusting the resources of the first sub - environmental type in the first resource package includes: Determining a first folder in the first resource package that is related to the running environment; Determining a second folder that is related to the running environment and matches the second application development framework; Deleting the folder related to the first application development framework in the first folder and adding the second folder to the first resource package.
8. The method according to claim 6, wherein adjusting the resources of the second sub - environmental type in the first resource package includes: Determining a first compilation product in the first resource package; Obtaining the source code of the first compilation product and recompiling the source code through the compilation component corresponding to the second application development framework to generate a second compilation product adapted to the second application development framework; Replacing the first compilation product in the first resource package with the second compilation product.
9. The method according to any one of claims 3 to 8, wherein the resource type includes a communication resource type, the communication resource type includes a first sub - communication type and a second sub - communication type, the first sub - communication type is used to indicate the resources used for cross - process communication, and the second sub - communication type is used to indicate the resources used for calling system interfaces related to the operating system.
10. The method according to claim 9, wherein for any resource type, adjusting the resources of the targeted resource type in the first resource package according to the application program resource conditions of the targeted resource type to obtain adjusted resources includes: For the communication resource type, adjusting the resources of the first sub - communication type in the first resource package and adjusting the resources of the second sub - communication type in the first resource package according to the application program resource conditions of the communication resource type; Based on the adjusted resources of the first sub - communication type and the adjusted resources of the second sub - communication type, determining the adjusted resources of the communication resource type.
11. The method according to claim 10, wherein adjusting the resources of the first sub - communication type in the first resource package includes: Determining the code of the rendering process with cross - process communication in the first resource package; The cross - process communication is used to implement the communication between the rendering process and the operating system; Adjust the code of the rendering process so that the rendering process after code adjustment directly realizes communication with the operating system through context calls.
12. The method according to claim 10, wherein the adjustment of the resources of the second sub-communication type in the first resource package includes: Determine the first system interface called by the first resource package; Determine a second system interface with the same function as the first system interface from the system interfaces provided by the second application development framework; Based on the second system interface, adjust the code in the first resource package that calls the first system interface.
13. The method according to any one of claims 1 to 12, wherein the running of the application program in the second application development framework through the second resource package includes: Directly run the application program in the second application development framework in the form of a desktop application through the second resource package.
14. The method according to any one of claims 1 to 13, wherein the running of the application program in the second application development framework through the second resource package includes: Call the second resource package through a target application program running in the second application development framework, and run the application program in the target application program in the form of a plugin.
15. The method according to any one of claims 1 to 14, wherein the application program includes a code editing application, and the application program running through the second resource package is used to edit the resources of the application program running in the second application development framework.
16. An application program processing device, the device includes: A determination module, configured to determine a first application development framework, an application program, and a second application development framework; An acquisition module, configured to acquire a first resource package of the application program, where the first resource package is applicable to the first application development framework and contains application resources used by the application program during its use; An adjustment module, configured to determine application program resource conditions matching the second application development framework, and adjust the first resource package according to the application program resource conditions to obtain a second resource package of the application program, where the second resource package is applicable to the second application development framework; And A running module, configured to run the application program in the second application development framework through the second resource package.
17. A computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method according to any one of claims 1 to 15 are implemented.
18. A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.
19. A computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.
Citation Information
Patent Citations
Implementation method of Widget system based on electron framework and television adopting system
CN110297624A
Software updating method and device for cross-platform application, equipment and medium
CN112328296A
Application program processing method and device, computer equipment and storage medium
CN117519691A
Application porting method and apparatus, device, and medium
US20220244930A1