Adaptation method of application programming interface and related equipment

By using API association information in the message center to automatically analyze and process API call differences, the problem of long adaptation time and low efficiency caused by API interface changes after SDK upgrade is solved, and the rapid automatic adaptation of API interfaces is achieved.

CN119987903APending Publication Date: 2025-05-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311508737.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

After the Software Development Toolkit (SDK) is upgraded, the application programming interface (API) interface in the source engineering code may change, resulting in developers needing to manually analyze and modify the API interface, resulting in long adaptation time and inefficient efficiency.

Method used

By creating a message center, the API's association information is used to automatically analyze and process API call differences, and the API's automatic adaptation and modification are achieved.

Benefits of technology

It shortens the API interface adaptation and modification time, improves the API interface adaptation efficiency, and reduces the need for developers to manually modify.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987903A_ABST
    Figure CN119987903A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an application programming interface adaptation method and related equipment, and the method comprises the steps: responding to an instruction for upgrading a software development kit in a source engineering code, and upgrading the software development kit in the source engineering code; compiling a source engineering code based on the upgraded software development kit; analyzing and processing the calling of the application programming interface in the source engineering code by utilizing the associated information of the application programming interface in the message center to obtain an analysis result; the analysis result is used for indicating the calling difference of the application programming interface before and after the software development kit is upgraded; according to the method, the application programming interface in the source engineering code is modified, adapted and compiled to obtain the target language code corresponding to the source engineering code based on the calling difference, so that the application programming interface in the source engineering code can be automatically adapted and modified, the application programming interface adaptation time is shortened, and the user experience is improved. And the adaptation efficiency of the application programming interface is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer equipment, and in particular to an application programming interface adaptation method and related equipment. Background Art

[0002] Currently, for application developers, developing a fully functional application requires the help of a third-party framework, which is also called a software development kit (SDK) on the client side. However, with changes in operating system upgrades, market demand, and private delivery, the SDK needs to be upgraded, which may cause the API interface in the source engineering code obtained by business development based on the SDK to change. At this time, the developer needs to analyze the API interface in the source engineering code based on the upgraded SDK and manually modify and adapt the API interface in the source engineering code, which leads to problems such as long API interface adaptation time and low adaptation efficiency. Summary of the invention

[0003] The embodiment of the present application provides an application programming interface adaptation method and related equipment, which can automatically adapt and modify the application programming interface in the source engineering code, shorten the application programming interface adaptation time, and improve the application programming interface adaptation efficiency.

[0004] On the one hand, an embodiment of the present application provides an application programming interface adaptation method, the method comprising:

[0005] In response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called;

[0006] Compile source engineering code based on the upgraded software development kit;

[0007] In the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed by using the associated information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface;

[0008] Based on the calling differences, the application programming interface in the source project code is modified and adapted, and compiled to obtain the target language code corresponding to the source project code.

[0009] In some implementations, the application programming interface association information includes a data type of the application programming interface, and the data type of the application programming interface is obtained by pre-mapping the original data type of the application programming interface; the call difference includes a data type difference; in the process of compiling the source project code, the application programming interface association information in the message center is used to analyze and process the call of the application programming interface in the source project code to obtain the analysis result, including:

[0010] In the process of compiling source project code, the application programming interface is called;

[0011] Using a data type extraction script to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface; the data type of the application programming interface is obtained by mapping the original data type of the application programming interface;

[0012] Passing data generated when the API is called based on the data type;

[0013] If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface is determined based on the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded.

[0014] In some implementations, based on the call differences, the application programming interface in the source project code is modified and adapted, including:

[0015] Based on the data type difference, the original data type of the application programming interface is verified and modified using the upgraded data type of the application programming interface in the upgraded software development kit.

[0016] In some implementations, the associated information of the application programming interface includes a derived subclass of the application programming interface and a target pointer; the derived subclass is derived from an abstract class generated based on the application programming interface, and in the process of compiling the source project code, the associated information of the application programming interface in the message center is used to analyze and process the call of the application programming interface in the source project code to obtain the analysis results, including:

[0017] In the process of compiling the source project code, the derived subclass is used to simulate the call of the upgraded software development toolkit to the application programming interface in the source project code to obtain the simulated call result;

[0018] If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, the target pointer is used to forward the message to the application programming interface to obtain the forwarding result;

[0019] Data analysis is performed based on the forwarding result to obtain analysis results.

[0020] In some implementations, the derived subclass maintains a cache list, and the cache list maintains the application programming interfaces called by the derived subclass during the compilation cycle;

[0021] By using the derived subclass, the upgraded software development kit is simulated to call the application programming interface in the source project code, and the simulated call results are obtained, including:

[0022] Using the derived subclass, the application programming interface is searched from the cache list maintained by the derived subclass for calling;

[0023] Add the instantiated object of the derived subclass to the cache pool, and set the state attribute of the instantiated object to the working state; the cache pool is used to provide a reuse environment for the instantiated objects of the derived subclass;

[0024] If the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulated call result indicating that the derived subclass failed to simulate calling the application programming interface is obtained.

[0025] In some implementations, the derived subclass corresponds to a parent class, the parent class maintains a cache list, and the target pointer is used to forward the message to the application programming interface to obtain a forwarding result, including:

[0026] Get the instantiated object from the cache pool;

[0027] If the attribute status of the instantiated object is in the working state, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center for calling;

[0028] If the application programming interface is not found in the cache list maintained by the parent class and the parent class is an abstract class of the application programming interface, a forwarding result indicating that the application programming interface is deleted or replaced in the upgraded software development kit is obtained.

[0029] In some implementations, a derived subclass has a corresponding binding function, which is used to pass parameters related to the derived subclass to the parent class of the derived subclass, and to search for an application programming interface from a cache list maintained by the parent class of the derived subclass through a target pointer in the message center for calling, including:

[0030] The parameters related to the derived subclass are passed to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass;

[0031] Through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass based on the parameters passed in by the bound function for calling.

[0032] In some implementations, the method further includes:

[0033] Before compiling the source project code, obtaining the application programming interface in the source project code;

[0034] Generate abstract classes based on the application programming interface;

[0035] Based on the abstract class, derive the corresponding derived subclass of the abstract class; and,

[0036] Create a message center for the application programming interface.

[0037] In some implementations, the method further includes:

[0038] During the source project code compilation cycle, the application programming interface called for the first time by the derived subclass is added to the cache list maintained by the derived subclass;

[0039] Store the cache list maintained by the derived subclass into the message center.

[0040] In some implementations, the analysis result includes interface differences, and data analysis is performed based on the forwarding result to obtain the analysis result, including:

[0041] If the forwarding result is used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit, a syntax analyzer is used to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application;

[0042] If no application programming interface is found in the upgraded software development kit through the abstract syntax tree, a differential calculation is performed on the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of the application programming interface before and after the software development kit is upgraded.

[0043] In some implementations, a syntax analyzer is used to construct a syntax tree for an application programming interface to obtain an abstract syntax tree of the application, including:

[0044] A syntax analyzer is used to scan the application programming interface call and segment the application programming interface call into a sequence of lexical units;

[0045] According to the mapped grammatical rules, the lexical unit sequence is processed to generate a grammatical tree to obtain an abstract syntax tree of the application programming interface; the grammatical rules are obtained by matching the grammatical rules of the application programming interface using regular expressions before compiling the source engineering code.

[0046] In some implementations, based on the call differences, the application programming interface in the source project code is modified and adapted, including:

[0047] Determine a target application programming interface for replacing the application programming interface in the source engineering code based on the interface differences;

[0048] According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface.

[0049] In some implementations, the method further includes:

[0050] If the application programming interface in the upgraded software development kit has restrictions on the range of operating system versions, the abstract syntax tree corresponding to the corresponding application programming interface in the source project code is modified according to the restricted operating system version.

[0051] In some implementations, the method further includes:

[0052] An upgrade completion notification is sent to the development object corresponding to the source project code. The upgrade completion notification is used to notify the development object that the software development tool kit upgrade is complete and the source project code compilation is complete.

[0053] On the one hand, an embodiment of the present application provides an application programming interface adaptation device, the device comprising:

[0054] An upgrading unit, configured to upgrade the software development kit in the source engineering code in response to an instruction to upgrade the software development kit in the source engineering code; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called;

[0055] A processing unit for compiling source engineering codes based on an upgraded software development kit;

[0056] The processing unit is further used to analyze and process the call of the application programming interface in the source engineering code by using the associated information of the application programming interface in the message center during the compilation of the source engineering code to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface;

[0057] The processing unit is also used to modify and adapt the application programming interface in the source engineering code based on the call difference, and compile to obtain the target language code corresponding to the source engineering code.

[0058] In some implementations, the associated information of the application programming interface includes a data type of the application programming interface, where the data type of the application programming interface is obtained by pre-mapping the original data type of the application programming interface; the call difference includes a data type difference; and the processing unit is specifically configured to:

[0059] In the process of compiling source project code, the application programming interface is called;

[0060] Using a data type extraction script to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface; the data type of the application programming interface is obtained by mapping the original data type of the application programming interface;

[0061] Passing data generated when the API is called based on the data type;

[0062] If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface is determined based on the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded.

[0063] In some implementations, the processing unit is specifically configured to:

[0064] Based on the data type difference, the original data type of the application programming interface is verified and modified using the upgraded data type of the application programming interface in the upgraded software development kit.

[0065] In some implementations, the associated information of the application programming interface includes a derived subclass and a target pointer of the application programming interface; the derived subclass is derived from an abstract class generated based on the application programming interface; and the processing unit is specifically configured to:

[0066] In the process of compiling the source engineering code, the derived subclass is used to simulate the call of the upgraded software development toolkit to the application programming interface in the source engineering code to obtain the simulated call result;

[0067] If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, the target pointer is used to forward the message to the application programming interface to obtain the forwarding result;

[0068] Data analysis is performed based on the forwarding result to obtain analysis results.

[0069] In some implementations, the derived subclass maintains a cache list, and the cache list maintains application programming interfaces called by the derived subclass during the compilation cycle; the processing unit is specifically used to:

[0070] Using the derived subclass, the application programming interface is searched from the cache list maintained by the derived subclass for calling;

[0071] Add the instantiated object of the derived subclass to the cache pool, and set the state attribute of the instantiated object to the working state; the cache pool is used to provide a reuse environment for the instantiated objects of the derived subclass;

[0072] If the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulated call result indicating that the derived subclass failed to simulate calling the application programming interface is obtained.

[0073] In some implementations, a derived subclass corresponds to a parent class, and the parent class maintains a cache list and a processing unit, which is specifically used to:

[0074] Get the instantiated object from the cache pool;

[0075] If the attribute status of the instantiated object is in the working state, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center for calling;

[0076] If the application programming interface is not found in the cache list maintained by the parent class and the parent class is an abstract class of the application programming interface, a forwarding result indicating that the application programming interface is deleted or replaced in the upgraded software development kit is obtained.

[0077] In some implementations, a derived subclass corresponds to a binding function, and the binding function is used to pass parameters related to the derived subclass. The processing unit is specifically used to:

[0078] The parameters related to the derived subclass are passed to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass;

[0079] Through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass based on the parameters passed in by the bound function for calling.

[0080] In some implementations, the processing unit is further configured to:

[0081] Before compiling the source project code, obtaining the application programming interface in the source project code;

[0082] Generate abstract classes based on the application programming interface;

[0083] Based on the abstract class, derive the corresponding derived subclass of the abstract class; and,

[0084] Create a message center for the application programming interface.

[0085] In some implementations, the processing unit is further configured to:

[0086] During the source project code compilation cycle, the application programming interface called by the derived subclass is added to the cache list maintained by the derived subclass;

[0087] Store the cache list maintained by the derived subclass into the message center.

[0088] In some implementations, the analysis result includes interface differences, and the processing unit is specifically configured to:

[0089] If the forwarding result is used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit, a syntax analyzer is used to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application;

[0090] If no application programming interface is found in the upgraded software development kit through the abstract syntax tree, a differential calculation is performed on the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of the application programming interface before and after the software development kit is upgraded.

[0091] In some implementations, the processing unit is specifically configured to:

[0092] A syntax analyzer is used to scan the application programming interface call and segment the application programming interface call into a sequence of lexical units;

[0093] According to the mapped grammatical rules, the lexical unit sequence is processed to generate a grammatical tree to obtain an abstract syntax tree of the application programming interface; the grammatical rules are obtained by matching the grammatical rules of the application programming interface using regular expressions before compiling the source engineering code.

[0094] In some implementations, the processing unit is specifically configured to:

[0095] Determine a target application programming interface for replacing the application programming interface in the source engineering code based on the interface differences;

[0096] According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface.

[0097] In some implementations, the processing unit is further configured to:

[0098] If the application programming interface in the upgraded software development kit has restrictions on the range of operating system versions, the abstract syntax tree corresponding to the corresponding application programming interface in the source project code is modified according to the restricted operating system version.

[0099] In some implementations, the processing unit is further configured to:

[0100] An upgrade completion notification is sent to the development object corresponding to the source project code. The upgrade completion notification is used to notify the development object that the software development tool kit upgrade is complete and the source project code compilation is complete.

[0101] In one aspect, an embodiment of the present application provides a computer device, the computer device comprising:

[0102] a processor suitable for executing a computer program;

[0103] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the adaptation method of the application programming interface as described above is implemented.

[0104] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is loaded by a processor and executes the adaptation method of the application programming interface as described above.

[0105] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the adaptation method of the above-mentioned application programming interface is implemented.

[0106] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit that needs to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the association information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing association information of the application programming interface; based on the call difference, the application programming interface in the source engineering code is modified and adapted, and compiled to obtain the target language code corresponding to the source engineering code. It can be seen that in the embodiment of the present application, by creating a message center, virtual memory resources can be provided for processing and analyzing the application programming interface. In addition, the call to the application programming interface can be automatically analyzed and processed based on the associated information of the application programming interface, and the difference in the call to the application programming interface before and after the software development kit is upgraded can be obtained. Then, the application programming interface in the source engineering code can be automatically modified and adapted based on the call difference, without the need for the development object to analyze the API interface based on the upgraded software development kit and manually modify and adapt it. This greatly shortens the adaptation and modification time of the application programming interface and improves the adaptation efficiency of the application programming interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0107] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0108] Figure 1 A schematic diagram of the architecture of an application programming interface adaptation system provided in an embodiment of the present application;

[0109] Figure 2 A schematic diagram of a process for adapting and modifying an API interface in a source engineering code provided in an embodiment of the present application;

[0110] Figure 3 A flowchart of an application programming interface adaptation method provided in an embodiment of the present application;

[0111] Figure 4A flowchart of another method for adapting an application programming interface provided in an embodiment of the present application;

[0112] Figure 5 A schematic diagram of an API interface adaptation process provided in an embodiment of the present application;

[0113] Figure 6 A flowchart of another method for adapting an application programming interface provided in an embodiment of the present application;

[0114] Figure 7 A schematic diagram of the relationship between an abstract class and a derived subclass provided in an embodiment of the present application;

[0115] Figure 8 A schematic diagram of a process for searching an API interface provided in an embodiment of the present application;

[0116] Fig. 9 A flowchart of determining an adapted application programming interface when an application programming interface is replaced or modified is provided in an embodiment of the present application;

[0117] Fig.10a A schematic diagram of an abstract syntax tree provided in an embodiment of the present application;

[0118] Fig.10b A schematic diagram of another abstract syntax tree provided in an embodiment of the present application;

[0119] Fig.11 A schematic diagram of the structure of an application programming interface adapter device provided in an embodiment of the present application;

[0120] Fig.12 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0121] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0122] First, the relevant technical terms involved in the embodiments of the present application are explained.

[0123] 1. Software Development Kit (SDK)

[0124] SDK refers to a collection of development tools for building application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. The SDK in the embodiments of the present application may be an SDK provided by different manufacturers, or an SDK provided by various operating systems (such as iOS, Android, etc.). SDK may include SDKs that provide basic capabilities, which may include but are not limited to: SDKs with map functions, SDKs with positioning capabilities, SDKs with face recognition capabilities, and so on. Development objects (such as developers) can use these SDKs to develop services and obtain source engineering codes. For example, using these SDKs to develop payment services can obtain source engineering codes for implementing payment functions; for another example, using these SDKs to develop social-type services can obtain source engineering codes for implementing social types.

[0125] The SDK contains various application programming interfaces (API). The so-called API is a set of predefined functions and classes for implementing specific functions or services. For development objects, API provides a mechanism for sharing and reusing code libraries. In an embodiment of the present application, when the SDK is upgraded, it will affect the API interface in the SDK. The impact here includes replacing a certain API interface in the SDK with another API interface; deleting a certain API interface, and adding a certain API interface. Among them, deleting a certain API interface means that the interface function corresponding to the API interface in the SDK cannot be used, and adding an API interface means that the interface function corresponding to the API interface is added to the SDK. When the API interface in the SDK is affected by the SDK upgrade, it will cause API interface adaptation problems in the source engineering code obtained by business development on the SDK.

[0126] It should be understood that an API interface may be called multiple times in the compiled source project code, and an API interface may be bound to other API interfaces. In other words, when an API interface is called, the API interface will call other API interfaces.

[0127] 2. Compilation Principles

[0128] A source project code (i.e., code written in a high-level language) needs to be compiled by a compiler to output the target language code. The so-called target language code refers to the code that can be recognized by the machine. The target language code obtained after compilation can be packaged and installed and run on the client. The source project code is compiled by the compiler to output the target language code, which can be divided into five basic steps: lexical analysis, syntax analysis, semantic analysis, and generation of intermediate code, optimization, and generation of target language code. These are the basic steps and processes that every compiler must have. Through these five basic steps, the source project code can be compiled to output the target language code. Among them, the syntax analysis stage can include: ① Scan the calls of the API interface and divide the calls of the API interface into a sequence of lexical units. ② According to the grammatical rules, the lexical unit sequence is mapped into an abstract syntax tree.

[0129] In an embodiment of the present application, the syntax analysis stage in the compilation principle may be involved. In this syntax analysis stage, corresponding adaptation may be performed on errors or warnings generated by calling the API interface after the SDK is upgraded.

[0130] 3. Message Center

[0131] In an embodiment of the present application, the message center refers to a virtual memory resource created for the API interface in the source project code. The associated information of the API interface can be stored in the message center. The associated information here may include, but is not limited to: an abstract class generated in advance based on the API interface in the source project code before compiling the source project code, a derived subclass derived based on the abstract class, a data type obtained by pre-mapping the original data type of the API interface in the source project code, a target pointer, etc. Through the message center, the call of the API interface can be simulated when the SDK is upgraded, and the message of the API interface can be forwarded according to the result of the simulated call. The so-called message forwarding refers to the process of forwarding the API interface to the parent class of the derived subclass using the target pointer, so as to realize the search for the API interface from the parent class for calling.

[0132] The message center may include a cache list (FuncCache) of API interface calls, which stores the API interfaces that have been called in the current compilation cycle. Schematically, in the current compilation cycle, API interface 1 will be stored in FuncCache after being called for the first time. When API interface 1 is called again in the current compilation cycle, it will be directly obtained from FuncCache. Since the API interface may generate multiple calls during the compilation of the source project code, in the embodiment of the present application, the introduction of FuncCache can be used to quickly find the call of the API interface.

[0133] It should be understood that the derived subclasses, abstract classes, parent classes, etc. in the embodiments of the present application maintain their own cache lists.

[0134] The present application embodiment provides an application programming interface adaptation solution, the general principle of which is as follows:

[0135] In response to the instruction to upgrade the software development kit in the source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes the API interface in the software development kit to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the associated information of the application programming interface in the message center to obtain the analysis result. The analysis result is used to indicate the difference in calling the API interface before and after the software development kit is upgraded, and the message center refers to a virtual memory resource created for the application programming interface to store the associated information of the application programming interface; based on the call difference, the API interface in the source engineering code is modified and adapted, and the target language code corresponding to the source engineering code is compiled.

[0136] In one implementation, the call difference may include a data type difference or an interface difference. If the call difference indicated by the analysis result includes a data type difference of the API interface before and after the software development kit is upgraded, in this implementation, the modification and adaptation of the API interface in the source engineering code may be based on the upgraded data type of the API interface in the upgraded software development kit, and the original data type of the API interface in the source engineering code is verified and modified. In another implementation, if the call difference indicated by the analysis result includes an interface difference of the API interface before and after the software development kit is upgraded, in this implementation, based on the interface difference, an API interface with the same interface function may be found and replaced, that is, the new API interface may be adapted.

[0137] It can be seen that in the embodiments of the present application, the calls to the application programming interface can be automatically analyzed and processed according to the associated information of the application programming interface, and the differences in the calls to the application programming interface before and after the software development kit is upgraded can be obtained. Then, the API interface in the source project code can be automatically modified and adapted based on the call differences. There is no need for the developer to analyze and manually modify and adapt the API interface based on the upgraded software development kit, which shortens the API interface adaptation modification time, improves the API interface adaptation efficiency, and thereby improves the compilation accuracy of the source project code.

[0138] Next, the adaptation system of the application programming interface provided in the embodiment of the present application is described.

[0139] See also Figure 1, is a schematic diagram of the architecture of an application programming interface adaptation system provided in an embodiment of the present application. The application programming interface adaptation system may include at least one terminal device (such as Figure 1 The terminal device 101, the terminal device 102 and the server 103 in the embodiment of the present application are provided. It should be understood that the embodiment of the present application does not impose any limitation on the number of terminal devices and the number of servers. The terminal device 101 and the terminal device 102 can be directly or indirectly connected through wired or wireless communication, respectively, and the terminal device 101 and the terminal device 102 can communicate through the server 103.

[0140] Terminal device 101 and terminal device 102 may be devices used by an object. In the embodiment of the present application, terminal device 101 may be a device used by a development object (such as a developer), and terminal device 102 may be a device used by an SDK provider (such as an SDK provider). Terminal device 101 and terminal device 102 may include but are not limited to smartphones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, vehicle-mounted terminals, smart wearable devices, and the like.

[0141] The server 103 can be used to provide services for the terminal device 101 and the terminal device 102. The services here can be communication services, SDK storage services, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0142] In one embodiment, the interaction process between the terminal device 101, the terminal device 102 and the server 103 is used as an example to explain the entire API interface adaptation process of adapting and modifying the API interface in the source project code during the SDK upgrade process. Figure 2 , is a schematic diagram of a process for adapting and modifying an API interface in a source engineering code provided by an embodiment of the present application. The API interface adaptation process mainly includes a preprocessing stage and a data dynamic analysis stage:

[0143] (1) Preprocessing stage

[0144] ① The access object sends an instruction to upgrade the SDK in the source engineering code to the SDK provider through the terminal device 101. In one implementation, the terminal device 101 sends an instruction to upgrade the SDK in the source engineering code to the terminal device 102 where the SDK provider is located through the server 103. The source engineering code is obtained by performing business development on the software development kit; the source engineering code includes the API interface in the software development kit to be called.

[0145] ② The terminal device 102 receives the instruction and responds to the instruction to upgrade the SDK in the source project code.

[0146] ③ Before compiling the source project code, detect the API interface in the source project code, and create an abstract class based on the API interface, and derive the derived subclass corresponding to the abstract class based on the abstract class. In addition, a message center can also be created for the API interface. It should be understood that the number of API interfaces in the source project code can be one or more. When the number of API interfaces is multiple, a corresponding abstract class can be created based on each API interface, and based on the corresponding abstract class, a derived subclass corresponding to the abstract class can be derived. At the same time, a message center will be created for each API interface. The message center includes a target pointer, and the derived subclass can use the target pointer to address and process the call of the API interface. The message center can also be used to store the cache list maintained by the derived subclass and the parent class of the derived subclass during the compilation process, and the cache list includes the set of API interfaces called during the compilation cycle.

[0147] In some implementations, a script can be run to match the grammatical rules in the API interface and the annotation information of the API interface, and the matched annotation information is set to an empty object. By setting the empty object, the annotation information can be used to scan the API interface and generate an abstract syntax tree in the subsequent use of a syntax analyzer without paying attention to the annotation information. The annotation information includes, but is not limited to, single-line comments, multi-line comments, nested comments, and the like. The matched grammatical rules can be used for the subsequent generation of an abstract syntax tree, and the grammatical rules can be described in BNF paradigm, for example. The grammatical rules in the API interface and the annotation information of the API interface can be matched using corresponding regular expressions. In addition, regular expressions can be used to match the original data types in the API interface. Due to the programming languages ​​used by different operating systems, the data types of the API interface may be different. Schematically, the data type of the API interface in the source engineering code written by the client 1 may be an int type written in Java, and the data type of the API interface in the source engineering code written by the client 2 may be an int type written in C++. In the embodiment of the present application, in order to be unified into a recognizable data type, it is necessary to map the original data type of the API interface in advance to obtain the data type of the API interface, and store the data type of the API interface in the message center.

[0148] By using the abstract classes and derived subclasses generated in the above preprocessing stage, the API interface calls can be simulated using the target pointer through the derived subclasses when compiling the source project code. The API interface calls can be attempted without changing the original calls, and the legality of the API interface calls can be standardized in the compiled environment.

[0149] (2) API call analysis phase

[0150] ④ After the preprocessing stage is completed, the terminal device 102 can compile the source engineering code according to the upgraded SDK.

[0151] ⑤ In the process of compiling the source project code, the application programming interface association information is used to analyze and process the call of the application programming interface in the source project code to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded.

[0152] In one implementation, the associated information may include the data type of the application programming interface. Using the associated information of the application programming interface, the call to the application programming interface in the source project code can be analyzed and processed by: in the process of compiling the source project code, directly calling the API interface, and obtaining the data type of the API interface from the message center, and based on the data type, when passing the data generated by the API interface, if the data type does not match the data type to be passed, then determining the analysis result based on the data type of the application programming interface before and after the software development kit is upgraded.

[0153] In another implementation, if the API interface in the source engineering code is not directly called during the process of compiling the source engineering code based on the upgraded software development tool, then the call of the API interface can be simulated by trying to simulate the call of the API interface. In this implementation, the call of the application programming interface in the source engineering code is analyzed and processed using the associated information of the application programming interface, and the analysis result can include: using the derived subclass to simulate the call of the upgraded SDK to the API interface in the cache pool to obtain the simulated call result of the API interface, and based on the simulated call result, forwarding the API interface to obtain the forwarding result, and performing data analysis based on the forwarding result to obtain the analysis result. Specifically, using the derived subclass to search for the API interface from the cache list maintained by the derived subclass, if the API interface is not found, it is necessary to use the target pointer to forward the API interface. The so-called message forwarding means using the target pointer to continue to search for the API interface from the cache list maintained by the parent class of the derived subclass until the target pointer points to the cache list of the abstract class, and finally the analysis result of the API interface can be obtained.

[0154] ⑥ The terminal device 102 can modify and adapt the application programming interface in the source engineering code based on the call difference indicated by the analysis result. In one implementation, if the call difference indicates the difference in data type of the API interface before and after the software development kit is upgraded, it means that the API interface has only changed in data type. Then, the upgraded data type of the API interface in the upgraded software development kit is used to verify and modify the original data type of the API interface. In another implementation, if the call difference indicates the interface difference of the API interface before and after the software development kit is upgraded, a new API interface needs to be reselected to replace the API interface.

[0155] ⑦ After modifying and adapting the application programming interface in the source engineering code, the terminal device 102 compiles the modified and adapted source engineering code to obtain the target language code corresponding to the source engineering code. The target language code refers to a language code that can be recognized by the machine, which can be installed and used by packaging and downloading.

[0156] It should be understood that the above-mentioned data dynamic analysis stage only takes the call of an API interface in the source engineering code as an example for relevant explanation. In the actual application process, the source engineering code includes API interfaces in multiple application development software development kits that need to be called. In this implementation process, multiple application programming interfaces are called in the process of compiling the source engineering code. When calling these multiple application programming interfaces, due to the upgrade of the software development kit, some application programming interfaces may not be directly called. At this time, for the first application programming interface that can be called directly, the data type of the first application programming interface can be obtained from the message center; the data type of the first application programming interface is to pre-map the original data type of the application programming interface and store it in the message center; based on the data type, the data generated when the first application programming interface is called is transmitted; if the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the analysis result of the first application programming interface is determined according to the data type of the first application programming interface before and after the software development kit is upgraded, and based on the call difference indicated by the analysis result of the first application programming interface, the first application programming interface is modified and adapted. For the second application programming interface that cannot be called directly, the derived subclass of the second application programming interface can be used to simulate the call of the upgraded software development kit to the second application programming interface, obtain the simulated call result, and forward the message to the second application programming interface based on the simulated call result to obtain the forwarding result, and perform data analysis based on the forwarding result to obtain the analysis result of the second application programming interface, and based on the call difference indicated by the analysis result of the second application programming interface, modify and adapt the second application programming interface to find an application programming interface that can replace the second application programming interface. That is, in the embodiment of the present application, in the process of compiling the source engineering code, the data type of the directly called API interface can be checked, and the change of the data type of such API interface can be directly checked. At the same time, for the API interface that cannot be called directly, it is possible to try to simulate the call of the upgraded SDK to such API interface in the cache pool, so as to obtain the simulated call result of such API interface, so as to determine the API interface for replacement based on the simulated call result later. In addition, in the embodiment of the present application, the call of the modified first application programming interface can also be simulated and adapted.

[0157] ⑧After obtaining the target language code corresponding to the source project code, it can be determined that the SDK upgrade is completed. The terminal device 102 can send an upgrade completion notification to the terminal device 101 through the server 103. The upgrade completion notification is used to notify the development object that the software development tool kit upgrade is completed and the source project code compilation is completed.

[0158] In summary, the embodiments of the present application can automatically analyze and process the calls to the API interface according to the associated information of the API interface, and obtain the differences in the calls to the API interface before and after the software development kit is upgraded. Therefore, the API interface can be automatically modified and adapted based on the differences in the calls to the API interface before and after the software development kit is upgraded, and rapid adaptation of the API interface can be achieved without the need for the development object to learn based on the upgraded software development kit and manually modify the API interface, thereby reducing the adaptation cost of the API interface adaptation, shortening the API interface adaptation time, and improving the adaptation efficiency of the API interface, thereby improving the efficiency and accuracy of code compilation.

[0159] Next, the adaptation method of the application programming interface provided in the embodiment of the present application is described.

[0160] See also Figure 3 , Figure 3 A flowchart of an application programming interface adaptation method provided in an embodiment of the present application. The application programming interface adaptation method can be executed by a computer device, which can be the above-mentioned terminal device 102 or a server. The application programming interface adaptation method can include the following steps S301-S304:

[0161] S301. In response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called.

[0162] The software development kit may include, but is not limited to, SDKs for various operating systems and SDKs for various manufacturers. The software development kit in the source engineering code may be determined based on business requirements. For example, if the business requirements include navigation services, the software development kit in the source engineering code may include SDKs for map functions, SDKs for positioning functions, and so on.

[0163] In one implementation, the source engineering code may include multiple software development kits, and the computer device may receive an instruction, which includes an identifier of a software development kit to be upgraded. In response to the instruction to upgrade the software development kit in the source engineering code, upgrading the software development kit in the source engineering code may include: in response to the instruction to upgrade the software development kit in the source engineering code, determining the identifier of the software development kit to be upgraded, and upgrading the software development kit corresponding to the identifier. The instruction may be triggered by a development object corresponding to the source engineering code, and the instruction may be an upgrade request or an email sent by the development object for upgrading the software development kit.

[0164] S302. Compile source engineering code based on the upgraded software development kit.

[0165] S303. During the compilation of the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the associated information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface.

[0166] The associated information may include the data type, derived subclasses, etc. of the API interface. In one implementation, step S303 may include: in the process of compiling the source engineering code, directly calling the API interface, if the API interface can be successfully called, the data type of the API interface can be obtained from the message center, and the data type generated when the API interface is called is transmitted based on the data type, if the data type of the API interface does not match the data type to be transmitted during the data transmission process, then it is determined that the application programming interface still exists in the upgraded software development kit, and only the original data type of the application programming interface has changed. At this time, the data type difference of the application programming interface is determined according to the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded. If the API interface cannot be called directly, at this time, the derived subclass can be used to simulate the upgraded software development kit's call to the application programming interface in the source project code to obtain a simulated call result. Based on the simulated call result, the application programming interface message is forwarded to obtain a forwarding result. The forwarding result is used to indicate whether the message forwarding is successful. If the forwarding result indicates that the message forwarding is successful, it means that the application programming interface has not been deleted. If the forwarding result indicates that the message forwarding is successful, it means that the application programming interface has been deleted or replaced in the upgraded software development kit. Data analysis is performed based on the forwarding result to obtain an analysis result. The call differences indicated by the analysis result include interface differences.

[0167] S304: Based on the calling differences, modify and adapt the application programming interface in the source project code, and compile to obtain the target language code corresponding to the source project code.

[0168] In one implementation, when the call difference includes the data type difference of the application programming interface before and after the software development kit is upgraded, based on the call difference, modifying and adapting the application programming interface in the source engineering code may specifically include: using the upgraded data type of the application programming interface in the upgraded software development kit to verify and modify the original data type of the application programming interface. Schematically, assuming that the application programming interface in the software development kit before the upgrade includes a function func1(int), the initial data type of the function func1(int) is int, and the application programming interface in the upgraded software development kit includes a function func1(string), at this time, the initial data type int of the application programming interface will be modified to the adapted string.

[0169] In another implementation, when the call difference includes the interface difference of the API interface before and after the software development kit is upgraded, modifying and adapting the application programming interface in the source engineering code based on the call difference may include: determining a target application programming interface for replacing the application programming interface based on the interface difference, and replacing the application programming interface based on the target application programming interface, thereby adapting the new API interface to the source engineering code.

[0170] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit that needs to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the association information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing association information of the application programming interface; based on the call difference, the application programming interface in the source engineering code is modified and adapted, and compiled to obtain the target language code corresponding to the source engineering code. It can be seen that in the embodiments of the present application, the calls to the application programming interface can be automatically analyzed and processed based on the associated information of the application programming interface, and the differences in the calls to the application programming interface before and after the software development kit is upgraded can be obtained. The application programming interface in the source engineering code can then be automatically modified and adapted based on the call differences. There is no need for the development object to analyze and manually modify and adapt the API interface based on the upgraded software development kit, which shortens the application programming interface adaptation time and improves the application programming interface adaptation efficiency.

[0171] See also Figure 4 , is a flow chart of another method for adapting an application programming interface provided in an embodiment of the present application. The method for adapting the application programming interface may be executed by a computer device, which may be the terminal device 102 mentioned above. The method for adapting the application programming interface may include the following steps S401-S406:

[0172] S401. In response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called.

[0173] S402. Compile source engineering code based on the upgraded software development kit.

[0174] S403. In the process of compiling the source engineering code, the application programming interface is called, and the data type of the application programming interface in the message center is checked using a data type extraction script to obtain the data type of the application programming interface; the data type of the application programming interface is obtained by mapping the original data type of the application programming interface.

[0175] Among them, the data type extraction script can be a script built into the software development kit, and of course, the script can also be downloaded when needed. The message center refers to a script created based on the application programming interface before compiling the source engineering code. In one implementation, due to the different programming languages ​​used by different operating systems, in order to better transmit the data generated by the API interface, the original data type of the API interface can be mapped in an embodiment of the present application to obtain the data type of the API interface and store it in the message center. Among them, the data type of the API interface may include but is not limited to: integer (int), floating point type (float), string (string), numeric type (bigint), object type (objec), symbol type (symbol), etc. Through mapping, the message center can identify the mapped data type and transmit data of the data type.

[0176] As an implementation method, a data type extraction script is used to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface, including: running the data type extraction script, using an operator (such as the typeof operator) to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface.

[0177] S404: Transfer data generated when the application programming interface is called based on the data type.

[0178] In a specific implementation, the data generated when the application programming interface is called is transmitted based on the data type, and it is determined whether the data type of the application programming interface matches the data type to be transmitted during the data transmission process. If it is determined that the data type of the application programming interface does not match the data type to be transmitted, step S405 is executed. If it is determined that the data type of the application programming interface matches the data type to be transmitted, the data type extraction script is continued to be used to check the data type of the next called application programming interface in the message center, and steps S403-S406 are executed.

[0179] S405. If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, determine the data type difference of the application programming interface according to the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded.

[0180] In a specific implementation, the upgraded data type of the application programming interface after the software development kit is upgraded is obtained, and the message center compares the difference between the initial data type and the upgraded data type of the application programming interface to obtain the data type difference of the application programming interface.

[0181] S406: Based on the data type difference, the upgraded data type of the application programming interface in the upgraded software development kit is used to verify and modify the original data type of the application programming interface, and the target language code corresponding to the source engineering code is compiled.

[0182] As an implementation manner, the original data type of the application programming interface can be modified and adapted to the upgraded data type of the application programming interface in the upgraded software development kit through the message center.

[0183] It should be understood that there may be multiple application programming interfaces in the source engineering code, and any application programming interface can refer to the above method, which will not be repeated here. In addition, the original data type of the application programming interface is verified and modified to obtain the modified application programming interface, and the call of the modified application programming interface can also be simulated to obtain the simulated call result corresponding to the modified application programming interface.

[0184] The following example illustrates the API interface adaptation process provided by the embodiment of this application. Figure 5, which is a schematic diagram of an API interface adaptation process provided in an embodiment of the present application. Taking conventional calling object management or page management as an example, each object (i.e., page instantiation) can be managed by the corresponding controller to generate data and transfer data during the call, and the controller inherits the abstract class corresponding to the page management. The process of API interface adaptation is as follows: ① In the process of compiling the source engineering code, directly call the API interface of page management. ② Determine the data type of the application programming interface: Use the data extraction script and typeof to check the data type of the API interface of page management to obtain the data type of the API interface of page management. ③ Based on the data type of the API interface of page management, transfer the data generated when the API interface is called. ④ Determine whether the data type of the API interface of page management matches the data type to be transferred. If not, that is, the data type of the API interface of page management does not match the data type to be transferred, then execute step ⑤. If so, that is, the data type of the API interface of page management matches the data type to be transferred, then execute step ⑥. ⑤ Obtain the upgraded data type of the page management API interface from the upgraded software development kit, and determine the data type difference of the page management API interface before and after the software development kit upgrade. According to the data type difference, use the upgraded data type of the API interface to modify the original data type of the API interface. ⑥ Use the data extraction script to use the typeof operator to check the data type of the next API interface call.

[0185] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the application programming interface is called; the data type of the application programming interface in the message center is checked using a data type extraction script to obtain the data type of the application programming interface; the data type of the application programming interface is a pre-mapped processing of the original data type of the application programming interface and stored in the message center; based on the data type, the data generated when the application programming interface is called is transmitted; if the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface is determined according to the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded. Based on the data type, the upgraded data type of the application programming interface in the upgraded software development kit is used to verify and modify the original data type of the application programming interface, and the target language code corresponding to the source engineering code is compiled. It can be seen that by mapping the data type of the API interface, the change of the data type of the API interface can be directly detected during the process of checking the data type of the application programming interface, so that the original data type of the application programming interface can be modified and adapted directly and automatically according to the upgraded data type of the application programming interface in the upgraded software development kit. There is no need for developers to analyze the API interface based on the upgraded software development kit and manually modify and adapt it, which shortens the API interface adaptation time and improves the API interface adaptation efficiency and adaptation cost.

[0186] See also Figure 6 , which is a flow chart of another method for adapting an application programming interface provided in an embodiment of the present application. The method for adapting the application programming interface may be executed by a computer device, which may be the terminal device 102 mentioned above. The method for adapting the application programming interface may include the following steps S601-S607:

[0187] S601, in response to an instruction to upgrade a software development kit in a source engineering code, upgrading the software development kit in the source engineering code; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called;

[0188] S602. Compile source engineering code based on the upgraded software development kit.

[0189] S603. During the process of compiling the source engineering code, the derived subclass of the application programming interface included in the association information of the application programming interface is used to simulate the call of the upgraded software development kit to the application programming interface in the source engineering code to obtain a simulated call result.

[0190] The simulation call result includes failure in calling the API interface using the derived subclass and success in calling the API interface using the derived subclass. When the simulation call result includes failure in calling the API interface using the derived subclass, step S604 is executed.

[0191] In one implementation, the specific implementation of step S603 may be: using a derived subclass, simulating the call of the upgraded software development kit to the application programming interface in the cache pool, and obtaining a simulated call result. The cache pool is formed by a thread created by pthread, and the cache pool can provide a basic environment for object reuse for the derived subclass. The object here refers to the object instantiated by the derived subclass.

[0192] In an embodiment of the present application, before compiling the source engineering code, an abstract class can be generated based on the application programming interface in the source engineering code, and based on the abstract class, a derived subclass of the abstract class can be derived. Of course, the derived subclass can continue to derive a new derived subclass, and then the derived subclass is the parent class of the new derived subclass. In schematic form, since a certain function may use multiple objects or multiple pages, such as a function for scanning and identifying objects, calling the application programming interface for scanning and identifying objects requires calling up the camera, loading the recognition model, initiating a recognition request, confirming the recognition result, and so on. In an embodiment of the present application, an abstract class (i.e., a controller corresponding to the abstract class) can be created based on the application programming interface for scanning and identifying objects, and then one or more derived subclasses of the abstract class can be derived based on the abstract class, such as Figure 7 FIG. 1 is a schematic diagram showing the relationship between an abstract class and a derived subclass provided in an embodiment of the present application. Figure 7 In the example, the abstract class controller (TMFScriptCheck) can derive three derived subclasses (such as Figure 7 Page controller (pageControl) 1, page controller (pageControl) 2 and page controller (pageControl) 3), and then page controller 1 and page controller 2 can each derive a new derived subclass (such as Figure 7 In the example, page controller 1 can derive sub-page controller (sub_pageControl) 1, and page controller 2 can derive sub-page controller 2 (sub_pageControl).

[0193] Among them, each derived subclass can maintain a cache list, each parent class can maintain a cache list, and the abstract class also maintains a cache list. The cache list maintains the application programming interface that has been called during the compilation cycle. Specifically, the cache list corresponding to the derived subclass maintains the application programming interface that has been called by the derived subclass during the compilation cycle. The cache list corresponding to the parent class maintains the application programming interface that has been called by the parent class during the compilation cycle. The cache list corresponding to the abstract class maintains the application programming interface that has been called by the abstract class during the compilation cycle. In one implementation, the cache lists maintained by each class can be stored in the message center. During the compilation process of the source engineering code, the API interface may generate multiple calls. The cache list introduced in the embodiment of the present application can be used to quickly find calls to the API interface.

[0194] Taking the derived subclass as an example, the generation process of the cache list maintained by the derived subclass includes: adding the application programming interface called by the derived subclass for the first time to the cache list maintained by the derived subclass during the source project code compilation cycle; storing the cache list maintained by the derived subclass in the message center. It should be understood that the API interface includes a set of predefined functions, so the cache list may store the called functions (i.e., the verification function set).

[0195] In one implementation, a script (the script here can be a script extracted from the above data type) can be run, and the derived subclass can be used to simulate the upgraded software development kit's call to the application programming interface in the cache pool to obtain a simulated call result. At this time, the derived subclass is used to simulate the upgraded software development kit's call to the application programming interface in the source project code to obtain a simulated call result, including: using the derived subclass to find the application programming interface from the cache list maintained by the derived subclass for calling; adding the instantiated object of the derived subclass after instantiation to the cache pool, and setting the state attribute of the instantiated object to the working state; wherein the state attribute can include but is not limited to a null value (nail), a working state (work), and a waiting state (wait); the cache pool is used to provide a reuse environment for the instantiated object for the derived subclass; if the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulated call result indicating that the derived subclass fails to simulate calling the application programming interface is obtained.

[0196] S604: If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, the target pointer is used to forward the message of the application programming interface to obtain a forwarding result.

[0197] The forwarding result may be used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit. Of course, the forwarding result is used to indicate that the application programming interface can be compiled successfully without modification or adaptation.

[0198] The message forwarding here means to continue searching the application programming interface from the cache list of the parent class corresponding to the derived subclass through the target pointer until the application programming interface is found. The message forwarding of the application programming interface using the target pointer can include the following process: ① Get the instantiated object from the cache pool; ② If the state attribute of the instantiated object is in the working state, then through the target pointer in the message center, search for the application programming interface from the cache list maintained by the parent class of the derived subclass and call it. ③ If the application programming interface is not found in the cache list maintained by the parent class and the parent class is the abstract class of the application programming interface, the forwarding result that the application programming interface is deleted or replaced is obtained. ④ If the application programming interface is not found in the cache list maintained by the parent class and the parent class is not an abstract class of the application programming interface, continue to obtain the instantiated object from the cache pool; if the attribute status of the instantiated object is in working state, then through the target pointer in the message center, find the application programming interface in the cache list maintained by the parent class of the parent class and call it. If the call of the application programming interface is not found in the cache list maintained by the parent class of the parent class, and the parent class of the parent class is an abstract class, then the forwarding result of the application programming interface being deleted or replaced is obtained. Otherwise, continue to search from the parent class of the parent class until the parent class is an abstract class or until the API interface is found in the parent class of the parent class.

[0199] For illustration, see Figure 8 , is a flowchart of a search API interface provided in an embodiment of the present application. Figure 8 In the example, the derived subclass is a controller. The instantiated object after the derived subclass is instantiated is the controller object. The call of the application programming interface can generate multiple function stacks, or in other words, it will generate multiple API interface calls. The process of searching for the API interface includes the following steps: ① Using the controller, search for the simulated API interface from the cache list maintained by the controller for calling, and add the controller object after the controller is instantiated to the cache pool, and set the state attribute of the controller object to the working state (work), where, Figure 8② If the application programming interface is not found in the cache list maintained by the controller for calling, it means that the controller fails to call the API interface, and then the instantiated object is obtained from the cache pool; if the attribute state of the instantiated object is in the working state, the target pointer in the message center is used to find the application programming interface in the cache list maintained by the parent class controller for calling. ③ If the application programming interface is not found in the cache list maintained by the parent class controller and the parent class controller is an abstract class of the application programming interface, the forwarding result that the application programming interface is deleted or replaced is obtained. ④ If the application programming interface is not found in the cache list maintained by the parent class controller and the parent class controller is not an abstract class of the application programming interface, the instantiated object is obtained from the cache pool; if the attribute status of the instantiated object is in working state, the target pointer in the message center is used to find the application programming interface in the cache list maintained by the parent class controller of the parent class controller for calling. If the call of the application programming interface is not found in the cache list maintained by the parent class controller of the parent class controller, and the parent class controller of the parent class controller is an abstract class, a forwarding result is obtained that the application programming interface is deleted or replaced. Otherwise, the search will continue from the parent class controller of the parent class controller until the parent class controller is an abstract class or until the API interface is found in the parent class controller of the parent class controller.

[0200] Among them, the derived subclass corresponds to a binding function, and the binding function corresponding to the derived subclass is used to pass parameters related to the derived subclass to the parent class of the derived subclass. Schematically, the derived subclass is a page controller, and the binding function corresponding to the derived subclass is used to pass component parameters related to the page controller to the parent class page controller. The component parameters here include but are not limited to parameters such as button components and table components. Through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass for calling, including: passing the parameters related to the derived subclass to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass; through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass based on the parameters passed in by the binding function for calling.

[0201] It should be understood that both the abstract class and the parent class correspond to a binding function. The parent class can pass the parameters related to the parent class to the parent class corresponding to the parent class through the corresponding binding function.

[0202] S605: Perform data analysis based on the forwarding result to obtain an analysis result; the analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the calling difference includes an interface difference. The interface difference may include: the application programming interface does not exist in the upgraded software development kit.

[0203] As an implementation method, the specific implementation method of step S605 may include: if the forwarding result indicates that the application programming interface is replaced or deleted in the upgraded software development kit, then enter dynamic method analysis, that is, use a syntax analyzer to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application programming interface; if the application programming interface is not found in the upgraded software development kit through the abstract syntax tree, then perform a differential calculation on the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of the application programming interface before and after the software development kit is upgraded, and generate an analysis result based on the interface difference of the application programming interface before and after the software development kit is upgraded. Among them, before compiling the source engineering code, run the script, use regular expressions to match the syntax rules of the application programming interface, and obtain the syntax rules of the application programming interface. The syntax rules may include but are not limited to: BNF paradigm description, etc. In addition, regular expressions can be used to match the comment information in the application programming interface to obtain the comment information in the application programming interface, which includes single-line comments, multi-line comments, nested comments, etc., and set the comment information to an empty object. By setting the comment information to an empty object, the syntax analyzer does not need to pay attention to the comment information when constructing the syntax tree.

[0204] S606: Determine a target application programming interface for replacing the application programming interface in the source engineering code according to the interface difference.

[0205] The interface difference includes that the application programming interface does not exist in the upgraded software development kit. In one implementation, the specific implementation of step S606 may be: based on the interface difference, the application programming interface with the same interface function in the different version systems is determined as the target application programming interface for replacing the application programming interface in the source engineering code. In another implementation, the interface difference includes that the application programming interface with the same interface function as the application programming interface exists in the upgraded software development kit. The specific implementation of step S606 may be: based on the interface difference, the application programming interface with the same interface function as the application programming interface is determined as the target application programming interface for replacing the application programming interface in the source engineering code.

[0206] S607: According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface, and the target language code corresponding to the source project code is compiled.

[0207] As an implementation method, the lexical units in the abstract syntax tree can be modified according to the target application programming interface to obtain an adapted application programming interface, and the adapted application programming interface can be compiled to obtain the target language code corresponding to the source engineering code. In an illustrative manner, the function names and data types in the abstract syntax tree can be modified according to the target application programming interface to obtain an adapted application programming interface.

[0208] For illustration, see Fig. 9 , is a flowchart of determining an adapted application programming interface when an application programming interface is replaced or modified, provided by an embodiment of the present application. Fig. 9 In the example, the call of the application programming interface includes the call of "result=add(10,20);", where the result variable is result, the function name is add, and the two parameters are 10 and 20. The process of determining the adapted application programming interface is as follows: ① Segment the lexical unit sequence of the application programming interface: Use a lexical analyzer to scan the call of the API interface, and segment "result=add(10,20)" into a lexical unit sequence (tokens). The lexical sequence units obtained by segmentation can be as follows: Identifier("result");Assignment("=");Identifier("add");ParenthesisOpen("(");Number("10");Comma(",");Number("20");ParenthesisClose(")");SemiColon(";"). ② Obtain grammar rules. Specifically, grammar rules can be obtained from the message center. ③ Generate an abstract syntax tree: According to the grammatical rules, the lexical unit sequence can be processed to generate a syntax tree to obtain an abstract syntax tree of result = add (10, 20). The abstract syntax tree can be Fig.10a ④ As shown in Fig.10aIf the abstract syntax tree in the upgraded software development kit does not find a function named add, then a differential calculation is performed on the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of result = add (10, 20) before and after the upgrade of the software development kit. ⑤ Replace the lexical unit in the abstract syntax tree: Through the interface difference, determine that the target application programming interface used to replace result = add (10, 20) is the function name addtion, and the data type of the target application programming interface is float. And modify the "add" in the abstract syntax tree corresponding to result = add (10, 20) to addtion, and modify the data type in the abstract syntax tree to float, that is, modify the "10" in the abstract syntax tree to "10.0", and modify the "20" in the abstract syntax tree to "20.0". The modified abstract syntax tree is as follows Fig.10b shown.

[0209] In some optional embodiments, if the application programming interface in the upgraded software development kit has restrictions on the interval of the operating system version, the abstract syntax tree corresponding to the corresponding application programming interface in the source engineering code is modified according to the restricted operating system version, so as to perform version adaptation. Schematically, Table 1 is an API interface provided by the SDK of a certain operating system, where truncateFileAtOffset is the interface name, calling this API interface can intercept the character content in the file from a certain offset point (offset), and the API interface _DEPRECATED_WITH_REPLACEMENT indicates that this API interface has expired and needs to be replaced using "truncateAtOffset:error:".

[0210] Table 1

[0211]

[0212] In addition, the system range to which the replaced API interface can be applied is given. The replaced API interface: "truncateAtOffset:error:" is shown in Table 2. From Table 2, it can be seen that the API interface has the same function as truncateFileAtOffset, but it can be seen through the API interface _AVAILABLE that the supported systems are different.

[0213] Table 2

[0214]

[0215] Therefore, it is necessary to modify the abstract syntax tree corresponding to the corresponding application programming interface in the source project code according to the operating system version of the replaced API interface, so as to achieve adaptation to the API interface in different version systems.

[0216] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the derived subclass of the application programming interface included in the associated information of the application programming interface is used to simulate the call of the upgraded software development kit to the application programming interface in the source engineering code, and a simulated call result is obtained; if the simulated call result indicates that the derived subclass fails to simulate the call to the application programming interface, the target pointer is used to forward the message to the application programming interface to obtain the forwarding result, and data analysis is performed based on the forwarding result to obtain the analysis result. The analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the call difference includes the interface difference, and according to the interface difference, the target application programming interface used to replace the application programming interface in the source engineering code is determined. According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface, and the target language code corresponding to the source engineering code is compiled. It can be seen that by simulating API interface calls in the cache pool, the interface changes of the API interface before and after the software development kit is upgraded can be detected, and then according to the interface differences, there is a target API interface that replaces the API interface, and by changing the abstract syntax tree corresponding to the API interface, it can automatically adapt to the call of the new API interface without manual adaptation, shortening the API interface adaptation time and improving the API interface adaptation efficiency and adaptation cost.

[0217] Next, the adapter device of the application programming interface provided in the embodiment of the present application is described.

[0218] See also Fig.11 , Fig.11 is a schematic diagram of the structure of an application programming interface adapter provided in an embodiment of the present application. The application programming interface adapter may be a computer program (including program code) in a computer device. For example, the application programming interface adapter may be an application software in a computer device. The blockchain-based data processing device may be used to execute Figure 3 , Figure 4 and Figure 6 Some or all of the steps in the method embodiment shown. Fig.11 , the adapter of this application programming interface includes the following units:

[0219] The upgrading unit 1101 is used to upgrade the software development kit in the source engineering code in response to an instruction to upgrade the software development kit in the source engineering code; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called;

[0220] The processing unit 1102 is used to compile source engineering codes based on the upgraded software development kit;

[0221] The processing unit 1102 is further used to analyze and process the call of the application programming interface in the source project code by using the associated information of the application programming interface in the message center during the compilation of the source project code to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface;

[0222] The processing unit 1102 is further used to modify and adapt the application programming interface in the source project code based on the call difference, and compile to obtain the target language code corresponding to the source project code.

[0223] In some implementations, the associated information of the application programming interface includes a data type of the application programming interface, where the data type of the application programming interface is obtained by pre-mapping the original data type of the application programming interface; the call difference includes a data type difference; the processing unit 1102 is specifically configured to:

[0224] In the process of compiling source project code, the application programming interface is called;

[0225] Using a data type extraction script to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface; the data type of the application programming interface is obtained by mapping the original data type of the application programming interface;

[0226] Passing data generated when the API is called based on the data type;

[0227] If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface before and after the software development kit upgrade is determined based on the initial data type of the application programming interface before the software development kit upgrade and the upgraded data type of the application programming interface after the software development kit upgrade.

[0228] In some implementations, the processing unit 1102 is specifically configured to:

[0229] Based on the data type difference, the original data type of the application programming interface is verified and modified using the upgraded data type of the application programming interface in the upgraded software development kit.

[0230] In some implementations, the associated information of the application programming interface includes a derived subclass and a target pointer of the application programming interface; the derived subclass is derived from an abstract class generated based on the application programming interface; the processing unit 1102 is specifically configured to:

[0231] Using the derived subclass, simulating the call of the upgraded software development kit to the application programming interface in the cache pool, and obtaining the simulated call result;

[0232] If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, the target pointer is used to forward the message to the application programming interface to obtain the forwarding result;

[0233] Data analysis is performed based on the forwarding result to obtain analysis results.

[0234] In some implementations, the derived subclass maintains a cache list, and the cache list maintains the application programming interface called by the derived subclass during the compilation cycle; the processing unit 1102 is specifically used to:

[0235] Using the derived subclass, the application programming interface is searched from the cache list maintained by the derived subclass for calling;

[0236] Add the instantiated object of the derived subclass to the cache pool, and set the state attribute of the instantiated object to the working state; the cache pool is used to provide a reuse environment for the instantiated objects of the derived subclass;

[0237] If the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulated call result indicating that the derived subclass failed to simulate calling the application programming interface is obtained.

[0238] In some implementations, a derived subclass corresponds to a parent class, and the parent class maintains a cache list; the processing unit 1102 is specifically used to:

[0239] Get the instantiated object from the cache pool;

[0240] If the attribute status of the instantiated object is in the working state, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center for calling;

[0241] If the application programming interface is not found in the cache list maintained by the parent class and the parent class is an abstract class of the application programming interface, a forwarding result indicating that the application programming interface is deleted or replaced in the upgraded software development kit is obtained.

[0242] In some implementations, a derived subclass corresponds to a binding function, and the binding function is used to transfer parameters related to the derived subclass. The processing unit 1102 is specifically used to:

[0243] The parameters related to the derived subclass are passed to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass;

[0244] Through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass based on the parameters passed in by the bound function for calling.

[0245] In some implementations, the processing unit 1102 is further configured to:

[0246] Before compiling the source project code, obtaining the application programming interface in the source project code;

[0247] Generate abstract classes based on the application programming interface;

[0248] Based on the abstract class, derive the corresponding derived subclass of the abstract class; and,

[0249] Create a message center for the application programming interface.

[0250] In some implementations, the processing unit 1102 is further configured to:

[0251] During the source project code compilation cycle, the application programming interface called by the derived subclass is added to the cache list maintained by the derived subclass;

[0252] Store the cache list maintained by the derived subclass into the message center.

[0253] In some implementations, the call difference includes an interface difference, and the processing unit 1102 is specifically configured to:

[0254] If the forwarding result is used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit, a syntax analyzer is used to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application;

[0255] If no application programming interface is found in the upgraded software development kit through the abstract syntax tree, a differential calculation is performed between the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of the application programming interface before and after the upgrade of the software development kit;

[0256] Generate analysis results based on the interface differences of the application programming interface before and after the software development kit upgrade.

[0257] In some implementations, the processing unit 1102 is specifically configured to:

[0258] A syntax analyzer is used to scan the application programming interface call and segment the application programming interface call into a sequence of lexical units;

[0259] According to the mapped grammatical rules, the lexical unit sequence is processed to generate a grammatical tree to obtain an abstract syntax tree of the application programming interface; the grammatical rules are obtained by matching the grammatical rules of the application programming interface using regular expressions before compiling the source engineering code.

[0260] In some implementations, the processing unit 1102 is specifically configured to:

[0261] Determine a target application programming interface for replacing the application programming interface in the source engineering code based on the interface differences;

[0262] According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface.

[0263] In some implementations, the processing unit 1102 is further configured to:

[0264] If the application programming interface in the upgraded software development kit has restrictions on the range of operating system versions, the abstract syntax tree corresponding to the corresponding application programming interface in the source project code is modified according to the restricted operating system version.

[0265] In some implementations, the processing unit 1102 is further configured to:

[0266] An upgrade completion notification is sent to the development object corresponding to the source project code. The upgrade completion notification is used to notify the development object that the software development tool kit upgrade is complete and the source project code compilation is complete.

[0267] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit that needs to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the association information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing association information of the application programming interface; based on the call difference, the application programming interface in the source engineering code is modified and adapted, and compiled to obtain the target language code corresponding to the source engineering code. It can be seen that in the embodiments of the present application, the calls to the application programming interface can be automatically analyzed and processed based on the associated information of the application programming interface, and the differences in the calls to the application programming interface before and after the software development kit is upgraded can be obtained. The application programming interface in the source engineering code can then be automatically modified and adapted based on the call differences, without the need for the development object to analyze and manually modify and adapt the API interface based on the upgraded software development kit. This greatly shortens the adaptation and modification time of the application programming interface and improves the adaptation efficiency of the application programming interface.

[0268] Next, the computer device provided in the embodiment of the present application is described.

[0269] Furthermore, the present application embodiment also provides a schematic diagram of the structure of a computer device. The schematic diagram of the structure of the computer device can be found in Fig.12 The computer device may include: a processor 1201, an input device 1202, an output device 1203 and a memory 1204. The processor 1201, the input device 1202, the output device 1203 and the memory 1204 are connected via a bus. The memory 1204 is used to store a computer program, the computer program includes program instructions, and the processor 1201 is used to execute the program instructions stored in the memory 1204.

[0270] The processor 1201 executes the following operations by running the program instructions in the memory 1204:

[0271] In response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called;

[0272] Compile source engineering code based on the upgraded software development kit;

[0273] In the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed by using the associated information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface;

[0274] Based on the calling differences, the application programming interface in the source project code is modified and adapted, and compiled to obtain the target language code corresponding to the source project code.

[0275] In some implementations, the associated information of the application programming interface includes a data type of the application programming interface, and the data type of the application programming interface is obtained by pre-mapping the original data type of the application programming interface; the call difference includes a data type difference;

[0276] During the process of compiling the source engineering code, the processor 1201 uses the associated information of the application programming interface in the message center to analyze and process the call of the application programming interface in the source engineering code. When the analysis result is obtained, the following operations may be specifically performed:

[0277] In the process of compiling source project code, the application programming interface is called;

[0278] Using a data type extraction script to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface; the data type of the application programming interface is obtained by mapping the original data type of the application programming interface;

[0279] Passing data generated when the API is called based on the data type;

[0280] If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface before and after the software development kit upgrade is determined based on the upgraded data type and the original data type of the application programming interface in the software development kit before the upgrade.

[0281] In some implementations, when the processor 1201 modifies and adapts the application programming interface in the source engineering code based on the call difference, the processor 1201 may specifically perform the following operations:

[0282] Based on the data type difference, the original data type of the application programming interface is verified and modified using the upgraded data type of the application programming interface in the upgraded software development kit.

[0283] In some implementations, the associated information of the application programming interface includes a derived subclass and a target pointer of the application programming interface; the derived subclass is derived from an abstract class generated based on the application programming interface;

[0284] During the process of compiling the source engineering code, the processor 1201 uses the associated information of the application programming interface in the message center to analyze and process the call of the application programming interface in the source engineering code. When the analysis result is obtained, the following operations may be specifically performed:

[0285] In the process of compiling the source engineering code, simulating the calling of the upgraded software development kit to the application programming interface in the source engineering code to obtain the simulated calling result;

[0286] If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, the target pointer is used to forward the message to the application programming interface to obtain the forwarding result;

[0287] Data analysis is performed based on the forwarding result to obtain analysis results.

[0288] In some implementations, the derived subclass maintains a cache list, and the cache list maintains the application programming interfaces called by the derived subclass during the compilation cycle;

[0289] When the processor 1201 uses the derived subclass to simulate the upgraded software development kit calling the application programming interface in the source engineering code and obtains the simulated calling result, it can specifically perform the following operations:

[0290] Using the derived subclass, the application programming interface is searched from the cache list maintained by the derived subclass for calling;

[0291] Add the instantiated object of the derived subclass to the cache pool, and set the state attribute of the instantiated object to the working state; the cache pool is used to provide a reuse environment for the instantiated objects of the derived subclass;

[0292] If the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulated call result indicating that the derived subclass failed to simulate calling the application programming interface is obtained.

[0293] In some implementations, the derived subclass corresponds to a parent class, and the parent class maintains a cache list. When the processor 1201 forwards the message to the application programming interface using the target pointer and obtains the forwarding result, the processor 1201 may specifically perform the following operations:

[0294] Get the instantiated object from the cache pool;

[0295] If the attribute status of the instantiated object is in the working state, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center for calling;

[0296] If the application programming interface is not found in the cache list maintained by the parent class and the parent class is an abstract class of the application programming interface, a forwarding result indicating that the application programming interface is deleted or replaced in the upgraded software development kit is obtained.

[0297] In some implementations, a derived subclass corresponds to a binding function, and the binding function is used to pass parameters related to the derived subclass to the parent class of the derived subclass. When the processor 1201 searches for the application programming interface from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center for calling, the processor 1201 may specifically perform the following operations:

[0298] The parameters related to the derived subclass are passed to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass;

[0299] Through the target pointer in the message center, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass based on the parameters passed in by the bound function for calling.

[0300] In some implementations, the processor 1201 may further perform the following operations:

[0301] Before compiling the source project code, obtaining the application programming interface in the source project code;

[0302] Generate abstract classes based on the application programming interface;

[0303] Based on the abstract class, derive the corresponding derived subclass of the abstract class; and,

[0304] Create a message center for the application programming interface.

[0305] In some implementations, the processor 1201 may further perform the following operations:

[0306] During the source project code compilation cycle, the application programming interface called by the derived subclass is added to the cache list maintained by the derived subclass;

[0307] Store the cache list maintained by the derived subclass into the message center.

[0308] In some implementations, the call difference includes an interface difference. When the processor 1201 performs data analysis based on the forwarding result and obtains the analysis result, the processor 1201 may specifically perform the following operations:

[0309] If the forwarding result is used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit, a syntax analyzer is used to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application;

[0310] If no application programming interface is found in the upgraded software development kit through the abstract syntax tree, a differential calculation is performed between the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain the interface difference of the application programming interface before and after the upgrade of the software development kit;

[0311] Generate analysis results based on the interface differences of the application programming interface before and after the software development kit upgrade.

[0312] In some implementations, when the processor 1201 constructs a syntax tree for the application programming interface using a syntax analyzer to obtain an abstract syntax tree of the application, the processor 1201 may specifically perform the following operations:

[0313] A syntax analyzer is used to scan the application programming interface call and segment the application programming interface call into a sequence of lexical units;

[0314] According to the mapped grammatical rules, the lexical unit sequence is processed to generate a grammatical tree to obtain an abstract syntax tree of the application programming interface; the grammatical rules are obtained by matching the grammatical rules of the application programming interface using regular expressions before compiling the source engineering code.

[0315] In some implementations, when the processor 1201 modifies and adapts the application programming interface in the source engineering code based on the call difference, the processor 1201 may specifically perform the following operations:

[0316] Determine a target application programming interface for replacing the application programming interface in the source engineering code based on the interface differences;

[0317] According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface.

[0318] In some implementations, the processor 1201 may further perform the following operations:

[0319] If the application programming interface in the upgraded software development kit has restrictions on the range of operating system versions, the abstract syntax tree corresponding to the corresponding application programming interface in the source project code is modified according to the restricted operating system version.

[0320] In some implementations, the processor 1201 may further perform the following operations:

[0321] An upgrade completion notification is sent to the development object corresponding to the source project code. The upgrade completion notification is used to notify the development object that the software development tool kit upgrade is complete and the source project code compilation is complete.

[0322] In an embodiment of the present application, in response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit that needs to be called; based on the upgraded software development kit, the source engineering code is compiled; in the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed using the association information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in calling the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing association information of the application programming interface; based on the call difference, the application programming interface in the source engineering code is modified and adapted, and compiled to obtain the target language code corresponding to the source engineering code. It can be seen that in the embodiments of the present application, the calls to the application programming interface can be automatically analyzed and processed based on the associated information of the application programming interface, and the differences in the calls to the application programming interface before and after the software development kit is upgraded can be obtained. The application programming interface in the source engineering code can then be automatically modified and adapted based on the call differences, without the need for the development object to analyze and manually modify and adapt the API interface based on the upgraded software development kit. This greatly shortens the adaptation and modification time of the application programming interface and improves the adaptation efficiency of the application programming interface.

[0323] In the embodiments of the present application, the term "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more units. In addition, each unit can be part of an overall unit that includes the function of the unit.

[0324] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the above Figure 3 , Figure 4 and Figure 6 The method in the corresponding embodiment, therefore, will not be repeated here. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one location, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network.

[0325] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device can perform the above Figure 3 , Figure 4 and Figure 6 The method in the corresponding embodiment will therefore not be described in detail here.

[0326] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0327] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A method for adapting an application programming interface, characterized in that: include: In response to an instruction to upgrade a software development kit in a source engineering code, the software development kit in the source engineering code is upgraded; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called; Compiling the source engineering code based on the upgraded software development kit; In the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed by using the association information of the application programming interface in the message center to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the association information of the application programming interface; Based on the calling differences, the application programming interface in the source engineering code is modified and adapted, and compiled to obtain the target language code corresponding to the source engineering code.

2. The method according to claim 1, characterized in that The associated information of the application programming interface includes a data type of the application programming interface, and the data type of the application programming interface is obtained by pre-mapping the original data type of the application programming interface; the calling difference includes a data type difference; In the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed by using the association information of the application programming interface in the message center to obtain the analysis result, including: In the process of compiling the source engineering code, calling the application programming interface; Using a data type extraction script to check the data type of the application programming interface in the message center to obtain the data type of the application programming interface; transmitting data generated when the application programming interface is called based on the data type; If the data type of the application programming interface does not match the data type to be transmitted during the data transmission process, the data type difference of the application programming interface is determined based on the initial data type of the application programming interface before the software development kit is upgraded and the upgraded data type of the application programming interface after the software development kit is upgraded.

3. The method according to claim 2, characterized in that The step of modifying and adapting the application programming interface in the source engineering code based on the calling difference includes: Based on the data type difference, the original data type of the application programming interface is verified and modified using the upgraded data type of the application programming interface in the upgraded software development kit.

4. The method according to claim 1, characterized in that The associated information of the application programming interface includes a derived subclass and a target pointer of the application programming interface; the derived subclass is derived from an abstract class generated based on the application programming interface; In the process of compiling the source engineering code, the call of the application programming interface in the source engineering code is analyzed and processed by using the association information of the application programming interface in the message center to obtain the analysis result, including: In the process of compiling the source engineering code, using the derived subclass, simulating the call of the upgraded software development kit to the application programming interface in the source engineering code to obtain a simulated call result; If the simulation call result indicates that the derived subclass fails to simulate calling the application programming interface, forwarding a message to the application programming interface using the target pointer to obtain a forwarding result; Data analysis is performed based on the forwarding result to obtain an analysis result.

5. The method according to claim 4, characterized in that The derived subclass maintains a cache list, and the cache list maintains application programming interfaces called by the derived subclass during a compilation cycle; The using of the derived subclass to simulate the calling of the upgraded software development kit to the application programming interface in the source engineering code to obtain the simulated calling result includes: Using the derived subclass, searching for the application programming interface from a cache list maintained by the derived subclass for invocation; Adding the instantiated object of the derived subclass to the cache pool, and setting the state attribute of the instantiated object to the working state; the cache pool is used to provide a reuse environment for the instantiated object of the derived subclass; If the application programming interface is not found in the cache list maintained by the derived subclass for calling, a simulation call result indicating that the derived subclass fails to simulate calling the application programming interface is obtained.

6. The method according to claim 5, characterized in that The derived subclass corresponds to a parent class, the parent class maintains a cache list, and the use of the target pointer to forward the message to the application programming interface to obtain a forwarding result includes: Obtaining the instantiated object from the cache pool; If the state attribute of the instantiated object is in the working state, the application programming interface is searched for and called from the cache list maintained by the parent class of the derived subclass through the target pointer in the message center; If the application programming interface is not found in the cache list maintained by the parent class and the parent class is an abstract class of the application programming interface, a forwarding result indicating that the application programming interface is deleted or replaced in the upgraded software development kit is obtained.

7. The method according to claim 6, characterized in that The derived subclass has a binding function corresponding to it, and the binding function is used to pass parameters related to the derived subclass to the parent class of the derived subclass, and the target pointer in the message center is used to search for the application programming interface from the cache list maintained by the parent class of the derived subclass for calling, including: Passing parameters related to the derived subclass to the parent class corresponding to the derived subclass through the binding function corresponding to the derived subclass; Through the target pointer in the message center, based on the parameters passed in by the binding function, the application programming interface is searched from the cache list maintained by the parent class of the derived subclass for calling.

8. The method according to claim 4, characterized in that The method further comprises: Before compiling the source engineering code, obtaining the application programming interface in the source engineering code; Based on the application programming interface, generating an abstract class; Based on the abstract class, derive a derived subclass corresponding to the abstract class; and, Create a message center for the application programming interface.

9. The method according to claim 5, characterized in that The method further comprises: During the source engineering code compilation cycle, adding the application programming interface first called by the derived subclass to a cache list maintained by the derived subclass; The cache list maintained by the derived subclass is stored in the message center.

10. The method according to claim 4, characterized in that The calling difference includes an interface difference, and the data analysis is performed based on the forwarding result to obtain the analysis result, including: If the forwarding result is used to indicate that the application programming interface is deleted or replaced in the upgraded software development kit, a syntax analyzer is used to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application; If the application programming interface is not found in the upgraded software development kit through the abstract syntax tree, a differential calculation is performed between the application programming interface of the software development kit before the upgrade and the application programming interface of the upgraded software development kit to obtain an interface difference of the application programming interface before and after the upgrade of the software development kit; An analysis result is generated according to the interface difference of the application programming interface before and after the software development kit is upgraded.

11. The method according to claim 10, characterized in that The step of using a syntax analyzer to construct a syntax tree for the application programming interface to obtain an abstract syntax tree of the application program includes: Scanning the application programming interface call using a syntax analyzer, and segmenting the application programming interface call into a sequence of lexical units; According to the mapped grammatical rules, the lexical unit sequence is processed for syntax tree generation to obtain an abstract syntax tree of the application programming interface; the grammatical rules are obtained by matching the grammatical rules of the application programming interface using regular expressions before compiling the source engineering code.

12. The method according to claim 10 or 11, characterized in that The step of modifying and adapting the application programming interface in the source engineering code based on the calling difference includes: Determining, based on the interface differences, a target application programming interface for replacing the application programming interface in the source engineering code; According to the target application programming interface, the abstract syntax tree is changed to obtain an adapted application programming interface.

13. The method according to claim 1, characterized in that The method further comprises: If the application programming interface in the upgraded software development kit has restrictions on the range of operating system versions, the abstract syntax tree corresponding to the corresponding application programming interface in the source engineering code is modified according to the restricted operating system version.

14. The method according to claim 1, wherein: The method further comprises: An upgrade completion notification is sent to the development object corresponding to the source engineering code, where the upgrade completion notification is used to notify the development object that the software development tool kit upgrade is complete and the source engineering code compilation is complete.

15. An application programming interface adapter, characterized in that: include: An upgrading unit, configured to upgrade a software development kit in a source engineering code in response to an instruction to upgrade the software development kit in the source engineering code; the source engineering code is obtained by performing business development on the software development kit; the source engineering code includes an application programming interface in the software development kit to be called; A processing unit, used to compile the source engineering code based on the upgraded software development kit; The processing unit is further used to analyze and process the call of the application programming interface in the source engineering code by using the associated information of the application programming interface in the message center during the compilation of the source engineering code to obtain an analysis result; the analysis result is used to indicate the difference in the call of the application programming interface before and after the software development kit is upgraded; the message center refers to a virtual memory resource created for the application programming interface for storing the associated information of the application programming interface; The processing unit is further used to modify and adapt the application programming interface in the source engineering code based on the calling difference, and compile to obtain the target language code corresponding to the source engineering code.

16. A computer device, characterized in that: include: a processor suitable for executing a computer program; A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the method for adapting the application programming interface according to any one of claims 1 to 14 is executed.

17. A computer-readable storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the method for adapting the application programming interface according to any one of claims 1 to 14 is executed.

18. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method for adapting the application programming interface according to any one of claims 1 to 14 is implemented.