CN111061643B - SDK cluster compatibility detection method and device, electronic equipment and storage medium - Google Patents

SDK cluster compatibility detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111061643B
CN111061643B CN201911346899.1A CN201911346899A CN111061643B CN 111061643 B CN111061643 B CN 111061643B CN 201911346899 A CN201911346899 A CN 201911346899A CN 111061643 B CN111061643 B CN 111061643B
Authority
CN
China
Prior art keywords
sdk
target
information
section
version
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911346899.1A
Other languages
Chinese (zh)
Other versions
CN111061643A (en
Inventor
邓竹立
彭飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
58tongcheng Information Technology Co ltd
Original Assignee
58tongcheng Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 58tongcheng Information Technology Co ltd filed Critical 58tongcheng Information Technology Co ltd
Priority to CN201911346899.1A priority Critical patent/CN111061643B/en
Publication of CN111061643A publication Critical patent/CN111061643A/en
Application granted granted Critical
Publication of CN111061643B publication Critical patent/CN111061643B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a method and a device for detecting the compatibility of an SDK cluster, electronic equipment and a storage medium, wherein when an application program is started, a target file is obtained from a file of the application program, and the target file comprises pre-written current version information of each SDK; analyzing the current version information of each SDK from the target file; acquiring version declaration information of at least one SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK; and determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK. The method can realize automatic identification of SDK cluster compatibility without human intervention, further effectively avoids application program function faults caused by the compatibility problem among the SDKs, and has high accuracy and high efficiency in the scenes of large number of SDKs and increased version iteration.

Description

SDK cluster compatibility detection method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for detecting compatibility of an SDK cluster, an electronic device, and a storage medium.
Background
Software Development Kit (SDK) refers to a collection of Development tools used by a Software engineer to build application Software for a particular Software package, software framework, hardware platform, operating system, etc.
Nowadays, mobile-end applications refer to more and more SDKs (SDK clusters) to implement various functions of the applications. Because dependency relationships often exist among the SDKs in the SDK cluster, only if the versions of the SDKs with dependency relationships are compatible with each other, each SDK in the cluster can stably provide respective functions for the APP. Otherwise, once compatibility problem between SDKs occurs, APP function failure will result.
At present, the compatibility of the SDK version is monitored mainly by manpower, SDK developers record and release version documents of the SDK, and know the dependent version of the new version of the SDK access party, so that the SDK access party can update the version of the SDK depended by the new version of the SDK in time.
However, with the increase of the number of SDKs, the complexity of the dependency relationship between SDK versions will also increase by a factor, and it is difficult to manage and monitor manually at that time, the error rate is high, and the time for exposing the compatibility problem is relatively delayed, and it is difficult to find and solve the problem in time. For example, the SDK cluster includes two SDKs, a and B, and a depends on B, assuming that the client upgrades a to a ', a ' needs to depend on the upgrade version B ' of B, then if the developer does not maintain the version document of the SDK, the access party will not upgrade B to B ', resulting in incompatibility of a ' and B.
Disclosure of Invention
The application provides a method and a device for detecting the compatibility of an SDK cluster, electronic equipment and a storage medium, so as to realize automatic detection of the compatibility of the SDK cluster.
In a first aspect, the present application provides a method for detecting compatibility of an SDK cluster, where the method includes:
when an application program is started, acquiring a target file from a file of the application program, wherein the target file comprises current version information of each SDK written in advance;
analyzing the current version information of each SDK from the target file;
acquiring version declaration information of at least one SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK;
and determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK.
Further, before obtaining the target file from the file of the application program, the method further includes:
and modifying any function in the SDK so as to add the current version information of the SDK into a target file of an application program through the modified function.
Further, the adding the current version information of the SDK to the target file of the application program through the modified function includes:
generating a target section name according to the current version information;
and creating data sections in the target data section according to the target section names.
Further, the generating of the target section name according to the current version information includes:
serializing the current version information to obtain a nonstandard character sequence;
and generating the target section name comprising the non-standard character sequence and a preset standard character sequence.
Further, the target file is a binary file, and the analyzing of the current version information of each SDK from the target file includes:
loading the target data segment according to the target segment name;
traversing the data sections included in the target data segment;
acquiring the section name of the traversed data section;
judging whether the section name of the data section is a target section name;
and if the section name of the data section is the target section name, acquiring the current version information of the SDK from the target section name.
Further, the determining whether the node name of the data node is the target node name includes:
judging whether the section names of the data sections comprise the standard character sequence or not;
if the section name of the data section includes the standard character sequence, the section name of the data section is a target section name;
if the section name of the data section does not include the standard character sequence, then the section name of the data section is not the target section name.
Further, the obtaining the current version information of the SDK from the target section name includes:
extracting the non-standard character sequence from the target section name;
and performing deserialization processing on the non-standard character sequence to obtain the current version information of the SDK.
Further, the determining whether the SDKs are compatible by comparing the current version information and the lowest version information of the same SDK includes:
acquiring the current version information of the dependent SDK according to the identifier of the dependent SDK;
comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK;
determining that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version;
and if the current version of the dependent SDK is not lower than the lowest version, determining that the dependent SDK is compatible.
Further, the obtaining of the version declaration information of the at least one SDK includes:
receiving version declaration information of the SDK sent by a client side to which the at least one SDK belongs after the SDK is upgraded; or,
acquiring version declaration information of the SDK from the client side of each SDK;
judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time;
if the SDK version declaration information is consistent with the SDK version declaration information, discarding the SDK version declaration information;
and if not, retaining the version declaration information of the SDK.
Further, the method further comprises:
and if the SDK is determined to be incompatible, generating an interface prompt for prompting a user to update the version of the SDK and displaying the interface prompt.
In a second aspect, the present application further provides an apparatus for detecting compatibility of an SDK cluster, where the apparatus includes:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a target file from a file of an application program when the application program is started, and the target file comprises current version information of each SDK written in advance;
the analysis module is used for analyzing the current version information of each SDK from the target file;
the second obtaining module is used for obtaining version declaration information of at least one SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK;
and the comparison module is used for determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK.
Further, the apparatus further comprises:
the modification module is used for modifying any function in the SDK;
and the adding module is used for adding the current version information of the SDK into a target file of the application program through the modified function.
Further, the target file includes at least one data segment, each of the data segments includes at least one data section, and the adding module includes:
the generating unit is used for generating a target section name according to the current version information;
and the creating unit is used for creating data sections in the target data section according to the target section names.
Further, the generation unit includes:
the serialization subunit is used for carrying out serialization processing on the current version information to obtain a nonstandard character sequence;
and the splicing subunit is used for generating the target section name comprising the non-standard character sequence and a preset standard character sequence.
Further, the target file is a binary file, and the parsing module includes:
the loading unit is used for loading the target data segment according to the target segment name;
the traversal acquisition unit is used for traversing the data sections included in the target data segment and acquiring the section names of the traversed data sections;
the judging unit is used for judging whether the section name of the data section is a target section name;
and the intercepting unit is used for acquiring the current version information of the SDK from the target node name if the node name of the data node is the target node name.
Further, the determining unit is specifically configured to:
judging whether the section names of the data sections comprise the standard character sequence or not;
if the section name of the data section includes the standard character sequence, the section name of the data section is a target section name;
if the section name of the data section does not include the standard character sequence, then the section name of the data section is not the target section name.
Further, the intercepting unit includes:
an extracting subunit, configured to extract the non-standard character sequence from the target segment name;
and the deserializing subunit is used for deserializing the nonstandard character sequence to obtain the current version information of the SDK.
Further, the comparison module includes:
the obtaining unit is used for obtaining the current version information of the dependent SDK according to the identification of the dependent SDK;
the comparison unit is used for comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK;
a determining unit, configured to determine that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version; and if the current version of the dependent SDK is not lower than the lowest version, determining that the dependent SDK is compatible.
Further, the obtaining module is specifically configured to:
receiving version declaration information of the SDK sent by a client side to which the at least one SDK belongs after the SDK is upgraded; or,
acquiring version declaration information of each SDK from a client to which the SDK belongs;
judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time;
if the SDK version declaration information is consistent, discarding the SDK version declaration information;
and if not, retaining the version declaration information of the SDK.
Further, the apparatus further comprises:
and the prompting module is used for generating an interface prompt and displaying the interface prompt if the SDK is determined to be incompatible, wherein the interface prompt is used for prompting a user to update the version of the SDK.
In a third aspect, the present application further provides an electronic device, including:
a memory for storing program instructions;
a processor for calling and executing program instructions in said memory to implement the method of any of the first aspects.
In a fourth aspect, the present application further provides a storage medium having a computer program stored therein, which when executed by at least one processor of the apparatus of the second aspect, performs the method of the first aspect.
As can be seen from the foregoing technical solutions, embodiments of the present application provide a method and an apparatus for detecting compatibility of an SDK cluster, an electronic device, and a storage medium, where when an application is started, a target file is obtained from a file of the application, where the target file includes current version information of each SDK written in advance; analyzing the current version information of each SDK from the target file; acquiring version declaration information of at least one SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK; and determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK. The method can realize automatic identification of SDK cluster compatibility without human intervention, further effectively avoids application program function faults caused by the compatibility problem among the SDKs, and has high accuracy and high efficiency in the scenes of large number of SDKs and increased version iteration.
Drawings
In order to more clearly describe the technical solution of the present application, the drawings required to be used in the embodiments will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
Fig. 1 is a flowchart illustrating a method for detecting compatibility of an SDK cluster according to an exemplary embodiment of the present application;
fig. 2 is a block diagram of a device for detecting compatibility of an SDK cluster according to an exemplary embodiment of the present application;
fig. 3 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to find a problem of version compatibility between SDKs in an SDK cluster referenced by an application in time, an embodiment of the present application provides a method for detecting compatibility of the SDK cluster, where fig. 1 is a flowchart of a method for detecting compatibility of the SDK cluster shown in this application according to an exemplary embodiment, and as shown in fig. 1, the method may include:
step 100, when the application program is started, obtaining a target file from the file of the application program, wherein the target file comprises the current version information of each SDK written in advance.
The SDK cluster includes a plurality of SDKs that are referenced by the application. The current version information of the SDK refers to the version information of the SDK developer that has last updated its version, and includes the identifier of the SDK and the current version number. The current version information of the SDKs is written by the respective SDKs into the object file of the application at compile time. The target file is a binary file in many files of the application program, for example, for the application program based on the IOS system, the target file may be a Mach-O file. The target file may include at least one data segment (segment), each segment including at least one data section (section).
As a possible implementation manner, any function in the SDK is modified, a data section with a name of a target section name is included in a target data section of the target file by virtue of the attribute of the modified function, and the target section name is generated according to the current version information of the SDK, that is, the current version information of the SDK is included in the target section name, so that the current version information of the SDK is added to the target file. The target data segment is a data segment, such as a Text segment, which is designated when the SDK function is modified and has a segment name of _ Text.
In an implementation manner of generating a target section name according to current version information:
firstly, carrying out serialization processing on current version information to obtain a nonstandard character sequence; wherein the current version information has a predefined data format, such as the dictionary dic, the identification of the explicit SDK in the dic and the current version number. An exemplary current version information dic is as follows, "RN" is the identification of the SDK, and "3.1.2" is the current version number of the SDK RN.
Figure BDA0002333619960000061
Then, the target section name including the non-standard character sequence and a preset standard character sequence is generated. For example, a preset standard character sequence "WBSG" may be spliced as a prefix before the non-standard character sequence, or the standard character sequence "WBSG" may be spliced as a suffix after the non-standard character sequence, and a new character string sequence formed by splicing is a target section name, for example, the new character string is section _ str.
Illustratively, a _ attribute modification is added after an arbitrary function in the SDK, and a section named "section _ str" is created in a Text section (section name _ Text) of the applied binary file by means of a function attribute, so that the current version information of the SDK is written into the target file.
Step 200, analyzing the current version information of each SDK from the target file.
Since each SDK writes its current version information into the target data segment of the target file at compile time, when the current version information of the SDK is parsed from the target file, the target data segment is triggered to be loaded first according to the name of the target segment (the name of the target data segment).
Because the current version information of each SDK exists in the target data segment in the form of a section name of a certain section, and the section name (target section name) containing the current version information includes a standard character sequence, after the target data segment is loaded, all data sections of the target data segment are traversed, and the section names of the traversed data sections are acquired, and for each acquired section name, whether the acquired section name is the target section name is determined by determining whether the acquired section name includes a standardized character sequence, and if the acquired section name includes a standardized character sequence, the section name is the target section name, otherwise, the section name is a non-target section name.
Based on the above example, the target data segment is a Text segment, the target segment name is _ Text, and the standard character sequence contained in the target paragraph name is "WBSG", then in this example, the Text segment with the segment name _ Text needs to be loaded first; then traversing the section arrays in the text sections to obtain the section name of each section in the arrays; and judging whether the section names contain a standard character sequence WBSG or not for each acquired section name, wherein the WBSG may be a prefix or a suffix of the section name, determining that a certain section name is a target section name if the certain section name contains the WBSG and determining that the certain section name is not the target section name if the certain section name does not contain the WBSG according to the judgment result.
If the node name of the data node is the target node name, the current version information of an SDK may be obtained from the target node name. Specifically, the target section name is composed of a non-standard character sequence and a standard character sequence, wherein the non-standard character sequence is represented by serialization of the current version information of the SDK, so that in order to acquire the current version information of the SDK from the target section name, the non-standard character sequence is firstly extracted from the target section name, then the non-standard character sequence is subjected to deserialization, and further the current version information of the SDK is acquired.
Step 300, obtaining version declaration information of at least one SDK, where the version declaration information includes dependent SDKs of the SDKs and minimum version information of the dependent SDKs.
As described in the background section, there are complex dependencies between SDKs in an SDK cluster, and the greater the number of SDKs, the more complex the dependency appears. For convenience of distinction and explanation, the SDK depended on by each SDK is referred to as a dependent SDK of the SDK in the present embodiment, and it is understood that any SDK in the cluster may be a dependent SDK of other SDKs, and meanwhile, has its own dependent SDK.
In order to facilitate management, maintenance, and communication of data, in this embodiment, a data format of the version declaration information is predefined, such as a dictionary dependent _ dic, an identifier of a dependent SDK explicitly in the dependent _ dic, and a required minimum version number of the dependent SDK, where one or more dependent SDKs of an SDK may be used. An exemplary version declaration dependent _ dic is as follows:
Figure BDA0002333619960000071
in the above exemplary version declaration depend _ dic, the identification of each dependent SDK and the required lowest version number of the dependent SDK are specified in the form of Key-Value, for example, in the depend _ dic, the dependent SDK includes "RN" and "IM" and the like, the lowest version number of "RN" is "3.0.0", and the lowest version number of "IM" is "6.0.0".
In some embodiments, the affiliated client of the SDK sends version declaration information for the SDK to the application after completing the upgrade of the home SDK.
In some embodiments, version declaration information for the home SDK is obtained by the application from the affiliated client of each SDK; then judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time; if the version information is consistent, the version information is discarded, and if the version information is inconsistent, the version information is maintained.
Step 400, determining whether the SDKs are compatible by comparing the current version information and the lowest version information of the same SDK.
Since the lowest version information is a version requirement for the dependent SDK, in step 400, the current version information and the lowest version information of each dependent SDK are compared one by one to determine whether the dependent SDK is compatible with other SDKs.
Specifically, for each dependent SDK related in the version declaration information of each SDK, first, according to the identifier of the dependent SDK, the current version information of the dependent SDK is obtained from the current version information of each SDK analyzed in step 200; then comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK; determining that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version; if the current version of the dependent SDK is not below the lowest version, it is determined that the dependent SDK is compatible.
Exemplarily, it is assumed that the current version information of each SDK parsed from the target file in step 200 and the version declaration information of the SDK acquired in step 300 are respectively as follows:
current version information for each SDK
Figure BDA0002333619960000081
Acquiring the identifiers "RN" and "IM" of the dependent SDKs of the SDK from the version declaration information of the certain SDK, so as to acquire the current version information of the dependent SDK according to the identifier of the dependent SDK, respectively acquiring the current version information of the "RN" as "3.1.2" and the current version information of the "IM" as "5.1.2", comparing the current version information of the "RN" with the lowest version information, wherein the current version number "3.1.2" is not lower than the lowest version number "3.0.0", so that the SDK "RN" is compatible, comparing the current version information of the "IM" with the lowest version information, wherein the current version number "5.1.2" is lower than the lowest version number "6.0.0", and therefore the SDK "IM" is incompatible.
In some embodiments, the method for detecting compatibility of an SDK cluster provided in the embodiment of the present application further includes:
step 500, if the SDK is determined to be incompatible, generating an interface prompt for prompting a user to update the version of the SDK and displaying the interface prompt.
It should be noted that, in order to be able to timely and automatically perform the above steps 100 to 500 when an application program is started to implement compatibility detection on an SDK cluster, a start function may be predefined, and when the application program is started, the start function is automatically called, so as to implement part or all of the implementation of the embodiment of the present application through the start function.
As can be seen from the foregoing embodiments, in the compatibility detection method for an SDK cluster provided in an embodiment of the present application, when an application is started, a target file is obtained from a file of the application, where the target file includes current version information of each SDK written in advance; analyzing the current version information of each SDK from the target file; acquiring version declaration information of at least one SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK; and determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK. The method can realize automatic identification of SDK cluster compatibility, does not need human intervention, writes the target file before compiling, reads the target file after compiling, realizes communication in the SDK cluster, and effectively avoids application program function faults caused by the compatibility problem among the SDKs.
According to the method for detecting the compatibility of the SDK cluster provided in the foregoing embodiment, an embodiment of the present application further provides a device for detecting the compatibility of the SDK cluster, where as shown in fig. 2, the device includes: a first obtaining module 210, configured to obtain a target file from a file of an application program when the application program is started, where the target file includes current version information of each SDK written in advance; the parsing module 220 is configured to parse the current version information of each SDK from the target file; a second obtaining module 230, configured to obtain version declaration information of at least one SDK, where the version declaration information includes a dependent SDK of the SDK and lowest version information of the dependent SDK; the comparing module 240 is configured to determine whether the SDKs are compatible by comparing the current version information and the lowest version information of the same SDK.
In some embodiments, the apparatus further comprises: the modification module is used for modifying any function in the SDK; and the adding module is used for adding the current version information of the SDK into a target file of an application program through the modified function.
In some embodiments, the target file includes at least one data segment, each of the data segments includes at least one data section, and the adding module includes: the generating unit is used for generating a target section name according to the current version information; and the creating unit is used for creating data sections in the target data section according to the target section names.
In some embodiments, the generating unit comprises: the serialization subunit is used for carrying out serialization processing on the current version information to obtain a nonstandard character sequence; and the splicing subunit is used for generating the target section name comprising the non-standard character sequence and a preset standard character sequence.
In some embodiments, the target file is a binary file, and the parsing module includes: a loading unit for loading the target data segment according to the target segment name; the traversal acquisition unit is used for traversing the data sections included in the target data segment and acquiring the section names of the traversed data sections; the judging unit is used for judging whether the section name of the data section is a target section name; and the intercepting unit is used for acquiring the current version information of the SDK from the target node name if the node name of the data node is the target node name.
In some embodiments, the determining unit is specifically configured to: judging whether the section names of the data sections comprise the standard character sequence or not; if the section name of the data section includes the standard character sequence, the section name of the data section is a target section name; if the section name of the data section does not include the standard character sequence, then the section name of the data section is not the target section name.
In some embodiments, the intercepting unit comprises: an extracting subunit, configured to extract the non-standard character sequence from the target section name; and the deserializing subunit is used for deserializing the nonstandard character sequence to obtain the current version information of the SDK.
In some embodiments, the comparison module comprises: the obtaining unit is used for obtaining the current version information of the dependent SDK according to the identification of the dependent SDK; the comparison unit is used for comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK; a determining unit, configured to determine that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version; and if the current version of the dependent SDK is not lower than the lowest version, determining that the dependent SDK is compatible.
In some embodiments, the obtaining module is specifically configured to: receiving version declaration information of the SDK sent by a client side to which the at least one SDK belongs after the SDK is upgraded; or acquiring version declaration information of the SDK from the client side to which each SDK belongs; judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time; if the SDK version declaration information is consistent with the SDK version declaration information, discarding the SDK version declaration information; and if the SDK version declaration information is inconsistent, retaining the SDK version declaration information.
In some embodiments, the apparatus further comprises: and the prompting module is used for generating an interface prompt and displaying the interface prompt if the SDK is determined to be incompatible, wherein the interface prompt is used for prompting a user to update the version of the SDK.
As can be seen from the foregoing embodiments, in the compatibility detection apparatus for an SDK cluster provided in the embodiments of the present application, when an application is started, a first obtaining module 210 obtains a target file from a file of the application, where the target file includes current version information of each SDK written in advance; the parsing module 220 parses the current version information of each SDK from the target file; the second obtaining module 230 obtains version declaration information of at least one SDK, where the version declaration information includes dependent SDKs of the SDKs and minimum version information of the dependent SDKs; the comparison module 240 determines whether the SDKs are compatible by comparing the current version information and the lowest version information of the same SDK. The device can automatically recognize the compatibility of the SDK cluster, does not need human intervention, writes the target file before compiling, reads the target file after compiling, realizes communication in the SDK cluster, and effectively avoids application program functional faults caused by the compatibility problem among the SDKs.
Fig. 3 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 3, the electronic device may include: a memory 301 for storing program instructions; the processor 302 is configured to call and execute the program instructions in the memory to implement the above-described compatibility detection method for the SDK cluster.
In this embodiment, the processor and the memory may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement an embodiment of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
In a specific implementation, the present invention further provides a computer storage medium, where the computer storage medium may store a computer program, and when at least one processor of the compatibility detection apparatus of the SDK cluster executes the computer program, the compatibility detection apparatus of the SDK cluster executes some or all of the steps in each embodiment of the compatibility detection method of the SDK cluster according to the present application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be substantially or partially embodied in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, or the like, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts among the various embodiments in this specification may be referred to each other. In particular, as for the device, the electronic apparatus and the storage medium embodiments, since they are substantially similar to the method embodiments, the description is simple, and reference may be made to the description in the method embodiments for relevant points.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.

Claims (20)

1. A method for detecting compatibility of an SDK cluster, the method comprising:
when an application program is started, acquiring a target file from a file of the application program, wherein the target file comprises current version information of each SDK written in advance;
analyzing the current version information of each SDK from the target file;
receiving version declaration information of the SDK sent by a client side to which the at least one SDK belongs after the SDK is upgraded; or acquiring version declaration information of the SDK from the client side to which each SDK belongs; the version declaration information of the SDK is in a Key-Value form data format;
judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time;
if the SDK version declaration information is consistent with the SDK version declaration information, discarding the SDK version declaration information;
if not, retaining the version declaration information of the SDK, wherein the version declaration information of the SDK comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK;
and determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK.
2. The method of claim 1, wherein before obtaining the target file from the file of the application program, the method further comprises:
and modifying any function in the SDK so as to add the current version information of the SDK into a target file of an application program through the modified function.
3. The method of claim 2, wherein the target file comprises at least one data segment, each data segment comprises at least one data section, and wherein adding the current version information of the SDK to the target file of the application program through the modified function comprises:
generating a target section name according to the current version information;
and creating data sections in a target data section according to the target section name.
4. The method of claim 3, wherein generating the target section name according to the current version information comprises:
serializing the current version information to obtain a nonstandard character sequence;
and generating the target section name comprising the non-standard character sequence and a preset standard character sequence.
5. The method as claimed in claim 4, wherein the target file is a binary file, and the parsing out the current version information of each SDK from the target file includes:
loading the target data segment according to the target segment name;
traversing the data sections included in the target data segment;
acquiring the section name of the traversed data section;
judging whether the section name of the data section is a target section name;
and if the section name of the data section is a target section name, acquiring the current version information of the SDK from the target section name.
6. The method of claim 5, wherein determining whether the section name of the data section is the target section name comprises:
judging whether the section names of the data sections comprise the standard character sequence or not;
if the section name of the data section comprises the standard character sequence, the section name of the data section is a target section name;
if the section name of the data section does not include the standard character sequence, then the section name of the data section is not the target section name.
7. The method as claimed in claim 6, wherein the obtaining the current version information of the SDK from the target node name comprises:
extracting the non-standard character sequence from the target section name;
and performing deserialization processing on the non-standard character sequence to obtain the current version information of the SDK.
8. The method of claim 1, wherein the determining whether the SDKs are compatible by comparing the current version information and the lowest version information of the same SDK comprises:
acquiring the current version information of the dependent SDK according to the identifier of the dependent SDK;
comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK;
determining that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version;
and if the current version of the dependent SDK is not lower than the lowest version, determining that the dependent SDK is compatible.
9. The method according to any one of claims 1-8, further comprising:
and if the SDK is determined to be incompatible, generating an interface prompt for prompting a user to update the version of the SDK and displaying the interface prompt.
10. An apparatus for detecting compatibility of an SDK cluster, the apparatus comprising:
the first acquisition module is used for acquiring a target file from a file of an application program when the application program is started, wherein the target file comprises current version information of each SDK written in advance;
the analysis module is used for analyzing the current version information of each SDK from the target file;
the second acquisition module is used for receiving version declaration information of the SDK sent by the client side to which the at least one SDK belongs after the SDK is upgraded; or acquiring the version declaration information of the SDK from the client side to which each SDK belongs; the version declaration information of the SDK is in a Key-Value form data format;
judging whether the acquired version declaration information of the SDK is consistent with the version declaration information of the SDK acquired last time;
if the SDK version declaration information is consistent with the SDK version declaration information, discarding the SDK version declaration information;
if not, retaining version declaration information of the SDK, wherein the version declaration information comprises a dependent SDK of the SDK and the lowest version information of the dependent SDK;
and the comparison module is used for determining whether the SDKs are compatible or not by comparing the current version information and the lowest version information of the same SDK.
11. The apparatus of claim 10, further comprising:
the modification module is used for modifying any function in the SDK;
and the adding module is used for adding the current version information of the SDK into a target file of the application program through the modified function.
12. The apparatus of claim 11, wherein the object file comprises at least one data segment, each of the data segments comprising at least one data section, and wherein the adding module comprises:
the generating unit is used for generating a target section name according to the current version information;
and the creating unit is used for creating data sections in the target data section according to the target section names.
13. The apparatus of claim 12, wherein the generating unit comprises:
the serialization subunit is used for carrying out serialization processing on the current version information to obtain a nonstandard character sequence;
and the splicing subunit is used for generating the target section name comprising the non-standard character sequence and a preset standard character sequence.
14. The apparatus of claim 13, wherein the object file is a binary file, and wherein the parsing module comprises:
the loading unit is used for loading the target data segment according to the target segment name;
the traversal acquisition unit is used for traversing the data sections included in the target data segment and acquiring the section names of the traversed data sections;
the judging unit is used for judging whether the section name of the data section is a target section name;
and the intercepting unit is used for acquiring the current version information of the SDK from the target node name if the node name of the data node is the target node name.
15. The apparatus according to claim 14, wherein the determining unit is specifically configured to:
judging whether the section names of the data sections comprise the standard character sequence or not;
if the section name of the data section includes the standard character sequence, the section name of the data section is a target section name;
if the section name of the data section does not include the standard character sequence, then the section name of the data section is not the target section name.
16. The apparatus of claim 15, wherein the truncating unit comprises:
an extracting subunit, configured to extract the non-standard character sequence from the target section name;
and the deserializing subunit is used for deserializing the nonstandard character sequence to obtain the current version information of the SDK.
17. The apparatus of claim 10, wherein the comparison module comprises:
the obtaining unit is used for obtaining the current version information of the dependent SDK according to the identification of the dependent SDK;
the comparison unit is used for comparing the current version information of the dependent SDK with the lowest version information of the dependent SDK;
a determining unit, configured to determine that the dependent SDK is incompatible if the current version of the dependent SDK is lower than the lowest version; and if the current version of the dependent SDK is not lower than the lowest version, determining that the dependent SDK is compatible.
18. The apparatus of any one of claims 10-17, further comprising:
and the prompting module is used for generating an interface prompt and displaying the interface prompt if the SDK is determined to be incompatible, wherein the interface prompt is used for prompting a user to update the version of the SDK.
19. An electronic device, comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in said memory to implement the method of any of claims 1-9.
20. A storage medium, in which a computer program is stored, which, when executed by at least one processor of an apparatus according to any one of claims 10-18, causes the apparatus to perform the method according to any one of claims 1-9.
CN201911346899.1A 2019-12-24 2019-12-24 SDK cluster compatibility detection method and device, electronic equipment and storage medium Active CN111061643B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911346899.1A CN111061643B (en) 2019-12-24 2019-12-24 SDK cluster compatibility detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911346899.1A CN111061643B (en) 2019-12-24 2019-12-24 SDK cluster compatibility detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111061643A CN111061643A (en) 2020-04-24
CN111061643B true CN111061643B (en) 2023-03-31

Family

ID=70303159

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911346899.1A Active CN111061643B (en) 2019-12-24 2019-12-24 SDK cluster compatibility detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111061643B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112214408B (en) * 2020-10-12 2024-05-28 抖音视界有限公司 Dependency conflict detection method, dependency conflict detection device, electronic equipment and computer readable medium
CN112764797B (en) * 2021-01-06 2023-03-21 浙江大华技术股份有限公司 Software compatibility detection method and device, electronic device and storage medium
CN113536316B (en) * 2021-06-17 2023-08-11 深圳开源互联网安全技术有限公司 Method and device for detecting component dependency information
CN113934642B (en) * 2021-11-19 2024-05-14 四川启睿克科技有限公司 Software compatibility testing method based on dynamic and static combination
CN114328270B (en) * 2022-01-20 2024-05-03 重庆长安汽车股份有限公司 OTA upgrade detection method based on SOA service and readable storage medium
CN115658374B (en) * 2022-12-23 2023-05-26 深圳市明源云科技有限公司 Platform compatibility problem repairing method and device, electronic equipment and storage medium
CN116382795A (en) * 2023-03-24 2023-07-04 阿里巴巴(中国)有限公司 System resource calling method and device
CN116881118B (en) * 2023-06-01 2024-05-14 广州汽车集团股份有限公司 Conflict detection method, device, electronic equipment and storage medium
CN116795452B (en) * 2023-07-20 2024-04-02 龙芯中科(北京)信息技术有限公司 Method, device and equipment for determining compatibility of driving program
CN118363649A (en) * 2024-03-29 2024-07-19 广州逸虎网络科技有限公司 APK file fusion method, device, equipment and medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032820B (en) * 2018-08-08 2021-02-12 网易(杭州)网络有限公司 Processing method and device for application program version compatibility
CN109783366A (en) * 2018-12-15 2019-05-21 深圳壹账通智能科技有限公司 APP edition upgrading compatibility test method, device, equipment and storage medium
CN109977008B (en) * 2019-02-22 2022-03-29 福建天泉教育科技有限公司 Method and terminal for making JS code depended on by application program compatible with native library

Also Published As

Publication number Publication date
CN111061643A (en) 2020-04-24

Similar Documents

Publication Publication Date Title
CN111061643B (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
US11481200B1 (en) Checking source code validity at time of code update
CN108920691B (en) Front-end static resource management method and device, computer equipment and storage medium
CN111897570A (en) Multi-dependency file extraction method and device based on Maven plug-in
CN107783766B (en) Method and device for cleaning files of application program
US11422917B2 (en) Deriving software application dependency trees for white-box testing
CN114968754A (en) Application program interface API test method and device
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
WO2016202000A1 (en) Differential rollback upgrading method and apparatus
CN116028122A (en) Device processing method and device based on processor
CN114003269A (en) Component processing method and device, electronic equipment and storage medium
CN112800194A (en) Interface change identification method, device, equipment and storage medium
CN108279905A (en) The method and device of library file is introduced in a kind of component
CN117251139A (en) Business process configuration management method, device, equipment and storage medium
CN115080114B (en) Application program transplanting processing method, device and medium
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN113821486B (en) Method and device for determining dependency relationship between pod libraries and electronic equipment
US20150347402A1 (en) System and method for enabling a client system to generate file system operations on a file system data set using a virtual namespace
US10146529B2 (en) Monitoring rules declaration and automatic configuration of the monitoring rules
CN111273940B (en) Method and device for uploading program file to code warehouse
WO2022214200A1 (en) Method and network element for pre-upgrade use case validation
CN113094086A (en) Component integration method and device, computer-readable storage medium and electronic equipment
CN113535221A (en) Method and device for managing application version
CN115421785B (en) Method, device and medium for transplanting application program
US20230094137A1 (en) Generating and visualizing a data structure of a management model of an application server

Legal Events

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