CN110659031A - Compiling method and device of application program, electronic equipment and storage medium - Google Patents

Compiling method and device of application program, electronic equipment and storage medium Download PDF

Info

Publication number
CN110659031A
CN110659031A CN201910903271.0A CN201910903271A CN110659031A CN 110659031 A CN110659031 A CN 110659031A CN 201910903271 A CN201910903271 A CN 201910903271A CN 110659031 A CN110659031 A CN 110659031A
Authority
CN
China
Prior art keywords
dependent
compiling
source code
operating system
package
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.)
Pending
Application number
CN201910903271.0A
Other languages
Chinese (zh)
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.)
Shenzhen Transsion Holdings Co Ltd
Original Assignee
Shenzhen Transsion Holdings 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 Shenzhen Transsion Holdings Co Ltd filed Critical Shenzhen Transsion Holdings Co Ltd
Priority to CN201910903271.0A priority Critical patent/CN110659031A/en
Publication of CN110659031A publication Critical patent/CN110659031A/en
Pending legal-status Critical Current

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
    • G06F8/71Version control; Configuration management

Abstract

The invention provides a compiling method of an application program, which comprises the following steps: acquiring a source code of a target application program and an obfuscating configuration file, wherein the obfuscating configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code; generating a compiled package under the first operating system; and generating the target compiling package under the second operating system. The system-dependent source code in the source code is replaced by the system-dependent compiling package, the problem that the code compiling process is lack of necessary dependent items and is error-reported is solved, the source code can be compiled under a proper compiling tool, and the development efficiency of the application program is improved.

Description

Compiling method and device of application program, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software technologies, and in particular, to a method and an apparatus for compiling an application program, an electronic device, and a storage medium.
Background
Windows from microsoft corporation, MacOS from apple corporation, and open-source Linux are the most popular operating systems on the market today, with a large amount of application software and users. Each operating system has its own characteristics and also has an independent development and use environment. Especially for developer users, when developing application software of different platforms, a plurality of software operating systems need to be used simultaneously. For example, the Linux-based android operating system is the most important operating system used by smart terminal devices such as mobile phones at present, and a developer user develops a large number of application programs on the android system.
In the prior art, a general developer user can directly develop an application program in a source code system environment with complete resources, and because a resource library in the source code system environment is complete, the calling and compiling of an application program source code are convenient, and a compiling error is not easy to occur.
Meanwhile, in some operating system environments, a convenient Integrated Development Environment (IDE) is lacked, and when a developer user loads and develops application source codes into the IDE in other operating system environments, the problem of error reporting due to the lack of necessary dependency items in the code compiling process because the source codes and the operating system environments are strongly coupled exists.
Disclosure of Invention
The invention provides a compiling method and device of an application program, electronic equipment and a storage medium, which are used for solving the problem that the code compiling process is lack of necessary dependence items and is error-reported.
According to a first aspect of the embodiments of the present disclosure, the present disclosure provides an application compiling method applied to an electronic device, where the electronic device is loaded with a first operating system and a second operating system, and the second operating system is loaded with a preset compiling tool, where the method includes:
acquiring a source code of a target application program and an obfuscation configuration file, wherein the obfuscation configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code;
generating a compiled package under the first operating system;
and generating the target compiling package under the second operating system.
Optionally, generating a compiled package under the first operating system includes:
and compiling the source code of the target application program under the first operating system according to the obfuscation configuration file to generate a compilation package.
Optionally, generating the target compilation package under a second operating system includes:
the non-system-dependent type class file corresponds to non-system-dependent source codes of the target application program; deleting the non-system-dependent type file to form a system-dependent compilation package;
and compiling the source code of the target application program by adopting the preset compiling tool under a second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate a target compiling package.
Optionally, the compiling the source code of the target application according to the obfuscation configuration file to generate a compiled package includes:
generating a system dependent type file by using the source code corresponding to the identification information of the system dependent source code in the confusion configuration file;
generating a non-system-dependent type file by using the source code corresponding to the identification information of the non-system-dependent source code in the confusion configuration file;
and generating a compiling package through the system dependent type class file and the non-system dependent type class file.
Optionally, before the compiling the source code of the target application program by using the preset compiling tool according to the system-dependent compiling package and the non-system-dependent source code under the second operating system to generate the target compiling package, the method further includes:
adopting the preset compiling tool to create a target application project under a second operating system;
and loading the system-dependent compiled package and the non-system-dependent source code to the target application project.
Optionally, the loading the system-dependent compiled package and the system-independent source code to the target application project includes:
determining the corresponding positions of the system-dependent compiled package and the non-system-dependent source code in the source code of the target application program;
and loading the system dependent compiling package and the non-system dependent source code to the target application project according to the corresponding position.
Optionally, the deleting the system-independent class file to form a system-dependent compiled package includes:
decompiling the compilation package to obtain a system dependent type class file and a non-system dependent type class file;
deleting the non-system-dependent type file;
and compiling the system dependent type file to generate the system dependent type compilation package.
Optionally, the first operating system or the second operating system is one of a google android operating system, a microsoft Windows operating system, an apple iOS operating system, an apple watch os operating system, an apple iPadOS operating system, an apple MacOS operating system, a Linux operating system, and a grand mons operating system, and/or the preset compiling tool is an IDE tool.
According to a second aspect of the embodiments of the present disclosure, the present invention provides an apparatus for compiling an application program, which is applied to an electronic device, where the electronic device is loaded with a first operating system and a second operating system, and the second operating system is loaded with a preset compiling tool, and the apparatus includes:
the system comprises an acquisition module, a configuration module and a configuration module, wherein a user acquires a source code of a target application program and an obfuscating configuration file, and the obfuscating configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code;
the first generation module is used for generating a compiling package under the first operating system;
and the second generation module is used for generating the target compiling package under the second operating system.
Optionally, the first generating module is specifically configured to:
and compiling the source code of the target application program under the first operating system according to the obfuscation configuration file to generate a compilation package.
Optionally, the second generating module is specifically configured to:
the non-system-dependent type class file corresponds to non-system-dependent source codes of the target application program; deleting the non-system-dependent type file to form a system-dependent compilation package;
and compiling the source code of the target application program by adopting the preset compiling tool under a second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate a target compiling package.
Optionally, when the generation module compiles the source code of the target application program according to the obfuscation configuration file to generate a compilation package, the generation module is specifically configured to:
generating a system dependent type file by using the source code corresponding to the identification information of the system dependent source code in the confusion configuration file;
generating a non-system-dependent type file by using the source code corresponding to the identification information of the non-system-dependent source code in the confusion configuration file;
and generating a compiling package through the system dependent type class file and the non-system dependent type class file.
Optionally, the compiling apparatus of the application program further includes:
the creating module is used for creating a target application project by adopting the preset compiling tool under a second operating system;
and the loading module is used for loading the system dependent compiling package and the non-system dependent source code to the target application project.
Optionally, the loading module is specifically configured to:
determining the corresponding positions of the system-dependent compiled package and the non-system-dependent source code in the source code of the target application program;
and loading the system dependent compiling package and the non-system dependent source code to the target application project according to the corresponding position.
Optionally, when deleting the non-system-dependent class file to form a system-dependent compilation package, the generating module is specifically configured to:
decompiling the compilation package to obtain a system dependent type class file and a non-system dependent type class file;
deleting the non-system-dependent type file;
and compiling the system dependent type file to generate the system dependent type compilation package.
Optionally, in the compiling device of the application program, the first operating system or the second operating system is one of a google android operating system, a microsoft Windows operating system, an apple iOS operating system, an apple watch operating system, an apple iPadOS operating system, an apple MacOS operating system, a Linux operating system, and a hong meng operating system, and/or the preset compiling tool is an IDE tool.
According to a third aspect of the embodiments of the present disclosure, the present invention provides an electronic apparatus including: a memory, a processor, and a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement a compilation method of an application program according to any one of the first aspect of the embodiments of the present disclosure.
According to a fourth aspect of the embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-readable storage medium is used for implementing the compiling method of the application program according to any one of the first aspect of the embodiments of the present disclosure.
According to the compiling method and device of the application program, the electronic equipment and the storage medium, the source code of the target application program and the confusion configuration file are obtained, wherein the confusion configuration file comprises the identification information of the system-dependent source code and the identification information of the non-system-dependent source code; compiling a source code of a target application program under the first operating system according to the obfuscation configuration file to generate a compilation package, wherein the compilation package comprises a system-dependent type file and a non-system-dependent type file, and the non-system-dependent type file corresponds to the non-system-dependent source code of the target application program; deleting the non-system-dependent type file to form a system-dependent compilation package; and compiling the source code of the target application program by adopting the preset compiling tool under a second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate the target compiling package.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flowchart of a method for compiling an application according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for compiling an application according to another embodiment of the present invention;
FIG. 3 is a flowchart of step S209 in the embodiment shown in FIG. 2;
FIG. 4 is a block diagram of an apparatus for compiling an application according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for compiling an application according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terms to which the present invention relates will be explained first:
operating the system: an Operating System (OS) refers to a program that manages hardware and software resources of an electronic device. The operating system can process basic affairs of managing and configuring the memory, determining the priority of the system resource supply and demand, controlling the input device and the output device, operating the network and managing the file system, and the operating system also provides an operating interface for the user to interact with the system. The application programs used by the user run on a specific operating system and are also developed based on the specific operating system, and the application programs on different operating systems are independent from each other and cannot be commonly used, so that the developer user is required to develop the application programs based on the operating system aiming at different operating systems.
A compiling tool: in the field of software development, compilation refers to the process of translation from source code (typically a high-level language) to object code (typically a low-level or machine language) that can be directly executed by a computer compiler or virtual machine. The tools used to accomplish this translation process may be collectively referred to as compilation tools. When a developer user develops an application, the developer user typically develops source code by using high-level speech such as JAVA, C + +, and the like, and then compiles the source code into object code, for example, an executable file, which can be recognized and run by a computer by means of a compiling tool. The compiling tool comprises a direct tool for performing 'translation' on the high-level code and also comprises an indirect tool for realizing auxiliary functions of code marking, debugging, management, graphical interface display, auxiliary editing and the like.
The following explains an application scenario of the embodiment of the present invention:
the electronic device provided by the embodiment of the invention can be a computer, a first operating system and a second operating system are loaded in the computer, the first operating system can be an android operating system running through a virtual machine, the second operating system can be a Windows operating system, and a compiling tool preset for compiling application programs of the android system is loaded in the second operating system.
In a specific application scenario provided by the embodiment of the present invention, a developer user needs to develop an application program running in an android operating system environment, and due to lack of a suitable compiling tool in the android operating system environment, the compiling efficiency of the application program is low, and due to lack of a corresponding auxiliary function, the developing efficiency of the application program is affected. Therefore, by using the compiling method of the application program provided by the embodiment of the invention, firstly, the source code of the target application program is compiled in the android operating system environment, and because the android operating system environment contains complete application program dependent items, the target application program can be compiled smoothly to generate a compiled package, the compiled package comprises a system dependent type file and a non-system dependent type file, and then the non-system dependent type file in the compiled package is deleted to form the system dependent type compiled package; and loading the system-dependent compiling package into a compiling tool in the second operating system, wherein the second operating system is a Windows operating system, and the Windows operating system has a more appropriate compiling tool, so that the system-dependent compiling package is loaded by using the compiling tool in the Windows operating system, then the non-system-dependent source code is loaded, and the system-dependent compiling package and the non-system-dependent source code are compiled together, thereby realizing the compiling of the source code of the target application program.
In an application scenario of the compiling method for the application program provided by the embodiment of the invention, a source code of a target application program is compiled according to an obfuscated configuration file under a first operating system to generate a compiling package, and a non-system-dependent type file in the compiling package is deleted to form a system-dependent compiling package; and compiling the source code of the target application program by adopting a preset compiling tool under a second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate the target compiling package.
The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a compiling method of an application program according to an embodiment of the present invention, where an execution main body of the compiling method of the application program according to the embodiment is a compiling apparatus of the application program, and the compiling apparatus of the application program is located in an electronic device, so that the compiling method of the application program according to the embodiment is applied to the electronic device, and a first operating system and a second operating system are loaded on the electronic device, and a preset compiling tool is loaded on the second operating system, as shown in fig. 1, the compiling method of the application program according to the embodiment includes the following steps:
step S101, a source code of a target application program and an obfuscation configuration file are obtained, wherein the obfuscation configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code.
The source code of the target application program comprises a system dependent source code and a non-system dependent source code, wherein the system dependent source code is a code item which can be compiled only by depending on an operating system environment; system-independent source code is a code item that can be compiled without relying on an operating system environment. Due to differences between different operating systems, application programs in different operating system environments can only be compiled in the operating system environment, otherwise, compilation failure may be caused by the existence of system dependent source codes in the source codes.
For example, in a source code of a target application program, a function a of an android operating system is called, a code item corresponding to the function a is a system dependent source code, and at this time, when the source code of the application program is compiled under the android operating system, because a complete functional resource library is in an environment of the android operating system, the system dependent source code can obtain support of the functional resource library in the environment of the android operating system, and therefore, the source code of the application program can be successfully compiled; if the source code of the application program is compiled in other operating system environments, because the operating system environment does not have the functional resource library in the android operating system environment, the a function in the source code cannot be supported by the functional resource library, and in the process of compiling the application program, a compiling failure caused by referring to the non-existent functional resource library occurs.
The obfuscation configuration file includes identification information of the system-dependent source code and identification information of the non-system-dependent source code, for example, the identification information may be an identifier of a code line for locating a specific code line, or may be a file name of a file referenced in the source code. According to the identification information in the obfuscated configuration file, which of the source codes of the target application program are system-dependent source codes and which are non-system-dependent source codes can be determined.
Step S102, generating a compiling package under a first operating system.
Optionally, the first operating system environment is a native environment of the target application, and in the first operating system environment, the target application may obtain support of a complete functional resource library and may also complete a normal compilation process. Under the environment of a first operating system, firstly, the confusion configuration file is used for determining the identifications of system dependent source codes and non-system dependent source codes in the source codes of the target application program, and then, the system dependent source codes and the non-system dependent source codes are compiled respectively by using a code compiling technology to generate a compiling package. In the compiling package, the corresponding system dependent source code and the corresponding non-system dependent source code respectively comprise a system dependent type file and a non-system dependent type file, namely, the system dependent source code is compiled to generate the system dependent type file; and compiling the non-system-dependent source code to generate a non-system-dependent type file.
Optionally, the system-dependent type class file includes a system-dependent source code in the source code of the target application program and a corresponding functional resource library interface, and is used to implement a function corresponding to the system-dependent source code. And in the non-system-dependent file, no content needing to be called exists, and the corresponding space is occupied, so that redundancy is generated, therefore, the system-dependent file in the compilation package can be deleted after the compilation package is obtained, the capacity of the compilation package can be reduced, and the compilation efficiency of the target application program is improved.
And deleting the non-system-dependent type files in the compilation package to form a system-dependent compilation package. The system dependent compiling package can realize the function corresponding to the system dependent source code.
And step S103, generating a target compiling package under the second operating system.
Optionally, after the system-dependent compilation package is obtained, the system-dependent compilation package and the non-system-dependent source code are compiled under a second operating system by using a compiling tool, so as to generate a target compilation package. In general, if the source code is directly compiled in the second operating system by using the compiling tool, during the compiling process of the compiler in the compiling tool, it is found that the system depends on the source code to reference the functional resource library in the first operating system environment, but the functional resource library is not present in the second operating system environment, so that the compiler may report an error, resulting in a compiling failure. After the system-dependent source code is generated into the corresponding system-dependent compilation package, the compiler can only access the functional interface of the system-dependent class file in the system-dependent compilation package, and the internal code of the system-dependent class file can not be checked any more, so that the compilation failure caused by the fact that the system-dependent source code refers to a nonexistent functional resource library is avoided. Because the system-dependent compiling package contains all the contents of the system-dependent source codes, the system-dependent compiling package and the system-independent source codes are compiled to generate a target compiling package with the same function as the source codes of the target application program.
Optionally, the first operating system or the second operating system is one of a google android operating system, a microsoft Windows operating system, an apple iOS operating system, an apple watch os operating system, an apple iPadOS operating system, an apple MacOS operating system, a Linux operating system, and a grand mons operating system, and/or the predetermined compiling tool is an IDE tool.
In this embodiment, a source code of a target application program and an obfuscation configuration file are obtained, where the obfuscation configuration file includes identification information of a system-dependent source code and identification information of a non-system-dependent source code; compiling the source code of the target application program under a first operating system according to the obfuscation configuration file to generate a compilation package, wherein the compilation package comprises a system-dependent type file and a non-system-dependent type file, and the non-system-dependent type file corresponds to the non-system-dependent source code of the target application program; deleting the non-system-dependent type files to form a system-dependent compilation package; and compiling the source code of the target application program by adopting a preset compiling tool under the second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate the target compiling package.
Fig. 2 is a flowchart of a compiling method of an application program according to another embodiment of the present invention, and as shown in fig. 2, the compiling method of an application program according to this embodiment further refines step S102 on the basis of the compiling method of an application program according to the embodiment shown in fig. 1, and further includes a process of creating and loading a target application project before step S103, and then the compiling method of an application program according to this embodiment includes the following steps:
step S201, a source code of a target application program and an obfuscation configuration file are obtained, where the obfuscation configuration file includes identification information of a system-dependent source code and identification information of a non-system-dependent source code.
Step S202, generating a system dependent type file from the source code corresponding to the identification information of the system dependent source code in the obfuscated configuration file.
The obfuscation configuration file includes identification information of system-dependent source codes and identification information of non-system-dependent source codes, and is used for identifying which code items in the source codes of the target application program can be compiled only by depending on the operating system environment and which code items do not need to depend on the operating system environment. And compiling the system dependent source code by obfuscating the identification information in the configuration file to generate a corresponding system dependent type file, wherein the system dependent type file can realize the function of the system dependent source code.
Specifically, a code compiling obfuscation technology is adopted to compile the system dependent source code to generate a system dependent type file. Alternatively, the code compilation obfuscation technique comprises a Java obfuscation technique by which the source code of the application may be compiled into class files. The internal source codes of the class files compiled by the Java obfuscation technology are obfuscated, so that the source codes of the application program are prevented from being checked and analyzed, and the safety of the source codes of the application program is ensured. Meanwhile, the class file reserves a corresponding functional interface, and the function of the source code is correspondingly realized through the functional interface.
The system dependent type file is compiled by adopting the obfuscation compiling technology, the source code in the system dependent type file cannot be checked and analyzed, and the function corresponding to the system dependent source code can be realized only through the corresponding functional interface, so that the execution process of the code in the system dependent type file is isolated from the outside, and when the target application program is compiled through the system dependent type file, the compiling failure of the target application program caused by the problem in the dependent type file can be avoided.
Step S203, generating a non-system dependent type file from the source code corresponding to the identification information of the non-system dependent source code in the obfuscated configuration file.
Correspondingly, the system-independent source code is compiled by obfuscating the identification information in the configuration file and adopting a code compiling obfuscation technology to generate a corresponding system-independent type file, and the system-dependent type file can realize the function of the system-independent source code.
In this embodiment, step S202 and step S203 are independent of each other, and there is no coupling relationship, so step S202 and step S203 may be executed sequentially, and the order of the two may be interchanged; or may be performed simultaneously, and the execution order of step S202 and step S203 is not specifically limited here.
And step S204, generating a compiling package through the system dependent type class file and the non-system dependent type class file.
After the system dependent type file and the non-system dependent type file are generated by compiling, the system dependent type file and the non-system dependent type file are automatically packaged into a compiling package for facilitating the management of the compiling files. Optionally, the compiling package packs the system dependent type files and the non-system dependent type files into a compressed package in a compression and packing manner, and optionally, the type of the compressed package is jar.
Step S205, performing decompiling on the compiled package to obtain a system dependent type class file and a non-system dependent type class file.
Specifically, since the system dependent type file and the non-system dependent type file cannot be added, modified, deleted, and the like in the compilation package, the compilation package is decompiled to obtain the system dependent type file and the non-system dependent type file in the compilation package, so that the system dependent type file and the non-system dependent type file are in a state in which the operations of adding, modifying, deleting, and the like can be performed. Optionally, the decompiling comprises decompressing, and the class files compressed in the compiled package are released through decompressing to obtain the system-dependent class files and the non-system-dependent class files.
And step S206, deleting the non-system-dependent type file.
In the non-system-dependent file, because the system-dependent item of the first operating system is not available, the compiling, modifying, debugging and other work can be directly carried out through the source code under the environment of the non-first operating system, which is more convenient and reliable. Therefore, the system-dependent type files in the compilation package can be deleted after the compilation package is obtained, the capacity of the compilation package can be reduced, and the compilation efficiency of the target application program can be improved.
And step S207, compiling the system dependent type file to generate a system dependent type compiling package.
And after the non-system-dependent type file is deleted, the system-dependent type file is compiled again to generate a system-dependent compiling package for use in subsequent compiling of the target application program. Optionally, the method for recompiling the system dependent class file includes: and compressing the system dependent type package into a compressed package as a compiling package. Optionally, the type of the compressed packet is jar.
And step S208, adopting a preset compiling tool to create a target application project under the second operating system.
Optionally, the second operating system is one of a google android operating system, a microsoft Windows operating system, an apple iOS operating system, an apple watch os operating system, an apple iPadOS operating system, an apple MacOS operating system, a Linux operating system, and a grand operating system. Optionally, the compilation tool is preset as an IDE tool. In the IDE tool, in order to better manage the compiling process of the target application program, a target application project is first created, and the target application project includes configuration information required for generating a target compiling package, for example: the generation position of the target compiling package, the position of the source code and the position of the library file.
And step S209, loading the system dependent compiling package and the non-system dependent source code to the target application project.
And loading the system-dependent compiled package and the non-system-dependent source code into the target application project, wherein the content of the system-dependent compiled package and the non-system-dependent source code is equivalent to that of the target application program source code loaded in the target application project. And then, editing, debugging, displaying and other operations can be performed on the system-independent source code by utilizing the characteristics of the IDE tool, and because the IDE tool has rich functions, the system-independent source code is debugged and compiled in an environment which is more native than the operating system of the target application program, for example: the android operating system is more efficient and convenient. Therefore, the target application program is quickly debugged and compiled, and the target compiling package is generated.
As shown in fig. 3, step S209 specifically includes the following specific steps:
step S2091, determining corresponding positions of the system-dependent compiled package and the system-independent source code in the source code of the target application.
Specifically, the obfuscated configuration file includes tag information of the system-dependent source code and the non-system-dependent source code, and the corresponding positions of the system-dependent compiled package and the non-system-dependent source code in the source code of the target application program are determined according to the obfuscated configuration file, which is equivalent to restoring the content of the source code of the target application program by using the system-dependent compiled package and the non-system-dependent source code, and is used for realizing the function corresponding to the source code of the target application program.
Step S2092, the system dependent compilation package and the non-system dependent source code are loaded to the target application project according to the corresponding position.
And according to the corresponding positions of the system-dependent compiling package and the non-system-dependent source code in the source code of the target application program, recombining the system-dependent compiling package and the non-system-dependent source code, and loading the recombined system-dependent compiling package and the non-system-dependent source code into the target application project, so that the target application project can realize the function of the target application program, and the compiling error caused by the system-dependent source code can be avoided.
And step S210, compiling the source code of the target application program by adopting a preset compiling tool under the second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate a target compiling package.
In this embodiment, the implementation manners of step 201 and step 210 are the same as the implementation manners of step 101 and step 103 in the embodiment shown in fig. 2 of the present invention, and are not described again.
Fig. 4 is a schematic diagram of an apparatus for compiling an application according to an embodiment of the present invention, and as shown in fig. 4, the apparatus 4 for compiling an application according to the embodiment is applied to an electronic device, the electronic device is equipped with a first operating system and a second operating system, the second operating system is loaded with a preset compiling tool, and the apparatus includes:
the obtaining module 41 is configured to obtain a source code of the target application and an obfuscation configuration file, where the obfuscation configuration file includes identification information of the system-dependent source code and identification information of the system-independent source code.
A first generating module 42, configured to generate a compiled package under a first operating system;
and a second generating module 43, configured to generate the target compiled package under the second operating system.
The obtaining module 41, the first generating module 42, and the second generating module 43 are connected in sequence. The compiling method of the application program provided in this embodiment may execute the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 5 is a schematic structural diagram of an application compiling apparatus according to another embodiment of the present invention, and as shown in fig. 5, the application compiling apparatus 5 according to this embodiment is applied to an electronic device, the electronic device is equipped with a first operating system and a second operating system, the second operating system is loaded with a preset compiling tool, and the application compiling apparatus 5 according to this embodiment further includes a creating module 51 and a loading module 52 on the basis of the application compiling apparatus according to the embodiment shown in fig. 4.
Further, when the first generating module 42 compiles the source code of the target application program according to the obfuscation configuration file to generate a compilation package, it is specifically configured to:
and generating a system dependent type file by using the source code corresponding to the identification information of the system dependent source code in the obfuscated configuration file. And generating the non-system-dependent type file by using the source code corresponding to the identification information of the non-system-dependent source code in the obfuscated configuration file. And generating a compiling package through the system dependent type class file and the non-system dependent type class file.
Further, when deleting the non-system-dependent class file to form the system-dependent compilation package, the first generating module 42 is specifically configured to: and decompiling the compilation package to obtain the system dependent type class file and the non-system dependent type class file. And deleting the non-system-dependent type file. And compiling the system dependent type file to generate a system dependent type compilation package.
Further, the creating module 51 is configured to create the target application project under the second operating system by using a preset compiling tool. And the loading module 52 is used for loading the system-dependent compiled package and the non-system-dependent source code to the target application project.
Further, the loading module 52 is specifically configured to determine corresponding positions of the system-dependent compiled package and the system-independent source code in the source code of the target application. And loading the system dependent compiling package and the non-system dependent source code to the target application project according to the corresponding position.
Further, in this embodiment, the first operating system or the second operating system is one of a google android operating system, a microsoft Windows operating system, an apple iOS operating system, an apple watch os operating system, an apple iPadOS operating system, an apple MacOS operating system, a Linux operating system, and a grand operating system, and/or the preset compiling tool is an IDE tool.
The compiling method of the application program provided in this embodiment may execute the technical solutions of the method embodiments shown in fig. 2 and fig. 3, and the implementation principles and technical effects are similar, and are not described herein again.
Fig. 6 is a schematic diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device according to the embodiment includes: memory 601, processor 602, and computer programs.
The computer program is stored in the memory 601 and configured to be executed by the processor 602 to implement the compiling method of the application program provided by any embodiment corresponding to fig. 1-2 of the present invention.
The memory 601 and the processor 602 are connected by a bus 603.
The relevant description may be understood by referring to the relevant description and effect corresponding to the steps in fig. 1-2, and will not be described herein too much.
An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement a compiling method of an application program provided in any embodiment corresponding to fig. 1-2 of the present invention.
The computer readable storage medium may be, among others, ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (10)

1. The method for compiling the application program is applied to electronic equipment, the electronic equipment is provided with a first operating system and a second operating system, and the second operating system is loaded with a preset compiling tool, and the method comprises the following steps:
acquiring a source code of a target application program and an obfuscation configuration file, wherein the obfuscation configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code;
generating a compiled package under the first operating system;
and generating the target compiling package under the second operating system.
2. The method of claim 1, wherein generating a compiled package under the first operating system comprises:
compiling a source code of a target application program under the first operating system according to the obfuscated configuration file to generate a compilation package;
generating a target compilation package under a second operating system, comprising:
the non-system-dependent type class file corresponds to non-system-dependent source codes of the target application program; deleting the non-system-dependent type file to form a system-dependent compilation package;
and compiling the source code of the target application program by adopting the preset compiling tool under a second operating system according to the system-dependent compiling package and the non-system-dependent source code to generate a target compiling package.
3. The method of claim 2, wherein compiling the source code of the target application according to the obfuscation configuration file to generate a compiled package comprises:
generating a system dependent type file by using the source code corresponding to the identification information of the system dependent source code in the confusion configuration file;
generating a non-system-dependent type file by using the source code corresponding to the identification information of the non-system-dependent source code in the confusion configuration file;
and generating a compiling package through the system dependent type class file and the non-system dependent type class file.
4. The method according to claim 2, wherein before the compiling the source code of the target application program with the preset compiling tool according to the system-dependent compiling package and the system-independent source code under the second operating system to generate the target compiling package, the method further comprises:
adopting the preset compiling tool to create a target application project under a second operating system;
and loading the system-dependent compiled package and the non-system-dependent source code to the target application project.
5. The method of claim 4, wherein loading the system-dependent compiled package and non-system-dependent source code into the target application project comprises:
determining the corresponding positions of the system-dependent compiled package and the non-system-dependent source code in the source code of the target application program;
and loading the system dependent compiling package and the non-system dependent source code to the target application project according to the corresponding position.
6. The method of claim 2, wherein said deleting the non-system-dependent class files to form a system-dependent compilation package comprises:
decompiling the compilation package to obtain a system dependent type class file and a non-system dependent type class file;
deleting the non-system-dependent type file;
and compiling the system dependent type file to generate the system dependent type compilation package.
7. The method according to any one of claims 1-6, wherein the first operating system or the second operating system is one of Google android operating system, Microsoft Windows operating system, apple iOS operating system, apple Watcos operating system, apple iPadOS operating system, apple MacOS operating system, Linux operating system, Huanwang operating system, and/or the predetermined compilation tool is an IDE tool.
8. An apparatus for compiling an application program, the apparatus being applied to an electronic device, the electronic device having a first operating system and a second operating system, the second operating system having a preset compiling tool loaded thereon, the apparatus comprising:
the system comprises an acquisition module, a configuration module and a configuration module, wherein a user acquires a source code of a target application program and an obfuscating configuration file, and the obfuscating configuration file comprises identification information of a system-dependent source code and identification information of a non-system-dependent source code;
the first generation module is used for generating a compiling package under the first operating system;
and the second generation module is used for generating the target compiling package under the second operating system.
9. An electronic device, comprising: a memory, a processor, and a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement a compilation method of an application program according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which computer-executable instructions are stored, and when executed by a processor, the computer-executable instructions are used for implementing a compiling method of an application program according to any one of claims 1 to 7.
CN201910903271.0A 2019-09-24 2019-09-24 Compiling method and device of application program, electronic equipment and storage medium Pending CN110659031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910903271.0A CN110659031A (en) 2019-09-24 2019-09-24 Compiling method and device of application program, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910903271.0A CN110659031A (en) 2019-09-24 2019-09-24 Compiling method and device of application program, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110659031A true CN110659031A (en) 2020-01-07

Family

ID=69038805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910903271.0A Pending CN110659031A (en) 2019-09-24 2019-09-24 Compiling method and device of application program, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110659031A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831316A (en) * 2020-07-21 2020-10-27 北京字节跳动网络技术有限公司 Software development kit updating method and device
CN112882719A (en) * 2021-03-01 2021-06-01 山东浪潮通软信息科技有限公司 Compiling method, device, equipment and storage medium
CN112925526A (en) * 2021-03-30 2021-06-08 平安科技(深圳)有限公司 Leakcanar-based compiling method, device, equipment and medium
CN113204347A (en) * 2021-04-02 2021-08-03 北京易捷思达科技发展有限公司 Processing method and device suitable for software package and electronic equipment
CN113849156A (en) * 2021-09-17 2021-12-28 中国科学院软件研究所 Code-free intelligent development system applied by OpenHarmony operating system and use method thereof
CN114564230A (en) * 2022-02-23 2022-05-31 北京布局未来教育科技有限公司 One-key uploading implementation method and device of Hongming system, electronic equipment and medium

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831316A (en) * 2020-07-21 2020-10-27 北京字节跳动网络技术有限公司 Software development kit updating method and device
CN112882719A (en) * 2021-03-01 2021-06-01 山东浪潮通软信息科技有限公司 Compiling method, device, equipment and storage medium
CN112882719B (en) * 2021-03-01 2024-03-22 浪潮通用软件有限公司 Compiling method, compiling device, compiling equipment and storage medium
CN112925526A (en) * 2021-03-30 2021-06-08 平安科技(深圳)有限公司 Leakcanar-based compiling method, device, equipment and medium
CN112925526B (en) * 2021-03-30 2023-09-19 平安科技(深圳)有限公司 Compiling method, device, equipment and medium based on Leakcanary
CN113204347A (en) * 2021-04-02 2021-08-03 北京易捷思达科技发展有限公司 Processing method and device suitable for software package and electronic equipment
CN113204347B (en) * 2021-04-02 2022-03-22 北京易捷思达科技发展有限公司 Processing method and device suitable for software package and electronic equipment
CN113849156A (en) * 2021-09-17 2021-12-28 中国科学院软件研究所 Code-free intelligent development system applied by OpenHarmony operating system and use method thereof
CN113849156B (en) * 2021-09-17 2022-06-28 中国科学院软件研究所 Codeless intelligent development system applied to OpenHarmony operating system and application method thereof
CN114564230A (en) * 2022-02-23 2022-05-31 北京布局未来教育科技有限公司 One-key uploading implementation method and device of Hongming system, electronic equipment and medium
CN114564230B (en) * 2022-02-23 2024-01-16 北京布局未来科技发展有限公司 One-key uploading realization method and device of hong Monte-go system, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN110659031A (en) Compiling method and device of application program, electronic equipment and storage medium
CN109491695B (en) Incremental updating method for integrated android application
CN110442327B (en) Application program construction method, device and server
CN110059456B (en) Code protection method, code protection device, storage medium and electronic equipment
KR20150024842A (en) Adaptive portable libraries
CN107678748B (en) Source code file compiling method and device
CN110083360B (en) Compiling method, device, equipment and storage medium of application program code
CN106648724B (en) Application program hot repair method and terminal
CN103177210A (en) Method of implanting dynamic stain analysis module in Android
CN100492387C (en) Method and system for software protected development based on Keil C51
CN111399840B (en) Module development method and device
CN110140108B (en) Handling sibling calls
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US8479177B2 (en) Attribute based method redirection
CN112769706B (en) Componentized routing method and system
CN115629971A (en) Application development system and method
US20230297348A1 (en) Method for operating second system application on first system, terminal device and storage medium
CN106775916B (en) Method and device for reducing application installation packages and electronic equipment
CN107239298B (en) Application program debugging method and device
US20180129490A1 (en) Object ordering preservation during lto link stage
CN113138768A (en) Application package generation method and device, electronic equipment and readable storage medium
US20180275976A1 (en) Link time optimization in presence of a linker script using path based rules
US10552135B1 (en) Reducing a size of an application package
CN103631585A (en) Method and system for developing application program
CN109189591B (en) Method and device for calling application component

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