Plug-in updating method and device, electronic equipment and computer readable storage medium
Patent Information
- Application Number
- CN202111187318.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-12
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2041-10-12
AI Technical Summary
[0003]在对现有技术的研究和实践过程中,本发明的发明人发现,通过插件管理器来更新插件时,往往需要插件使用者手动更新插件,另外,插件管理器管理的这些插件在更新之前还需要通过插件平台进行审核,从而影像插件的迭代效率,因此,导致插件更新的更新效率较低
[0023]本发明实施例在获取针对开发插件的插件信息后,根据所述插件信息,对开发插件的更新状态进行检测,得到开发插件的当前更新状态,当当前更新状态为需要更新时,基于插件信息,获取开发插件的目标插件包,然后,在目标插件包中筛选出业务逻辑代码,并基于业务逻辑代码对开发插件的当前插件包进行更新;由于该方案通过获取开发插件的插件信息之后,检测开发插件的更新状态,在需要更新时,可以自动获取目标插件包对开发插件进行更新,无须手动更新,从而可以提升插件更新的更新效率。
Smart Images

Figure CN115964061B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and more specifically to a plug-in update method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] In recent years, with the rapid development of internet technology, more and more applications have been developed. During the development of these applications, plugins on the development platform are often used. Updating these plugins usually requires using the development platform's plugin manager.
[0003] In the process of researching and practicing existing technologies, the inventors of this invention discovered that when updating plugins through a plugin manager, plugin users often need to manually update the plugins. In addition, the plugins managed by the plugin manager need to be reviewed by the plugin platform before being updated, which affects the iteration efficiency of the plugins. Therefore, the update efficiency of plugins is low. Summary of the Invention
[0004] This invention provides a plug-in update method, apparatus, electronic device, and computer-readable storage medium, which can improve the update efficiency of plug-in updates.
[0005] A plugin update method includes:
[0006] Obtain plugin information for the development plugin, wherein the development plugin is a plugin that runs in an integrated environment developed in a preset programming language;
[0007] Based on the plugin information, the update status of the development plugin is detected to obtain the current update status of the development plugin;
[0008] When the current update status indicates that an update is required, the target plugin package of the developed plugin is obtained based on the plugin information;
[0009] The business logic code is selected from the target plugin package, and the current plugin package of the developed plugin is updated based on the business logic code.
[0010] Accordingly, embodiments of the present invention provide a plug-in update device, comprising:
[0011] The first acquisition unit is used to acquire plugin information for the development plugin, wherein the development plugin is a plugin that runs in an integrated environment developed in a preset programming language;
[0012] The detection unit is used to detect the update status of the development plugin based on the plugin information, and obtain the current update status of the development plugin;
[0013] The second acquisition unit is used to acquire the target plugin package of the developed plugin based on the plugin information when the current update status is that an update is required.
[0014] The update unit is used to filter out business logic code from the target plugin package and update the current plugin package of the developed plugin based on the business logic code.
[0015] Optionally, in some embodiments, the detection unit may be specifically used to identify the target version information of the development plugin in the plugin information; and to determine the current update status of the development plugin based on the target version information.
[0016] Optionally, in some embodiments, the detection unit may be specifically used to obtain the current version information of the development plugin and compare the target version information with the current version information; when the target version information is the same as the current version information, the current update status of the development plugin is determined to be no update required; when the target version information is different from the current version information, the current update status of the development plugin is determined to be an update required.
[0017] Optionally, in some embodiments, the updating unit may be specifically used to identify a code storage area and a code backup area in the current plugin package of the development plugin; extract historical business logic code from the code storage area and move the historical business logic code to the code backup area; add the business logic code to the code storage area to obtain the updated development plugin.
[0018] Optionally, in some embodiments, the plugin update device may further include a hot-loading unit, which may be used to obtain the historical object instance corresponding to the historical business logic code; update the historical object instance based on the business logic code, so as to hot-load the updated developed plugin.
[0019] Optionally, in some embodiments, the hot-loading unit may be used to compile the business logic code to obtain a target class file; load the target class file and create a target object instance corresponding to the target class file; and update the historical object instance based on the target object instance so as to hot-load the updated development plugin.
[0020] Optionally, in some embodiments, the second acquisition unit may be specifically used to detect the running status of the development plugin; when the running status is not running, the initial plugin package of the development plugin is acquired according to the plugin information, and the integrity of the initial plugin package is verified; when the integrity verification of the initial plugin package passes, the initial plugin package is used as the target plugin package.
[0021] Furthermore, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the plug-in update method provided in embodiments of the present invention.
[0022] Furthermore, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the plug-in update methods provided in embodiments of the present invention.
[0023] In this embodiment of the invention, after obtaining plugin information for a development plugin, the update status of the development plugin is detected based on the plugin information to obtain the current update status of the development plugin. When the current update status indicates that an update is required, the target plugin package of the development plugin is obtained based on the plugin information. Then, business logic code is selected from the target plugin package, and the current plugin package of the development plugin is updated based on the business logic code. Since this solution detects the update status of the development plugin after obtaining its plugin information, and can automatically obtain the target plugin package to update the development plugin when an update is required, without the need for manual updates, the update efficiency of plugin updates can be improved. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a schematic diagram of a scenario for the plugin update method provided in an embodiment of the present invention;
[0026] Figure 2 This is a flowchart illustrating the plug-in update method provided in an embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram of the structure of the plugin package for the development plugin provided in this embodiment of the invention;
[0028] Figure 4 This is a schematic diagram of the automatic update process for the development plugin provided in an embodiment of the present invention;
[0029] Figure 5 This is another flowchart illustrating the plug-in update method provided in this embodiment of the invention;
[0030] Figure 6 This is a schematic diagram of the plug-in update device provided in an embodiment of the present invention;
[0031] Figure 7 This is another structural schematic diagram of the plug-in update device provided in an embodiment of the present invention;
[0032] Figure 8 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] This invention provides a plug-in update method, apparatus, and computer-readable storage medium. The plug-in update apparatus can be integrated into an electronic device, which may be a server or a terminal, etc.
[0035] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0036] For example, see Figure 1 Taking the integration of a plugin update device into an electronic device as an example, after obtaining plugin information for a development plugin, the electronic device detects the update status of the development plugin based on the plugin information to obtain the current update status of the development plugin. When the current update status indicates that an update is required, the target plugin package of the development plugin is obtained based on the plugin information. Then, business logic code is selected from the target plugin package, and the current plugin package of the development plugin is updated based on the business logic code, thereby improving the update efficiency of the plugin update.
[0037] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0038] This embodiment will be described from the perspective of a plug-in update device, which can be integrated into an electronic device, such as a server or a terminal. The terminal can include tablet computers, laptops, personal computers (PCs), wearable devices, virtual reality devices, or other smart devices that can update plug-ins.
[0039] A plugin update method includes:
[0040] Obtain plugin information for the development plugin, which is a plugin running in an integrated environment developed in a preset programming language. Based on the plugin information, detect the update status of the development plugin to obtain its current update status. When the current update status indicates that an update is required, obtain the target plugin package for the development plugin based on the plugin information, filter out the business logic code in the target plugin package, and update the current plugin package of the development plugin based on the business logic code.
[0041] like Figure 2 As shown, the specific process of this plugin update method is as follows:
[0042] 101. Obtain plugin information for plugin development.
[0043] Among them, the development plugin can be a plugin that runs in an integrated environment developed in a preset programming language. Taking Java as an example, the development plugin can be an IDEA plugin that runs in IDEA (an integrated environment developed in Java). Specifically, the IDEA plugin can be a tool for developers developed by plugin developers based on JetBrains' plugin development specifications, which is used to improve development efficiency and the development process.
[0044] Among them, plugin information can be the latest information about the plugin development released by the plugin developer or the development platform. For example, it can be the plugin update information released by the plugin developer after updating the plugin, or it can be the message that the plugin developer submits the latest version of the plugin to the development platform for review, or it can be the information that the development platform receives the latest version of the plugin, or it can be the information that the development platform approves the latest version of the plugin.
[0045] There are several ways to obtain plugin information. For example, you can listen to the development platform and load the service management code in the current plugin package when the development platform starts up, so as to start the package management service corresponding to the service management code. Then, you can receive push information through the package management service and filter out the plugin information of the development plugin from the push information.
[0046] There are several ways to receive push information through the package management service and filter out the plugin information of the developed plugin. For example, it can receive the first push information sent by the plugin server corresponding to the developer of the developed plugin and filter out the plugin information in the first push information. Alternatively, it can receive the second push information sent by the development platform and filter out the plugin information in the second push information.
[0047] There are several ways to receive the first push notification and filter out plugin information from it. For example, when a plugin developer develops the latest version of the plugin, they can receive the latest version information from the plugin server corresponding to the plugin developer to obtain the first push notification. From the first push notification, they can filter out the version information of the latest version of the plugin, the latest plugin package, or the storage address of the latest plugin package to obtain the plugin information. Alternatively, they can send an update request to the plugin server, receive the latest version information of the plugin returned by the plugin server, obtain the first push notification, and filter out the version information of the latest version of the plugin, the latest plugin package, or the storage address of the latest plugin package to obtain the plugin information.
[0048] The first push notification sent by the plugin server can be received without being restricted by the development platform's review process. Typically, the review cycle for plugins by the development platform is quite long, which affects the iteration efficiency of plugins. However, by directly receiving the first push notification sent by the plugin developer and obtaining the plugin information, the plugin can be updated without being restricted by the development platform. When the developer develops the latest version of the plugin, the plugin update device can receive the first push notification sent by the developer through the plugin server as soon as possible, and then update the plugin, thereby greatly improving the development efficiency of plugins.
[0049] There are several ways to receive the second push information and filter out the plugin information from it. For example, when the development platform receives the latest version of the development plugin or approves the latest version of the development plugin, it receives the information of the latest version of the development plugin sent by the development platform, obtains the second push information, and filters out the version information, the latest plugin package, or the storage address of the latest plugin package from the second push information. Alternatively, it can send a plugin update request to the development platform, receive the information of the latest version of the development plugin returned by the development platform based on the plugin update request, obtain the second push information, and filter out the version information, the latest plugin package, or the storage address of the latest plugin package from the second push information.
[0050] 102. Based on the plugin information, check the update status of the developed plugin to obtain the current update status of the developed plugin.
[0051] The update status can be a status information indicating whether the developed plugin needs to be updated. The update status can include "needs to be updated" and "does not need to be updated".
[0052] There are several ways to detect the update status of developed plugins, including the following:
[0053] For example, the target version information of the plugin can be identified in the plugin information, and the current update status of the plugin can be determined based on the target version information.
[0054] The target version information can be the latest version of the plugin being developed. Version information can be the plugin's version number or other identifying information indicating the version. Based on the target version information, there are several ways to determine the current update status of the plugin. For example, one can obtain the plugin's current version information and compare it with the target version information. If the target version information and the current version information are the same, the plugin's current update status is determined to be no update required; if they are different, the plugin's current update status is determined to be an update required.
[0055] 103. When the current update status is "update required", obtain the target plugin package for the developed plugin based on the plugin information.
[0056] The target plugin package can be the plugin package corresponding to the latest version of the development plugin. A plugin package can be understood as a code package that stores the development plugin code. This plugin package can contain two sub-code packages: a package management service sub-code package and a plugin service sub-code package, such as... Figure 3 As shown, the plugin service sub-package is the core of the plugin's functionalities, providing users with relevant functions and business logic (such as dependency associations and creating new projects). The plugin service consists of a host module and a business module. The host layer primarily responds to and triggers basic IDEA events, such as menu selection and button clicks, essentially acting as a proxy for business logic implementation. The business logic module is where the plugin's actual business logic and functionality are implemented; it's where automatic updates occur during plugin updates. The package management service sub-package can include a communication module and a version management module. The communication module interacts with the developer's corresponding plugin server or development platform's service to push information, while the version management module primarily monitors the update status of the plugin.
[0057] There are several ways to obtain the target plugin package for developing plugins, as follows:
[0058] For example, the running status of the developed plugin can be detected. When the running status is not running, the initial plugin package of the developed plugin can be obtained according to the plugin information, and the integrity of the initial plugin package can be verified. When the integrity verification of the initial plugin package passes, the initial plugin package is used as the target plugin package.
[0059] The running status is used to indicate whether the development plugin is currently running. There are several ways to detect the running status of a development plugin. For example, you can obtain the currently running processes and query the running process corresponding to the development plugin. If the running process corresponding to the development plugin exists, the running status of the development plugin can be determined to be running. If the running process corresponding to the development plugin does not exist, the running status of the development plugin can be determined to be not running. Alternatively, you can obtain the running processes of the development platform and query whether there is a child process corresponding to the development plugin. If the child process corresponding to the development plugin exists, the running status of the development plugin can be determined to be running. If the child process corresponding to the development plugin does not exist, the running status of the development plugin can be determined to be not running.
[0060] When the development plugin is in a non-running state, there are several ways to obtain the initial plugin package based on the plugin information. For example, you can query the plugin package in the plugin information. If the plugin package exists in the plugin information, use it as the initial plugin package for the development plugin. If the plugin package does not exist in the plugin information, identify the storage address of the plugin package in the plugin information and download or receive the initial plugin package based on that storage address.
[0061] Taking core.zip as an example, there are several ways to obtain the target plugin package. For instance, when downloading or receiving the initial plugin package, a cache file named core.tmp can be created in the plugin installation directory. Once the plugin package is fully downloaded and passes the file integrity verification, the core.tmp cache file can be renamed to core.zip, and the core.zip file can be used as the target plugin package for plugin development.
[0062] Optionally, when the development plugin is running, the plugin update task can be cached, and then the running status of the development plugin can be monitored until the running status of the development plugin is not running. Then, the target plugin package of the development plugin can be obtained according to the plugin information.
[0063] 104. Filter out the business logic code in the target plugin package, and update the current plugin package of the developed plugin based on the business logic code.
[0064] The business logic code can be the logic code that implements the corresponding functions or business logic of the plugin.
[0065] There are several ways to filter out business logic code, including the following:
[0066] For example, the target plugin package can be decompressed to obtain a code collection, the code in the code collection can be categorized, and the business logic code can be selected from the code collection based on the categorization results. Alternatively, the target plugin package can be decompressed to obtain a decompressed plugin package, the code storage area in the decompressed plugin package can be identified, the code storage area can be categorized, the business logic code storage area can be identified from the code area based on the categorization results, and the code stored in the business logic code storage area can be extracted as business logic storage code.
[0067] Taking the target plugin package as a core.zip file as an example, there are several ways to filter out the business logic code. For example, you can unzip the core.zip file, filter out the business logic code file xxx-plugin.jar in the unzipped files, and use this business logic code file as the business logic code in the target plugin package.
[0068] After the business logic code is selected, the current plugin package of the development plugin can be updated based on the business logic code. There are several ways to update it. For example, the code storage area and the code backup area can be identified in the current plugin package of the development plugin. The historical business logic code can be extracted from the code storage area and moved to the code backup area. The business logic code can be added to the code storage area to obtain the updated development plugin.
[0069] The code storage area can be understood as the area in the current plugin package of the developed plugin that stores the code. The code backup area is the area in the current plugin package of the developed plugin that is used to back up historical business logic code. The historical business logic code stored in the code backup area is used for plugin version rollback. Version rollback can be understood as, if the business logic code of the latest version of the developed plugin has a problem, the historical business logic code stored in the code backup area can be called to enable the developed plugin to run normally.
[0070] Specifically, updating the development plugin primarily involves updating the current plugin package to obtain the updated plugin package. The biggest difference between the updated and current plugin packages lies in the business logic code stored in the code storage area. This means that updating the plugin only updates the business logic code in the code storage area, making it an incremental update, thus improving update speed and efficiency. Furthermore, during the incremental update, the historical business logic code before the update is also backed up, enabling plugin version rollback and ensuring the stability of the development plugin.
[0071] Optionally, after the current plugin package of the developed plugin is updated, hot reloading of the updated plugin can also be implemented. For example, the historical object instance corresponding to the historical business logic code can be obtained, and the historical object instance can be updated based on the business logic code so that the developed plugin can be hot reloaded after the update.
[0072] In this context, a historical object instance can be understood as an instance corresponding to the implementation class of a specific function in the business logic code; for example, it could be an instance of an XX.class object. During application development on the application platform, to implement a specific function, one can directly call the object instance corresponding to that function. There are several ways to update historical object instances based on business logic code. For example, the business logic code can be compiled to obtain a target class file, loaded, and a target object instance corresponding to the target class file can be created. The historical object instance can then be updated based on the target object instance, enabling hot reloading and plugin development.
[0073] There are several ways to update historical object instances based on target object instances. For example, one could arbitrarily select an object instance from the target object instances, filter out historical object instances that share a common parent class with the target object instance, replace the target object instance with the corresponding historical object instance, and so on, replacing each historical object instance with its corresponding historical object instance. Then, the host module in the updated plugin package of the updated plugin can call the target object instance to implement the functionality of calling the corresponding historical object instance.
[0074] Among them, the updated plugin mainly uses static proxy to achieve hot reloading. Taking the hot recording process of function A as an example, the specific details are as follows:
[0075] (1) Assuming time T1, in the host module of the current plugin package of the development plugin (the development plugin has not been updated), the implementation class of function A in the business logic code is an instance of object A1.class.
[0076] (2) Assuming that at time T2 (T2=T1+t1,t1>0), the plugin is updated through the package management module in the plugin package, and at the same time, the host module in the updated plugin package is notified that there is new business logic code available.
[0077] (3) At time T3 (T3 = T2 + t2, t2 > 0), the host module receives an update completion notification from the package management module and knows that a new implementation class A2 can be used by reading the version number file Plugin.version.
[0078] (4) At time T4 (T4 = T3 + t3, t3 > 0), the host module loads and updates the object instance of the implementation class A2.class of the function A through the class loader and reflection.
[0079] (5) At time T5 (T5 = T4 + t4, t4 > 0), the host module implements the business logic of function A by calling the instance of object A2.class.
[0080] At this point, the implementation of hot reloading is complete. It should be noted that A is the common parent class of A1 and A2. It can be seen that the static proxy method mainly updates the object instance corresponding to each function by updating the object instance through the class loader and reflection. After the plugin is updated, it can directly call the updated object instance to use the functions in the plugin without restarting the development plugin.
[0081] The update process for development plugins is primarily implemented through the package management service module built into the plugin's current plugin package. This package management service module triggers the plugin update logic by listening for plugin startup notifications and receiving push messages, thereby achieving automatic plugin package updates. Specifically, it can be described as follows... Figure 4 As shown, after starting the development platform, the plugin user can trigger the package management service for the development plugin. Then, the package management service checks whether the development plugin is the latest version. When the development plugin is the latest version, the plugin update process can be stopped. When the development plugin is not the latest version, it means that the development plugin needs to be updated. At this time, the running status of the development plugin can be checked. When the development plugin is running, the plugin update task can be cached. When the development plugin finishes running, the update will continue. When the development plugin is not running, the latest target plugin package can be obtained. Then, the target plugin package replaces the current plugin package of the development plugin. This replacement is not a complete replacement, but an incremental replacement, thereby realizing the update of the development plugin.
[0082] As can be seen from the above, in this embodiment of the application, after obtaining the plugin information for the development plugin, the update status of the development plugin is detected based on the plugin information to obtain the current update status of the development plugin. When the current update status indicates that an update is required, the target plugin package of the development plugin is obtained based on the plugin information. Then, the business logic code is selected from the target plugin package, and the current plugin package of the development plugin is updated based on the business logic code. Since this solution detects the update status of the development plugin after obtaining the plugin information, and can automatically obtain the target plugin package to update the development plugin when an update is required, without the need for manual updates, the update efficiency of plugin updates can be improved.
[0083] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0084] In this embodiment, the plugin update device will be specifically integrated into an electronic device, with the electronic device serving as the terminal and the plugin being developed as an IDEA plugin, as an example for explanation.
[0085] like Figure 5 As shown, a plugin update method is described below, with the specific process as follows:
[0086] 201. Obtain plugin information for IDEA plugins from the terminal.
[0087] For example, the terminal listens to the development platform. When the development platform starts, it loads the service management code in the current plugin package to start the package management service corresponding to the service management code.
[0088] When an IDEA plugin developer creates a new version of the plugin, the terminal can receive information about the latest version of the IDEA plugin from the plugin server corresponding to the plugin developer through the package management service. This first push notification allows the terminal to filter out the version information, the latest plugin package, or the storage address of the latest plugin package from the first push notification to obtain the plugin information. Alternatively, the terminal can send an update request to the plugin server and receive the latest version information of the IDEA plugin returned by the plugin server. This first push notification allows the terminal to filter out the version information, the latest plugin package, or the storage address of the latest plugin package from the first push notification to obtain the plugin information.
[0089] When the development platform receives the latest version of the IDEA plugin or approves the latest version of the IDEA plugin, the terminal can receive the information about the latest version of the IDEA plugin sent by the development platform through the package management service, and obtain the second push information. In the second push information, the terminal can filter out the version information of the latest version of the IDEA plugin, the latest version of the plugin package, or the storage address of the latest version of the plugin package. Alternatively, the terminal can send a plugin update request to the development platform and receive the information about the latest version of the IDEA plugin returned by the development platform based on the plugin update request, and obtain the second push information. In the second push information, the terminal can filter out the version information of the latest version of the IDEA plugin, the latest version of the plugin package, or the storage address of the latest version of the plugin package.
[0090] 202. The terminal checks the update status of the IDEA plugin based on the plugin information to obtain the current update status of the IDEA plugin.
[0091] For example, the terminal can identify the target version information of the IDEA plugin in the plugin information, obtain the current version information of the IDEA plugin, and compare the target version information with the current version information. When the target version information is the same as the current version information, the current update status of the IDEA plugin is determined to be no update required. When the target version information is different from the current version information, the current update status of the IDEA plugin is determined to be an update required.
[0092] 203. When the current update status is "update required", the terminal obtains the target plugin package of the IDEA plugin based on the plugin information.
[0093] For example, the terminal can obtain the currently running processes and query the running process corresponding to the IDEA plugin. If a running process corresponding to the IDEA plugin exists, the running status of the IDEA plugin can be determined to be running. If no running process corresponding to the IDEA plugin exists, the running status of the IDEA plugin can be determined to be not running. Alternatively, it can obtain the running processes of the development platform and query whether there is a child process corresponding to the IDEA plugin. If a child process corresponding to the IDEA plugin exists, the running status of the IDEA plugin can be determined to be running. If no child process corresponding to the IDEA plugin exists, the not running status of the IDEA plugin can be determined to be not running.
[0094] When the IDEA plugin is in a non-running state, the terminal can query the plugin package in the plugin information. If the plugin package exists in the plugin information, it will be used as the initial plugin package for the IDEA plugin. If the plugin package does not exist in the plugin information, the storage address of the plugin package will be identified in the plugin information, and the initial plugin package for the IDEA plugin will be downloaded or received based on that storage address.
[0095] Optionally, when the IDEA plugin is running, the terminal can cache the plugin update task, and then continue to check the running status of the IDEA plugin until the running status of the IDEA plugin is not running. Then, based on the plugin information, the target plugin package of the IDEA plugin can be obtained.
[0096] 204. The terminal filters out the business logic code from the target plugin package.
[0097] For example, the terminal can decompress the target plugin package to obtain a code collection, classify the code in the code collection, and filter out the business logic code based on the classification results. Alternatively, it can decompress the target plugin package to obtain a decompressed plugin package, identify the code storage area in the decompressed plugin package, classify the code storage area, identify the business logic code storage area in the code area based on the classification results, and extract the code stored in the business logic code storage area as business logic storage code.
[0098] 205. The terminal updates the current plugin package of the IDEA plugin based on the business logic code.
[0099] For example, the terminal can identify the code storage area and the code backup area in the current plugin package of the IDEA plugin, extract the historical business logic code in the code storage area, move the historical business logic code to the code backup area, and add the business logic code to the code storage area to obtain the updated IDEA plugin.
[0100] Optionally, after the current plugin package of the IDEA plugin is updated, hot reloading of the updated IDEA plugin can also be implemented. For example, the terminal can obtain the historical object instance corresponding to the historical business logic code, compile the business logic code to obtain the target class file, load the target class file, and create the target object instance corresponding to the target class file. Based on the target object instance, the historical object instance is updated so that the updated IDEA plugin can be hot reloaded.
[0101] As can be seen from the above, in this embodiment, after the terminal obtains the plugin information for the IDEA plugin, it detects the update status of the IDEA plugin based on the plugin information to obtain the current update status of the IDEA plugin. When the current update status indicates that an update is required, it obtains the target plugin package of the IDEA plugin based on the plugin information. Then, it filters out the business logic code from the target plugin package and updates the current plugin package of the IDEA plugin based on the business logic code. Since this solution detects the update status of the IDEA plugin after obtaining the plugin information, it can automatically obtain the target plugin package to update the IDEA plugin when an update is required, without the need for manual updates, thereby improving the update efficiency of plugin updates.
[0102] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0103] In this embodiment, the plugin update device will be specifically integrated into an electronic device, with the electronic device serving as the terminal, the plugin being an IDEA plugin, and the development platform being IDEA, as an example for explanation.
[0104] For example, when IDEA starts, the package management service within the IDEA plugin can be activated. This service is built into the code of the current plugin package. Through this service, it receives push notifications from the plugin server corresponding to the plugin developer or the IDEA development server. It retrieves the latest version information of the IDEA plugin from these push notifications and reads the current version information of the IDEA plugin from the Plugin.version file in the plugin package. The Plugin.version file is a version record file created by the package management service in the IDEA plugin's installation directory after the plugin is first installed and runs successfully. This version record file primarily stores the current version information of the IDEA plugin.
[0105] The latest version information is compared with the current version information. If the latest version information is the same as the current version information, it can be determined that the IDEA plugin does not need to be updated. If the latest version information is different from the current version information, it can be determined that the IDEA plugin needs to be updated. When the IDEA plugin does not need to be updated, the plugin update process can be exited directly. When the IDEA plugin needs to be updated, it continues to check whether the plugin is being used. This can be done by checking whether the IDEA plugin process exists in the currently running processes, or by checking whether the IDEA plugin's child process exists in the IDEA process. If the IDEA plugin process or child process exists, it can be determined that the IDEA plugin is currently running. If the IDEA plugin process or child process does not exist, it can be determined that the IDEA plugin is not running. When the IDEA plugin is running, the plugin update task can be cached. When the IDEA plugin is not running, the updated plugin file can be downloaded through the package management service. During the download, a cache file named core.tmp is created in the plugin installation directory. After the IDEA updated plugin file is downloaded and passes the file integrity verification, the core.tmp cache file is renamed to core.zip. After decompressing the core.zip file, extract the business logic code file xxx-plugin.jar from the decompressed files. Replace the historical business logic files in the current plugin package of the IDEA plugin with the business logic code file xxx-plugin.jar, and back up the historical business logic files to the backup directory of the installation directory for IDEA plugin version rollback. At this point, the IDEA plugin update is complete, resulting in the updated IDEA plugin and its corresponding updated plugin package.
[0106] After updating the IDEA plugin, the package management service module sends a notification to the host module within the updated plugin package, indicating that updated business logic code is available. Upon receiving the notification, the host module reads the version file `Plugin.version` to confirm that the IDEA plugin has been updated and that updated implementation classes for each function are available. Then, the host module updates the object instances of the implementation classes for each function in the IDEA plugin using class loading and reflection. When a specific function in the IDEA plugin needs to be implemented, the host module can call the corresponding object instance to complete the task. This implements hot reloading of the updated IDEA plugin, allowing direct use without restarting it.
[0107] To better implement the above methods, embodiments of the present invention also provide a plug-in update device, which can be integrated into electronic devices, such as servers or terminals, and the terminal may include tablet computers, laptop computers and / or personal computers.
[0108] For example, such as Figure 6 As shown, the plugin update device may include a first acquisition unit 301, a detection unit 302, a second acquisition unit 303, and an update unit 304, as follows:
[0109] (1) First acquisition unit 301;
[0110] The first acquisition unit 301 is used to acquire plugin information for the development plugin, which is a plugin that runs in an integrated environment developed in a preset programming language.
[0111] For example, the first acquisition unit can be used to listen to the development platform. When the development platform starts, it loads the service management code in the current plugin package to start the package management service corresponding to the service management code. The package management service receives the first push information sent by the plugin server corresponding to the developer of the plugin and filters out the plugin information in the first push information. Alternatively, the package management service can also receive the second push information sent by the development platform and filter out the plugin information in the second push information.
[0112] (2) Detection unit 302;
[0113] The detection unit 302 is used to detect the update status of the developed plugin based on the plugin information, and obtain the current update status of the developed plugin.
[0114] For example, the detection unit 302 can be used to identify the target version information of the development plugin in the plugin information, obtain the current version information of the development plugin, and compare the target version information with the current version information. When the target version information is the same as the current version information, the current update status of the development plugin is determined to be no need to update. When the target version information is different from the current version information, the current update status of the development plugin is determined to be need to update.
[0115] (3) Second acquisition unit 303;
[0116] The second acquisition unit 303 is used to acquire the target plugin package for developing the plugin based on the plugin information when the current update status is "update required".
[0117] For example, the second acquisition unit 303 can be specifically used to, when the current update status is "update required," acquire the currently running process, query the running process corresponding to the development plugin within the running process, and determine that the development plugin is running when a running process corresponding to the development plugin exists, and that it is not running when no running process corresponding to the development plugin exists. Alternatively, it can acquire the running process of the development platform and query whether a child process corresponding to the development plugin exists within the process. If a child process corresponding to the development plugin exists, the development plugin is running; if no child process corresponding to the development plugin exists, it is not running. When the running status is not running, the plugin package is queried in the plugin information. If the plugin package exists in the plugin information, it is used as the initial plugin package for the development plugin. If the plugin package does not exist in the plugin information, the storage address of the plugin package is identified in the plugin information, and the initial plugin package for the development plugin is downloaded or received based on that storage address. The integrity of the initial plugin package is verified, and if the integrity verification of the initial plugin package passes, the initial plugin package is used as the target plugin package. When the development plugin is running, the plugin update task can be cached. Then, the development plugin's running status is monitored until it is not running. Finally, the target plugin package is obtained based on the plugin information.
[0118] (4) Update unit 304;
[0119] Update unit 304 is used to filter out business logic code in the target plugin package and update the current plugin package of the developed plugin based on the business logic code.
[0120] For example, update unit 304 can be used to decompress the target plugin package to obtain a code set, categorize the code in the code set, and filter out business logic code based on the categorization results. Alternatively, it can decompress the target plugin package to obtain a decompressed plugin package, identify the code storage area in the decompressed plugin package, categorize the code storage area, identify the business logic code storage area within the code area based on the categorization results, and extract the code stored in the business logic code storage area as business logic storage code. In the current plugin package of the developing plugin, the code storage area and code backup area are identified. Historical business logic code is extracted from the code storage area and moved to the code backup area. The business logic code is then added to the code storage area to obtain the updated developed plugin.
[0121] Optionally, the plug-in update device may also include a hot-loading unit 305, such as Figure 7 As shown, the specific details are as follows:
[0122] The hot-loading unit 305 can be used to hot-load updated plugins.
[0123] For example, the hot-loading unit 305 can be used to obtain the historical object instance corresponding to the historical business logic code, compile the business logic code to obtain the target class file, load the target class file, create the target object instance corresponding to the target class file, and update the historical object instance based on the target object instance so that the plugin can be developed after the hot-loading update.
[0124] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0125] As can be seen from the above, in this embodiment, after the first acquisition unit 301 acquires the plugin information for the development plugin, the detection unit 302 detects the update status of the development plugin based on the plugin information to obtain the current update status of the development plugin. When the current update status indicates that an update is required, the second acquisition unit 303 acquires the target plugin package of the development plugin based on the plugin information. Then, the update unit 304 filters out the business logic code in the target plugin package and updates the current plugin package of the development plugin based on the business logic code. Since this solution detects the update status of the development plugin after acquiring the plugin information, it can automatically acquire the target plugin package to update the development plugin when an update is required, without the need for manual updates, thereby improving the update efficiency of plugin updates.
[0126] This invention also provides an electronic device, such as... Figure 8 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:
[0127] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0128] The processor 401 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.
[0129] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0130] The electronic device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0131] The electronic device may also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0132] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:
[0133] Obtain plugin information for the development plugin, which is a plugin running in an integrated environment developed in a preset programming language. Based on the plugin information, detect the update status of the development plugin to obtain its current update status. When the current update status indicates that an update is required, obtain the target plugin package for the development plugin based on the plugin information, filter out the business logic code in the target plugin package, and update the current plugin package of the development plugin based on the business logic code.
[0134] For example, an electronic device monitors a development platform. When the development platform starts, it loads the service management code from the current plugin package to launch the corresponding package management service. This service receives a first push notification from the plugin server corresponding to the plugin developer and filters out plugin information from it. Alternatively, the package management service can receive a second push notification from the development platform and filter out plugin information from it as well. The target version information of the plugin is identified within the plugin information, and the current version information is obtained. The target version information is compared with the current version information. If they match, the plugin's current update status is determined to be "no update needed"; otherwise, it is determined to be "update needed".
[0135] When the current update status is "update required," the system retrieves the currently running processes and queries for the corresponding running processes of the development plugin. If a running process for the development plugin exists, its running status is confirmed as "running." If no running process exists, its running status is confirmed as "not running." Alternatively, the system can retrieve the running processes of the development platform and query for the existence of child processes corresponding to the development plugin. If a child process exists, its running status is confirmed as "running." If no child process exists, its not running status is confirmed as "not running." When the running status is "not running," the system queries the plugin information for the plugin package. If the plugin package exists in the plugin information, it is used as the initial plugin package for the development plugin. If the plugin package does not exist in the plugin information, the storage address of the plugin package is identified in the plugin information, and the initial plugin package is downloaded or received based on that storage address. The initial plugin package undergoes integrity verification. If the integrity verification of the initial plugin package passes, it is used as the target plugin package. When the development plugin is running, the plugin update task can be cached. Then, the development plugin's running status is monitored until it is not running. Finally, the target plugin package is obtained based on the plugin information.
[0136] The target plugin package is decompressed to obtain a code collection. The code in this collection is categorized, and based on the categorization results, business logic code is selected. Alternatively, the target plugin package can be decompressed to obtain a decompressed plugin package. Within this decompressed package, code storage areas are identified and categorized. Based on the categorization results, the business logic code storage area is identified within the code storage area, and the code stored there is extracted as business logic storage code. In the current plugin package for development, the code storage area and code backup area are identified. Historical business logic code is extracted from the code storage area and moved to the code backup area. The updated business logic code is then added to the code storage area, resulting in the updated development plugin. The historical object instance corresponding to the historical business logic code is obtained, and the business logic code is compiled to obtain the target class file. This target class file is loaded, and a target object instance corresponding to it is created. The historical object instance is updated based on the target object instance to enable hot reloading of the updated development plugin.
[0137] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0138] As can be seen from the above, in this embodiment of the invention, after obtaining the plugin information for the development plugin, the update status of the development plugin is detected based on the plugin information to obtain the current update status of the development plugin. When the current update status indicates that an update is required, the target plugin package of the development plugin is obtained based on the plugin information. Then, business logic code is selected from the target plugin package, and the current plugin package of the development plugin is updated based on the business logic code. Since this solution detects the update status of the development plugin after obtaining the plugin information, and can automatically obtain the target plugin package to update the development plugin when an update is required, without the need for manual updates, the update efficiency of plugin updates can be improved.
[0139] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0140] To this end, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the plug-in update methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:
[0141] Obtain plugin information for the development plugin, which is a plugin running in an integrated environment developed in a preset programming language. Based on the plugin information, detect the update status of the development plugin to obtain its current update status. When the current update status indicates that an update is required, obtain the target plugin package for the development plugin based on the plugin information, filter out the business logic code in the target plugin package, and update the current plugin package of the development plugin based on the business logic code.
[0142] For example, the development platform can be monitored. When the development platform starts, the service management code in the current plugin package is loaded to start the package management service corresponding to that service management code. This package management service receives the first push notification from the plugin server corresponding to the plugin developer, and filters out plugin information from the first push notification. Alternatively, the package management service can receive a second push notification from the development platform, and filter out plugin information from the second push notification. The target version information of the plugin is identified from the plugin information, the current version information of the plugin is obtained, and the target version information is compared with the current version information. If the target version information is the same as the current version information, the current update status of the plugin is determined to be no update required; if the target version information is different from the current version information, the current update status of the plugin is determined to be an update required.
[0143] When the current update status is "update required," the system retrieves the currently running processes and queries for the corresponding running processes of the development plugin. If a running process for the development plugin exists, its running status is confirmed as "running." If no running process exists, its running status is confirmed as "not running." Alternatively, the system can retrieve the running processes of the development platform and query for the existence of child processes corresponding to the development plugin. If a child process exists, its running status is confirmed as "running." If no child process exists, its not running status is confirmed as "not running." When the running status is "not running," the system queries the plugin information for the plugin package. If the plugin package exists in the plugin information, it is used as the initial plugin package for the development plugin. If the plugin package does not exist in the plugin information, the storage address of the plugin package is identified in the plugin information, and the initial plugin package is downloaded or received based on that storage address. The initial plugin package undergoes integrity verification. If the integrity verification of the initial plugin package passes, it is used as the target plugin package. When the development plugin is running, the plugin update task can be cached. Then, the development plugin's running status is monitored until it is not running. Finally, the target plugin package is obtained based on the plugin information.
[0144] The target plugin package is decompressed to obtain a code collection. The code in this collection is categorized, and based on the categorization results, business logic code is selected. Alternatively, the target plugin package can be decompressed to obtain a decompressed plugin package. Within this decompressed package, code storage areas are identified and categorized. Based on the categorization results, the business logic code storage area is identified within the code storage area, and the code stored there is extracted as business logic storage code. In the current plugin package for development, the code storage area and code backup area are identified. Historical business logic code is extracted from the code storage area and moved to the code backup area. The updated business logic code is then added to the code storage area, resulting in the updated development plugin. The historical object instance corresponding to the historical business logic code is obtained, and the business logic code is compiled to obtain the target class file. This target class file is loaded, and a target object instance corresponding to it is created. The historical object instance is updated based on the target object instance to enable hot reloading of the updated development plugin.
[0145] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0146] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0147] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the plug-in update methods provided in the embodiments of the present invention, the beneficial effects that any of the plug-in update methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0148] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations of the plug-in update aspect or IDEA plug-in hot reloading aspect described above.
[0149] The above provides a detailed description of a plug-in update method, apparatus, electronic device, and computer-readable storage medium provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A plugin update method, characterized in that, include: Obtain plugin information for the development plugin, wherein the development plugin is a plugin that runs in an integrated environment developed in a preset programming language; Based on the plugin information, the update status of the development plugin is detected to obtain the current update status of the development plugin; When the current update status indicates that an update is required, the target plugin package of the developed plugin is obtained based on the plugin information; The target plugin package is decompressed to obtain a decompressed plugin package. A code storage area is identified in the decompressed plugin package. The code storage area is classified. Based on the classification results, a business logic code storage area is identified in the code storage area. The code stored in the business logic code storage area is extracted as the business logic code. In the current plugin package of the development plugin, a code storage area and a code backup area are identified. The business logic code is added to the code storage area, and the historical business logic code in the code storage area is moved to the code backup area. The historical business logic code stored in the code backup area is used for version rollback of the development plugin. The package management service module built into the current plugin package sends a prompt message to the host module in the current plugin package to notify the host module that updated business logic code is available. After receiving the prompt message, the host module determines that the development plugin has been updated by reading the version number file. The host module compiles the business logic code to obtain a target class file, loads the target class file and creates a target object instance corresponding to the target class file in the current plugin package of the development plugin. It then selects historical object instances that share a common parent class with the target object instance from the historical object instances corresponding to the historical business logic code, and replaces the historical object instance with the target object instance to hot-load the updated development plugin, so that the updated development plugin can use the updated functions without restarting.
2. The plugin update method according to claim 1, characterized in that, The step of detecting the update status of the development plugin based on the plugin information to obtain the current update status of the development plugin includes: The target version information of the developed plugin is identified from the plugin information; Based on the target version information, the current update status of the development plugin is determined.
3. The plugin update method according to claim 2, characterized in that, Determining the current update status of the development plugin based on the target version information includes: Obtain the current version information of the development plugin, and compare the target version information with the current version information; When the target version information is the same as the current version information, the current update status of the development plugin is determined to be no update required; When the target version information is different from the current version information, the current update status of the development plugin is determined to be that it needs to be updated.
4. The plug-in update method according to any one of claims 1 to 3, characterized in that, The step of obtaining the target plugin package for the developed plugin based on the plugin information includes: The running status of the developed plugin is monitored; When the running status is not running, the initial plugin package of the developed plugin is obtained according to the plugin information, and the integrity of the initial plugin package is verified. When the integrity verification of the initial plugin package passes, the initial plugin package is used as the target plugin package.
5. A plug-in update device, characterized in that, include: The first acquisition unit is used to acquire plugin information for the development plugin, wherein the development plugin is a plugin that runs in an integrated environment developed in a preset programming language; The detection unit is used to detect the update status of the development plugin based on the plugin information, and obtain the current update status of the development plugin; The second acquisition unit is used to acquire the target plugin package of the developed plugin based on the plugin information when the current update status is that an update is required. The update unit is used to decompress the target plugin package to obtain a decompressed plugin package, identify a code storage area in the decompressed plugin package, classify the code storage area, identify a business logic code storage area in the code storage area based on the classification result, and extract the code stored in the business logic code storage area as business logic code. In the current plugin package of the development plugin, a code storage area and a code backup area are identified. The business logic code is added to the code storage area, and the historical business logic code in the code storage area is moved to the code backup area. The historical business logic code stored in the code backup area is used for version rollback of the development plugin. A prompt message is sent to the host module in the current plugin package through the package management service module built into the current plugin package to notify the host module that updated business logic code is available. After receiving the prompt message, the host module determines that the development plugin has been updated by reading the version number file. The host module compiles the business logic code to obtain a target class file, loads the target class file, and creates a target object instance corresponding to the target class file in the current plugin package of the development plugin. From the historical object instances corresponding to the historical business logic code, historical object instances with a common parent class with the target object instance are selected, and the historical object instances are replaced with the target object instance to hot-load the updated development plugin, so that the updated development plugin can use the updated functions without restarting.
6. An electronic device, characterized in that, It includes a processor and a memory, the memory storing an application program, and the processor running the application program within the memory to perform the steps of the plug-in update method according to any one of claims 1 to 4.
7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the plug-in update method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the plug-in update method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Client application service logic updating method and device and equipment
CN104598266A
Service plug-in management method and system
CN106708547A
Project code information updating deployment method and device
CN107193615A