Automatic compiling method, device, electronic equipment and system

By using automated scripts to generate and install the Har package of the HarmonyOS NEXT project in the Flutter framework, the high complexity of cross-platform development of the HarmonyOS NEXT system is solved, and efficient automatic mixed compilation and development efficiency are improved.

CN120596094APending Publication Date: 2025-09-05SHENZHEN GREEN CONNECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510480814.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

In the existing technology, the cross-platform development of the HarmonyOS NEXT system is highly complex and has low development efficiency. It requires multiple manual operations and the compilation and debugging steps need to be repeated after the code is modified.

Method used

Compilation is performed in the Flutter project directory of the Flutter framework through an automated script, the target Har package is generated using the AOT compilation method, and the dependency configuration information is parsed through the ohpm toolset and automatically installed into the HarmonyOS NEXT project.

Benefits of technology

It achieves fast and accurate automatic mixed compilation of HarmonyOS NEXT projects, simplifies the complexity of cross-platform development, and improves development efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120596094A_ABST
    Figure CN120596094A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, and discloses an automatic compiling method and device, electronic equipment and a system.The method comprises the steps that in response to a code modification instruction triggered by a developer, a pre-constructed automatic script is run, and compiling operation is executed in a Flutter item directory of a Flutter framework according to the code modification instruction; and moving the target Har package to the determined target directory, and executing an installation operation on the target Har package in a parent directory of the Flutter project. Visibly, by implementing the method and the device, the script is automatically constructed, so that automatic mixed compiling of the Har package corresponding to the HarmonyOS NEXT project based on the Flutter framework can be quickly and accurately realized when a developer modifies a code, and the development efficiency is improved while the cross-platform development complexity of the HarmonyOS NEXT system is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to an automatic compilation method, device, electronic equipment and system. Background Art

[0002] Currently, with the development of the HarmonyOS NEXT system, in order to simplify the complexity of cross-platform development and realize cross-platform applications in the HarmonyOS NEXT system, it is necessary to use a cross-platform development framework, such as the Flutter framework.

[0003] In the prior art, the steps of the mixed compilation and debugging solution with the Flutter framework in the HarmonyOS NEXT system are mainly: manually putting the har package compiled by the Flutter framework into the HarmonyOS project, then making dependencies, and then compiling and debugging. However, this compilation and debugging method requires multiple manual operations, and after the developer manually modifies the code, the above steps need to be repeated, resulting in low development efficiency. It can be seen that it is particularly important to propose a new mixed compilation solution to simplify the cross-platform development complexity of the HarmonyOS NEXT system while improving development efficiency. Summary of the Invention

[0004] The present invention provides an automatic compilation method, device, electronic device and system, which can quickly and accurately realize automatic mixed compilation of Har packages corresponding to HarmonyOS NEXT projects based on the Flutter framework, which is conducive to simplifying the complexity of cross-platform development of the HarmonyOS NEXT system while improving development efficiency.

[0005] To solve the above technical problems, the first aspect of the present invention discloses an automatic compilation method, which is applied to an electronic device equipped with HarmonyOS NEXT, wherein the electronic device has an application installed, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application. The method includes:

[0006] In response to a code modification instruction triggered by a developer, a pre-built automated script is run to perform a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, wherein the compilation operation includes an operation of compiling the target Har package through AOT compilation;

[0007] By running the automated script, the target Har package is moved to the determined target directory, and in the parent directory of the Flutter project directory, the predetermined target file is parsed using the preset ohpm toolset to obtain the dependency configuration information of the HarmonyOS NEXT project. The target file is used to describe the project dependencies of the HarmonyOS NEXT project.

[0008] According to the dependency configuration information, an installation operation is performed on the target Har package to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information. The installation operation includes installing the target Har package into a pre-built HarmonyOS NEXT project.

[0009] As an optional implementation, in the first aspect of the present invention, before performing the compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, the method further includes:

[0010] Detecting a target directory of the HarmonyOS NEXT project to obtain a detection result, where the detection result includes a first detection result or a second detection result;

[0011] And, performing a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction includes:

[0012] According to the detection result and the code modification instruction, a compilation operation is performed in the Flutter project directory of the Flutter framework.

[0013] As an optional implementation manner, in the first aspect of the present invention, detecting the target directory of the pre-built HarmonyOSNEXT project to obtain the detection result includes:

[0014] Detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, where the target directory is used to store the preset Har package;

[0015] When it is detected that the HarmonyOS NEXT project exists in the target directory, determining whether there is a historical Har package in the target directory;

[0016] When it is determined that the target directory does not contain the historical Har package, determining that the detection result is a first detection result that does not require a clearing operation to be performed on the target directory;

[0017] When it is determined that the target directory contains the historical Har packet, the detection result is determined to be a second detection result requiring a clearing operation to be performed on the target directory.

[0018] As an optional implementation, in the first aspect of the present invention, performing a compilation operation in a Flutter project directory of the Flutter framework according to the detection result and the code modification instruction includes:

[0019] When the detection result is the first detection result, switch from the target directory to the Flutter project directory of the Flutter framework, and compile the target Har package in the Flutter project directory through the AOT compilation mode according to the code modification instruction;

[0020] When the detection result is the second detection result, the historical Har package is cleared in the target directory, and the operation of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory by AOT compilation.

[0021] As an optional embodiment, in the first aspect of the present invention, the method further comprises:

[0022] When detecting that the target directory does not exist in the HarmonyOS NEXT project, determining that the detection result is a third detection result indicating that a directory creation operation needs to be performed on the HarmonyOS NEXT project;

[0023] And, performing a compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction, including:

[0024] When the detection result is the third detection result, according to the preset configuration parameters, a directory corresponding to the HarmonyOS NEXT project is created as the target directory, and the operation of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0025] As an optional implementation, in the first aspect of the present invention, the step of compiling the target Har package in the Flutter project directory by AOT compilation according to the code modification instruction includes:

[0026] Analyzing the code modification instruction to obtain a first code program corresponding to the code modification instruction;

[0027] According to the first code program, updating the second code program corresponding to the HarmonyOS NEXT project to obtain a target code program;

[0028] According to the target code program, the target code program is compiled in the Flutter project directory by AOT compilation to generate a target Har package corresponding to the target code program.

[0029] A second aspect of the present invention discloses an automatic compilation device, which is applied to an electronic device equipped with HarmonyOS NEXT, and the electronic device is installed with an application program, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application program, the device comprising:

[0030] A running module is used to respond to a code modification instruction triggered by a developer and run a pre-built automation script to perform a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction. The compilation operation includes an operation of compiling the target Har package through AOT compilation;

[0031] A moving module, configured to move the target Har package to the determined target directory by running the automation script;

[0032] An installation module is used to parse a predetermined target file in the parent directory of the Flutter project directory through a preset ohpm toolset to obtain dependency configuration information of the HarmonyOS NEXT project, where the target file is used to describe the project dependency relationship of the HarmonyOS NEXT project; and perform an installation operation on the target Har package according to the dependency configuration information to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information. The installation operation includes installing the target Har package into a pre-built HarmonyOSNEXT project.

[0033] As an optional embodiment, in the second aspect of the present invention, the device further includes:

[0034] a detection module, configured to detect a target directory of the HarmonyOS NEXT project before the running module performs a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, and obtain a detection result, wherein the detection result includes a first detection result or a second detection result;

[0035] And, the running module performs the compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, specifically including:

[0036] According to the detection result and the code modification instruction, a compilation operation is performed in the Flutter project directory of the Flutter framework.

[0037] As an optional implementation, in the second aspect of the present invention, the detection module includes:

[0038] The detection submodule is used to detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, and the target directory is used to store the preset Har package;

[0039] a judgment submodule, configured to, when the detection submodule detects that the HarmonyOS NEXT project exists in the target directory, determine whether there is a historical Har package in the target directory;

[0040] a determination submodule configured to, when the determination submodule determines that the target directory does not contain the historical Har packet, determine that the detection result is a first detection result that does not require a clearing operation to be performed on the target directory;

[0041] The determining submodule is further configured to, when the judging submodule determines that the target directory contains the historical Har packet, determine that the detection result is a second detection result requiring a clearing operation to be performed on the target directory.

[0042] As an optional implementation, in the second aspect of the present invention, the running module performs a compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction, specifically including:

[0043] When the detection result is the first detection result, switch from the target directory to the Flutter project directory of the Flutter framework, and compile the target Har package in the Flutter project directory through the AOT compilation mode according to the code modification instruction;

[0044] When the detection result is the second detection result, the historical Har package is cleared in the target directory, and the operation of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory by AOT compilation.

[0045] As an optional implementation, in the second aspect of the present invention, the determining submodule is further configured to, when the detecting submodule detects that the target directory does not exist in the HarmonyOS NEXT project, determine that the detection result is a third detection result indicating that a directory creation operation needs to be performed on the HarmonyOS NEXT project;

[0046] And, the running module performs the compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction, specifically including:

[0047] When the detection result is the third detection result, according to the preset configuration parameters, a directory corresponding to the HarmonyOS NEXT project is created as the target directory, and the operation of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0048] As an optional implementation, in the second aspect of the present invention, the operation module compiles the target Har package in the Flutter project directory by AOT compilation according to the code modification instruction, specifically including:

[0049] Analyzing the code modification instruction to obtain a first code program corresponding to the code modification instruction;

[0050] According to the first code program, updating the second code program corresponding to the HarmonyOS NEXT project to obtain a target code program;

[0051] According to the target code program, the target code program is compiled in the Flutter project directory by AOT compilation to generate a target Har package corresponding to the target code program.

[0052] A third aspect of the present invention discloses an electronic device, comprising:

[0053] a memory storing executable program code;

[0054] a processor coupled to the memory;

[0055] The processor calls the executable program code stored in the memory to execute the automatic compilation method disclosed in the first aspect of the present invention.

[0056] A fourth aspect of the present invention discloses an automatic compilation system, the system comprising at least the automatic compilation apparatus according to the second aspect of the present invention, and a network-attached storage device in communication with the automatic compilation apparatus, wherein the network-attached storage device stores an automation script. When the automatic compilation apparatus runs the automation script, the automatic compilation apparatus performs an automatic compilation operation for a code modification instruction triggered by a developer according to any one of the automatic compilation methods according to the first aspect of the present invention and based on the automation script.

[0057] or,

[0058] The system includes at least the electronic device as described in claim 8, and a network-attached storage device communicatively connected to the electronic device, and an automation script is stored on the network-attached storage device. When the electronic device runs the automation script, the electronic device completes the automatic compilation operation for the code modification instruction triggered by the developer according to the automatic compilation method as described in any one of claims 1-6 and based on the automation script.

[0059] A fifth aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores computer instructions. When the computer instructions are called, they are used to execute the automatic compilation method disclosed in the first aspect of the present invention.

[0060] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0061] The implementation of the present invention can automatically build scripts, and can quickly and accurately realize automatic mixed compilation of the Har package corresponding to the HarmonyOS NEXT project based on the Flutter framework when developers modify the code, which is conducive to simplifying the complexity of cross-platform development of the HarmonyOS NEXT system while improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0063] Figure 1This is a flow chart of an automatic compilation method disclosed in an embodiment of the present invention;

[0064] Figure 2 This is a flow chart of another automatic compilation method disclosed in an embodiment of the present invention;

[0065] Figure 3 It is a structural diagram of an automatic compilation device disclosed in an embodiment of the present invention;

[0066] Figure 4 It is a structural diagram of another automatic compilation device disclosed in an embodiment of the present invention;

[0067] Figure 5 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present invention;

[0068] Figure 6 This is a schematic diagram of the structure of an automatic compilation system disclosed in an embodiment of the present invention;

[0069] Figure 7 It is a structural diagram of another automatic compilation system disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0070] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0071] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.

[0072] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0073] The present invention discloses an automatic compilation method, device, electronic device, and system. These methods, through automated build scripts, enable rapid and accurate automatic mixed compilation of Har packages corresponding to HarmonyOS NEXT projects based on the Flutter framework when developers modify code. This helps simplify the cross-platform development complexity of the HarmonyOS NEXT system while improving development efficiency. These are described in detail below.

[0074] Example 1

[0075] See also Figure 1 , Figure 1 This is a flow chart of an automatic compilation method disclosed in an embodiment of the present invention. Figure 1 The described automatic compilation method can be applied to an electronic device equipped with HarmonyOS NEXT, and the electronic device has an application installed, the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application. The method can also be applied to an automatic compilation device, wherein the device may include a compilation device or a compilation server, wherein the compilation server may include a cloud server or a local server, which is not limited in the embodiment of the present invention. Figure 1 As shown, the automatic compilation method may include the following operations:

[0076] 101. In response to a code modification instruction triggered by a developer, a pre-built automation script is run to perform a compilation operation in a Flutter project directory of the Flutter framework according to the code modification instruction.

[0077] In an embodiment of the present invention, optionally, the code modification instruction triggered by the developer may be an instruction for performing code modification on the related application to be modified under the HarmonyOSNEXT project. The compilation operation may include an operation of compiling to obtain a target Har package through AOT compilation. Specifically, through the Flutter Build System (Flutter BuildSystem is a build management tool within the Flutter framework, responsible for handling the build process of the Flutter application, including compiling and packaging the application), the flutter build har of the Flutter Build System is called to generate the target Har package.

[0078] In an embodiment of the present invention, specifically, in response to a code modification instruction triggered by a developer, running a pre-built automation script to perform a compilation operation in a Flutter project directory of the Flutter framework according to the code modification instruction may include: in response to the code modification instruction triggered by the developer, using the executeBuild() function as the main function to control the build process to trigger the running of the automation script to execute related operations of the code program corresponding to the automation script. The specific operations are as follows:

[0079] Use $flutter_folder ($flutter_folder can be the identifier of the Flutter project directory) to switch the current directory to the Flutter project directory of the Flutter framework (the Flutter project directory can be the directory where files related to the HarmonyOS NEXT project in the Flutter framework are located) and prepare for compilation operations, such as building a Har (HarmonyOS Application Resource Package) package. The Har package is the format used to package and distribute applications in the HarmonyOS NEXT system. Similar to APK files of other operating systems (such as Android), the HAR package contains all the necessary resources and code of the application, making it easy to install and run on devices where the HarmonyOS NEXT system is located (such as mobile phones, tablets, or computers).

[0080] 102. Move the target Har package to the determined target directory by running the automation script.

[0081] In the embodiment of the present invention, optionally, the target directory may be an existing directory in the HarmonyOS NEXT project, or a newly created directory in the HarmonyOS NEXT project, which is not limited in the embodiment of the present invention.

[0082] In an embodiment of the present invention, specifically, moving the target Har package to the determined target directory by running an automated script may include: moving the target Har package from the Flutter project directory to the target directory by running the .ohos / har / related code in the automated script. In step 101, switching the current directory to the Flutter project directory of the Flutter framework through $flutter_folder may specifically be switching the current directory from the target directory to the Flutter project directory of the Flutter framework through $flutter_folder.

[0083] 103. In the parent directory of the Flutter project directory, use the preset ohpm toolset to parse the predetermined target files to obtain the dependency configuration information of the HarmonyOS NEXT project.

[0084] In an embodiment of the present invention, the target file is used to describe the project dependencies of the HarmonyOS NEXT project. The HarmonyOS NEXT project can be constructed through the ArkTS framework of the HarmonyOS NEXT system, so that the automatic mixed compilation of the ArkTS framework and the Flutter framework corresponding to the HarmonyOS NEXT project in the HarmonyOS NEXT system can be achieved by building an automated compilation process. Specifically, by running the relevant code of $parent_dir ($parent_dir can be used to represent the parent directory of the current directory) in the automation script, the current directory is switched from the Flutter project directory to the parent directory of the Flutter project directory, and the target Har package is installed in the HarmonyOS NEXT project in the parent directory.

[0085] 104. Perform an installation operation on the target Har package according to the dependency configuration information, so as to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information.

[0086] In an embodiment of the present invention, the installation operation includes an operation of installing the target Har package into a pre-built HarmonyOS NEXT project. Specifically, the ohpm tool set can be used to parse the ohpm.json file to obtain the dependency configuration information of the HarmonyOS NEXT project; then, according to the dependency configuration information, the ohpminstall command is executed to install the target Har package as a dependency into the HarmonyOS NEXT project. In this way, in the parent directory of the Flutter project directory, the predetermined target file is parsed by the preset ohpm tool set to obtain the dependency configuration information of the HarmonyOS NEXT project, which can improve the accuracy and efficiency of parsing the dependency configuration information based on the ohpm tool set. Then, according to the dependency configuration information, the installation operation is performed on the target Har package to achieve the installation of the target Har package into the HarmonyOS NEXT project through the dependency configuration information, which can improve the accuracy and efficiency of installing the target Har package into the HarmonyOS NEXT project, thereby improving the compilation efficiency and accuracy, thereby improving the software development efficiency and accuracy based on the developer's code modification instructions, and also facilitating subsequent debugging.

[0087] It can be seen that implementation Figure 1The described automatic compilation method can respond to code modification instructions triggered by developers and run pre-built automation scripts to perform compilation operations in the Flutter project directory of the Flutter framework according to the code modification instructions, such as: compiling the target Har package through the AOT compilation method. When the developer modifies the code, the automation script can quickly and accurately implement automatic mixed compilation of the Har package corresponding to the Har package of the HarmonyOS NEXT project based on the Flutter framework, thereby realizing end-to-end unattended construction of the target Har package. Compared with the traditional manual execution of multiple discrete steps, which is prone to build failures caused by path configuration errors or omissions, this solution can improve compilation efficiency and accuracy by replacing manual operations with the automated process of the automation script, thereby improving the construction efficiency and accuracy of the target Har package. Subsequently, the target Har package is moved to the determined target directory by running the automation script. The constructed target Har package can be automatically moved to the target directory by the automation script, which is conducive to improving the efficiency and timeliness of moving the target Har package, and the target Har package is installed in the parent directory of the Flutter project directory. The installation operation includes installing the target Har package to the pre-built HarmonyOS The operation of the NEXT project can improve the efficiency and accuracy of installing the target Har package into the HarmonyOS NEXT project based on the installation processing of the target Har package that is built quickly and accurately, which is beneficial to improving the compilation efficiency and accuracy, thereby improving the software development efficiency and accuracy based on the developer's code modification instructions, and is also beneficial to subsequent debugging.

[0088] Example 2

[0089] See also Figure 2 , Figure 2 This is a flow chart of an automatic compilation method disclosed in an embodiment of the present invention. Figure 2 The described automatic compilation method can be applied to an electronic device equipped with HarmonyOS NEXT, and the electronic device has an application installed, the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application. The method can also be applied to an automatic compilation device, wherein the device may include a compilation device or a compilation server, wherein the compilation server may include a cloud server or a local server, which is not limited in the embodiment of the present invention. Figure 2 As shown, the automatic compilation method may include the following operations:

[0090] 201. In response to the code modification instruction triggered by the developer, run the pre-built automation script to detect the target directory of the HarmonyOS NEXT project and obtain the detection result.

[0091] In an embodiment of the present invention, specifically, by running the relevant code of $target_folder ($target_folder can be an identifier of the target directory) in the automation script, the target directory of the HarmonyOS NEXT project is detected to obtain a detection result. Optionally, the detection result may include a first detection result or a second detection result, wherein the first detection result can be used to indicate the result that a clear operation does not need to be performed on the target directory, and the second detection result can be used to indicate the result that a clear operation needs to be performed on the target directory. Optionally, the detection result may include a first detection result, a second detection result or a third detection result, wherein the third detection result can be used to indicate the result that a directory creation operation needs to be performed on the HarmonyOS NEXT project, which is not limited in the embodiment of the present invention.

[0092] In an embodiment of the present invention, the automated script may include operations of detecting the target directory, entering the Flutter project directory to compile the target Har package, moving the target Har package to the target directory, and entering the parent directory of the Flutter project directory to install the target Har package to depend on the HarmonyOS NEXT project, etc. In this way, by building an automated script of the complete compilation process instead of manual operations, it is beneficial to improve compilation efficiency and accuracy, thereby improving software development efficiency and accuracy.

[0093] 202. Based on the detection results and code modification instructions, perform a compilation operation in the Flutter project directory of the Flutter framework.

[0094] 203. Move the target Har package to the target directory by running the automation script.

[0095] 204. In the parent directory of the Flutter project directory, the predetermined target file is parsed using the preset ohpm toolset to obtain the dependency configuration information of the HarmonyOS NEXT project.

[0096] 205. Perform an installation operation on the target Har package according to the dependency configuration information, so as to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information.

[0097] In the embodiment of the present invention, for the detailed description of steps 201 to 205 , please refer to the detailed description of steps 101 to 104 in the first embodiment, which will not be repeated in the embodiment of the present invention.

[0098] It can be seen that implementation Figure 2The described automatic compilation method can respond to code modification instructions triggered by developers and run pre-built automation scripts to perform compilation operations in the Flutter project directory of the Flutter framework according to the code modification instructions, such as: compiling the target Har package through the AOT compilation method. When the developer modifies the code, the automation script can quickly and accurately implement automatic mixed compilation of the Har package corresponding to the Har package of the HarmonyOS NEXT project based on the Flutter framework, thereby realizing end-to-end unattended construction of the target Har package. Compared with the traditional manual execution of multiple discrete steps, which is prone to build failures caused by path configuration errors or omissions, this solution can improve compilation efficiency and accuracy by replacing manual operations with the automated process of the automation script, thereby improving the construction efficiency and accuracy of the target Har package. Subsequently, the target Har package is moved to the determined target directory by running the automation script. The constructed target Har package can be automatically moved to the target directory by the automation script, which is conducive to improving the efficiency and timeliness of moving the target Har package, and the target Har package is installed in the parent directory of the Flutter project directory. The installation operation includes installing the target Har package to the pre-built HarmonyOS The NEXT project operation can improve the efficiency and accuracy of installing the target Har package into the HarmonyOS NEXT project based on the installation processing of the quickly and accurately built target Har package. This helps improve compilation efficiency and accuracy, thereby improving the efficiency and accuracy of software development based on the developer's code modification instructions, and also facilitates subsequent debugging. In addition, it can also automatically detect the target directory of the HarmonyOS NEXT project when running the automation script to obtain the detection result, which helps improve the accuracy and efficiency of the target directory detection, thereby facilitating the accurate triggering of the subsequent compilation process based on the detection result.

[0099] In an optional embodiment, detecting the target directory of the pre-built HarmonyOS NEXT project in step 201 to obtain the detection result may include:

[0100] Detect whether the target directory exists in all directories of the pre-built HarmonyOS NEXT project;

[0101] When detecting that the HarmonyOS NEXT project exists in the target directory, determine whether there is a historical Har package in the target directory;

[0102] When it is determined that the target directory does not have a historical Har package, determining that the detection result is a first detection result that does not require a clear operation to be performed on the target directory;

[0103] When it is determined that a historical Har package exists in the target directory, the detection result is determined to be a second detection result requiring a clearing operation to be performed on the target directory.

[0104] In an embodiment of the present invention, the target directory can be used to store preset Har packages, such as target Har packages and / or historical Har packages. Optionally, the target directory may also contain other configuration files related to the HarmonyOS NEXT system, which is not limited in the embodiment of the present invention. Compared with the traditional method of manually deleting the Flutter directory of the entire HarmonyOS NEXT project, this solution can retain other configuration files in the target directory by only deleting the old Har package under the target directory, avoiding subsequent dependency reconstruction caused by full cleanup, which is beneficial to reducing the loss of third-party plug-in configuration due to deletion of the entire Flutter directory, and is beneficial to reducing the repeated construction overhead when the Har package is repeatedly built according to the code modification instructions.

[0105] Specifically, through $target_folder, it is detected whether the target directory exists in all directories of the HarmonyOS NEXT project; when it is detected that the target directory exists, it is determined whether there is a historical Har package in the target directory (the historical Har package can be the Har package corresponding to the historical code instruction before the code modification instruction, and the historical code instruction can include the first code writing instruction or the historical code modification instruction); when it is determined that there is no historical Har package, it means that there is no need to perform a clear operation on the target directory; when it is determined that there is a historical Har package, it means that there is a need to perform a clear operation on the target directory.

[0106] It can be seen that this optional embodiment can detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, and when it is detected that the target directory exists in the HarmonyOS NEXT project, it further determines whether there is a historical Har package in the target directory. When it is determined that there is no historical Har package in the target directory, the detection result is determined to be a first detection result that does not require a clear operation on the target directory, which can improve the accuracy and reliability of the first detection result. When it is determined that there is a historical Har package in the target directory, the detection result is determined to be a second detection result that requires a clear operation on the target directory, which can improve the accuracy and reliability of the second detection result, which is beneficial to the triggering accuracy and timeliness of subsequent Flutter compilation operations.

[0107] In another optional embodiment, performing a compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction in step 202 may include:

[0108] When the detection result is the first detection result, switch from the target directory to the Flutter project directory of the Flutter framework, and compile the target Har package in the Flutter project directory through AOT compilation according to the code modification instructions;

[0109] When the detection result is the second detection result, the historical Har package is cleared in the target directory, and the execution is triggered to switch from the target directory to the Flutter project directory of the Flutter framework, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0110] In the embodiment of the present invention, specifically, clearing the historical Har packages in the target directory may include: clearing the historical Har packages in the target directory by running relevant codes of .ohos / har / * in the automation script.

[0111] It can be seen that this optional implementation method can directly switch from the target directory to the Flutter project directory of the Flutter framework when there is no historical Har package in the target directory, and compile the target Har package in the Flutter project directory through the AOT compilation method according to the code modification instructions. It can improve the compilation accuracy and efficiency of the Flutter framework, and is conducive to improving the accuracy and efficiency of the target Har package built based on the compilation operation, which is conducive to subsequently moving the accurately constructed target Har package to the target directory to achieve accurate installation of the target Har package to the HarmonyOS NEXT project. In the case that there is a historical Har package in the target directory, the historical Har package in the target directory is first cleared, and then the execution of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through the AOT compilation method. By clearing the old Har package in the target directory, the subsequent erroneous installation of the old Har as the installation object can be reduced, resulting in the compilation content not being adjusted according to the code modification instructions, resulting in the compilation result not being consistent with the developer's expected result.

[0112] In this optional embodiment, as an optional implementation manner, the method may further include:

[0113] When it is detected that the target directory of the HarmonyOS NEXT project does not exist, determining that the detection result is a third detection result that requires performing a directory creation operation on the HarmonyOS NEXT project;

[0114] Furthermore, the above step 202, based on the detection results and the code modification instructions, performs a compilation operation in the Flutter project directory of the Flutter framework, which may include:

[0115] When the detection result is the third detection result, according to the preset configuration parameters, a directory corresponding to the HarmonyOS NEXT project is created as the target directory, and the execution is triggered to switch from the target directory to the Flutter project directory of the Flutter framework, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0116] In an embodiment of the present invention, specifically, when it is detected that the target directory does not exist in the HarmonyOS NEXT project, a directory corresponding to the HarmonyOS NEXT project can be created as the target directory according to preset configuration parameters (configuration parameters can be parameters required for creating the target directory and performing relevant configuration on the target directory, such as path configuration parameters, access permission configuration parameters, etc.). At this time, there will be no historical Har package in the target directory, and there is no need to perform the operation of detecting whether there is a historical Har package. It can directly trigger the subsequent switching from the target directory to the Flutter project directory of the Flutter framework, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory through the AOT compilation method. And the code modification instruction triggered by the developer at this time can be an instruction for the first code writing for the relevant application to be adapted to the HarmonyOSNEXT project under the HarmonyOS NEXT project. For example, assuming that there is an application to be adapted to the HarmonyOS NEXT project, such as WeChat, the instruction triggered by the developer at this time is: an instruction to write the relevant version code of the WeChat application to the HarmonyOS NEXT project.

[0117] It can be seen that this optional embodiment can, when detecting that the target directory does not exist in the HarmonyOS NEXT project, first create a directory corresponding to the HarmonyOS NEXT project as the target directory according to the preset configuration parameters, and then switch to the Flutter project directory, and according to the code modification instructions, compile the target Har package in the Flutter project directory through the AOT compilation method. By creating the target directory, the target Har package subsequently compiled in the Flutter project directory can be automatically stored in the target directory, reducing the situation where the developer needs to manually create and manually move the target directory after compiling the target Har package, which reduces the efficiency of subsequent installation.

[0118] In this optional embodiment, as another optional implementation, according to the code modification instruction, compiling the target Har package in the Flutter project directory by AOT compilation mode may include:

[0119] Analyzing the code modification instruction to obtain a first code program corresponding to the code modification instruction;

[0120] According to the first code program, the second code program corresponding to the HarmonyOS NEXT project is updated to obtain a target code program;

[0121] According to the target code program, the target code program is compiled in the Flutter project directory through the AOT compilation method to generate the target Har package corresponding to the target code program.

[0122] In an embodiment of the present invention, specifically, based on the program identifier corresponding to the first code program, a matching code program that matches the program identifier is found from the second code program corresponding to the HarmonyOS NEXT project; based on the program format of the matching code program, the format of the first code program is updated to obtain an updated first code program, so that the program format of the updated first code program is the same as the program format of the matching code program; then, based on the updated first code program, the matching code program in the second code program corresponding to the HarmonyOS NEXT project is replaced to obtain a target code program. The target code program includes the updated first code program and the remaining code programs in the second code program except the matching code program.

[0123] It can be seen that this optional implementation method can analyze the code modification instruction to obtain the first code program corresponding to the code modification instruction, can improve the analysis accuracy and efficiency of the first code program corresponding to the code modification instruction, and then according to the first code program, update the second code program corresponding to the HarmonyOS NEXT project to obtain the target code program, which can improve the accuracy and reliability of the updated target code program based on the first code program corresponding to the code modification instruction, and then compile the target code program in the Flutter project directory through the AOT compilation method according to the target code program to generate a target Har package corresponding to the target code program, which can improve the accuracy and reliability of the compiled target Har package based on the accurately updated target code program, thereby facilitating the subsequent Har package installation dependency on the HarmonyOS NEXT project.

[0124] Example 3

[0125] See also Figure 3 , Figure 3This is a schematic diagram of the structure of an automatic compilation device disclosed in an embodiment of the present invention. Figure 3 The described automatic compilation device can be applied to an electronic device equipped with HarmonyOS NEXT, and the electronic device has an application installed, the electronic device is in communication connection with a network attached storage device, the electronic device can access the network attached storage device through the application, and the device may include a compilation device or a compilation server, wherein the compilation server may include a cloud server or a local server, which is not limited in the embodiment of the present invention. Figure 3 As shown, the automatic compilation device may include:

[0126] The running module 301 is used to respond to the code modification instruction triggered by the developer and run the pre-built automation script to perform the compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction. The compilation operation includes the operation of compiling the target Har package through the AOT compilation method.

[0127] The moving module 302 is used to move the target Har package to the determined target directory by running an automated script.

[0128] The installation module 303 is used to parse the predetermined target file in the parent directory of the Flutter project directory through the preset ohpm toolset to obtain the dependency configuration information of the HarmonyOS NEXT project. The target file is used to describe the project dependency relationship of the HarmonyOS NEXT project; according to the dependency configuration information, perform an installation operation on the target Har package to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information. The installation operation includes installing the target Har package into the pre-built HarmonyOS NEXT project.

[0129] It can be seen that implementation Figure 3The described automatic compilation device can respond to code modification instructions triggered by developers and run pre-built automation scripts to perform compilation operations in the Flutter project directory of the Flutter framework according to the code modification instructions, such as: compiling the target Har package through the AOT compilation method. It can quickly and accurately implement automatic mixed compilation of the Har package corresponding to the Har package of the HarmonyOS NEXT project based on the Flutter framework through the automation script when the developer modifies the code, thereby realizing end-to-end unattended construction of the target Har package. Compared with the traditional manual execution of multiple discrete steps, which is prone to build failures caused by path configuration errors or omissions, this solution can improve compilation efficiency and accuracy by replacing manual operations with the automated process of the automation script, thereby improving the construction efficiency and accuracy of the target Har package. Subsequently, the target Har package is moved to the determined target directory by running the automation script. The constructed target Har package can be automatically moved to the target directory through the automation script, which is conducive to improving the efficiency and timeliness of moving the target Har package, and performing the installation operation on the target Har package in the parent directory of the Flutter project directory. The installation operation includes installing the target Har package to the pre-built HarmonyOS The operation of the NEXT project can improve the efficiency and accuracy of installing the target Har package into the HarmonyOS NEXT project based on the installation processing of the target Har package that is built quickly and accurately, which is beneficial to improving the compilation efficiency and accuracy, thereby improving the software development efficiency and accuracy based on the developer's code modification instructions, and is also beneficial to subsequent debugging.

[0130] In an optional embodiment, if Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of another automatic compilation device disclosed in an embodiment of the present invention, such as Figure 4 As shown, the device may further include:

[0131] The detection module 304 is configured to detect the target directory of the HarmonyOS NEXT project before the running module 301 performs the compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, and obtain a detection result, which includes a first detection result or a second detection result. In addition, the specific method in which the running module 301 performs the compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction may include:

[0132] Based on the detection results and code modification instructions, compile in the Flutter project directory of the Flutter framework.

[0133] It can be seen that this optional embodiment can automatically detect the target directory of the HarmonyOS NEXT project to obtain detection results when running the automation script, which is conducive to improving the detection accuracy and efficiency of the target directory, and thus is conducive to accurately triggering the execution of subsequent compilation processes based on the detection results.

[0134] In this optional embodiment, as an optional implementation, as Figure 4 As shown, the detection module 304 may include:

[0135] The detection submodule 3041 is used to detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, and the target directory is used to store the preset Har package.

[0136] The judgment submodule 3042 is used to judge whether there is a historical Har package in the target directory when the detection submodule 3041 detects that the HarmonyOS NEXT project exists in the target directory.

[0137] The determination submodule 3043 is configured to determine that the detection result is a first detection result that does not require a clearing operation on the target directory when the judgment submodule 3042 determines that the target directory does not contain any historical Har packets.

[0138] The determination submodule 3043 is further configured to determine that the detection result is a second detection result indicating that a clearing operation needs to be performed on the target directory when the judgment submodule 3042 determines that there is a historical Har packet in the target directory.

[0139] It can be seen that this optional implementation method can detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, and when it is detected that the target directory exists in the HarmonyOS NEXT project, it further determines whether there is a historical Har package in the target directory. When it is determined that there is no historical Har package in the target directory, the detection result is determined to be the first detection result that does not require a clear operation on the target directory, which can improve the accuracy and reliability of the first detection result. When it is determined that there is a historical Har package in the target directory, the detection result is determined to be the second detection result that requires a clear operation on the target directory, which can improve the accuracy and reliability of the second detection result, which is beneficial to the triggering accuracy and timeliness of subsequent Flutter compilation operations.

[0140] In this optional implementation, the operation module 301 may optionally perform the compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction, specifically including:

[0141] When the detection result is the first detection result, switch from the target directory to the Flutter project directory of the Flutter framework, and compile the target Har package in the Flutter project directory through AOT compilation according to the code modification instructions;

[0142] When the detection result is the second detection result, the historical Har package is cleared in the target directory, and the execution is triggered to switch from the target directory to the Flutter project directory of the Flutter framework, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0143] It can be seen that this optional implementation method can also directly switch from the target directory to the Flutter project directory of the Flutter framework when there is no historical Har package in the target directory, and compile the target Har package in the Flutter project directory through the AOT compilation method according to the code modification instructions. It can improve the compilation accuracy and efficiency of the Flutter framework, and is conducive to improving the accuracy and efficiency of the target Har package built based on the compilation operation, so as to facilitate the subsequent moving of the accurately constructed target Har package to the target directory to achieve accurate installation of the target Har package to the HarmonyOS NEXT project. In the case that there is a historical Har package in the target directory, the historical Har package in the target directory is first cleared, and then the execution of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through the AOT compilation method. By clearing the old Har package in the target directory, the subsequent erroneous installation of the old Har as the installation object can be reduced, resulting in the compilation content not being adjusted according to the code modification instructions, resulting in the compilation result not being consistent with the developer's expected result.

[0144] In this optional embodiment, the determination submodule 3043 is optionally further configured to, when the detection submodule 3041 detects that the target directory of the HarmonyOS NEXT project does not exist, determine that the detection result is a third detection result indicating that a directory creation operation needs to be performed on the HarmonyOS NEXT project. Furthermore, the execution module 301 may, based on the detection result and the code modification instruction, perform a compilation operation in the Flutter project directory of the Flutter framework in a specific manner, including:

[0145] When the detection result is the third detection result, according to the preset configuration parameters, a directory corresponding to the HarmonyOS NEXT project is created as the target directory, and the execution is triggered to switch from the target directory to the Flutter project directory of the Flutter framework, and according to the code modification instructions, the target Har package is compiled in the Flutter project directory through AOT compilation.

[0146] It can be seen that this optional implementation method can also create a directory corresponding to the HarmonyOS NEXT project as the target directory according to the preset configuration parameters when it is detected that the target directory does not exist in the HarmonyOS NEXT project, and then switch to the Flutter project directory, and compile the target Har package in the Flutter project directory through the AOT compilation method according to the code modification instructions. By creating the target directory, the target Har package subsequently compiled in the Flutter project directory can be automatically stored in the target directory, reducing the situation where the developer needs to manually create and move the target directory after compiling the target Har package, which reduces the efficiency of subsequent installation.

[0147] In this optional embodiment, optionally, the operation module 301 compiles the target Har package in the Flutter project directory through the AOT compilation mode according to the code modification instruction, which may specifically include:

[0148] Analyzing the code modification instruction to obtain a first code program corresponding to the code modification instruction;

[0149] According to the first code program, the second code program corresponding to the HarmonyOS NEXT project is updated to obtain a target code program;

[0150] According to the target code program, the target code program is compiled in the Flutter project directory through the AOT compilation method to generate the target Har package corresponding to the target code program.

[0151] It can be seen that this optional implementation method can also analyze the code modification instruction to obtain the first code program corresponding to the code modification instruction, which can improve the analysis accuracy and efficiency of the first code program corresponding to the code modification instruction, and then update the second code program corresponding to the HarmonyOS NEXT project according to the first code program to obtain the target code program, which can improve the accuracy and reliability of the updated target code program based on the first code program corresponding to the code modification instruction, and then compile the target code program in the Flutter project directory through the AOT compilation method according to the target code program to generate a target Har package corresponding to the target code program, which can improve the accuracy and reliability of the compiled target Har package based on the accurately updated target code program, thereby facilitating the subsequent Har package installation dependency on the HarmonyOS NEXT project.

[0152] Example 4

[0153] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. Figure 5 As shown, the electronic device may include:

[0154] A memory 401 storing executable program code;

[0155] a processor 402 coupled to the memory 401;

[0156] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the automatic compilation method described in the first embodiment or the second embodiment of the present invention.

[0157] Example 5

[0158] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an automatic compilation system disclosed in an embodiment of the present invention. Figure 6 As shown, the automatic compilation system includes at least the automatic compilation device 50 as described in the third embodiment of the present invention, and a network-attached storage device 60 in communication with the automatic compilation device 50, and the network-attached storage device 60 stores an automation script. When the automatic compilation device 50 runs the automation script, the automatic compilation device 50 completes the automatic compilation operation for the code modification instruction triggered by the developer based on the automation script according to the automatic compilation method described in the first or second embodiment of the present invention;

[0159] or,

[0160] See also Figure 7 , Figure 7This is a schematic diagram of the structure of another automatic compilation system disclosed in an embodiment of the present invention. Figure 7 As shown, the automatic compilation system includes at least the electronic device 40 as described in the fourth embodiment of the present invention, and a network-attached storage device 60 that is communicatively connected to the electronic device 40, and an automation script is stored on the network-attached storage device 60. When the electronic device 40 runs the automation script, the electronic device 40 completes the automatic compilation operation for the code modification instruction triggered by the developer based on the automation script according to the automatic compilation method described in the first embodiment of the present invention or the second embodiment of the present invention.

[0161] Example 6

[0162] An embodiment of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute the steps of the automatic compilation method described in the first embodiment or the second embodiment of the present invention.

[0163] Example 7

[0164] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps in the automatic compilation method described in embodiment 1 or embodiment 2.

[0165] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.

[0166] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the portion that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.

[0167] Finally, it should be noted that the automatic compilation method, device, electronic device, and system disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features therein may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. An automatic compilation method, wherein the method is applied to an electronic device equipped with HarmonyOS NEXT, wherein the electronic device has an application installed, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application, characterized in that: The method comprises: In response to a code modification instruction triggered by a developer, a pre-built automated script is run to perform a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction, wherein the compilation operation includes an operation of compiling the target Har package through AOT compilation; By running the automated script, the target Har package is moved to the determined target directory, and in the parent directory of the Flutter project directory, the predetermined target file is parsed using the preset ohpm toolset to obtain the dependency configuration information of the HarmonyOS NEXT project. The target file is used to describe the project dependencies of the HarmonyOS NEXT project. According to the dependency configuration information, an installation operation is performed on the target Har package to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information. The installation operation includes installing the target Har package into a pre-built HarmonyOS NEXT project.

2. The automatic compilation method according to claim 1, characterized in that Before performing a compile operation in the Flutter project directory of the Flutter framework according to the code modification instruction, the method further includes: Detecting a target directory of the HarmonyOS NEXT project to obtain a detection result, where the detection result includes a first detection result or a second detection result; And, performing a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction includes: According to the detection result and the code modification instruction, a compilation operation is performed in the Flutter project directory of the Flutter framework.

3. The automatic compilation method according to claim 2, characterized in that The detection process detects the target directory of the pre-built HarmonyOS NEXT project and obtains the detection results, including: Detect whether there is a target directory in all directories of the pre-built HarmonyOS NEXT project, where the target directory is used to store the preset Har package; When it is detected that the HarmonyOS NEXT project exists in the target directory, determining whether there is a historical Har package in the target directory; When it is determined that the target directory does not contain the historical Har package, determining that the detection result is a first detection result that does not require a clearing operation to be performed on the target directory; When it is determined that the target directory contains the historical Har packet, the detection result is determined to be a second detection result requiring a clearing operation to be performed on the target directory.

4. The automatic compilation method according to claim 3, characterized in that The performing a compile operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction includes: When the detection result is the first detection result, switch from the target directory to the Flutter project directory of the Flutter framework, and compile the target Har package in the Flutter project directory through the AOT compilation mode according to the code modification instruction; When the detection result is the second detection result, the historical Har package is cleared in the target directory, and the operation of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory by AOT compilation.

5. The automatic compilation method according to claim 4, characterized in that: The method further comprises: When detecting that the target directory does not exist in the HarmonyOS NEXT project, determining that the detection result is a third detection result indicating that a directory creation operation needs to be performed on the HarmonyOS NEXT project; And, performing a compilation operation in the Flutter project directory of the Flutter framework according to the detection result and the code modification instruction, including: When the detection result is the third detection result, according to the preset configuration parameters, a directory corresponding to the HarmonyOSNEXT project is created as the target directory, and the execution of switching from the target directory to the Flutter project directory of the Flutter framework is triggered, and according to the code modification instruction, the target Har package is compiled in the Flutter project directory through AOT compilation.

6. The automatic compilation method according to claim 4 or 5, characterized in that: According to the code modification instruction, the target Har package is compiled in the Flutter project directory by AOT compilation, including: Analyzing the code modification instruction to obtain a first code program corresponding to the code modification instruction; According to the first code program, updating the second code program corresponding to the HarmonyOS NEXT project to obtain a target code program; According to the target code program, the target code program is compiled in the Flutter project directory by AOT compilation to generate a target Har package corresponding to the target code program.

7. An automatic compilation device, wherein the device is applied to an electronic device equipped with HarmonyOS NEXT, the electronic device is installed with an application, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application, characterized in that: The device comprises: A running module is used to respond to a code modification instruction triggered by a developer and run a pre-built automation script to perform a compilation operation in the Flutter project directory of the Flutter framework according to the code modification instruction. The compilation operation includes an operation of compiling the target Har package through AOT compilation; A moving module, configured to move the target Har package to the determined target directory by running the automation script; An installation module is used to parse a predetermined target file in the parent directory of the Flutter project directory through a preset ohpm toolset to obtain dependency configuration information of the HarmonyOS NEXT project, where the target file is used to describe the project dependency relationship of the HarmonyOS NEXT project; and perform an installation operation on the target Har package according to the dependency configuration information to install the target Har package into the HarmonyOS NEXT project through the dependency configuration information. The installation operation includes installing the target Har package into a pre-built HarmonyOSNEXT project.

8. An electronic device, characterized in that: The electronic device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the automatic compilation method according to any one of claims 1 to 6.

9. An automatic compilation system, characterized in that The system comprises at least the automatic compilation apparatus according to claim 7, and a network-attached storage device in communication with the automatic compilation apparatus, wherein an automation script is stored on the network-attached storage device, and when the automatic compilation apparatus runs the automation script, the automatic compilation apparatus completes an automatic compilation operation for a code modification instruction triggered by a developer according to the automatic compilation method according to any one of claims 1 to 6 and based on the automation script; or, The system includes at least the electronic device as described in claim 8, and a network-attached storage device communicatively connected to the electronic device, and an automation script is stored on the network-attached storage device. When the electronic device runs the automation script, the electronic device completes the automatic compilation operation for the code modification instruction triggered by the developer according to the automatic compilation method as described in any one of claims 1-6 and based on the automation script.

10. A computer storage medium, characterized in that The computer storage medium stores computer instructions, which, when called, are used to execute the automatic compilation method according to any one of claims 1 to 6.