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

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

Info

Publication number
CN112748930A
CN112748930A CN202110070637.8A CN202110070637A CN112748930A CN 112748930 A CN112748930 A CN 112748930A CN 202110070637 A CN202110070637 A CN 202110070637A CN 112748930 A CN112748930 A CN 112748930A
Authority
CN
China
Prior art keywords
sdk
level
information
calling
compiling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110070637.8A
Other languages
Chinese (zh)
Other versions
CN112748930B (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

Images

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: in the process of compiling a target program, acquiring a first-level Software Development Kit (SDK) referred by the target program and a second-level SDK referred by the first-level SDK; acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK; and matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program. The technical scheme of the embodiment of the invention realizes the detection of the program calling error 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, third-party jar (Java archive) packages/aar (android archive) packages are frequently introduced in project development, and the jar packages/aar packages are externally dependent. When the externally-dependent jar packet/aar packet is subjected to version replacement, the project program is normal in the compiling process, but when the project really runs on the line, triggering is triggered to the jar packet/aar packet which is dependent by a third party, a program calling error is generated, and the project program is crashed.
Disclosure of Invention
Embodiments of the present invention provide a compilation detection method, apparatus, device, and storage medium, which can detect a program call error during program compilation and reduce the number of times of program crash.
In a first aspect, an embodiment of the present invention provides a compilation detection method, including:
in the process of compiling the target program, acquiring a first-level Software Development Kit (SDK) referred by the target program and a second-level SDK referred by the first-level SDK;
acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program.
Optionally, the obtaining a first-level software development kit SDK referred by the target program and a second-level SDK referred 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 using a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain corresponding byte code files.
Optionally, the obtaining of the call class information included in the first-level SDK and the definition class information included in the second-level SDK includes:
and utilizing the ASM to respectively extract class information of byte code files corresponding to the first-level SDK and the second-level SDK to obtain calling class information and definition class information.
Optionally, the method includes, by using ASM, extracting class information of byte code files corresponding to the first-level SDK and the second-level SDK, respectively, to obtain calling class information and definition class information, including:
and respectively accessing byte code files corresponding to the first-level SDK and the second-level SDK by using the ASM according to the sequence of the information access levels from low to high to obtain calling information and defining information.
Optionally, matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program, where the compiling detection result includes:
traversing all the calling information, and if all the calling information has matched definition information, determining that the compiling detection result is successful;
and 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 a compiling error, the method further includes:
acquiring a target SDK name and a target calling program corresponding to the wrong compiling target calling class information;
and outputting a compiling detection result with a compiling error, 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 a first access level, the external class is a second access level, the annotation and class attributes are a third access level, and the internal class, variable and method are a fourth access level.
In a second aspect, an embodiment of the present invention further provides a compilation detection apparatus, including:
the SDK acquisition module is used for acquiring a first-level software development kit SDK quoted by the target program and a second-level SDK quoted 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 information with the definition 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, where the electronic device includes:
one or more processors;
a storage device 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 compilation detection method provided by any of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the compilation detection method provided in any embodiment of the present invention.
In the embodiment of the invention, a first-level SDK referred by an object program and a second-level SDK referred by the first-level SDK are obtained in the process of compiling the object program; acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK; the calling information and the definition information are matched to obtain a compiling detection result corresponding to the target program, the problem that a calling error cannot be detected in the program compiling period in the prior art is solved, the calling error is timely found by detecting the consistency of the calling information and the definition information in the program compiling period, and the program crash times are reduced.
Drawings
FIG. 1a is a flowchart of a compilation detection method according to a first embodiment of the present invention;
FIG. 1b is a schematic diagram of a scanned content to which embodiments of the present invention are applicable;
FIG. 1c is a schematic diagram of a file access sequence to which embodiments of the present invention are adapted;
FIG. 1d is a schematic diagram of an output result adapted according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a compiling detection device according to a second embodiment of the invention;
fig. 3 is a schematic structural diagram of an electronic device in a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1a is a flowchart of a compilation detection method in one embodiment of the present invention, which is applicable to detecting a program call error during program compilation, and which may be executed by a compilation detection apparatus, which may be implemented by 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, acquiring a first-level SDK referenced by the target program and a second-level SDK referenced by the first-level SDK.
In this embodiment, the target program may be a program code of an XX plug-in and other items, the SDK may be a jar package or an aar package that is generated according to a service requirement, and the target program may specify the SDK by referring to the SDK and use a function of the SDK. The first-level SDK is a third-party jar/aar package directly referenced by the target program, and the second-level SDK is a jar/aar package referenced by the third-party jar/aar package.
The Java package is an archive file of a java byte code file (class file), and only comprises the class file and a manifest file, and does not contain information such as resource files in android; the aar package is an archive file specific to the android, and includes a bytecode file, an android resource file, and the like.
Optionally, the obtaining the first-level SDK referred by the target program and the second-level SDK referred 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 using a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain corresponding byte code files.
In this embodiment, in order to subsequently detect whether the calling of the method in the second-level SDK in the first-level SDK is correct, in the process of compiling the target program by using the compiling tool gardle, a Transform API may be used to obtain each third-party jar/aar packet referred by the target program and a jar/aar packet externally dependent on each third-party jar/aar packet, decompress all jar/aar packets, extract a class file in each jar/aar packet, and send the class file to the ASM, so as to extract specified class information from the class file by the ASM.
And step 120, acquiring the calling class information included in the first-level SDK and the definition class information included in the second-level SDK.
Optionally, the obtaining of the call class information included in the first-level SDK and the definition class information included in the second-level SDK may include: and utilizing the ASM to respectively extract class information of byte code files corresponding to the first-level SDK and the second-level SDK to obtain calling class information and definition class information.
The ASM is a general Java bytecode operation and analysis framework, and may be applied to dynamically generate classes or enhance the functions of existing classes, for example, a binary class file may be directly generated, or information such as a class name, a method, an attribute, and Java bytecode (instruction) may be read from the class file before the class is loaded into the Java virtual machine, so as to dynamically change the class behavior.
In this embodiment, ASM may be used to scan class files in each jar packet/aar packet 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 then store the call class information and the definition class information. The scanned class information may be as shown in fig. 1b, and includes: the package name of jar/aar package, class name (including internal and anonymous classes), method name of calling method, variable, enumeration, annotation, interface, etc.
It should be noted that although ASM is often used for bytecode instrumentation, in this embodiment, it is not necessary to modify the class file by using ASM, and only the class information needs to be scanned and analyzed from the class file, so that the impact on the overall performance of the target program can be avoided while detecting a call error in the target program.
Optionally, using ASM to respectively extract class information of the bytecode files corresponding to the first-level SDK and the second-level SDK, so as to obtain calling class information and definition class information, where the method includes: and respectively accessing byte code files corresponding to the first-level SDK and the second-level SDK by using the ASM according to the sequence of the information access levels from low to high to obtain calling information and defining information.
Optionally, the information access level includes: the class resource information is a first access level, the external class is a second access level, the annotation and class attributes are a third access level, and the internal class, variable and method are a fourth access level.
In this embodiment, for each class file in the first-level SDK and the second-level SDK, an access method matched with each information access level in the ASM may be sequentially called according to the sequence of the information access levels from low to high, and corresponding class information is scanned and extracted from the class file. As shown in fig. 1c, according to the access sequence, information such as class resource information, external classes, annotations (including class annotations, method annotations, and variable annotations), class attributes, internal classes, variables (including local variables and member variables), and method names may be sequentially extracted from the class file, and all the extracted information may be used as the class information of the class file.
And step 130, matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program.
Optionally, matching the calling type information with the definition type information to obtain a compiling detection result corresponding to the target program, where the compiling detection result may include: traversing all the calling information, and if all the calling information has matched definition information, determining that the compiling detection result is successful; and 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 information and the definition information are obtained, the calling information and the definition information need to be compared, and whether the calling and the definition of the method are inconsistent is determined according to a difference between the calling information and the definition information. For example, assuming that a class B in a third-party jar package a referenced by the target program invokes a method E externally dependent on a class D in a jar package C, but a method with a method name E does not exist in the definition class information, or a parameter variable defining the method with the method name E in the definition class information is different from a parameter variable calling the method E in the class information, or other inconsistency occurs, it is considered that an error is found in compilation detection, and it may be determined that a compilation error occurs.
It should be noted that although each piece of calling class information needs to be compared with the definition class information, the compiling is considered to be 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 not the same as the definition class information, the compiling is considered to be faulty.
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 wrong compiling target calling class information; and outputting a compiling detection result with a compiling error, 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 a compilation error occurs, and improve the efficiency of later-stage program maintenance and debugging, when it is found that target call class information is inconsistent with definition class information, a target SDK name (jar packet/arr packet name) corresponding to the target call class information and a target call program in which the target call class information is located may be obtained, and then a compilation detection result of the compilation error, the target SDK name, and the target call program are output and displayed according to an output format shown in fig. 1 d.
For example, as shown in fig. 1d, the output result is shown as a schematic diagram, the compiled detection result is a method font, which indicates that the calling method is not found, the name of the third-party jar packet where the scanning error occurs is huya-vod-player, and the calling relationship is: hu ya vod palyser huya vodfragment — > com huya vi simplevodcontrol view (getAllComponent). The method comprises the steps of extracting a calling class in a third-party jar package, extracting SimpleVodControl View from the third-party jar package, and extracting a called method name in the definition class.
In the embodiment of the invention, a first-level SDK referred by an object program and a second-level SDK referred by the first-level SDK are obtained in the process of compiling the object program; acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK; the calling information and the definition information are matched to obtain a compiling detection result corresponding to the target program, the problem that a calling error cannot be detected in the program compiling period in the prior art is solved, the calling error is timely found by detecting the consistency of the calling information and the definition information in the program compiling period, the error in the program running process is avoided, and the collapse times of the program are reduced.
Example two
Fig. 2 is a schematic structural diagram of a compilation detection apparatus in a second embodiment of the present invention, which is applicable to detecting a program call error during program compilation, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device, such as a client or a server. As shown in fig. 2, the apparatus includes: the SDK obtaining module 210, the class information obtaining module 220, and the compiling detecting module 230, wherein:
the SDK obtaining module 210 is configured to obtain, in the process of compiling the target program, a first-level software development kit SDK referred by the target program and a second-level SDK referred by the first-level SDK;
the class information acquiring module 220 is configured to acquire call class information included in the first-level SDK and definition class information included in the second-level SDK;
and the compiling detection module 230 is configured to match the calling class information with the definition class information to obtain a compiling detection result corresponding to the target program.
In the embodiment of the invention, a first-level SDK referred by an object program and a second-level SDK referred by the first-level SDK are obtained in the process of compiling the object program; acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK; the calling information and the definition information are matched to obtain a compiling detection result corresponding to the target program, the problem that a calling error cannot be detected in the program compiling period in the prior art is solved, the calling error is timely found by detecting the consistency of the calling information and the definition information in the program compiling period, and the program crash times are reduced.
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 using a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain corresponding byte code files.
Optionally, the class information obtaining module 220 is specifically configured to:
and utilizing the ASM to respectively extract class information of byte code files corresponding to the first-level SDK and the second-level SDK 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 by using the ASM according to the sequence of the information access levels from low to high to obtain calling information and defining information.
Optionally, the compiling detection module 230 is specifically configured to:
traversing all the calling information, and if all the calling information has matched definition information, determining that the compiling detection result is successful;
and 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 includes: the output module is used for acquiring a target SDK name and a target calling program corresponding to the target calling class information with the compiling error after the compiling detection result is determined to be the compiling error;
and outputting a compiling detection result with a compiling error, 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 a first access level, the external class is a second access level, the annotation and class attributes are a third access level, and the internal class, variable and method are a 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 corresponding functional modules and beneficial effects of the execution method.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an electronic device in 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 only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in FIG. 3, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, 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 may 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 and write to non-removable, nonvolatile magnetic media (not shown in FIG. 3, and commonly referred to as a "hard drive"). Although not shown in FIG. 3, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are 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, for example, in 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 of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement the compilation detection method provided by the embodiment of the present invention. Namely: a compilation detection method is implemented, comprising:
in the process of compiling the target program, acquiring a first-level Software Development Kit (SDK) referred by the target program and a second-level SDK referred by the first-level SDK;
acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program.
Example four
The fourth embodiment of the present invention further discloses a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a compilation detection method, including:
in the process of compiling the target program, acquiring a first-level Software Development Kit (SDK) referred by the target program and a second-level SDK referred by the first-level SDK;
acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program.
Computer storage media for embodiments of the invention may employ 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 is not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. 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 the context of 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.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. 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, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A compilation detection method, comprising:
in the process of compiling a target program, acquiring a first-level Software Development Kit (SDK) referred by the target program and a second-level SDK referred by the first-level SDK;
acquiring calling class information included in the first-level SDK and definition class information included in the second-level SDK;
and matching the calling information with the definition information to obtain a compiling detection result corresponding to the target program.
2. The method of claim 1, wherein obtaining the first-level Software Development Kit (SDK) referenced by the target program and the 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 using a Transform API, and decompressing the first-level SDK and the second-level SDK to obtain corresponding byte code files.
3. The method of claim 2, wherein obtaining the call class information included in the first-level SDK and the definition class information included in the second-level SDK comprises:
and utilizing the ASM to respectively extract class information of the byte code files corresponding to the first-level SDK and the second-level SDK so as to obtain calling class information and definition class information.
4. The method of claim 3, wherein the using ASM to extract class information of the byte code files corresponding to the first-level SDK and the second-level SDK respectively to obtain the calling class information and the defining class information comprises:
and respectively accessing byte code files corresponding to the first-level SDK and the second-level SDK by using the ASM according to the sequence of the information access levels from low to high to obtain calling information and defining information.
5. The method of claim 1, wherein matching the calling class information with the defining class information to obtain a compilation detection result corresponding to the target program comprises:
traversing all the calling information, and if all the calling information has matched definition information, determining that the compiling detection result is successful;
and 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.
6. The method of claim 5, after determining that the compilation detection result is a compilation error, further comprising:
acquiring a target SDK name and a target calling program corresponding to the wrong compiling target calling class information;
and outputting a compiling detection result with a compiling error, a target SDK name and a target calling program according to a preset output format.
7. The method of claim 4, wherein the information access level comprises: the class resource information is a first access level, the external class is a second access level, the annotation and class attributes are a third access level, and the internal class, variable and method are a fourth access level.
8. A compilation detection device, comprising:
the SDK acquisition module is used for acquiring a first-level software development kit SDK referred by a target program and a second-level SDK referred 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 information with the definition information to obtain a compiling detection result corresponding to the target program.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the compilation detection method as recited in any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the compilation detection method as claimed in any one of claims 1 to 7.
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 true CN112748930A (en) 2021-05-04
CN112748930B 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)

Cited By (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 (5)

* 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
US20180136912A1 (en) * 2016-11-17 2018-05-17 The Mathworks, Inc. Systems and methods for automatically generating code for deep learning systems
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

Patent Citations (5)

* 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
US20180136912A1 (en) * 2016-11-17 2018-05-17 The Mathworks, Inc. Systems and methods for automatically generating code for deep learning systems
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

Cited By (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

Also Published As

Publication number Publication date
CN112748930B (en) 2024-03-01

Similar Documents

Publication Publication Date Title
US9442828B2 (en) Generating test scripts through application integration
US10713437B2 (en) Method and apparatus for identifying questionable line break characters in an application
CN109471851B (en) Data processing method, device, server and storage medium
CN112231407B (en) DDL synchronization method, device, equipment and medium of PostgreSQL database
JP5303795B2 (en) Application analysis method, analysis system, and analysis program
US9026612B2 (en) Generating a custom parameter rule based on a comparison of a run-time value to a request URL
CN114328208A (en) Code detection method and device, electronic equipment and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110727476B (en) Method, device, equipment and storage medium for generating authorization configuration file
CN110175128B (en) Similar code case acquisition method, device, equipment and storage medium
CN110888791A (en) Log processing method, device, equipment and storage medium
CN112748930B (en) Compilation detection method, device, 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
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
CN110888641A (en) Automatic script generation method and device, server and storage medium
CN113656044B (en) Android installation package compression method and device, computer equipment and storage medium
CN113342431B (en) Function call stack backtracking and program exception handling method, device, equipment and medium
CN115705294B (en) Method, device, electronic equipment and medium for acquiring function call information
CN112131611B (en) Data correctness verification method, device, equipment, system and storage medium
CN113687880A (en) Method, device, equipment and medium for calling component
CN114219643A (en) Transaction calling method, device, equipment and storage medium
CN109062797B (en) Method and device for generating information
CN111399901B (en) State enumeration class generation method, device, server and storage medium
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