CN112748930B - Compilation detection method, device, equipment and storage medium - Google Patents

Compilation detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN112748930B
CN112748930B CN202110070637.8A CN202110070637A CN112748930B CN 112748930 B CN112748930 B CN 112748930B CN 202110070637 A CN202110070637 A CN 202110070637A CN 112748930 B CN112748930 B CN 112748930B
Authority
CN
China
Prior art keywords
class information
sdk
level
compiling
calling
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
CN202110070637.8A
Other languages
Chinese (zh)
Other versions
CN112748930A (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.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya 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 Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202110070637.8A priority Critical patent/CN112748930B/en
Publication of CN112748930A publication Critical patent/CN112748930A/en
Application granted granted Critical
Publication of CN112748930B publication Critical patent/CN112748930B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The embodiment of the invention discloses a compiling detection method, a compiling detection device, compiling detection equipment and a storage medium. The method comprises the following steps: acquiring a first-level Software Development Kit (SDK) referenced by a target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program; acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK; and matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program. The technical scheme of the embodiment of the invention realizes that the program calling error is detected during the program compiling period, and reduces the program crash times.

Description

Compilation detection method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a compiling detection method, a compiling detection device, compiling detection equipment and a storage medium.
Background
With the development of computer technology, the third party jar (Java Archive) package/aar (Android Archive) package is often referred to in project development, and external dependencies exist in the jar package/aar package. When the version of the external dependent jar package/aar package is replaced, the project program is normal in the compiling process, but when the project is really running on line, the triggering of the external dependent jar package/aar package leads to program calling errors, and the project program crashes.
Disclosure of Invention
The embodiment of the invention provides a compiling detection method, a compiling detection device, compiling detection equipment and a storage medium, which can detect program calling errors during program compiling and reduce program crash times.
In a first aspect, an embodiment of the present invention provides a compile detection method, including:
acquiring a first-level software development kit (Software Development Kit, SDK) referenced by the target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
Optionally, obtaining the first-level software development kit SDK referenced by the target program and the second-level SDK referenced by the first-level SDK includes:
and acquiring a first-level SDK referenced by the target program and a second-level SDK referenced by the first-level SDK by utilizing a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain the corresponding byte code file.
Optionally, obtaining the call class information included in the first-level SDK and the definition class information included in the second-level SDK includes:
and respectively extracting class information from the byte code files corresponding to the first-level SDK and the second-level SDK by using ASM to obtain calling class information and definition class information.
Optionally, extracting class information from the byte code files corresponding to the first level SDK and the second level SDK by using ASM to obtain call class information and definition class information, including:
and respectively accessing byte code files corresponding to the first level SDK and the second level SDK according to the order of the information access level from low to high by using ASM to obtain calling class information and definition class information.
Optionally, matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program, including:
traversing each piece of calling class information, and if the matched definition class information exists in each piece of calling class information, determining that the compiling detection result is successful;
if the definition class information which is not matched with the calling class information exists, determining that the compiling detection result is a compiling error.
Optionally, after determining that the compiling detection result is compiling error, the method further includes:
acquiring a target SDK name and a target calling program corresponding to the compiling error target calling class information;
and outputting a compiling detection result of compiling errors, a target SDK name and a target calling program according to a preset output format.
Optionally, the information access level includes: the class resource information is the first access level, the external class is the second access level, the annotation and class attribute is the third access level, and the internal class, variable and method are the fourth access level.
In a second aspect, an embodiment of the present invention further provides a compiling detection device, including:
the SDK acquisition module is used for acquiring a first-level Software Development Kit (SDK) referenced by the target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
the class information acquisition module is used for acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK;
and the compiling detection module is used for matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the compile detection method provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the compile detection method provided by any embodiment of the present invention.
In the embodiment of the invention, a first-level SDK referenced by a target program and a second-level SDK referenced by the first-level SDK are acquired in the process of compiling the target program; acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK; the method comprises the steps of matching calling class information with definition class information to obtain a compiling detection result corresponding to a target program, solving the problem that calling errors cannot be detected during program compiling in the prior art, and timely finding out program calling errors and reducing program crash times by detecting consistency of the calling class information and the definition class information during program compiling.
Drawings
FIG. 1a is a flow chart of a compile detection method in accordance with a first embodiment of the present invention;
FIG. 1b is a schematic diagram of scanned content in accordance with an embodiment of the present invention;
FIG. 1c is a schematic diagram of a file access sequence adapted to an embodiment of the present invention;
FIG. 1d is a schematic diagram of an output result adapted to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a compiling detecting device according to a second embodiment of the invention;
fig. 3 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1a is a flowchart of a compile detection method according to a first embodiment of the present invention, which is applicable to detecting program call errors during program compilation, and which may be performed by a compile detection device, which may be implemented in software and/or hardware and may be generally integrated in an electronic device, such as a client or a server. As shown in fig. 1a, the method comprises:
step 110, in the process of compiling the target program, a first level SDK referred to by the target program and a second level SDK referred to by the first level SDK are obtained.
In this embodiment, the target program may be program code of an item such as XX plug-in, and the SDK may be a jar package or aar package generated correspondingly according to the service requirement, and the target program may specify the SDK by referring to the target program, and use functions of the SDK. The first-level SDK is a third-party jar package/aar package directly referenced by the target program, and the second-level SDK is a jar package/aar package referenced by the third-party jar package/aar package.
The jar package is an archive file of a java byte code file (class file), and only comprises the class file and the list file, and does not contain information such as resource files in android; aar package is an archive file unique to an android, and contains both a bytecode file and a resource file of an android.
Optionally, obtaining the first level SDK referenced by the target program and the second level SDK referenced by the first level SDK may include: and acquiring a first-level SDK referenced by the target program and a second-level SDK referenced by the first-level SDK by utilizing a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain the corresponding byte code file.
In this embodiment, in order to detect whether the call to the method in the second level SDK in the first level SDK is correct later, in the process of compiling the target program by using the compiling tool gardle, the Transform API may be used to obtain each third party jar package/aar package referenced by the target program, and each third party jar package/aar package externally dependent jar package/aar package, decompress all jar packages/aar packages, extract class files in each jar package/aar package, and send the class files to the ASM, so as to extract specified class information from the class files through the ASM.
Step 120, call class information included in the first-level SDK and definition class information included in the second-level SDK are acquired.
Optionally, obtaining the call class information included in the first level SDK and the definition class information included in the second level SDK may include: and respectively extracting class information from the byte code files corresponding to the first-level SDK and the second-level SDK by using ASM to obtain calling class information and definition class information.
The ASM is a generic Java bytecode operation and analysis framework, and can be applied to dynamically generating classes or enhancing functions of existing classes, for example, binary class files can be directly generated, and information such as class names, methods, attributes, java bytecodes (instructions) and the like can be read from class files before the classes are loaded into a Java virtual machine, so as to dynamically change class behaviors.
In this embodiment, the ASM may be used to scan class files in jar packets/aar packets extracted by the Transform API, so as to extract call class information from the first level SDK, extract definition class information from the second level SDK, and store the call class information and the definition class information. The class information obtained by scanning may be as shown in fig. 1b, and includes: the packet name of jar packet/aar packet, class name (including internal class and anonymous class), method name of calling method, variable, enumeration, annotation, interface, etc.
It should be noted that although ASM is commonly used for inserting byte codes, in this embodiment, the class file is not required to be modified by ASM, and only class information is required to be scanned and analyzed from the class file, so that the influence on the overall performance of the target program can be avoided while the call error in the target program is detected.
Optionally, extracting class information from the byte code files corresponding to the first level SDK and the second level SDK by using ASM to obtain call class information and definition class information, which may include: and respectively accessing byte code files corresponding to the first level SDK and the second level SDK according to the order of the information access level from low to high by using ASM to obtain calling class information and definition class information.
Optionally, the information access level includes: the class resource information is the first access level, the external class is the second access level, the annotation and class attribute is the third access level, and the internal class, variable and method are the fourth access level.
In this embodiment, for each class file in the first level SDK and the second level SDK, the access method in the ASM that matches each information access level may be sequentially called according to the order of the information access level from low to high, and the corresponding class information may be scanned and extracted from the class file. As shown in fig. 1c, in order of access, information such as class resource information, external class, annotation (including class annotation, method annotation, and variable annotation), class attribute, internal class, variable (including local variable and member variable), and method name may be sequentially extracted from the class file, and all the extracted information may be used as class information of the class file.
And 130, matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
Optionally, matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program may include: traversing each piece of calling class information, and if the matched definition class information exists in each piece of calling class information, determining that the compiling detection result is successful; if the definition class information which is not matched with the calling class information exists, determining that the compiling detection result is a compiling error.
In this embodiment, after the calling class information and the definition class information are obtained, the calling class information and the definition class information need to be compared, and whether the calling and definition of the method are inconsistent or not is determined according to the difference between the calling class information and the definition class information. For example, assuming that class B in third party jar package a referenced by the target program calls method E of class D in external dependent jar package C, but a method with a method name of E does not exist in the definition class information, or a parameter variable of a method with a method name of E in the definition class information is different from a parameter variable of method E in the call class information, or there are other inconsistencies, it is considered that an error is found in the compilation detection, and a compilation error can be determined.
Although each piece of calling class information is compared with the definition class information, the compiling is considered successful only when all pieces of calling class information have the same definition class information, and if at least one piece of calling class information is inconsistent with the definition class information, the compiling is considered to be wrong.
Optionally, after determining that the compilation detection result is a compilation error, the method may further include: acquiring a target SDK name and a target calling program corresponding to the compiling error target calling class information; and outputting a compiling detection result of compiling errors, a target SDK name and a target calling program according to a preset output format.
In this embodiment, in order to accurately locate specific call error information after determining that the compiling is in error, and improve the efficiency of maintenance and debugging of the later program, when it is found that the target call class information is inconsistent with the definition class information, the target SDK name (jar packet/ar packet name) corresponding to the target call class information and the target call program where the target call class information is located may be obtained, and then the compiling detection result, the target SDK name and the target call program of the compiling error may be output and displayed according to the output format shown in fig. 1 d.
For example, as shown in the output result schematic diagram of fig. 1d, the compiling detection result is methodNotFound, which indicates that the calling method is not found, the third party jar packet name of the position where the scanning error occurs is huya-vod-player, and the calling relationship is: com.huya.huya_vod_palier.huyavodfragment- > com.huya.vi.simplevodcontrol view (getallcontent). Wherein com.huya.huya_vod_palier.huyaVodFragment represents a call class extracted from a third party jar packet, simpleVodControllView is a definition class in a jar packet which is externally dependent on the third party jar packet, and getAllComponent represents a method name of a called method in the definition class.
In the embodiment of the invention, a first-level SDK referenced by a target program and a second-level SDK referenced by the first-level SDK are acquired in the process of compiling the target program; acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK; the method comprises the steps of matching calling class information with definition class information to obtain a compiling detection result corresponding to a target program, solving the problem that calling errors cannot be detected during program compiling in the prior art, and timely finding out program calling errors by detecting consistency of the calling class information and the definition class information during program compiling, avoiding errors during program running, and reducing program breakdown times.
Example two
Fig. 2 is a schematic structural diagram of a compiling detection device according to a second embodiment of the invention, which is applicable to detecting a program call error during compiling a program, and which can be implemented in software and/or hardware, and which can be generally integrated in an electronic device, such as a client or a server. As shown in fig. 2, the apparatus includes: the system comprises an SDK acquisition module 210, a class information acquisition module 220 and a compilation detection module 230, wherein:
an SDK obtaining module 210, configured to obtain, during compiling of the target program, a first-level software development kit SDK referred to by the target program and a second-level SDK referred to by the first-level SDK;
a class information obtaining module 220, configured to obtain call class information included in the first level SDK and definition class information included in the second level SDK;
the compiling detection module 230 is configured to match the calling class information with the definition class information, and obtain a compiling detection result corresponding to the target program.
In the embodiment of the invention, a first-level SDK referenced by a target program and a second-level SDK referenced by the first-level SDK are acquired in the process of compiling the target program; acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK; the method comprises the steps of matching calling class information with definition class information to obtain a compiling detection result corresponding to a target program, solving the problem that calling errors cannot be detected during program compiling in the prior art, and timely finding out program calling errors and reducing program crash times by detecting consistency of the calling class information and the definition class information during program compiling.
Optionally, the SDK obtaining module 210 is specifically configured to:
and acquiring a first-level SDK referenced by the target program and a second-level SDK referenced by the first-level SDK by utilizing a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain the corresponding byte code file.
Optionally, the class information obtaining module 220 is specifically configured to:
and respectively extracting class information from the byte code files corresponding to the first-level SDK and the second-level SDK by using ASM to obtain calling class information and definition class information.
Optionally, the class information obtaining module 220 is specifically configured to:
and respectively accessing byte code files corresponding to the first level SDK and the second level SDK according to the order of the information access level from low to high by using ASM to obtain calling class information and definition class information.
Optionally, the compiling detection module 230 is specifically configured to:
traversing each piece of calling class information, and if the matched definition class information exists in each piece of calling class information, determining that the compiling detection result is successful;
if the definition class information which is not matched with the calling class information exists, determining that the compiling detection result is a compiling error.
Optionally, the method further comprises: the output module is used for acquiring a target SDK name and a target calling program corresponding to the target calling class information of the compiling error after determining that the compiling detection result is the compiling error;
and outputting a compiling detection result of compiling errors, a target SDK name and a target calling program according to a preset output format.
Optionally, the information access level includes: the class resource information is the first access level, the external class is the second access level, the annotation and class attribute is the third access level, and the internal class, variable and method are the fourth access level.
The compiling detection device provided by the embodiment of the invention can execute the compiling detection method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example III
Fig. 3 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention. Fig. 3 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 3 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 3, device 12 is in the form of a general purpose computing device. Components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 3, commonly referred to as a "hard disk drive"). Although not shown in fig. 3, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with device 12, and/or any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, via network adapter 20. As shown, network adapter 20 communicates with other modules of device 12 over bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a compile detection method provided by an embodiment of the present invention. Namely: a compiling detection method is realized, which comprises the following steps:
acquiring a first-level Software Development Kit (SDK) referenced by a target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
Example IV
The fourth embodiment of the present invention also discloses a computer storage medium having stored thereon a computer program which when executed by a processor implements a compile detection method comprising:
acquiring a first-level Software Development Kit (SDK) referenced by a target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

1. A compile detection method, comprising:
acquiring a first-level Software Development Kit (SDK) referenced by a target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
acquiring call class information included in the first-level SDK and definition class information included in the second-level SDK;
matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program;
the step of matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program comprises the following steps:
traversing each piece of calling class information, and if the matched definition class information exists in each piece of calling class information, determining that the compiling detection result is successful;
if the definition class information which is not matched with the calling class information exists, determining that the compiling detection result is a compiling error.
2. The method of claim 1, wherein obtaining a first level software development kit, SDK, referenced by the target program and a second level SDK, referenced by the first level SDK, comprises:
and acquiring a first level SDK referenced by the target program and a second level SDK referenced by the first level SDK by utilizing a Transform API, and decompressing the first level SDK and the second level SDK to obtain a corresponding byte code file.
3. The method of claim 2, wherein obtaining the call class information included in the first-tier SDK and the definition class information included in the second-tier SDK comprises:
and respectively extracting class information from the byte code files corresponding to the first-level SDK and the second-level SDK by using ASM to obtain calling class information and definition class information.
4. The method of claim 3, wherein extracting class information from the byte code files corresponding to the first level SDK and the second level SDK by using ASM to obtain call class information and definition class information includes:
and respectively accessing byte code files corresponding to the first-level SDK and the second-level SDK according to the order of the information access level from low to high by using ASM to obtain calling class information and definition class information.
5. The method of claim 1, further comprising, after determining that the compilation detection result is a compilation error:
acquiring a target SDK name and a target calling program corresponding to the compiling error target calling class information;
and outputting a compiling detection result of compiling errors, a target SDK name and a target calling program according to a preset output format.
6. The method of claim 4, wherein the information access level comprises: the class resource information is the first access level, the external class is the second access level, the annotation and class attribute is the third access level, and the internal class, variable and method are the fourth access level.
7. A compile detection device, comprising:
the SDK acquisition module is used for acquiring a first-level Software Development Kit (SDK) referenced by the target program and a second-level SDK referenced by the first-level SDK in the process of compiling the target program;
a class information acquisition module, configured to acquire call class information included in the first level SDK and definition class information included in the second level SDK;
the compiling detection module is used for matching the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program;
the compiling detection module is specifically used for:
traversing each piece of calling class information, and if the matched definition class information exists in each piece of calling class information, determining that the compiling detection result is successful;
if the definition class information which is not matched with the calling class information exists, determining that the compiling detection result is a compiling error.
8. An electronic device, the electronic device comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the compilation detection method of any of claims 1-6.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements a compilation detection method according to any of claims 1-6.
CN202110070637.8A 2021-01-19 2021-01-19 Compilation detection method, device, equipment and storage medium Active CN112748930B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110070637.8A CN112748930B (en) 2021-01-19 2021-01-19 Compilation detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110070637.8A CN112748930B (en) 2021-01-19 2021-01-19 Compilation detection method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112748930A CN112748930A (en) 2021-05-04
CN112748930B true CN112748930B (en) 2024-03-01

Family

ID=75652529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110070637.8A Active CN112748930B (en) 2021-01-19 2021-01-19 Compilation detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112748930B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342347A (en) * 2021-05-31 2021-09-03 网易传媒科技(北京)有限公司 Information processing method, device, computing equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105184160A (en) * 2015-07-24 2015-12-23 哈尔滨工程大学 API object calling relation graph based method for detecting malicious behavior of application program in Android mobile phone platform
CN108920370A (en) * 2018-07-02 2018-11-30 北京百度网讯科技有限公司 Compatibility issue detection method, device and equipment
CN111290760A (en) * 2020-03-03 2020-06-16 北京字节跳动网络技术有限公司 Application program compiling method and device, electronic equipment and storage medium
CN111679831A (en) * 2020-06-04 2020-09-18 同盾控股有限公司 Software development kit processing method, operation monitoring method, device and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10157045B2 (en) * 2016-11-17 2018-12-18 The Mathworks, Inc. Systems and methods for automatically generating code for deep learning systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105184160A (en) * 2015-07-24 2015-12-23 哈尔滨工程大学 API object calling relation graph based method for detecting malicious behavior of application program in Android mobile phone platform
CN108920370A (en) * 2018-07-02 2018-11-30 北京百度网讯科技有限公司 Compatibility issue detection method, device and equipment
CN111290760A (en) * 2020-03-03 2020-06-16 北京字节跳动网络技术有限公司 Application program compiling method and device, electronic equipment and storage medium
CN111679831A (en) * 2020-06-04 2020-09-18 同盾控股有限公司 Software development kit processing method, operation monitoring method, device and storage medium

Also Published As

Publication number Publication date
CN112748930A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
US9442828B2 (en) Generating test scripts through application integration
US20180101379A1 (en) Source code element signatures
CN112231407B (en) DDL synchronization method, device, equipment and medium of PostgreSQL database
JP5303795B2 (en) Application analysis method, analysis system, and analysis program
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
US9026612B2 (en) Generating a custom parameter rule based on a comparison of a run-time value to a request URL
CN112363753A (en) Data verification method and device, electronic equipment and storage medium
CN113051514A (en) Element positioning method and device, electronic equipment and storage medium
CN110727476B (en) Method, device, equipment and storage medium for generating authorization configuration file
CN112748930B (en) Compilation detection method, device, equipment and storage medium
CN114003269A (en) Component processing method and device, electronic equipment and storage medium
CN114416481A (en) Log analysis method, device, equipment and storage medium
CN113238737A (en) Page packaging method and device, electronic equipment and storage medium
US9064042B2 (en) Instrumenting computer program code by merging template and target code methods
CN110888641B (en) Script automatic generation method and device, server and storage medium
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN113342431B (en) Function call stack backtracking and program exception handling method, device, equipment and medium
CN113050987B (en) Method and device for generating interface document, storage medium and electronic equipment
CN112131611B (en) Data correctness verification method, device, equipment, system and storage medium
CN112685072B (en) Method, device, equipment and storage medium for generating communication address knowledge base
CN111741046B (en) Data reporting method, data acquisition method, device, equipment and medium
CN114219643A (en) Transaction calling method, device, equipment and storage medium
CN113687880A (en) Method, device, equipment and medium for calling component
CN109062797B (en) Method and device for generating information
CN114205156A (en) Message detection method and device for tangent plane technology, electronic equipment and medium

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