WO2022078057A1 - Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device - Google Patents

Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device Download PDF

Info

Publication number
WO2022078057A1
WO2022078057A1 PCT/CN2021/113283 CN2021113283W WO2022078057A1 WO 2022078057 A1 WO2022078057 A1 WO 2022078057A1 CN 2021113283 W CN2021113283 W CN 2021113283W WO 2022078057 A1 WO2022078057 A1 WO 2022078057A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
application
application package
source code
hotspot
Prior art date
Application number
PCT/CN2021/113283
Other languages
French (fr)
Chinese (zh)
Inventor
钟卫东
杨天平
王德强
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2022078057A1 publication Critical patent/WO2022078057A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Definitions

  • the present application relates to the technical field of computer software, and in particular, to an application package publishing method, an application package application method, an application package publishing device, an application package application device, a storage medium, a server and an electronic device.
  • the application package market is booming, and there are more and more software platforms supporting application packages.
  • the application package is also called a light application, a small application, a small program, and the like.
  • Application packages usually take up less space, are easy for users to use, and run on a software platform.
  • Embodiments of the present application provide an application package publishing method, an application package application method, an application package publishing device, an application package application device, a storage medium, a server, and an electronic device, which can improve the startup speed of the application package.
  • an embodiment of the present application provides a method for publishing an application package, including:
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • an embodiment of the present application also provides an application method for an application package, including:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • an embodiment of the present application further provides an apparatus for publishing an application package, including:
  • a first obtaining module configured to obtain a first release file of an application package, wherein the first release file includes an application source code
  • a first pre-compilation module configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code
  • a first processing module configured to add the bytecode to the first release file to obtain a second release file
  • a publishing module configured to publish the application package according to the first publishing file and the second publishing file or publish the application package according to the first publishing file.
  • an embodiment of the present application further provides an application device for an application package, including:
  • a second acquisition module used to acquire a release file of the application package, wherein the release file includes the application source code
  • an installation module for installing the release file to an installation directory to form an installation file
  • a second pre-compilation module configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code
  • the second processing module is configured to store the bytecode in the installation directory, so as to complete the installation of the application package.
  • an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute:
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • an embodiment of the present application further provides a server for executing:
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • an embodiment of the present application further provides an electronic device, the electronic device includes a processor and a memory, the memory stores a computer program, and the processor calls the computer program stored in the memory by calling the computer program. , which is used to execute:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • FIG. 1 is a schematic diagram of a first application scenario of an application package provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a first startup process of an application package provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a method for publishing an application package provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a second application scenario of the application package provided by the embodiment of the present application.
  • FIG. 5 is a schematic diagram of a second startup process of an application package provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a method for applying an application package provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a third application scenario of an application package provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an apparatus for publishing an application package according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a first structure of an application device of an application package provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a second structure of an application device of an application package provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Electronic devices such as smartphones can run various applications, such as application packages.
  • the application package is also called a quick application, a light application, a small application, a small program, and the like.
  • Application packages usually take up less space, are easy for users to use, and run on a software platform.
  • FIG. 1 is a schematic diagram of a first application scenario of an application package provided by an embodiment of the present application.
  • Application packages can be developed by developers.
  • the developer can use a programming language (such as JavaScript and other languages) to write code files, and package the code files and used resource files together to form a release file. Subsequently, the developer can publish the application package to the application market for users to download and use.
  • a programming language such as JavaScript and other languages
  • the application market can serve as a platform for developers to release application packages and a platform for users to download application packages. After the developer publishes the application package to the application market, the application market may provide the application package for users to download.
  • the application market can be realized by an application program that manages application packages, such as software stores, application stores, and application managers developed by various manufacturers. It can be understood that the application market may run on a server, and the server provides a publishing platform service and a downloading service of the application package.
  • the user can download the application package from the application market of the server, then install the application package on the electronic device, and start the application package to realize the desired function.
  • the application package can be run on the user's electronic device, such as an electronic device such as a smart phone.
  • the download process and installation process of the application package are very fast. For example, the time required to download an application package may be less than 1 second. The time may also be less than 1 second. Therefore, the download process and installation process of the application package can be hidden from the user.
  • the application package when the user needs to use the application package, he can click the icon or link of the application package, the application package is downloaded and installed in the background, and starts immediately after the installation is completed, and the interface presented to the user after the application package is started. Therefore, for the user, the application package can be embodied as "one-point-to-use", that is, it can be started and used immediately after being clicked.
  • FIG. 2 is a schematic diagram of a first startup process of an application package provided by an embodiment of the present application.
  • the electronic device After the application package is downloaded and installed, when the electronic device starts the application package, the electronic device needs to sequentially parse, compile bytecode, interpret and execute, compile machine code and other processes of the code file of the application package.
  • the above processes need to be repeatedly executed.
  • the time spent parsing and compiling the bytecode is about 30% of the total time required to start the application package. For example, if it takes 2 seconds to start an application package, it takes about 0.6 seconds to parse and compile the bytecode. It can be seen that parsing and compiling the bytecode takes a long time in the startup process of the application package.
  • An embodiment of the present application provides a method for publishing an application package.
  • the method for publishing an application package can be applied to a server, for example, an application package management server, and the server executes the method for publishing the application package.
  • An embodiment of the present application provides a method for publishing an application package, including:
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • the publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file includes:
  • the network environment state of the electronic device When receiving the download request for downloading the application package sent by the electronic device, determine the network environment state of the electronic device, and the network environment state includes a local area network environment and a mobile network environment;
  • the first release file is sent to the electronic device.
  • the first release file further includes a hotspot file
  • the target code segment in the application source code is precompiled to obtain the bytecode corresponding to the target code segment in the application source code, include:
  • the target code segment in the application source code is precompiled to obtain bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • FIG. 3 is a first schematic flowchart of a method for publishing an application package provided by an embodiment of the present application.
  • the publishing method of the application package includes:
  • the server may obtain the first release file of the application package.
  • the first release file may be a release file provided to the application market after the developer completes the development of the application package. It can be understood that the first release file may include a code file written by a developer and a used resource file, for example, the resource file may include functions to be used. Both the code file and the resource file may be presented as code, that is, the application source code corresponding to the application package.
  • the server may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code.
  • the target code segment may include code that needs to be executed when the application package is started, and may also include code that needs to be executed during the running process after the application package is started.
  • Pre-compilation may include two processes of parsing and compiling bytecodes, that is, parsing the target code segment first, and then compiling the target code segment into bytecode.
  • the electronic device does not need to parse and compile the bytecode for the target code segment, that is, the application in the target code segment does not need to be parsed and compiled.
  • the code that needs to be executed when the package starts is parsed and the bytecode is compiled, which can save the time-consuming of the startup process and improve the startup speed of the application package.
  • the target code segment when the target code segment also includes code that needs to be executed during the running process after the application package is started, for example, the target code segment may include all the codes in the application source code.
  • the electronic device does not need to parse and compile bytecodes for the code that needs to be executed during the running process of the application package in the target code segment, so the response speed of the application package can be improved , and can reduce the power consumption when the application package is running.
  • the first published file further includes a hotspot file.
  • the hotspot file may include any one of a startup hotspot file and a running hotspot file.
  • the startup hotspot file is used to record the function that needs to be executed when the application package is started, that is, the startup hotspot function.
  • the running hotspot file is used to record the functions that need to be executed during the running process after the application package is started, that is, the running hotspot function.
  • both the activation hotspot function and the running hotspot function may include multiple functions.
  • the developer can use tools such as a hotspot recording tool to record the functions that the application package needs to execute during the startup process and the functions that need to be executed during the running process after startup, so as to generate the startup. hotspot file and the running hotspot file.
  • the server may, based on the hotspot function information recorded in the hotspot file, The target code segment in the application source code is precompiled to obtain the bytecode.
  • the target code segment in the application source code is precompiled to obtain the bytecode.
  • the startup hotspot function recorded in the startup hotspot file can be pre-compiled to obtain the corresponding bytecode
  • the startup hotspot function recorded in the startup hotspot file and the startup hotspot function recorded in the running hotspot file can be compiled simultaneously. Run the hotspot function to precompile to get the corresponding bytecode.
  • the electronic device does not need to parse and compile the bytecode of the hotspot function recorded in the hotspot file, which can save the time required for parsing and compiling the hotspot function, and thus saves startup time.
  • the time-consuming process improves the startup speed of the application package.
  • the server After obtaining the bytecode corresponding to the target code segment in the application source code, the server adds the bytecode to the first release file, for example, the bytecode can be packaged into the first release file to Get the second release file.
  • the server can release the application package according to the first release file and the second release file, or release the application package according to the first release file for users to download the application package. For example, when the user needs to use the application package, the server may provide the first release file for the user to download, and may also provide the second release file for the user to download.
  • FIG. 4 is a schematic diagram of a second application scenario of an application package provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a second startup process of an application package provided by an embodiment of the present application.
  • the application package is developed by the developer. After the development is completed, the developer can release the application package to the application market to form a first release file, where the first release file includes the application source code. Subsequently, the server precompiles the target code segment in the application source code, and adds the precompiled bytecode to the first release file to obtain the second release file. Subsequently, the first release file and the second release file are provided to the user for download.
  • download the application package, install the application package, and start the application package in sequence It is understandable that in the whole process of downloading the application package, installing the application package, and starting the application package, the user may only perform one operation.
  • the electronic device After the server precompiles all the application source codes of the application package, each time the application package is started, the electronic device only needs to perform the following processes: interpreting, executing, and compiling machine code, as shown in FIG. 5 . Therefore, during the startup process of the application package, the electronic device can omit the process of parsing and compiling the bytecode. Therefore, the time-consuming of the startup process can be saved, and the startup speed of the application package can be improved.
  • the precompiled function also precompiles the running hotspot functions that need to be used during the running process of the application package, the application package does not need to parse and compile the bytecode of the running hotspot function called during the running process, so that it can be Improve the response speed of the application package and reduce the power consumption of the application package when it is running.
  • the server After the server precompiles the code corresponding to the hotspot function recorded in the hotspot file of the application package, every time the application package is started, the electronic device does not need to parse and compile the hotspot function when parsing and compiling the bytecode. Therefore, the time required for parsing and compiling hotspot functions can be saved, which can also save time in the startup process and improve the startup speed of the application package.
  • the server when publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, the server may perform the following steps:
  • the network environment state includes a local area network environment and a mobile network environment
  • the server can determine the network environment state of the electronic device, for example, obtain the network environment state information of the electronic device by communicating with the electronic device.
  • the network environment state includes a local area network environment and a mobile network environment.
  • a local area network environment can be understood as an electronic device that has been connected to a local area network and communicates with network devices through the local area network.
  • a mobile network environment can be understood as an electronic device that is not connected to a local area network and communicates with a network device through a mobile network.
  • the server sends a corresponding release file to the electronic device according to the network environment state.
  • the server sends the second release file to the electronic device;
  • the server sends the first release file to the electronic device Publish the file.
  • the data volume of the second release file is larger than the data volume of the first release file.
  • the server when receiving a download request for downloading the application package sent by the electronic device, the server may further determine whether the second release file exists in the application market. For example, when the server only precompiles the code corresponding to the hotspot file of the application package, if the first release file does not include the code corresponding to the hotspot file, the server does not need to perform the precompilation operation, and the first release file will not be formed at this time. 2. Release documents. If there is a second release file, the corresponding release file is sent to the electronic device according to the network environment state; if there is no second release file, the first release file is directly sent to the electronic device.
  • the electronic device since the target code segment in the application source code of the first publishing file is precompiled to form the bytecode, after the electronic device downloads and installs the application package, every time the electronic device downloads and installs the application package, When starting the application package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the start-up process can be saved to improve the startup speed of the application package.
  • the embodiment of the present application further provides an application method of an application package, and the application method of the application package can be applied to an electronic device.
  • the electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • Embodiments of the present application also provide an application method for an application package, including:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • the release file further includes a hotspot file
  • the pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code includes:
  • the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • the method further includes:
  • FIG. 6 is a schematic flowchart of an application method of an application package provided by an embodiment of the present application.
  • the application method of the application package includes:
  • the electronic device may obtain the release file of the application package, for example, download the release file of the application package from the application market of the server. For example, when the user clicks on the icon or link of the application package, the electronic device can be triggered to download the application package from the application market.
  • the release file may provide a release file to the application market for the developer of the application package.
  • the release file may include a code file written by the developer and a resource file used, for example, the resource file may include functions that need to be used. Both the code file and the resource file may be presented as code, that is, the application source code corresponding to the application package.
  • the electronic device After the electronic device obtains the release file of the application package, it can be installed, and the release file is installed into the installation directory of the electronic device to form an installation file.
  • the installation file includes files formed during the installation process of the release file, for example, files released during the installation process.
  • the electronic device may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code.
  • the target code segment may include code that needs to be executed when the application package is started, and may also include code that needs to be executed during the running process after the application package is started.
  • Pre-compilation may include two processes of parsing and compiling bytecodes, that is, parsing the target code segment first, and then compiling the target code segment into bytecode.
  • the electronic device does not need to parse and compile the bytecode for the target code segment, that is, the application in the target code segment does not need to be parsed and compiled.
  • the code that needs to be executed when the package starts is parsed and the bytecode is compiled, which can save the time-consuming of the startup process and improve the startup speed of the application package.
  • the target code segment when the target code segment also includes code that needs to be executed during the running process after the application package is started, for example, the target code segment may include all the codes in the application source code.
  • the electronic device does not need to parse and compile bytecodes for the code that needs to be executed during the running process of the application package in the target code segment, so the response speed of the application package can be improved , and can reduce the power consumption when the application package is running.
  • the published files further include hotspot files.
  • the hotspot file may include any one of a startup hotspot file and a running hotspot file.
  • the startup hotspot file is used to record the function that needs to be executed when the application package is started, that is, the startup hotspot function.
  • the running hotspot file is used to record the functions that need to be executed during the running process after the application package is started, that is, the running hotspot function.
  • both the activation hotspot function and the running hotspot function may include multiple functions.
  • the developer can use tools such as a hotspot recording tool to record the functions that the application package needs to execute during the startup process and the functions that need to be executed during the running process after startup, so as to generate the startup. hotspot file and the running hotspot file.
  • the electronic device may, based on the hotspot function information recorded in the hotspot file,
  • the bytecode is obtained by precompiling the target code segment in the application source code.
  • the startup hotspot function recorded in the startup hotspot file can be pre-compiled to obtain the corresponding bytecode
  • the startup hotspot function recorded in the startup hotspot file and the startup hotspot function recorded in the running hotspot file can be compiled simultaneously. Run the hotspot function to precompile to get the corresponding bytecode.
  • the electronic device does not need to parse and compile the bytecode of the hotspot function recorded in the hotspot file, which can save the time required for parsing and compiling the hotspot function, and thus saves startup time.
  • the time-consuming process improves the startup speed of the application package.
  • the electronic device After obtaining the bytecode corresponding to the target code segment in the application source code, the electronic device stores the bytecode in the installation directory to complete the installation of the application package. After the installation is complete, the application package can be launched.
  • the method for applying the application package further includes:
  • the electronic device when it receives the startup instruction of the application package, it can execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package. For example, after the installation of the application package is completed, when the user clicks on the icon of the application package, a startup instruction is triggered at this time, and the electronic device receives the startup instruction and starts the application package. For another example, when the application package has not been installed, when the user clicks the application package icon or link in the application market, the download, installation and startup of the application package can be triggered at the same time, that is, the download instruction of the application package can be triggered simultaneously in this case. , installation instruction and startup instruction, and then the electronic device downloads the application package according to the download instruction, installation instruction and startup instruction, installs it immediately after the download is completed, and starts immediately after the installation is completed.
  • FIG. 7 is a schematic diagram of a third application scenario of the application package provided by the embodiment of the present application.
  • the application package is developed by the developer. After the development is completed, the developer can publish the application package to the application market to form a release file.
  • the application market can provide the release files to users for download.
  • the electronic device may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, and then store the bytecode in the application source code. to the installation directory to complete the installation of the application package. It is understandable that in the whole process of downloading the application package, installing the application package, and starting the application package, the user may only perform one operation.
  • the electronic device After the electronic device precompiles all the application source codes of the application package during the installation process of the application package, each time the application package is started, the electronic device only needs to perform the following processes: interpreting, executing, and compiling the machine code, as shown in Figure 5 shown. Therefore, during the startup process of the application package, the electronic device can omit the process of parsing and compiling the bytecode. Therefore, the time-consuming of the startup process can be saved, and the startup speed of the application package can be improved.
  • the precompiled function also precompiles the running hotspot functions that need to be used during the running process of the application package, the application package does not need to parse and compile the bytecode of the running hotspot function called during the running process, so that it can be Improve the response speed of the application package and reduce the power consumption of the application package when it is running.
  • the electronic device After the electronic device precompiles the code corresponding to the hotspot function recorded in the hotspot file of the application package during the installation process of the application package, every time the application package is started, the electronic device does not need to parse and compile the bytecode when parsing and compiling the bytecode. Then, parsing and compiling the bytecode of the hotspot function can save the time required for parsing and compiling the hotspot function, thereby also saving the time-consuming of the startup process and improving the startup speed of the application package.
  • the target code segment in the application source code of the published file is precompiled to form bytecode, so after the installation is completed, each time When starting the application package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the start-up process can be saved to improve the startup speed of the application package.
  • Embodiments of the present application further provide an apparatus for publishing an application package, where the apparatus for publishing an application package may be integrated in a server, for example, an application package management server.
  • FIG. 8 is a schematic structural diagram of an application package publishing apparatus 300 according to an embodiment of the present application.
  • the publishing apparatus 300 of the application package includes:
  • a first obtaining module 301 configured to obtain a first release file of an application package, wherein the first release file includes an application source code
  • a first pre-compilation module 302 configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
  • a first processing module 303 configured to add the bytecode to the first release file to obtain a second release file
  • the publishing module 304 is configured to publish the application package according to the first publishing file and the second publishing file or publish the application package according to the first publishing file.
  • the first release file further includes a hotspot file
  • the first precompilation module 302 is used for:
  • the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • the publishing module 304 is used to:
  • the network environment state includes a local area network environment and a mobile network environment
  • the first release file is sent to the electronic device.
  • the target code segment in the application source code of the first distribution file is precompiled to form bytecode
  • the electronic device downloads and installs the application package, every startup When applying the package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, Improve the startup speed of the application package.
  • the embodiment of the present application further provides an application device of an application package, and the application device of the application package can be integrated in an electronic device.
  • the electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • FIG. 9 is a first structural schematic diagram of an application device 400 of an application package provided by an embodiment of the present application.
  • the application device 400 of the application package includes:
  • a second obtaining module 401 configured to obtain a release file of an application package, wherein the release file includes an application source code
  • the second pre-compilation module 403 is configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
  • the second processing module 404 is configured to store the bytecode in the installation directory, so as to complete the installation of the application package.
  • the release file further includes a hotspot file
  • the second precompilation module 403 is used for:
  • the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • FIG. 10 is a second schematic structural diagram of an application device 400 of an application package provided by an embodiment of the present application.
  • the application device 400 of the application package further includes a start-up module 405, and the start-up module 405 is used for:
  • the target code segment in the application source code of the published file is precompiled to form bytecode, so after the installation is completed, each startup When applying the package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, Improve the startup speed of the application package.
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • the server when publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, the server is configured to execute:
  • the network environment state includes a local area network environment and a mobile network environment
  • the first release file is sent to the electronic device.
  • the first release file further includes a hotspot file, and when pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the The server described above is used to execute:
  • the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • the embodiments of the present application also provide an electronic device.
  • the electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
  • FIG. 11 is a schematic structural diagram of an electronic device 500 provided by an embodiment of the present application.
  • the electronic device 500 includes a processor 501 and a memory 502 .
  • the processor 501 is electrically connected to the memory 502 .
  • the processor 501 is the control center of the electronic device 500, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic device by running or calling the computer program stored in the memory 502, and calling the data stored in the memory 502. Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
  • the processor 501 in the electronic device 500 loads the instructions corresponding to the processes of one or more computer programs into the memory 502 according to the following steps, and is executed by the processor 501 and stored in the memory 502 computer program that performs the following steps:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • the release file further includes a hotspot file, and when pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the processor 501 Perform the following steps:
  • the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  • the processor 501 after storing the bytecode in the installation directory to complete the installation of the application package, the processor 501 further performs the following steps:
  • Memory 502 may be used to store computer programs and data.
  • the computer program stored in the memory 502 contains instructions executable in the processor.
  • a computer program can be composed of various functional modules.
  • the processor 501 executes various functional applications and data processing by calling the computer program stored in the memory 502 .
  • the target code segment in the application source code of the published file is precompiled to form bytecode. Therefore, after the installation is completed, each time the application package is started, The electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, and the startup of the application package can be improved. speed.
  • An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the method for publishing an application package described in any of the foregoing embodiments.
  • the computer program when run on a computer, causes the computer to execute:
  • the application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  • An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the method for applying an application package described in any of the foregoing embodiments.
  • the computer program when run on a computer, causes the computer to execute:
  • release file of the application package wherein the release file includes the application source code
  • the bytecode is stored in the installation directory to complete the installation of the application package.
  • the storage medium may include but is not limited to: read only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.

Abstract

A method and apparatus for publishing an application package, a method and apparatus for applying an application package, and a storage medium, a server and an electronic device. The method for publishing an application package comprises: acquiring a first publishing file of an application package; precompiling a target code segment in an application source code, so as to obtain a corresponding bytecode; adding the bytecode to the first publishing file, so as to obtain a second publishing file; and publishing the application package according to the first publishing file and the second publishing file, or publishing the application package according to the first publishing file.

Description

应用包发布方法、应用方法、装置、介质、服务器及设备Application package publishing method, application method, apparatus, medium, server and device
本申请要求于2020年10月12日提交中国专利局、申请号为202011085779.3、发明名称为“应用包发布方法、应用方法、装置、介质、服务器及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on October 12, 2020 with the application number 202011085779.3 and the invention name is "application package publishing method, application method, device, medium, server and equipment", all of which are The contents are incorporated herein by reference.
技术领域technical field
本申请涉及计算机软件技术领域,特别涉及一种应用包的发布方法、应用包的应用方法、应用包的发布装置、应用包的应用装置、存储介质、服务器及电子设备。The present application relates to the technical field of computer software, and in particular, to an application package publishing method, an application package application method, an application package publishing device, an application package application device, a storage medium, a server and an electronic device.
背景技术Background technique
近年来,在计算机软件领域,应用包市场蓬勃发展,支持应用包的软件平台也越来越多。其中,应用包又称为轻应用、小应用、小程序等。应用包通常占用空间较小,用户使用方便,依托于软件平台来运行。In recent years, in the field of computer software, the application package market is booming, and there are more and more software platforms supporting application packages. Among them, the application package is also called a light application, a small application, a small program, and the like. Application packages usually take up less space, are easy for users to use, and run on a software platform.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种应用包的发布方法、应用包的应用方法、应用包的发布装置、应用包的应用装置、存储介质、服务器及电子设备,可以提升应用包的启动速度。Embodiments of the present application provide an application package publishing method, an application package application method, an application package publishing device, an application package application device, a storage medium, a server, and an electronic device, which can improve the startup speed of the application package.
第一方面,本申请实施例提供一种应用包的发布方法,包括:In a first aspect, an embodiment of the present application provides a method for publishing an application package, including:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
第二方面,本申请实施例还提供一种应用包的应用方法,包括:In a second aspect, an embodiment of the present application also provides an application method for an application package, including:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
第三方面,本申请实施例还提供一种应用包的发布装置,包括:In a third aspect, an embodiment of the present application further provides an apparatus for publishing an application package, including:
第一获取模块,用于获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;a first obtaining module, configured to obtain a first release file of an application package, wherein the first release file includes an application source code;
第一预编译模块,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;a first pre-compilation module, configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
第一处理模块,用于将所述字节码加入所述第一发布文件,以得到第二发布文件;a first processing module, configured to add the bytecode to the first release file to obtain a second release file;
发布模块,用于根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。A publishing module, configured to publish the application package according to the first publishing file and the second publishing file or publish the application package according to the first publishing file.
第四方面,本申请实施例还提供一种应用包的应用装置,包括:In a fourth aspect, an embodiment of the present application further provides an application device for an application package, including:
第二获取模块,用于获取应用包的发布文件,其中所述发布文件包括应用源代码;a second acquisition module, used to acquire a release file of the application package, wherein the release file includes the application source code;
安装模块,用于将所述发布文件安装至安装目录,以形成安装文件;an installation module for installing the release file to an installation directory to form an installation file;
第二预编译模块,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;a second pre-compilation module, configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
第二处理模块,用于将所述字节码存储到所述安装目录,以完成所述应用包的安装。The second processing module is configured to store the bytecode in the installation directory, so as to complete the installation of the application package.
第五方面,本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行:In a fifth aspect, an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
第六方面,本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行:In a sixth aspect, an embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is made to execute:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
第七方面,本申请实施例还提供一种服务器,用于执行:In a seventh aspect, an embodiment of the present application further provides a server for executing:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
第八方面,本申请实施例还提供一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行:In an eighth aspect, an embodiment of the present application further provides an electronic device, the electronic device includes a processor and a memory, the memory stores a computer program, and the processor calls the computer program stored in the memory by calling the computer program. , which is used to execute:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that are used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1为本申请实施例提供的应用包的第一种应用场景示意图。FIG. 1 is a schematic diagram of a first application scenario of an application package provided by an embodiment of the present application.
图2为本申请实施例提供的应用包的第一种启动过程示意图。FIG. 2 is a schematic diagram of a first startup process of an application package provided by an embodiment of the present application.
图3为本申请实施例提供的应用包的发布方法的流程示意图。FIG. 3 is a schematic flowchart of a method for publishing an application package provided by an embodiment of the present application.
图4为本申请实施例提供的应用包的第二种应用场景示意图。FIG. 4 is a schematic diagram of a second application scenario of the application package provided by the embodiment of the present application.
图5为本申请实施例提供的应用包的第二种启动过程示意图。FIG. 5 is a schematic diagram of a second startup process of an application package provided by an embodiment of the present application.
图6为本申请实施例提供的应用包的应用方法的流程示意图。FIG. 6 is a schematic flowchart of a method for applying an application package provided by an embodiment of the present application.
图7为本申请实施例提供的应用包的第三种应用场景示意图。FIG. 7 is a schematic diagram of a third application scenario of an application package provided by an embodiment of the present application.
图8为本申请实施例提供的应用包的发布装置的结构示意图。FIG. 8 is a schematic structural diagram of an apparatus for publishing an application package according to an embodiment of the present application.
图9为本申请实施例提供的应用包的应用装置的第一种结构示意图。FIG. 9 is a schematic structural diagram of a first structure of an application device of an application package provided by an embodiment of the present application.
图10为本申请实施例提供的应用包的应用装置的第二种结构示意图。FIG. 10 is a schematic diagram of a second structure of an application device of an application package provided by an embodiment of the present application.
图11为本申请实施例提供的电子设备的结构示意图。FIG. 11 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有付出创造性劳动前提下所获得的所有其他实施例,都属于本申请的保护范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of this application.
诸如智能手机等电子设备可以运行各种应用程序,例如应用包。其中,应用包又称为快应用、轻应用、小应用、小程序等。应用包通常占用空间较小,用户使用方便,依托于软件平台来运行。Electronic devices such as smartphones can run various applications, such as application packages. Among them, the application package is also called a quick application, a light application, a small application, a small program, and the like. Application packages usually take up less space, are easy for users to use, and run on a software platform.
参考图1,图1为本申请实施例提供的应用包的第一种应用场景示意图。Referring to FIG. 1 , FIG. 1 is a schematic diagram of a first application scenario of an application package provided by an embodiment of the present application.
应用包可以由开发者进行开发。在应用包的开发过程中,开发者可以使用编程语言(例如JavaScript等语言)编写代码文件,并将代码文件和使用的资源文件打包到一起,形成发布文件。随后,开发者可以将应用包发布到应用市场,供用户下载使用。Application packages can be developed by developers. In the development process of the application package, the developer can use a programming language (such as JavaScript and other languages) to write code files, and package the code files and used resource files together to form a release file. Subsequently, the developer can publish the application package to the application market for users to download and use.
应用市场可以作为开发者发布应用包的平台,以及为用户提供应用包下载服务的平台。在开发者将应用包发布到应用市场后,应用市场可以将应用包提供给用户下载。其中,应用市场可以通过对应用包进行管理的应用程序来实现,例如各个厂家开发的软件商店、应用商店、应用管家等。可以理解的,应用市场可以运行在服务器上,由服务器提供应用包的发布平台服务和下载服务。The application market can serve as a platform for developers to release application packages and a platform for users to download application packages. After the developer publishes the application package to the application market, the application market may provide the application package for users to download. Among them, the application market can be realized by an application program that manages application packages, such as software stores, application stores, and application managers developed by various manufacturers. It can be understood that the application market may run on a server, and the server provides a publishing platform service and a downloading service of the application package.
用户在需要使用应用包时,可以从服务器的应用市场下载应用包,随后在电子设备上安装应用包,并启动应用包,以实现所需的功能。可以理解的,应用包可以运行在用户的电子设备上,例如智能手机等电子设备。需要说明的是,由于应用包通常占用空间较小,因此应用包的下载过程和安装过程都是很快的,例如下载一个应用包所需的时间可能不到1秒,安装应用包所需的时间也可能不到1秒。因此,对于用户而言,应用包的下载过程和安装过程可以是隐藏的。例如,用户在需要使用应用包时,可以点击应用包的图标或者链接,应用包即在后台被下载和安装,安装完成后立即启动,呈现给用户的即为应用包启动后的界面。从而,对用户而言,应用包可以体现为“一点即用”,即点击后可以立即启动来使用。When the user needs to use the application package, the user can download the application package from the application market of the server, then install the application package on the electronic device, and start the application package to realize the desired function. It can be understood that the application package can be run on the user's electronic device, such as an electronic device such as a smart phone. It should be noted that since the application package usually occupies a small space, the download process and installation process of the application package are very fast. For example, the time required to download an application package may be less than 1 second. The time may also be less than 1 second. Therefore, the download process and installation process of the application package can be hidden from the user. For example, when the user needs to use the application package, he can click the icon or link of the application package, the application package is downloaded and installed in the background, and starts immediately after the installation is completed, and the interface presented to the user after the application package is started. Therefore, for the user, the application package can be embodied as "one-point-to-use", that is, it can be started and used immediately after being clicked.
同时参考图2,图2为本申请实施例提供的应用包的第一种启动过程示意图。Referring to FIG. 2 at the same time, FIG. 2 is a schematic diagram of a first startup process of an application package provided by an embodiment of the present application.
应用包下载并安装完成后,电子设备在启动应用包时,需要依次对应用包的代码文件进行解析、编译字节码、解释执行、编译机器码等过程。After the application package is downloaded and installed, when the electronic device starts the application package, the electronic device needs to sequentially parse, compile bytecode, interpret and execute, compile machine code and other processes of the code file of the application package.
需要说明的是,电子设备在每次启动应用包时,都需要重复执行上述各个过程。其中,解析和编译字节码所耗费的时间约为启动应用包所需总时间的30%。例如,若启动一个应用包需要2秒,那么解析和编译字节码大约需要0.6秒的时间。由此可见,解析和编译字节码在应用包的启动过程中的耗时是很长的。It should be noted that each time the electronic device starts the application package, the above processes need to be repeatedly executed. Among them, the time spent parsing and compiling the bytecode is about 30% of the total time required to start the application package. For example, if it takes 2 seconds to start an application package, it takes about 0.6 seconds to parse and compile the bytecode. It can be seen that parsing and compiling the bytecode takes a long time in the startup process of the application package.
本申请实施例提供一种应用包的发布方法,所述应用包的发布方法可以应用于服务器中,例如应用于应用包管理服务器中,通过所述服务器执行所述应用包的发布方法。An embodiment of the present application provides a method for publishing an application package. The method for publishing an application package can be applied to a server, for example, an application package management server, and the server executes the method for publishing the application package.
本申请实施例提供一种应用包的发布方法,包括:An embodiment of the present application provides a method for publishing an application package, including:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
在一些实施例中,所述根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包,包括:In some embodiments, the publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file includes:
接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境 状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving the download request for downloading the application package sent by the electronic device, determine the network environment state of the electronic device, and the network environment state includes a local area network environment and a mobile network environment;
当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
在一些实施例中,所述第一发布文件还包括热点文件,所述对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码,包括:In some embodiments, the first release file further includes a hotspot file, and the target code segment in the application source code is precompiled to obtain the bytecode corresponding to the target code segment in the application source code, include:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
参考图3,图3为本申请实施例提供的应用包的发布方法的第一种流程示意图。其中,所述应用包的发布方法包括:Referring to FIG. 3 , FIG. 3 is a first schematic flowchart of a method for publishing an application package provided by an embodiment of the present application. Wherein, the publishing method of the application package includes:
110,获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码。110. Obtain a first release file of the application package, where the first release file includes the application source code.
服务器可以获取应用包的第一发布文件。其中,所述第一发布文件可以为开发者完成应用包的开发后,提供到应用市场的发布文件。可以理解的,所述第一发布文件可以包括开发者编写的代码文件以及所使用的资源文件,所述资源文件例如可以包括需要使用的函数。所述代码文件和所述资源文件都可以呈现为代码,也即应用包对应的应用源代码。The server may obtain the first release file of the application package. The first release file may be a release file provided to the application market after the developer completes the development of the application package. It can be understood that the first release file may include a code file written by a developer and a used resource file, for example, the resource file may include functions to be used. Both the code file and the resource file may be presented as code, that is, the application source code corresponding to the application package.
120,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码。120. Precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code.
服务器获取到第一发布文件后,可以对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码。其中,所述目标代码段可以包括所述应用包启动时需要执行的代码,还可以包括所述应用包启动后在运行过程中需要执行的代码。预编译可以包括解析和编译字节码两个过程,也即先对所述目标代码段进行解析,再将所述目标代码段编译为字节码。After acquiring the first release file, the server may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code. The target code segment may include code that needs to be executed when the application package is started, and may also include code that needs to be executed during the running process after the application package is started. Pre-compilation may include two processes of parsing and compiling bytecodes, that is, parsing the target code segment first, and then compiling the target code segment into bytecode.
因此,用户在下载并安装应用包后,在每次启动应用包时,电子设备无需对所述目标代码段进行解析和编译字节码,也即无需对所述目标代码段中的所述应用包启动时需要执行的代码进行解析和编译字节码,从而可以节省启动过程的耗时,提升应用包的启动速度。Therefore, after the user downloads and installs the application package, each time the application package is started, the electronic device does not need to parse and compile the bytecode for the target code segment, that is, the application in the target code segment does not need to be parsed and compiled. The code that needs to be executed when the package starts is parsed and the bytecode is compiled, which can save the time-consuming of the startup process and improve the startup speed of the application package.
可以理解的,当所述目标代码段还包括所述应用包启动后在运行过程中需要执行的代码时,例如所述目标代码段可以包括所述应用源代码中的全部代码,这种情况下,在所述应用包的运行过程中,电子设备也无需对所述目标代码段中的所述应用包运行过程中需要执行的代码进行解析和编译字节码,因此可以提升应用包的响应速度,以及可以降低应用包运行时的功耗。It can be understood that when the target code segment also includes code that needs to be executed during the running process after the application package is started, for example, the target code segment may include all the codes in the application source code. In this case, , during the running process of the application package, the electronic device does not need to parse and compile bytecodes for the code that needs to be executed during the running process of the application package in the target code segment, so the response speed of the application package can be improved , and can reduce the power consumption when the application package is running.
在一些实施例中,所述第一发布文件还包括热点文件。其中,所述热点文件可以包括启动热点文件和运行热点文件中任意一种。所述启动热点文件用于记录所述应用包启动时需要执行的函数,也即启动热点函数。所述运行热点文件用于记录所述应用包启动后在运行过程中需要执行的函数,也即运行热点函数。其中,所述启动热点函数、所述运行热点函数都可以包括多个函数。可以理解的,开发者可以在应用包开发完成后,通过诸如热点记录工具等工具来记录应用包在启动过程中需要执行的函数以及启动后在运行过程中需要执行的函数,从而生成所述启动热点文件和所述运行热点文件。In some embodiments, the first published file further includes a hotspot file. Wherein, the hotspot file may include any one of a startup hotspot file and a running hotspot file. The startup hotspot file is used to record the function that needs to be executed when the application package is started, that is, the startup hotspot function. The running hotspot file is used to record the functions that need to be executed during the running process after the application package is started, that is, the running hotspot function. Wherein, both the activation hotspot function and the running hotspot function may include multiple functions. It is understandable that after the development of the application package is completed, the developer can use tools such as a hotspot recording tool to record the functions that the application package needs to execute during the startup process and the functions that need to be executed during the running process after startup, so as to generate the startup. hotspot file and the running hotspot file.
其中,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,服务器可以基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码。例如,可以对所述启动热点文件中记录的启动热点函数进行预编译,得到对应的字节码,也可以同时对所述启动热点文件中记录的启动热点函数以及所述运行热点文件中记录的运行热点函数进行预编译,得到对应的字节码。Wherein, when precompiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the server may, based on the hotspot function information recorded in the hotspot file, The target code segment in the application source code is precompiled to obtain the bytecode. For example, the startup hotspot function recorded in the startup hotspot file can be pre-compiled to obtain the corresponding bytecode, and the startup hotspot function recorded in the startup hotspot file and the startup hotspot function recorded in the running hotspot file can be compiled simultaneously. Run the hotspot function to precompile to get the corresponding bytecode.
从而,在用户每次启动应用包时,电子设备无需再对所述热点文件中记录的热点函数进行解析和编译字节码,可以节省解析和编译热点函数所需的时间,因此也可以节省启动 过程的耗时,提升应用包的启动速度。Therefore, each time the user starts the application package, the electronic device does not need to parse and compile the bytecode of the hotspot function recorded in the hotspot file, which can save the time required for parsing and compiling the hotspot function, and thus saves startup time. The time-consuming process improves the startup speed of the application package.
130,将所述字节码加入所述第一发布文件,以得到第二发布文件。130. Add the bytecode to the first release file to obtain a second release file.
服务器得到所述应用源代码中目标代码段对应的字节码后,将所述字节码加入所述第一发布文件,例如可以将所述字节码打包进所述第一发布文件,以得到第二发布文件。After obtaining the bytecode corresponding to the target code segment in the application source code, the server adds the bytecode to the first release file, for example, the bytecode can be packaged into the first release file to Get the second release file.
140,根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。140. Publish the application package according to the first publishing file and the second publishing file, or publish the application package according to the first publishing file.
服务器得到所述第二发布文件后,即可根据所述第一发布文件和所述第二发布文件发布所述应用包,或者根据所述第一发布文件发布所述应用包,以供用户下载所述应用包。例如,当用户需要使用应用包时,服务器既可以提供所述第一发布文件供用户下载,也可以提供所述第二发布文件供用户下载。After obtaining the second release file, the server can release the application package according to the first release file and the second release file, or release the application package according to the first release file for users to download the application package. For example, when the user needs to use the application package, the server may provide the first release file for the user to download, and may also provide the second release file for the user to download.
在本申请的描述中,需要理解的是,诸如“第一”、“第二”等术语仅用于区分类似的对象,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。In the description of this application, it should be understood that terms such as "first", "second" and the like are only used to distinguish similar objects, and cannot be interpreted as indicating or implying relative importance or implying the indicated technology number of features.
同时参考图4、图5,图4为本申请实施例提供的应用包的第二种应用场景示意图,图5为本申请实施例提供的应用包的第二种启动过程示意图。4 and 5 at the same time, FIG. 4 is a schematic diagram of a second application scenario of an application package provided by an embodiment of the present application, and FIG. 5 is a schematic diagram of a second startup process of an application package provided by an embodiment of the present application.
其中,应用包由开发者进行开发。开发完成后,开发者可以将应用包发布到应用市场,形成第一发布文件,所述第一发布文件包括应用源代码。随后,服务器对所述应用源代码中目标代码段进行预编译,并将预编译得到的字节码加入到第一发布文件中,得到第二发布文件。随后,将第一发布文件和第二发布文件提供给用户下载。用户需要使用应用包时,依次下载应用包、安装应用包、启动应用包。可以理解的,下载应用包、安装应用包、启动应用包的整个过程中,用户可以只进行一次操作即可。The application package is developed by the developer. After the development is completed, the developer can release the application package to the application market to form a first release file, where the first release file includes the application source code. Subsequently, the server precompiles the target code segment in the application source code, and adds the precompiled bytecode to the first release file to obtain the second release file. Subsequently, the first release file and the second release file are provided to the user for download. When the user needs to use the application package, download the application package, install the application package, and start the application package in sequence. It is understandable that in the whole process of downloading the application package, installing the application package, and starting the application package, the user may only perform one operation.
当服务器对应用包的全部应用源代码进行预编译后,在每次启动应用包时,电子设备只进行以下过程即可:解释执行、编译机器码,如图5所示。从而,应用包的启动过程中,电子设备可以省略解析和编译字节码的过程。因此,可以节省启动过程的耗时,提升应用包的启动速度。并且,由于预编译时也对应用包运行过程中需要使用到的运行热点函数进行了预编译,因此应用包在运行过程中无需对所调用的运行热点函数进行解析和编译字节码,从而可以提升应用包的响应速度,并且可以降低应用包运行时的功耗。After the server precompiles all the application source codes of the application package, each time the application package is started, the electronic device only needs to perform the following processes: interpreting, executing, and compiling machine code, as shown in FIG. 5 . Therefore, during the startup process of the application package, the electronic device can omit the process of parsing and compiling the bytecode. Therefore, the time-consuming of the startup process can be saved, and the startup speed of the application package can be improved. In addition, since the precompiled function also precompiles the running hotspot functions that need to be used during the running process of the application package, the application package does not need to parse and compile the bytecode of the running hotspot function called during the running process, so that it can be Improve the response speed of the application package and reduce the power consumption of the application package when it is running.
当服务器对应用包的热点文件中记录的热点函数对应的代码进行预编译后,在每次启动应用包时,电子设备在进行解析和编译字节码时,无需再对热点函数进行解析和编译字节码,因此可以节省解析和编译热点函数所需的时间,从而也可以节省启动过程的耗时,提升应用包的启动速度。After the server precompiles the code corresponding to the hotspot function recorded in the hotspot file of the application package, every time the application package is started, the electronic device does not need to parse and compile the hotspot function when parsing and compiling the bytecode. Therefore, the time required for parsing and compiling hotspot functions can be saved, which can also save time in the startup process and improve the startup speed of the application package.
在一些实施例中,根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包时,服务器可以执行以下步骤:In some embodiments, when publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, the server may perform the following steps:
接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request sent by an electronic device to download the application package, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
根据所述网络环境状态向所述电子设备发送相应的发布文件。Send a corresponding release file to the electronic device according to the network environment state.
服务器得到第二发布文件后,当接收到电子设备发送的下载所述应用包的下载请求时,例如当用户点击应用包的图标或者链接时,电子设备产生下载请求并向服务器的应用市场发送产生的下载请求,此时服务器可以确定电子设备的网络环境状态,例如通过与电子设备通信来获取电子设备的网络环境状态信息。其中,所述网络环境状态包括局域网环境和移动网络环境。局域网环境可以理解为电子设备已经连接到局域网,并通过局域网与网络设备进行通信。移动网络环境可以理解为电子设备未连接局域网,通过移动网络与网络设备进行通信。After the server obtains the second release file, when receiving a download request for downloading the application package sent by the electronic device, for example, when the user clicks on the icon or link of the application package, the electronic device generates a download request and sends the generated download request to the application market of the server. At this time, the server can determine the network environment state of the electronic device, for example, obtain the network environment state information of the electronic device by communicating with the electronic device. Wherein, the network environment state includes a local area network environment and a mobile network environment. A local area network environment can be understood as an electronic device that has been connected to a local area network and communicates with network devices through the local area network. A mobile network environment can be understood as an electronic device that is not connected to a local area network and communicates with a network device through a mobile network.
随后,服务器根据所述网络环境状态向所述电子设备发送相应的发布文件。例如,当所述网络环境状态为局域网环境时,服务器向所述电子设备发送所述第二发布文件;当所 述网络环境状态为移动网络环境时,服务器向所述电子设备发送所述第一发布文件。Then, the server sends a corresponding release file to the electronic device according to the network environment state. For example, when the network environment state is a local area network environment, the server sends the second release file to the electronic device; when the network environment state is a mobile network environment, the server sends the first release file to the electronic device Publish the file.
可以理解的,由于第二发布文件是在第一发布文件内加入了预编译得到的字节码,因此所述第二发布文件的数据量大于所述第一发布文件的数据量。当用户的电子设备处于移动网络环境时,也即未连接局域网时,向电子设备发送所述第一发布文件可以节省电子设备的网络资源。而当用户的电子设备处于局域网环境时,通常局域网的网络资源优于移动网络,因此可以向电子设备发送数据量较大的第二发布文件。It can be understood that, because the bytecode obtained by pre-compilation is added to the first release file in the second release file, the data volume of the second release file is larger than the data volume of the first release file. When the user's electronic device is in a mobile network environment, that is, when the local area network is not connected, sending the first release file to the electronic device can save network resources of the electronic device. When the user's electronic device is in a local area network environment, usually the network resources of the local area network are better than that of the mobile network, so the second release file with a larger amount of data can be sent to the electronic device.
可以理解的,在一些实施例中,在接收到电子设备发送的下载所述应用包的下载请求时,服务器还可以判断应用市场中是否存在所述第二发布文件。例如,当服务器只对应用包的热点文件对应的代码进行预编译时,若所述第一发布文件中未包括热点文件对应的代码,则服务器无需进行预编译操作,此时也不会形成第二发布文件。若存在第二发布文件,再根据所述网络环境状态向所述电子设备发送相应的发布文件;若不存在第二发布文件,则直接向所述电子设备发送所述第一发布文件。It can be understood that, in some embodiments, when receiving a download request for downloading the application package sent by the electronic device, the server may further determine whether the second release file exists in the application market. For example, when the server only precompiles the code corresponding to the hotspot file of the application package, if the first release file does not include the code corresponding to the hotspot file, the server does not need to perform the precompilation operation, and the first release file will not be formed at this time. 2. Release documents. If there is a second release file, the corresponding release file is sent to the electronic device according to the network environment state; if there is no second release file, the first release file is directly sent to the electronic device.
本申请实施例提供的应用包的发布方法中,由于对第一发布文件的应用源代码中的目标代码段进行预编译形成字节码,因此在电子设备下载并安装应用包后,在每次启动应用包时,电子设备无需再对所述应用源代码中的目标代码段进行编译,从而可以省略对所述目标代码段的解析和编译字节码的过程,因此可以节省启动过程的耗时,提升应用包的启动速度。In the method for publishing the application package provided by the embodiment of the present application, since the target code segment in the application source code of the first publishing file is precompiled to form the bytecode, after the electronic device downloads and installs the application package, every time the electronic device downloads and installs the application package, When starting the application package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the start-up process can be saved to improve the startup speed of the application package.
本申请实施例还提供一种应用包的应用方法,所述应用包的应用方法可以应用于电子设备中。所述电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、汽车、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The embodiment of the present application further provides an application method of an application package, and the application method of the application package can be applied to an electronic device. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
本申请实施例还提供一种应用包的应用方法,包括:Embodiments of the present application also provide an application method for an application package, including:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
在一些实施例中,所述发布文件还包括热点文件,所述对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码,包括:In some embodiments, the release file further includes a hotspot file, and the pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code includes:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
在一些实施例中,所述将所述字节码存储到所述安装目录,以完成所述应用包的安装之后,还包括:In some embodiments, after the storing the bytecode in the installation directory to complete the installation of the application package, the method further includes:
接收所述应用包的启动指令;receiving a startup instruction of the application package;
根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
参考图6,图6为本申请实施例提供的应用包的应用方法的流程示意图。其中,所述应用包的应用方法包括:Referring to FIG. 6 , FIG. 6 is a schematic flowchart of an application method of an application package provided by an embodiment of the present application. Wherein, the application method of the application package includes:
210,获取应用包的发布文件,其中所述发布文件包括应用源代码。210. Obtain a release file of the application package, where the release file includes the application source code.
电子设备可以获取应用包的发布文件,例如从服务器的应用市场下载应用包的发布文件。例如,当用户点击应用包的图标或者链接时,即可触发电子设备从应用市场下载所述应用包。其中,所述发布文件可以为应用包的开发者提供到应用市场的发布文件。所述发布文件可以包括开发者编写的代码文件以及所使用的资源文件,所述资源文件例如可以包 括需要使用的函数。所述代码文件和所述资源文件都可以呈现为代码,也即应用包对应的应用源代码。The electronic device may obtain the release file of the application package, for example, download the release file of the application package from the application market of the server. For example, when the user clicks on the icon or link of the application package, the electronic device can be triggered to download the application package from the application market. The release file may provide a release file to the application market for the developer of the application package. The release file may include a code file written by the developer and a resource file used, for example, the resource file may include functions that need to be used. Both the code file and the resource file may be presented as code, that is, the application source code corresponding to the application package.
220将所述发布文件安装至安装目录,以形成安装文件。220 Install the release file into an installation directory to form an installation file.
电子设备获取到应用包的发布文件后,即可进行安装,将所述发布文件安装到电子设备的安装目录中,以形成安装文件。可以理解的,所述安装文件包括所述发布文件在安装过程中形成的文件,例如安装过程中释放出的文件。After the electronic device obtains the release file of the application package, it can be installed, and the release file is installed into the installation directory of the electronic device to form an installation file. It can be understood that the installation file includes files formed during the installation process of the release file, for example, files released during the installation process.
230,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码。230. Precompile the target code segment in the application source code to obtain bytecodes corresponding to the target code segment in the application source code.
在应用包的安装过程中,电子设备可以对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码。其中,所述目标代码段可以包括所述应用包启动时需要执行的代码,还可以包括所述应用包启动后在运行过程中需要执行的代码。预编译可以包括解析和编译字节码两个过程,也即先对所述目标代码段进行解析,再将所述目标代码段编译为字节码。During the installation process of the application package, the electronic device may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code. The target code segment may include code that needs to be executed when the application package is started, and may also include code that needs to be executed during the running process after the application package is started. Pre-compilation may include two processes of parsing and compiling bytecodes, that is, parsing the target code segment first, and then compiling the target code segment into bytecode.
因此,用户在下载并安装应用包后,在每次启动应用包时,电子设备无需对所述目标代码段进行解析和编译字节码,也即无需对所述目标代码段中的所述应用包启动时需要执行的代码进行解析和编译字节码,从而可以节省启动过程的耗时,提升应用包的启动速度。Therefore, after the user downloads and installs the application package, each time the application package is started, the electronic device does not need to parse and compile the bytecode for the target code segment, that is, the application in the target code segment does not need to be parsed and compiled. The code that needs to be executed when the package starts is parsed and the bytecode is compiled, which can save the time-consuming of the startup process and improve the startup speed of the application package.
可以理解的,当所述目标代码段还包括所述应用包启动后在运行过程中需要执行的代码时,例如所述目标代码段可以包括所述应用源代码中的全部代码,这种情况下,在所述应用包的运行过程中,电子设备也无需对所述目标代码段中的所述应用包运行过程中需要执行的代码进行解析和编译字节码,因此可以提升应用包的响应速度,以及可以降低应用包运行时的功耗。It can be understood that when the target code segment also includes code that needs to be executed during the running process after the application package is started, for example, the target code segment may include all the codes in the application source code. In this case, , during the running process of the application package, the electronic device does not need to parse and compile bytecodes for the code that needs to be executed during the running process of the application package in the target code segment, so the response speed of the application package can be improved , and can reduce the power consumption when the application package is running.
在一些实施例中,所述发布文件还包括热点文件。其中,所述热点文件可以包括启动热点文件和运行热点文件中任意一种。所述启动热点文件用于记录所述应用包启动时需要执行的函数,也即启动热点函数。所述运行热点文件用于记录所述应用包启动后在运行过程中需要执行的函数,也即运行热点函数。其中,所述启动热点函数、所述运行热点函数都可以包括多个函数。可以理解的,开发者可以在应用包开发完成后,通过诸如热点记录工具等工具来记录应用包在启动过程中需要执行的函数以及启动后在运行过程中需要执行的函数,从而生成所述启动热点文件和所述运行热点文件。In some embodiments, the published files further include hotspot files. Wherein, the hotspot file may include any one of a startup hotspot file and a running hotspot file. The startup hotspot file is used to record the function that needs to be executed when the application package is started, that is, the startup hotspot function. The running hotspot file is used to record the functions that need to be executed during the running process after the application package is started, that is, the running hotspot function. Wherein, both the activation hotspot function and the running hotspot function may include multiple functions. It is understandable that after the development of the application package is completed, the developer can use tools such as a hotspot recording tool to record the functions that the application package needs to execute during the startup process and the functions that need to be executed during the running process after startup, so as to generate the startup. hotspot file and the running hotspot file.
其中,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,电子设备可以基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码。例如,可以对所述启动热点文件中记录的启动热点函数进行预编译,得到对应的字节码,也可以同时对所述启动热点文件中记录的启动热点函数以及所述运行热点文件中记录的运行热点函数进行预编译,得到对应的字节码。Wherein, when pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the electronic device may, based on the hotspot function information recorded in the hotspot file, The bytecode is obtained by precompiling the target code segment in the application source code. For example, the startup hotspot function recorded in the startup hotspot file can be pre-compiled to obtain the corresponding bytecode, and the startup hotspot function recorded in the startup hotspot file and the startup hotspot function recorded in the running hotspot file can be compiled simultaneously. Run the hotspot function to precompile to get the corresponding bytecode.
从而,在用户每次启动应用包时,电子设备无需再对所述热点文件中记录的热点函数进行解析和编译字节码,可以节省解析和编译热点函数所需的时间,因此也可以节省启动过程的耗时,提升应用包的启动速度。Therefore, each time the user starts the application package, the electronic device does not need to parse and compile the bytecode of the hotspot function recorded in the hotspot file, which can save the time required for parsing and compiling the hotspot function, and thus saves startup time. The time-consuming process improves the startup speed of the application package.
240,将所述字节码存储到所述安装目录,以完成所述应用包的安装。240. Store the bytecode in the installation directory to complete the installation of the application package.
电子设备得到所述应用源代码中目标代码段对应的字节码后,将所述字节码存储到所述安装目录,以完成所述应用包的安装。安装完成后,即可启动所述应用包。After obtaining the bytecode corresponding to the target code segment in the application source code, the electronic device stores the bytecode in the installation directory to complete the installation of the application package. After the installation is complete, the application package can be launched.
在一些实施例中,将所述字节码存储到所述安装目录,以完成所述应用包的安装之后,所述应用包的应用方法还包括:In some embodiments, after the bytecode is stored in the installation directory to complete the installation of the application package, the method for applying the application package further includes:
接收所述应用包的启动指令;receiving a startup instruction of the application package;
根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码, 以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction, so as to start the application package.
其中,当电子设备接收到所述应用包的启动指令时,可以根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。例如,在应用包安装完成后,当用户点击应用包的图标时,此时触发启动指令,电子设备接收所述启动指令,并启动所述应用包。再例如,在尚未安装应用包时,当用户点击应用市场中的应用包图标或者链接时,可以同时触发应用包的下载、安装以及启动,也即这种情况下可以同时触发应用包的下载指令、安装指令和启动指令,随后电子设备根据下载指令、安装指令和启动指令下载应用包,下载完成后立即进行安装,安装完成后立即启动。Wherein, when the electronic device receives the startup instruction of the application package, it can execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package. For example, after the installation of the application package is completed, when the user clicks on the icon of the application package, a startup instruction is triggered at this time, and the electronic device receives the startup instruction and starts the application package. For another example, when the application package has not been installed, when the user clicks the application package icon or link in the application market, the download, installation and startup of the application package can be triggered at the same time, that is, the download instruction of the application package can be triggered simultaneously in this case. , installation instruction and startup instruction, and then the electronic device downloads the application package according to the download instruction, installation instruction and startup instruction, installs it immediately after the download is completed, and starts immediately after the installation is completed.
可以理解的,电子设备执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包时,无需再对所述应用源代码中目标代码段进行解析和编译字节码,因此可以节省启动过程的耗时,提升应用包的启动速度。It can be understood that when the electronic device executes the installation file and the bytecode corresponding to the target code segment in the application source code to start the application package, there is no need to parse and analyze the target code segment in the application source code. Compile bytecode, so it can save time in the startup process and improve the startup speed of the application package.
同时参考图7,图7为本申请实施例提供的应用包的第三种应用场景示意图。Referring to FIG. 7 at the same time, FIG. 7 is a schematic diagram of a third application scenario of the application package provided by the embodiment of the present application.
其中,应用包由开发者进行开发。开发完成后,开发者可以将应用包发布到应用市场,形成发布文件。应用市场可以将发布文件提供给用户下载。用户需要使用应用包时,依次下载应用包、安装应用包、启动应用包。在安装应用包时,电子设备可以对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码,随后将所述字节码存储到所述安装目录,以完成所述应用包的安装。可以理解的,下载应用包、安装应用包、启动应用包的整个过程中,用户可以只进行一次操作即可。The application package is developed by the developer. After the development is completed, the developer can publish the application package to the application market to form a release file. The application market can provide the release files to users for download. When the user needs to use the application package, download the application package, install the application package, and start the application package in sequence. When installing the application package, the electronic device may precompile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, and then store the bytecode in the application source code. to the installation directory to complete the installation of the application package. It is understandable that in the whole process of downloading the application package, installing the application package, and starting the application package, the user may only perform one operation.
当电子设备在应用包的安装过程中对应用包的全部应用源代码进行预编译后,在每次启动应用包时,电子设备只进行以下过程即可:解释执行、编译机器码,如图5所示。从而,应用包的启动过程中,电子设备可以省略解析和编译字节码的过程。因此,可以节省启动过程的耗时,提升应用包的启动速度。并且,由于预编译时也对应用包运行过程中需要使用到的运行热点函数进行了预编译,因此应用包在运行过程中无需对所调用的运行热点函数进行解析和编译字节码,从而可以提升应用包的响应速度,并且可以降低应用包运行时的功耗。After the electronic device precompiles all the application source codes of the application package during the installation process of the application package, each time the application package is started, the electronic device only needs to perform the following processes: interpreting, executing, and compiling the machine code, as shown in Figure 5 shown. Therefore, during the startup process of the application package, the electronic device can omit the process of parsing and compiling the bytecode. Therefore, the time-consuming of the startup process can be saved, and the startup speed of the application package can be improved. In addition, since the precompiled function also precompiles the running hotspot functions that need to be used during the running process of the application package, the application package does not need to parse and compile the bytecode of the running hotspot function called during the running process, so that it can be Improve the response speed of the application package and reduce the power consumption of the application package when it is running.
当电子设备在应用包的安装过程中对应用包的热点文件中记录的热点函数对应的代码进行预编译后,在每次启动应用包时,电子设备在进行解析和编译字节码时,无需再对热点函数进行解析和编译字节码,因此可以节省解析和编译热点函数所需的时间,从而也可以节省启动过程的耗时,提升应用包的启动速度。After the electronic device precompiles the code corresponding to the hotspot function recorded in the hotspot file of the application package during the installation process of the application package, every time the application package is started, the electronic device does not need to parse and compile the bytecode when parsing and compiling the bytecode. Then, parsing and compiling the bytecode of the hotspot function can save the time required for parsing and compiling the hotspot function, thereby also saving the time-consuming of the startup process and improving the startup speed of the application package.
本申请实施例提供的应用包的应用方法中,由于在应用包的安装过程中,对发布文件的应用源代码中的目标代码段进行预编译形成字节码,因此在安装完成后,每次启动应用包时,电子设备无需再对所述应用源代码中的目标代码段进行编译,从而可以省略对所述目标代码段的解析和编译字节码的过程,因此可以节省启动过程的耗时,提升应用包的启动速度。In the application method of the application package provided by the embodiment of the present application, since in the installation process of the application package, the target code segment in the application source code of the published file is precompiled to form bytecode, so after the installation is completed, each time When starting the application package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the start-up process can be saved to improve the startup speed of the application package.
本申请实施例还提供一种应用包的发布装置,所述应用包的发布装置可以集成在服务器中,例如集成在应用包管理服务器中。Embodiments of the present application further provide an apparatus for publishing an application package, where the apparatus for publishing an application package may be integrated in a server, for example, an application package management server.
参考图8,图8为本申请实施例提供的应用包的发布装置300的结构示意图。其中,所述应用包的发布装置300包括:Referring to FIG. 8 , FIG. 8 is a schematic structural diagram of an application package publishing apparatus 300 according to an embodiment of the present application. Wherein, the publishing apparatus 300 of the application package includes:
第一获取模块301,用于获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;A first obtaining module 301, configured to obtain a first release file of an application package, wherein the first release file includes an application source code;
第一预编译模块302,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;a first pre-compilation module 302, configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
第一处理模块303,用于将所述字节码加入所述第一发布文件,以得到第二发布文件;a first processing module 303, configured to add the bytecode to the first release file to obtain a second release file;
发布模块304,用于根据所述第一发布文件和所述第二发布文件发布所述应用包或根 据所述第一发布文件发布所述应用包。The publishing module 304 is configured to publish the application package according to the first publishing file and the second publishing file or publish the application package according to the first publishing file.
在一些实施例中,所述第一发布文件还包括热点文件,所述第一预编译模块302用于:In some embodiments, the first release file further includes a hotspot file, and the first precompilation module 302 is used for:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
在一些实施例中,所述发布模块304用于:In some embodiments, the publishing module 304 is used to:
接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request sent by an electronic device to download the application package, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
其中,所述应用包的发布装置300的各个模块的具体实现方式,可以参考上述应用包的发布方法中的描述,在此不再赘述。For the specific implementation manner of each module of the application package publishing apparatus 300, reference may be made to the description in the above-mentioned application package publishing method, which will not be repeated here.
本申请实施例提供的应用包的发布装置,由于对第一发布文件的应用源代码中的目标代码段进行预编译形成字节码,因此在电子设备下载并安装应用包后,在每次启动应用包时,电子设备无需再对所述应用源代码中的目标代码段进行编译,从而可以省略对所述目标代码段的解析和编译字节码的过程,因此可以节省启动过程的耗时,提升应用包的启动速度。In the application package distribution device provided by the embodiment of the present application, since the target code segment in the application source code of the first distribution file is precompiled to form bytecode, after the electronic device downloads and installs the application package, every startup When applying the package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, Improve the startup speed of the application package.
本申请实施例还提供一种应用包的应用装置,所述应用包的应用装置可以集成在电子设备中。所述电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、汽车、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The embodiment of the present application further provides an application device of an application package, and the application device of the application package can be integrated in an electronic device. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
参考图9,图9为本申请实施例提供的应用包的应用装置400的第一种结构示意图。其中,所述应用包的应用装置400包括:Referring to FIG. 9 , FIG. 9 is a first structural schematic diagram of an application device 400 of an application package provided by an embodiment of the present application. Wherein, the application device 400 of the application package includes:
第二获取模块401,用于获取应用包的发布文件,其中所述发布文件包括应用源代码;A second obtaining module 401, configured to obtain a release file of an application package, wherein the release file includes an application source code;
安装模块402,用于将所述发布文件安装至安装目录,以形成安装文件;an installation module 402, configured to install the release file into an installation directory to form an installation file;
第二预编译模块403,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;The second pre-compilation module 403 is configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
第二处理模块404,用于将所述字节码存储到所述安装目录,以完成所述应用包的安装。The second processing module 404 is configured to store the bytecode in the installation directory, so as to complete the installation of the application package.
在一些实施例中,所述发布文件还包括热点文件,所述第二预编译模块403用于:In some embodiments, the release file further includes a hotspot file, and the second precompilation module 403 is used for:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
在一些实施例中,参考图10,图10为本申请实施例提供的应用包的应用装置400的第二种结构示意图。其中,所述应用包的应用装置400还包括启动模块405,所述启动模块405用于:In some embodiments, referring to FIG. 10 , FIG. 10 is a second schematic structural diagram of an application device 400 of an application package provided by an embodiment of the present application. Wherein, the application device 400 of the application package further includes a start-up module 405, and the start-up module 405 is used for:
接收所述应用包的启动指令;receiving a startup instruction of the application package;
根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
其中,所述应用包的应用装置400的各个模块的具体实现方式,可以参考上述应用包的应用方法中的描述,在此不再赘述。For the specific implementation manner of each module of the application device 400 of the application package, reference may be made to the description in the application method of the application package, which will not be repeated here.
本申请实施例提供的应用包的应用装置,由于在应用包的安装过程中,对发布文件的应用源代码中的目标代码段进行预编译形成字节码,因此在安装完成后,每次启动应用包时,电子设备无需再对所述应用源代码中的目标代码段进行编译,从而可以省略对所述目标代码段的解析和编译字节码的过程,因此可以节省启动过程的耗时,提升应用包的启动 速度。In the application device of the application package provided by the embodiment of the present application, since in the installation process of the application package, the target code segment in the application source code of the published file is precompiled to form bytecode, so after the installation is completed, each startup When applying the package, the electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, Improve the startup speed of the application package.
本申请实施例还提供一种服务器,用于执行:The embodiment of the present application also provides a server for executing:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
在一些实施例中,根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包时,所述服务器用于执行:In some embodiments, when publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, the server is configured to execute:
接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request sent by an electronic device to download the application package, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
在一些实施例中,所述第一发布文件还包括热点文件,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,所述服务器用于执行:In some embodiments, the first release file further includes a hotspot file, and when pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the The server described above is used to execute:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
本申请实施例还提供一种电子设备。所述电子设备可以为智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、汽车、数据存储装置、音频播放装置、视频播放装置、笔记本电脑、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The embodiments of the present application also provide an electronic device. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a laptop, a desktop computing device, a wearable device such as Electronic watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.
参考图11,图11为本申请实施例提供的电子设备500的结构示意图。其中,电子设备500包括处理器501和存储器502。处理器501与存储器502电性连接。Referring to FIG. 11 , FIG. 11 is a schematic structural diagram of an electronic device 500 provided by an embodiment of the present application. The electronic device 500 includes a processor 501 and a memory 502 . The processor 501 is electrically connected to the memory 502 .
处理器501是电子设备500的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或调用存储在存储器502内的计算机程序,以及调用存储在存储器502内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 501 is the control center of the electronic device 500, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic device by running or calling the computer program stored in the memory 502, and calling the data stored in the memory 502. Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
在本实施例中,电子设备500中的处理器501按照如下的步骤,将一个或一个以上的计算机程序的进程对应的指令加载到存储器502中,并由处理器501来运行存储在存储器502中的计算机程序,从而执行以下步骤:In this embodiment, the processor 501 in the electronic device 500 loads the instructions corresponding to the processes of one or more computer programs into the memory 502 according to the following steps, and is executed by the processor 501 and stored in the memory 502 computer program that performs the following steps:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
在一些实施例中,所述发布文件还包括热点文件,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,处理器501执行以下步骤:In some embodiments, the release file further includes a hotspot file, and when pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code, the processor 501 Perform the following steps:
基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
在一些实施例中,将所述字节码存储到所述安装目录,以完成所述应用包的安装之后,处理器501还执行以下步骤:In some embodiments, after storing the bytecode in the installation directory to complete the installation of the application package, the processor 501 further performs the following steps:
接收所述应用包的启动指令;receiving a startup instruction of the application package;
根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
存储器502可用于存储计算机程序和数据。存储器502存储的计算机程序中包含有可在处理器中执行的指令。计算机程序可以组成各种功能模块。处理器501通过调用存储在存储器502的计算机程序,从而执行各种功能应用以及数据处理。Memory 502 may be used to store computer programs and data. The computer program stored in the memory 502 contains instructions executable in the processor. A computer program can be composed of various functional modules. The processor 501 executes various functional applications and data processing by calling the computer program stored in the memory 502 .
本申请实施例提供的电子设备,由于在应用包的安装过程中,对发布文件的应用源代码中目标代码段进行预编译形成字节码,因此在安装完成后,每次启动应用包时,电子设备无需再对所述应用源代码中目标代码段进行编译,从而可以省略对所述目标代码段的解析和编译字节码的过程,因此可以节省启动过程的耗时,提升应用包的启动速度。In the electronic device provided by the embodiment of the present application, during the installation process of the application package, the target code segment in the application source code of the published file is precompiled to form bytecode. Therefore, after the installation is completed, each time the application package is started, The electronic device does not need to compile the target code segment in the application source code, so that the process of parsing the target code segment and compiling the bytecode can be omitted, so the time-consuming of the startup process can be saved, and the startup of the application package can be improved. speed.
本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,所述计算机执行上述任一实施例所述的应用包的发布方法。An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the method for publishing an application package described in any of the foregoing embodiments.
例如,在一些实施例中,当所述计算机程序在计算机上运行时,使得所述计算机执行:For example, in some embodiments, the computer program, when run on a computer, causes the computer to execute:
获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,所述计算机执行上述任一实施例所述的应用包的应用方法。An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer executes the method for applying an application package described in any of the foregoing embodiments.
例如,在一些实施例中,当所述计算机程序在计算机上运行时,使得所述计算机执行:For example, in some embodiments, the computer program, when run on a computer, causes the computer to execute:
获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
需要说明的是,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过计算机程序来指令相关的硬件来完成,所述计算机程序可以存储于计算机可读存储介质中,所述存储介质可以包括但不限于:只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或光盘等。It should be noted that those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium , the storage medium may include but is not limited to: read only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
以上对本申请实施例所提供的应用包的发布方法、应用包的应用方法、装置、存储介质及电子设备进行了详细介绍。本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The method for publishing the application package, the method for applying the application package, the apparatus, the storage medium, and the electronic device provided by the embodiments of the present application have been described in detail above. The principles and implementations of the present application are described herein using specific examples, and the descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application; meanwhile, for those skilled in the art, according to the Thoughts, there will be changes in specific embodiments and application scopes. To sum up, the contents of this specification should not be construed as limitations on the present application.

Claims (20)

  1. 一种应用包的发布方法,包括:An application package publishing method, including:
    获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
    根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  2. 根据权利要求1所述的应用包的发布方法,其中,所述根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包,包括:The method for publishing an application package according to claim 1, wherein the publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, include:
    接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request sent by an electronic device to download the application package, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
    当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
    当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
  3. 根据权利要求1所述的应用包的发布方法,其中,所述第一发布文件还包括热点文件,所述对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码,包括:The method for publishing an application package according to claim 1, wherein the first publishing file further includes a hotspot file, and the target code segment in the application source code is precompiled to obtain the target code segment in the application source code. The bytecode corresponding to the target code segment, including:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  4. 一种应用包的应用方法,包括:An application method of an application package, comprising:
    获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
    将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
  5. 根据权利要求4所述的应用包的应用方法,其中,所述发布文件还包括热点文件,所述对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码,包括:The method for applying an application package according to claim 4, wherein the release file further includes a hotspot file, and the target code segment in the application source code is precompiled to obtain the target code in the application source code The bytecode corresponding to the segment, including:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  6. 根据权利要求4所述的应用包的应用方法,其中,所述将所述字节码存储到所述安装目录,以完成所述应用包的安装之后,还包括:The method for applying an application package according to claim 4, wherein after the storing the bytecode in the installation directory to complete the installation of the application package, the method further comprises:
    接收所述应用包的启动指令;receiving a startup instruction of the application package;
    根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
  7. 一种应用包的发布装置,包括:An apparatus for publishing an application package, comprising:
    第一获取模块,用于获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;a first obtaining module, configured to obtain a first release file of an application package, wherein the first release file includes an application source code;
    第一预编译模块,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;a first pre-compilation module, configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    第一处理模块,用于将所述字节码加入所述第一发布文件,以得到第二发布文件;a first processing module, configured to add the bytecode to the first release file to obtain a second release file;
    发布模块,用于根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。A publishing module, configured to publish the application package according to the first publishing file and the second publishing file or publish the application package according to the first publishing file.
  8. 根据权利要求7所述的应用包的发布装置,其中,所述发布模块用于:The apparatus for publishing application packages according to claim 7, wherein the publishing module is used for:
    接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request sent by an electronic device to download the application package, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
    当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
    当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
  9. 根据权利要求7所述的应用包的发布装置,其中,所述第一发布文件还包括热点文件,所述第一预编译模块用于:The apparatus for publishing application packages according to claim 7, wherein the first publishing file further comprises a hotspot file, and the first pre-compilation module is used for:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  10. 一种应用包的应用装置,包括:An application device of an application package, comprising:
    第二获取模块,用于获取应用包的发布文件,其中所述发布文件包括应用源代码;a second acquisition module, used to acquire a release file of the application package, wherein the release file includes the application source code;
    安装模块,用于将所述发布文件安装至安装目录,以形成安装文件;an installation module for installing the release file to an installation directory to form an installation file;
    第二预编译模块,用于对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;a second pre-compilation module, configured to pre-compile the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    第二处理模块,用于将所述字节码存储到所述安装目录,以完成所述应用包的安装。The second processing module is configured to store the bytecode in the installation directory, so as to complete the installation of the application package.
  11. 根据权利要求10所述的应用包的应用装置,其中,所述发布文件还包括热点文件,所述第二预编译模块用于:The application device of the application package according to claim 10, wherein the release file further comprises a hotspot file, and the second pre-compilation module is used for:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain the bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  12. 根据权利要求10所述的应用包的应用装置,其中,还包括启动模块,所述启动模块用于:The application device of the application package according to claim 10, further comprising a startup module, wherein the startup module is used for:
    接收所述应用包的启动指令;receiving a startup instruction of the application package;
    根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
  13. 一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行:A storage medium, in which a computer program is stored, when the computer program runs on a computer, the computer is made to execute:
    获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
    根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  14. 一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行:A storage medium, in which a computer program is stored, when the computer program runs on a computer, the computer is made to execute:
    获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
    将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
  15. 一种服务器,用于执行:A server that executes:
    获取应用包的第一发布文件,其中所述第一发布文件包括应用源代码;Obtain the first release file of the application package, wherein the first release file includes the application source code;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码加入所述第一发布文件,以得到第二发布文件;adding the bytecode to the first release file to obtain a second release file;
    根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件 发布所述应用包。The application package is released according to the first release file and the second release file or the application package is released according to the first release file.
  16. 根据权利要求15所述的服务器,其中,根据所述第一发布文件和所述第二发布文件发布所述应用包或根据所述第一发布文件发布所述应用包时,所述服务器用于执行:The server according to claim 15, wherein when publishing the application package according to the first publishing file and the second publishing file or publishing the application package according to the first publishing file, the server is configured to: implement:
    接收到电子设备发送的下载所述应用包的下载请求时,确定所述电子设备的网络环境状态,所述网络环境状态包括局域网环境和移动网络环境;When receiving a download request for downloading the application package sent by the electronic device, determine a network environment state of the electronic device, where the network environment state includes a local area network environment and a mobile network environment;
    当所述网络环境状态为局域网环境时,向所述电子设备发送所述第二发布文件;When the network environment state is a local area network environment, sending the second release file to the electronic device;
    当所述网络环境状态为移动网络环境时,向所述电子设备发送所述第一发布文件。When the network environment state is a mobile network environment, the first release file is sent to the electronic device.
  17. 根据权利要求15所述的服务器,其中,所述第一发布文件还包括热点文件,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,所述服务器用于执行:The server according to claim 15, wherein the first release file further includes a hotspot file, and pre-compile the target code segment in the application source code to obtain the word corresponding to the target code segment in the application source code Section code, the server is used to execute:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  18. 一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行:An electronic device, the electronic device comprising a processor and a memory, a computer program is stored in the memory, and the processor is configured to execute by calling the computer program stored in the memory:
    获取应用包的发布文件,其中所述发布文件包括应用源代码;Obtain the release file of the application package, wherein the release file includes the application source code;
    将所述发布文件安装至安装目录,以形成安装文件;installing the release file into an installation directory to form an installation file;
    对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码;Pre-compiling the target code segment in the application source code to obtain the bytecode corresponding to the target code segment in the application source code;
    将所述字节码存储到所述安装目录,以完成所述应用包的安装。The bytecode is stored in the installation directory to complete the installation of the application package.
  19. 根据权利要求18所述的电子设备,其中,所述发布文件还包括热点文件,对所述应用源代码中目标代码段进行预编译,以得到所述应用源代码中目标代码段对应的字节码时,所述处理器用于执行:The electronic device according to claim 18, wherein the release file further comprises a hotspot file, and precompile the target code segment in the application source code to obtain bytes corresponding to the target code segment in the application source code code, the processor is used to execute:
    基于所述热点文件中所记录的热点函数信息,对所述应用源代码中目标代码段进行预编译得到字节码,其中所述热点文件包括启动热点文件和运行热点文件中任意一种。Based on the hotspot function information recorded in the hotspot file, the target code segment in the application source code is precompiled to obtain bytecode, wherein the hotspot file includes any one of a startup hotspot file and a running hotspot file.
  20. 根据权利要求18所述的电子设备,其中,所述处理器还用于执行:The electronic device of claim 18, wherein the processor is further configured to perform:
    接收所述应用包的启动指令;receiving a startup instruction of the application package;
    根据所述启动指令执行所述安装文件以及所述应用源代码中目标代码段对应的字节码,以启动所述应用包。Execute the installation file and the bytecode corresponding to the target code segment in the application source code according to the startup instruction to start the application package.
PCT/CN2021/113283 2020-10-12 2021-08-18 Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device WO2022078057A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011085779.3 2020-10-12
CN202011085779.3A CN112148318B (en) 2020-10-12 2020-10-12 Application package release method, application method, device, medium, server and equipment

Publications (1)

Publication Number Publication Date
WO2022078057A1 true WO2022078057A1 (en) 2022-04-21

Family

ID=73951462

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/113283 WO2022078057A1 (en) 2020-10-12 2021-08-18 Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device

Country Status (2)

Country Link
CN (1) CN112148318B (en)
WO (1) WO2022078057A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148318B (en) * 2020-10-12 2024-02-13 Oppo广东移动通信有限公司 Application package release method, application method, device, medium, server and equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177199A (en) * 2011-12-22 2013-06-26 盛乐信息技术(上海)有限公司 Webpage application code protective method and system, and executive speed-up method and system
US9280339B1 (en) * 2013-12-12 2016-03-08 Amazon Technologies, Inc. Class replacer during application installation
CN105630569A (en) * 2015-12-17 2016-06-01 北京金山安全软件有限公司 Software source code processing method and device and electronic equipment
CN108664773A (en) * 2018-04-26 2018-10-16 北京三快在线科技有限公司 The guard method of Java source code and device
CN111159658A (en) * 2019-12-16 2020-05-15 广州三七互娱科技有限公司 Byte code processing method, system, device, computer equipment and storage medium
CN112148318A (en) * 2020-10-12 2020-12-29 Oppo广东移动通信有限公司 Application package issuing method, application method, device, medium, server and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177199A (en) * 2011-12-22 2013-06-26 盛乐信息技术(上海)有限公司 Webpage application code protective method and system, and executive speed-up method and system
US9280339B1 (en) * 2013-12-12 2016-03-08 Amazon Technologies, Inc. Class replacer during application installation
CN105630569A (en) * 2015-12-17 2016-06-01 北京金山安全软件有限公司 Software source code processing method and device and electronic equipment
CN108664773A (en) * 2018-04-26 2018-10-16 北京三快在线科技有限公司 The guard method of Java source code and device
CN111159658A (en) * 2019-12-16 2020-05-15 广州三七互娱科技有限公司 Byte code processing method, system, device, computer equipment and storage medium
CN112148318A (en) * 2020-10-12 2020-12-29 Oppo广东移动通信有限公司 Application package issuing method, application method, device, medium, server and equipment

Also Published As

Publication number Publication date
CN112148318B (en) 2024-02-13
CN112148318A (en) 2020-12-29

Similar Documents

Publication Publication Date Title
US6295643B1 (en) Method and apparatus for improving java virtual machine performance using persistent execution information
Taivalsaari et al. Web browser as an application platform
EP3035191B1 (en) Identifying source code used to build executable files
JP6294886B2 (en) Generate native code from intermediate language code for applications
WO2016192556A1 (en) Interface invoking method, device and terminal
US7844960B2 (en) Optimizing software program execution during class loading phase
US20160162272A1 (en) Method and apparatus for loading a rendering engine
CN110187910B (en) Thermal updating method, device, equipment and computer readable storage medium
US20040268301A1 (en) Adding new compiler methods to an integrated development environment
US11625253B2 (en) Application-level runtime environment for executing applications native to mobile devices without full installation
GB2589658A (en) Method and apparatus for running an applet
CN113688186B (en) Intelligent contract execution method, engine and block link point
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US7966600B2 (en) Distributed resource understanding tool management
US9632804B2 (en) Method, apparatus, and communication system for implementing internet application
US8904346B1 (en) Method and system for automated load testing of web applications
WO2022078057A1 (en) Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device
US10353700B1 (en) Code base sharing between standalone and web-based versions of an application via an emulated network communication channel
CN111913741B (en) Object interception method, device, medium and electronic equipment
CN112988175A (en) Cross-platform application installation package generation method, device, medium and electronic equipment
CN112394906A (en) Method and equipment for switching application operation
CN116069366A (en) Client application program updating method and device, storage medium and electronic equipment
CN114911541A (en) Configuration information processing method and device, electronic equipment and storage medium
CN114547604A (en) Application detection method and device, storage medium and electronic equipment
CN111338633B (en) Method and device for generating installation-free file and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21879104

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21879104

Country of ref document: EP

Kind code of ref document: A1