CN112306516A - Method and apparatus for updating code - Google Patents

Method and apparatus for updating code Download PDF

Info

Publication number
CN112306516A
CN112306516A CN202010111872.0A CN202010111872A CN112306516A CN 112306516 A CN112306516 A CN 112306516A CN 202010111872 A CN202010111872 A CN 202010111872A CN 112306516 A CN112306516 A CN 112306516A
Authority
CN
China
Prior art keywords
code
new
function
main module
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010111872.0A
Other languages
Chinese (zh)
Other versions
CN112306516B (en
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010111872.0A priority Critical patent/CN112306516B/en
Publication of CN112306516A publication Critical patent/CN112306516A/en
Application granted granted Critical
Publication of CN112306516B publication Critical patent/CN112306516B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

Embodiments of the present disclosure disclose methods and apparatus for updating code. One embodiment of the method comprises: acquiring a main module code from an object code warehouse, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code; in response to detecting that the function code in the main module code is updated to a new function code, updating the identification code to a new identification code, wherein the new identification code is used for representing a new sub-module code corresponding to the new function code; generating a new main module code by using the new function code and the new identification code; the new master module code is stored to the object code repository. The implementation method can ensure the normal operation of the software codes and improve the code updating efficiency.

Description

Method and apparatus for updating code
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and an apparatus for updating code.
Background
Application software (e.g., chat software) typically includes a main module for implementing software basic functions (e.g., conversation functions) and sub-modules for implementing additional functions (e.g., dynamic sharing functions). The sub-modules of the application software can be developed individually by developers. After the development of the sub-modules is completed, a binding relationship between the main module and the sub-modules is usually established when the main module of the application software is developed, so that the main module can call the bound sub-modules during running, and further, the basic function and the additional function of the software are realized.
Disclosure of Invention
Embodiments of the present disclosure propose methods and apparatuses for updating code.
In a first aspect, an embodiment of the present disclosure provides a method for updating code, the method including: acquiring a main module code from an object code warehouse, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code; in response to detecting that the function code in the main module code is updated to a new function code, updating the identification code to a new identification code, wherein the new identification code is used for representing a new sub-module code corresponding to the new function code; generating a new main module code by using the new function code and the new identification code; the new master module code is stored to the object code repository.
In some embodiments, generating the new main module code using the new function code and the new identification code comprises: and generating a new main module code meeting the preset condition by using the new function code and the new identification code.
In some embodiments, generating a new main module code satisfying a preset condition using the new function code and the new identification code includes: generating a candidate code by using the new function code and the new identification code; determining whether the candidate codes meet preset conditions; in response to determining that the candidate code satisfies a preset condition, the candidate code is determined as a new master module code.
In some embodiments, generating a new main module code satisfying a preset condition using the new function code and the new identification code further comprises: in response to determining that the candidate code does not satisfy the preset condition, adjusting the candidate code so that the adjusted candidate code satisfies the preset condition; and determining the adjusted candidate code as the new main module code.
In some embodiments, the preset conditions include at least one of: the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification.
In some embodiments, in response to detecting that the function code in the main module code is updated to a new function code, updating the identification code to the new identification code comprises: in response to detecting with the pre-installed hook that the function code in the main module code is updated to a new function code, the identification code is updated with the hook to the new identification code.
In a second aspect, an embodiment of the present disclosure provides an apparatus for updating code, the apparatus including: the acquisition unit is configured to acquire a main module code from the object code warehouse, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code; an updating unit configured to update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to the new function code, wherein the new identification code is used for representing a new sub-module code corresponding to the new function code; a generating unit configured to generate a new main module code using the new function code and the new identification code; a storage unit configured to store the new master module code to the object code repository.
In some embodiments, the generating unit is further configured to: and generating a new main module code meeting the preset condition by using the new function code and the new identification code.
In some embodiments, the generating unit comprises: a generation module configured to generate a candidate code using the new function code and the new identification code; a first determination module configured to determine whether the candidate code satisfies a preset condition; a second determination module configured to determine the candidate code as a new main module code in response to determining that the candidate code satisfies a preset condition.
In some embodiments, the generating unit further comprises: an adjustment module configured to adjust the candidate code so that the adjusted candidate code satisfies a preset condition in response to determining that the candidate code does not satisfy the preset condition; a third determination module configured to determine the adjusted candidate code as a new main module code.
In some embodiments, the preset conditions include at least one of: the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification.
In some embodiments, the update unit is further configured to: in response to detecting with the pre-installed hook that the function code in the main module code is updated to a new function code, the identification code is updated with the hook to the new identification code.
In a third aspect, an embodiment of the present disclosure provides a terminal device, including: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method of any of the embodiments of the method for updating code described above.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, which when executed by a processor, implements the method of any of the above-described methods for updating code.
In the prior art, a developer may develop a new version for a main module of application software, and in order to enable the application software to operate normally, the developer may manually adjust sub-modules bound by the main module to the new version sub-modules matched with the new version main module.
The method and apparatus for updating code provided by the embodiments of the present disclosure may update an identification code in a main module code to a new identification code automatically when a function code in the main module code is updated to a new function code by acquiring the main module code from an object code repository, wherein the main module code includes an identification code and a function code for implementing a function of the main module, the identification code is used to characterize a sub-module code corresponding to the new function code, then generating a new main module code using the new function code and the new identification code, and finally storing the new main module code to the object code repository in response to detecting that the function code in the main module code is updated to the new function code, compared with an artificial updating mode in the prior art, the embodiment of the disclosure can improve the code updating efficiency and reduce the consumption of human resources while ensuring the normal operation of the software codes.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method for updating code, according to the present disclosure;
FIG. 3 is a schematic diagram of one application scenario of a method for updating code in accordance with an embodiment of the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method for updating code according to the present disclosure;
FIG. 5 is a schematic diagram illustrating one embodiment of an apparatus for updating code according to the present disclosure;
FIG. 6 is a block diagram of a computer system suitable for use with a terminal device implementing an embodiment of the disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the disclosed method for updating code or apparatus for updating code may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various client applications, such as code management type applications, web browser applications, search type applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices, including but not limited to smart phones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg Audio Layer 4), laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as a code management server that manages codes submitted by the terminal apparatuses 101, 102, 103. The code management server can manage the received data such as the new master module code, for example, by storing the data.
It should be noted that the method for updating the code provided by the embodiment of the present disclosure is generally executed by the terminal device 101, 102, 103, and accordingly, the apparatus for updating the code is generally disposed in the terminal device 101, 102, 103.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for updating code in accordance with the present disclosure is shown. The method for updating the code comprises the following steps:
in step 201, the main module code is obtained from the object code repository.
In this embodiment, an executing agent (e.g., the terminal device shown in fig. 1) of the method for updating the code may acquire the main module code from the object code repository through a wired connection or a wireless connection. Wherein the object code repository may be a code repository in which the master module code is to be updated. The object code repository may correspond to application software for storing code of the corresponding application software.
Specifically, the object code repository may be a code repository established by a developer for application software. As an example, the object code repository may be a Git repository that developers build for chat software. Git is an open-source distributed version control system for efficient, high-speed processing of very small to very large project version management. The Git repository is used to store the code corresponding to a particular version of an item (i.e., application software).
In practice, the target code repository may be a code repository provided on the execution main body, or may be a code repository provided on an electronic device communicatively connected to the execution main body.
In this embodiment, the main module code may include an identification code and a function code for realizing the function of the main module. The master module function may be a base function (e.g., a conversation function) developed by a developer for application software (e.g., chat software). The identification code may be used to characterize the sub-module code to which the function code corresponds. The sub-module code may be used to implement additional functionality of the application software (e.g., dynamic sharing functionality). The sub-module code corresponding to the function code may be a sub-module code whose corresponding version matches the version of the function code.
In response to detecting that the function code in the main module code is updated to a new function code, the identification code is updated to a new identification code, step 202.
In this embodiment, the execution agent may update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to a new function code. And the new identification code is used for representing a new sub-module code corresponding to the new function code. The new function code matches the new sub-module code to which it corresponds.
It will be appreciated that a developer may develop different versions for software, and that the versions of the main module and the sub-modules in the software should be matched. For example, a developer may predetermine that the v1 version of the master module matches the v1 version of the slave module; the v2 version of the master module matches the v2 version of the slave module. Furthermore, when the master module is updated from the v1 version to the v2 version, the sub-modules should be updated from the v1 version to the v2 version, so as to facilitate the normal operation of the software.
In this embodiment, the developer may set an identification code in the main module code for characterizing the sub-module matching the main module. The identification code may include an identification (e.g., a code id of the sub-module) uniquely characterizing the sub-module matching the main module, and when detecting that the function code in the main module code is updated to a new function code, the execution subject may update the identification code to the new identification code, so as to adjust the correspondence between the main module in the original version and the sub-module in the original version to the correspondence between the main module in the new version and the sub-module in the new version.
Specifically, the execution subject may update the identification code to a new identification code by using various methods. As an example, the execution subject may obtain a code id of a new version sub-module matching the new version main module from the target code repository, and then modify the code id of the original sub-module in the original identification code into the code id of the new sub-module, so as to obtain the new identification code.
In some optional implementations of this embodiment, the executing may update the identification code to the new identification code using the hook in response to detecting that the function code in the main module code is updated to the new function code using the pre-installed hook.
In practice, hook (hook) technology is a technology that intercepts messages of a certain process and performs custom processing on the messages. The developer can develop hook software for a certain interception process. The hook software may record rules for intercepting information and processing information. And when the information to be intercepted is detected, the hook software can intercept the information and process the information.
In this implementation, a developer may develop a hook for intercepting a new function code and install the hook on the execution body, and the execution body may detect the new function code using the installed hook, and update the identification code in the main module code to a new identification code when the new function code is detected.
It should be noted that, when the object code repository is a Git repository, the hook may be a Git hook (i.e., Git hook).
Step 203, a new main module code is generated by using the new function code and the new identification code.
In this embodiment, the execution agent may generate a new main module code by using the new function code and the new identification code.
Specifically, the execution subject may directly determine a code composed of the new function code and the new identification code as a new main module code; alternatively, the execution subject may adjust the new function code and the new identification code (for example, adjust the formats of the new function code and the new identification code), and determine a code composed of the adjusted new function code and the new identification code as a new main module code.
Step 204, store the new master module code to the object code repository.
In this embodiment, based on the new main module code obtained in step 203, the executing entity may store the new main module code into the target code repository.
Specifically, if the object code repository is a code repository provided in an electronic device communicatively connected to the execution main unit, after the execution main unit obtains a new main module code, the execution main unit may send the new main module code to the communicatively connected electronic device, so that the electronic device stores the new main module code in the object code repository.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for updating code according to the present embodiment. In the application scenario of fig. 3, first, the terminal 301 may obtain the main module code 303 from an object code repository of the server 302, where the main module code 303 includes an identification code 3031 and a function code 3032 for implementing a function of the main module, and the identification code 3031 is used to characterize a sub-module code corresponding to the function code 3032. Then, the terminal 301 may update the identification code 3032 to a new identification code 3042 in response to detecting that the function code 3031 in the main module code 303 is updated to the new function code 3041, wherein the new identification code 3042 is used to characterize a new sub-module code corresponding to the new function code 3041. Next, the terminal 301 may generate a new main module code 304 using the new function code 3041 and the new identification code 3042. Finally, the terminal 301 may send the new master module code 304 to the server 302 to store the new master module code 304 to the object code repository.
Compared with the manual updating mode in the prior art, the method provided by the embodiment of the disclosure can improve the code updating efficiency and reduce the consumption of human resources while ensuring the normal operation of software codes.
With further reference to FIG. 4, a flow 400 of yet another embodiment of a method for updating code is shown. The process 400 of the method for updating code includes the steps of:
step 401, the master module code is obtained from the object code repository.
In this embodiment, an executing agent (e.g., the terminal device shown in fig. 1) of the method for updating the code may acquire the main module code from the object code repository through a wired connection or a wireless connection. Wherein the object code repository may be a code repository in which the master module code is to be updated. The object code repository may correspond to application software for storing code of the corresponding application software.
In this embodiment, the main module code may include an identification code and a function code for realizing the function of the main module. The master module functionality may be the basic functionality developed by the developer for the application software. The identification code may be used to characterize the sub-module code to which the function code corresponds. The sub-module code may be used to implement additional functionality of the application software. The sub-module code corresponding to the function code may be a sub-module code whose corresponding version matches the version of the function code.
In response to detecting that the function code in the main module code is updated to a new function code, the identification code is updated to a new identification code, step 402.
In this embodiment, the execution agent may update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to a new function code. And the new identification code is used for representing a new sub-module code corresponding to the new function code. The new function code matches the new sub-module code to which it corresponds.
In this embodiment, the developer may set an identification code in the main module code for characterizing the sub-module matching the main module. The identification code may include an identification for uniquely characterizing the sub-module matched with the main module, and the execution main body may update the identification code to be a new identification code when detecting that the function code in the main module code is updated to be a new function code, so as to adjust the correspondence between the main module of the original version and the sub-module of the original version to be the correspondence between the main module of the new version and the sub-module of the new version.
And step 403, generating a new main module code meeting the preset conditions by using the new function code and the new identification code.
In this embodiment, the execution agent may generate a new main module code satisfying a preset condition by using the new function code and the new identification code. The preset condition may be a condition predetermined by a developer and used for performing normalization processing on the code to be stored in the target code repository.
In some optional implementations of this embodiment, the preset condition may include, but is not limited to, at least one of: the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification. The preset format may be used for a writing format of the specification code, for example, for line feed of the specification code. The pre-set code specification may be used to specify the way the code is written. Such as a writing style for specifying loop statements.
In some optional implementations of this embodiment, with the new function code and the new identification code, the execution subject may generate a new main module code that satisfies the preset condition by: first, the execution agent may generate a candidate code using the new function code and the new identification code. Then, the execution subject may determine whether the candidate code satisfies a preset condition. Finally, the execution agent may determine the candidate code as a new main module code in response to determining that the candidate code satisfies a preset condition.
Specifically, the execution subject may directly determine a code composed of the new function code and the new identification code as the candidate code.
In some optional implementation manners of this embodiment, the execution subject may further adjust the candidate code in response to determining that the candidate code does not satisfy the preset condition, so that the adjusted candidate code satisfies the preset condition. Finally, the adjusted candidate code is determined as the new master module code.
Here, the execution subject may adjust the candidate code in various ways based on a preset condition. For example, the preset condition is that the code does not include a character. The execution subject may delete the characters included in the candidate code to obtain an adjusted candidate code, and then determine the adjusted candidate code as a new main module code.
In particular, the execution subject may also adjust the candidate code using a hook installed in advance. Specifically, the developer may record a rule for adjusting the code in the hook in advance. The hook can intercept and capture the candidate codes which do not meet the preset condition, and adjust the candidate codes based on the pre-recorded code adjustment rule to obtain the adjusted candidate codes which meet the preset condition as new main module codes.
At step 404, the new master module code is stored to the object code repository.
In this embodiment, based on the new main module code obtained in step 403, the executing entity may store the new main module code into the target code repository.
Step 401, step 402, and step 404 may be performed in a manner similar to that of step 201, step 202, and step 204 in the foregoing embodiment, respectively, and the above description for step 201, step 202, and step 204 also applies to step 401, step 402, and step 404, and is not described herein again.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for updating code in the present embodiment highlights the step of generating a new main module code satisfying the preset condition by using the new function code and the new identification code. Therefore, the scheme described in this embodiment can offer new main module codes meeting the preset conditions to the code warehouse, so that the code standardization in the code warehouse can be improved, the process of code management is facilitated to be simplified, and the maintenance cost of the codes is reduced.
With further reference to fig. 5, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for updating code, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the apparatus 500 for updating code of the present embodiment includes: an acquisition unit 501, an update unit 502, a generation unit 503, and a storage unit 504. The obtaining unit 501 is configured to obtain a main module code from the object code repository, where the main module code includes an identification code and a function code for implementing a function of the main module, and the identification code is used to characterize a sub-module code corresponding to the function code; the updating unit 502 is configured to update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to a new function code, wherein the new identification code is used to characterize a new sub-module code corresponding to the new function code; the generation unit 503 is configured to generate a new main module code using the new function code and the new identification code; the storage unit 504 is configured to store the new master module code to the object code repository.
In this embodiment, the obtaining unit 501 of the apparatus 500 for updating codes may obtain the main module code from the object code repository through a wired connection manner or a wireless connection manner. Wherein the object code repository may be a code repository in which the master module code is to be updated. The object code repository may correspond to application software for storing code of the corresponding application software.
In this embodiment, the main module code may include an identification code and a function code for realizing the function of the main module. The master module functionality may be the basic functionality developed by the developer for the application software. The identification code may be used to characterize the sub-module code to which the function code corresponds. The sub-module code may be used to implement additional functionality of the application software. The sub-module code corresponding to the function code may be a sub-module code whose corresponding version matches the version of the function code.
In this embodiment, the updating unit 502 may update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to the new function code. And the new identification code is used for representing a new sub-module code corresponding to the new function code. The new function code matches the new sub-module code to which it corresponds.
In this embodiment, the developer may set an identification code in the main module code for characterizing the sub-module matching the main module. The identification code may include an identification for uniquely characterizing the sub-module that matches the master module.
In this embodiment, the generation unit 503 may generate a new main module code using the new function code and the new identification code described above.
In this embodiment, based on the new main module code obtained by the generating unit 503, the storing unit 504 may store the new main module code to the target code repository.
In some optional implementations of this embodiment, the generating unit 503 is further configured to: and generating a new main module code meeting the preset condition by using the new function code and the new identification code.
In some optional implementations of this embodiment, the generating unit 503 includes: a generating module (not shown in the figure) configured to generate a candidate code using the new function code and the new identification code; a first determining module (not shown in the figure) configured to determine whether the candidate code satisfies a preset condition; a second determining module (not shown in the figure) configured to determine the candidate code as the new main module code in response to determining that the candidate code satisfies a preset condition.
In some optional implementations of this embodiment, the generating unit 503 further includes: an adjusting module (not shown in the figure) configured to adjust the candidate code so that the adjusted candidate code satisfies the preset condition in response to determining that the candidate code does not satisfy the preset condition; a third determining module (not shown in the figure) configured to determine the adjusted candidate code as the new main module code.
In some optional implementations of this embodiment, the preset condition includes at least one of: the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification.
In some optional implementations of this embodiment, the updating unit 502 is further configured to: in response to detecting with the pre-installed hook that the function code in the main module code is updated to a new function code, the identification code is updated with the hook to the new identification code.
It will be understood that the elements described in the apparatus 500 correspond to various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 500 and the units included therein, and are not described herein again.
Compared with the manual updating mode in the prior art, the apparatus 500 provided by the above embodiment of the present disclosure can automatically update the identification code in the main module code to the new identification code matched with the new function code when the function code in the main module code is updated to the new function code, and compared with the manual updating mode in the prior art, the embodiment of the present disclosure can improve the efficiency of code updating and reduce the consumption of human resources while ensuring the normal operation of software codes.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., the terminal device of fig. 1) 600 suitable for implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a main module code from an object code warehouse, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code; in response to detecting that the function code in the main module code is updated to a new function code, updating the identification code to a new identification code, wherein the new identification code is used for representing a new sub-module code corresponding to the new function code; generating a new main module code by using the new function code and the new identification code; the new master module code is stored to the object code repository.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation on the unit itself, for example, the acquiring unit may also be described as a "unit acquiring the master module code".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (14)

1. A method for updating code, comprising:
acquiring a main module code from an object code warehouse, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code;
in response to detecting that the function code in the main module code is updated to a new function code, updating the identification code to a new identification code, wherein the new identification code is used for characterizing a new sub-module code corresponding to the new function code;
generating a new main module code by using the new function code and the new identification code;
storing the new master module code to the object code repository.
2. The method of claim 1, wherein said generating a new main module code using said new function code and a new identification code comprises:
and generating a new main module code meeting preset conditions by using the new function code and the new identification code.
3. The method according to claim 2, wherein the generating a new main module code satisfying a preset condition using the new function code and the new identification code comprises:
generating a candidate code by using the new function code and the new identification code;
determining whether the candidate code meets a preset condition;
in response to determining that the candidate code satisfies a preset condition, determining the candidate code as a new master module code.
4. The method according to claim 3, wherein said generating a new main module code satisfying a preset condition using said new function code and new identification code further comprises:
in response to determining that the candidate code does not satisfy a preset condition, adjusting the candidate code so that the adjusted candidate code satisfies the preset condition;
and determining the adjusted candidate code as the new main module code.
5. The method of claim 2, wherein the preset conditions include at least one of:
the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification.
6. The method according to one of claims 1-5, wherein said updating the identification code to a new identification code in response to detecting that the function code in the main module code is updated to a new function code comprises:
in response to detecting with a pre-installed hook that a function code in the main module code is updated to a new function code, updating with the hook the identification code to a new identification code.
7. An apparatus for updating code, comprising:
the obtaining unit is configured to obtain a main module code from an object code repository, wherein the main module code comprises an identification code and a function code for realizing the function of the main module, and the identification code is used for representing a sub-module code corresponding to the function code;
an updating unit configured to update the identification code to a new identification code in response to detecting that the function code in the main module code is updated to a new function code, wherein the new identification code is used for characterizing a new sub-module code corresponding to the new function code;
a generating unit configured to generate a new main module code using the new function code and the new identification code;
a storage unit configured to store the new master module code to the object code repository.
8. The apparatus of claim 7, wherein the generating unit is further configured to:
and generating a new main module code meeting preset conditions by using the new function code and the new identification code.
9. The apparatus of claim 8, wherein the generating unit comprises:
a generation module configured to generate a candidate code using the new function code and the new identification code;
a first determination module configured to determine whether the candidate code satisfies a preset condition;
a second determination module configured to determine the candidate code as a new main module code in response to determining that the candidate code satisfies a preset condition.
10. The apparatus of claim 9, wherein the generating unit further comprises:
an adjustment module configured to adjust the candidate code so that the adjusted candidate code satisfies a preset condition in response to determining that the candidate code does not satisfy the preset condition;
a third determination module configured to determine the adjusted candidate code as a new main module code.
11. The apparatus of claim 8, wherein the preset condition comprises at least one of:
the format of the code is a preset format; the code does not include characters; the code conforms to a preset code specification.
12. The apparatus according to one of claims 7-11, wherein the updating unit is further configured to:
in response to detecting with a pre-installed hook that a function code in the main module code is updated to a new function code, updating with the hook the identification code to a new identification code.
13. A terminal device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202010111872.0A 2020-02-24 2020-02-24 Method and apparatus for updating code Active CN112306516B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010111872.0A CN112306516B (en) 2020-02-24 2020-02-24 Method and apparatus for updating code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010111872.0A CN112306516B (en) 2020-02-24 2020-02-24 Method and apparatus for updating code

Publications (2)

Publication Number Publication Date
CN112306516A true CN112306516A (en) 2021-02-02
CN112306516B CN112306516B (en) 2024-08-16

Family

ID=74336652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010111872.0A Active CN112306516B (en) 2020-02-24 2020-02-24 Method and apparatus for updating code

Country Status (1)

Country Link
CN (1) CN112306516B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110321024A1 (en) * 2010-06-28 2011-12-29 Nokia Corporation Method and apparatus for updating an executing application
CN105094780A (en) * 2014-05-14 2015-11-25 国际商业机器公司 Information correlation method and device
CN107193615A (en) * 2017-06-29 2017-09-22 北京全域医疗技术有限公司 The renewal dispositions method and device of item code information
US20180114025A1 (en) * 2016-10-20 2018-04-26 International Business Machines Corporation Code package processing
CN109002295A (en) * 2018-10-19 2018-12-14 武汉斗鱼网络科技有限公司 A kind of static code scan method, system, server and storage medium
CN110175043A (en) * 2019-06-18 2019-08-27 广州华多网络科技有限公司 The generation method and device of protocol interface code release update notification
CN110704309A (en) * 2019-09-12 2020-01-17 上海麦克风文化传媒有限公司 Automatic code quality inspection method and system
CN110795326A (en) * 2018-08-01 2020-02-14 武汉斗鱼网络科技有限公司 Code interception detection method, storage medium, electronic device and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110321024A1 (en) * 2010-06-28 2011-12-29 Nokia Corporation Method and apparatus for updating an executing application
CN105094780A (en) * 2014-05-14 2015-11-25 国际商业机器公司 Information correlation method and device
US20180114025A1 (en) * 2016-10-20 2018-04-26 International Business Machines Corporation Code package processing
CN107193615A (en) * 2017-06-29 2017-09-22 北京全域医疗技术有限公司 The renewal dispositions method and device of item code information
CN110795326A (en) * 2018-08-01 2020-02-14 武汉斗鱼网络科技有限公司 Code interception detection method, storage medium, electronic device and system
CN109002295A (en) * 2018-10-19 2018-12-14 武汉斗鱼网络科技有限公司 A kind of static code scan method, system, server and storage medium
CN110175043A (en) * 2019-06-18 2019-08-27 广州华多网络科技有限公司 The generation method and device of protocol interface code release update notification
CN110704309A (en) * 2019-09-12 2020-01-17 上海麦克风文化传媒有限公司 Automatic code quality inspection method and system

Also Published As

Publication number Publication date
CN112306516B (en) 2024-08-16

Similar Documents

Publication Publication Date Title
CN107302597B (en) Message file pushing method and device
CN110809189B (en) Video playing method and device, electronic equipment and computer readable medium
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN110704833A (en) Data permission configuration method, device, electronic device and storage medium
CN111694629A (en) Information display method and device and electronic equipment
CN110288625B (en) Method and apparatus for processing image
CN110619101B (en) Method and apparatus for processing information
CN110708238B (en) Method and apparatus for processing information
CN110442416B (en) Method, electronic device and computer-readable medium for presenting information
CN112307393A (en) Information issuing method and device and electronic equipment
CN111626802A (en) Method and apparatus for processing information
CN112306516B (en) Method and apparatus for updating code
CN114237819A (en) Method and device for processing based on Java virtual machine and electronic equipment
CN111367592B (en) Information processing method and device
CN110619079B (en) Method and device for pushing information
CN113568695A (en) Corner mark processing method and device for boarder application
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN112311842A (en) Method and device for information interaction
CN111294657A (en) Information processing method and device
CN111787043A (en) Data request method and device
CN111291254A (en) Information processing method and device
CN113778387B (en) Method and device for generating code
CN114253520B (en) Interface code generation method and device
CN114513548B (en) Directional call information processing method and device
CN111294321B (en) Information processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant