CN116991427B - Application compiling method and device, computing equipment and storage medium - Google Patents

Application compiling method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN116991427B
CN116991427B CN202311255724.6A CN202311255724A CN116991427B CN 116991427 B CN116991427 B CN 116991427B CN 202311255724 A CN202311255724 A CN 202311255724A CN 116991427 B CN116991427 B CN 116991427B
Authority
CN
China
Prior art keywords
file
information
source code
compiling
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311255724.6A
Other languages
Chinese (zh)
Other versions
CN116991427A (en
Inventor
陈会星
胡庆红
袁海胜
袁啟良
刘建强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202311255724.6A priority Critical patent/CN116991427B/en
Publication of CN116991427A publication Critical patent/CN116991427A/en
Application granted granted Critical
Publication of CN116991427B publication Critical patent/CN116991427B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells

Abstract

The present invention relates to the field of application development, and in particular, to an application compiling method, an apparatus, a computing device, and a storage medium, where the method includes: analyzing an engineering file, wherein the engineering file comprises: source code information, basic environment information, dependency information, construction system information and variable information; acquiring a source code file according to the source code information; acquiring a basic environment file according to basic environment information; acquiring a dependent file according to the dependent information; generating a construction script according to the construction system information, the basic environment file and the source code file; and setting a container, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file. By the application compiling method, the compiling application file can be generated through the simpler engineering file, the application compiling difficulty and complexity are reduced, and the application compiling efficiency is improved; and the container environment is used for construction during compiling, so that the influence of the compiling process on a host machine is avoided, and the safety is high.

Description

Application compiling method and device, computing equipment and storage medium
Technical Field
The present invention relates to the field of application development, and in particular, to an application compiling method, an apparatus, a computing device, and a storage medium.
Background
As various applications in computers are developed, the manner in which the applications are installed becomes diversified. When the application is installed, the installation can be performed by adopting a source code packet or a binary packet. The binary package is simpler than the source code package, the binary package is compiled, the installation speed is faster than the source code package, and errors are not easy to occur in the installation process.
In the prior art, the Debian system can construct binary packages by constructing a software package tool dpkg. In the construction process, the debrian manages the meta information of the software package through the debrian catalogue in the source code catalogue, such as description source code package information, debrian/control file description source code package information and dependency relationship; the debian/rule describes the actions performed by the build process; the debrian/changelog describes the source code version iteration information of the software package, and the like. The configuration file under the debrian directory increases with the complexity of the software package; and is built based on the color environment, such as pbuilder, cowbuilder, etc.
The binary package generation mode in the prior art has the problem of higher learning cost, and the system is required to learn the debrian construction specification because of the great difficulty in writing the debrian engineering file. And the color environment is used in the construction, so that isolation is realized only on the file system level, and the security is weaker.
For this reason, a new application compiling method and apparatus are required.
Disclosure of Invention
To this end, the present invention provides an application compilation method in an effort to solve or at least alleviate the above-presented problems.
According to a first aspect of the present invention there is provided an application compilation method adapted to run in a computing device, the method comprising: analyzing an engineering file, wherein the engineering file comprises: source code information, basic environment information, dependency information, construction system information and variable information; acquiring a source code file according to the source code information; acquiring a basic environment file according to basic environment information; acquiring a dependent file according to the dependent information; generating a construction script according to the construction system information, the basic environment file and the source code file; and setting a container, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file.
Alternatively, in the method according to the invention, the engineering file is stored under an engineering directory, which is created by executing an initializing engineering file command.
Optionally, in the method according to the present invention, acquiring the source code file according to the source code information includes: analyzing a source code type field in the source code information to determine a source code type; and acquiring the source code file from the corresponding storage position according to the source code type.
Optionally, in the method according to the present invention, the source code type includes: compression package, remote code repository, and local code.
Optionally, in the method according to the invention, the engineering file further comprises product information.
Optionally, in the method according to the present invention, the basic environment information is determined according to a product type field of the product information, the product type field includes an application, a runtime environment file, and a library file, and when the product type field is the application, the basic environment information is the runtime environment information; when the product type field is a runtime environment file or library file, the base environment information is basic environment information.
Optionally, in the method according to the present invention, acquiring the base environment file according to the base environment information includes: when the basic environment information is the runtime environment information, acquiring a runtime environment file according to the runtime environment information; and determining basic environment information according to the runtime environment information, acquiring a basic environment file according to the basic environment information, and taking the runtime environment file and the basic environment file as basic environment files.
Optionally, in the method according to the present invention, further comprising: when the basic environment information is basic environment information, a basic environment file is acquired according to the basic environment information and is used as the basic environment file.
Optionally, in the method according to the present invention, acquiring the dependency file according to the dependency information includes: storing the dependent file to a local code repository to regenerate a compiled application file from the dependent file of the local code repository; the dependent files of the local code repository are stored to the build working directory for mounting to the container to generate compiled application files.
Optionally, in the method according to the present invention, further comprising: judging whether a history construction record exists or not; if the history building record exists, the dependent file recorded in the history building record is acquired.
Optionally, in the method according to the present invention, the constructing system information includes cmake, qmake, an automatic construction tool, and a custom construction, and generating the construction script according to the constructing system information, the base environment file, and the source code file includes: based on different construction systems recorded by construction system information, a construction script is generated according to the basic environment file and the source code file.
Optionally, in the method according to the present invention, further comprising: after the compiling application file is successfully generated, the dependent file used by compiling at the time is recorded, and a history construction record is generated.
Optionally, in the method according to the present invention, further comprising: the compiled application file is stored to a local code repository to find the compiled application file according to the local code repository.
Optionally, in the method according to the present invention, further comprising: executing the test build product command, comprising: determining the name of a software package according to the product information of the engineering file; inquiring whether a successfully constructed compiling application file exists in a local code warehouse according to the name of the software package; if the compiling application file exists, setting a container, running the compiling application file in the container according to the running environment file, and testing the compiling application file.
Optionally, in the method according to the present invention, further comprising: executing a push build product command, comprising: establishing communication connection with a server, and acquiring an application identifier from the server; and generating a transmission file according to the application identifier and the compiled application file, and sending the transmission file to the server.
Optionally, in the method according to the present invention, further comprising: acquiring verification information for verifying application identifiers in transmission files by a server; and determining an uploading result according to the verification information.
According to a second aspect of the present invention there is provided an application compiling apparatus adapted to reside in a computing device, the apparatus comprising: the system comprises a compiling module, a container module, a code warehouse module, a file system module and a server module, wherein the compiling module is suitable for executing compiling flow commands and comprises: analyzing the engineering file to obtain a source code file, wherein the engineering file comprises source code information, basic environment information, dependency information, construction system information and variable information; acquiring a source code file according to the source code information; acquiring a basic environment file according to basic environment information; acquiring a dependent file according to the dependent information; generating a construction script according to the construction system information, the basic environment file and the source code file; setting a container according to the container module, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file; the file system module is suitable for storing the compiling application file in the corresponding catalogue and mounting the corresponding catalogue in the local code warehouse; the code warehouse module is suitable for providing a local code warehouse, storing the dependent file after acquiring the dependent file, storing the compiled application file after generating the compiled application file, and submitting the compiled application file to the server; the server module is suitable for providing a server and storing the compiled application files submitted by the code warehouse module.
According to a third aspect of the present invention there is provided a computing device comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing the application compilation method according to the present invention.
According to a fourth aspect of the present invention there is provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computing device, cause the computing device to perform an application compilation method according to the present invention.
The application compiling method is suitable for being executed in computing equipment, and comprises the steps of analyzing an engineering file, wherein the engineering file comprises source code information, basic environment information, dependency information, construction system information and variable information; acquiring a source code file according to the source code information; acquiring a basic environment file according to basic environment information; acquiring a dependent file according to the dependent information; generating a construction script according to the construction system information, the basic environment file and the source code file; and setting a container, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file. By the application compiling method, the compiling application file can be generated through the simpler engineering file, the application compiling difficulty and complexity are reduced, and the application compiling efficiency is improved; and the container environment is used for construction during compiling, so that the influence of the compiling process on a host machine is avoided, and the safety is high.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 illustrates a schematic diagram of an application compilation method 100 according to an exemplary embodiment of the present invention;
FIG. 2 illustrates a block diagram of a computing device 200 according to an exemplary embodiment of the invention;
fig. 3 shows a schematic diagram of an application compiling apparatus 300 according to an exemplary embodiment of the invention;
FIG. 4 illustrates a functional schematic of a compilation module 310, according to an exemplary embodiment of the present invention;
FIG. 5 shows a schematic diagram of a compilation flow according to an exemplary embodiment of the present invention;
FIG. 6 shows a schematic diagram of a test build product according to an exemplary embodiment of the invention;
FIG. 7 shows a schematic diagram of pushing build products according to an exemplary embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Like reference numerals generally refer to like parts or elements.
Fig. 1 shows a schematic diagram of an application compiling method 100 according to an exemplary embodiment of the invention. The application compilation method 100 of the present invention is suitable for execution in a computing device.
FIG. 2 illustrates a block diagram of a computing device 200 according to an exemplary embodiment of the invention. In a basic configuration, computing device 200 includes at least one processing unit 220 and system memory 210. According to one aspect, depending on the configuration and type of computing device, system memory 210 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 210 includes an operating system 211.
According to one aspect, operating system 211 is suitable, for example, for controlling the operation of computing device 200. Further, examples are practiced in connection with a graphics library, other operating systems, or any other application program and are not limited to any particular application or system. This basic configuration is illustrated in fig. 2 by those components within dashed line 215. According to one aspect, computing device 200 has additional features or functionality. For example, according to one aspect, computing device 200 includes additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape.
As set forth hereinabove, according to one aspect, program modules 212 are stored in system memory 210. According to one aspect, program modules 212 may include one or more application programs, the invention is not limited to the type of application program, e.g., applications further include: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided application, web browser applications, etc.
According to one aspect, the examples may be practiced in a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic components or a microprocessor. For example, the example may be practiced with a system on a chip (SOC) that integrates the components shown in fig. 2 on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all of which are integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functionality described herein may be operated via dedicated logic integrated with other components of computing device 200 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other techniques capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum techniques. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuit or system.
According to one aspect, computing device 200 may also have one or more input devices 231, such as a keyboard, mouse, pen, voice input device, touch input device, or the like. Output devices 232 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 200 may include one or more communication connections 233 that allow communication with other computing devices 240. Examples of suitable communication connections 233 include, but are not limited to: RF transmitter, receiver and/or transceiver circuitry; universal Serial Bus (USB), parallel and/or serial ports. Computing device 200 may be communicatively connected to other computing devices 240 via communication connection 233.
Embodiments of the present invention also provide a non-transitory readable storage medium storing instructions for causing a computing device to perform a method according to embodiments of the present invention. The readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be any method or technology for information storage. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of readable storage media include, but are not limited to: phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transitory readable storage medium.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., carrier wave or other transport mechanism) and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio Frequency (RF), infrared, and other wireless media.
It should be noted that although the above-described computing device only shows processing unit 220, system memory 210, input device 231, output device 232, and communication connection 233, the device may include other components necessary to achieve proper operation in a particular implementation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
Returning to FIG. 1, as shown in FIG. 1, the application compilation method of the present invention first performs step 110: analyzing an engineering file, wherein the engineering file comprises: source code information, basic environment information, dependency information, construction system information and variable information.
According to one embodiment of the present invention, the engineering file may be specifically implemented in yaml format, and the present invention does not limit the specific file format of the engineering file. The yaml format writing difficulty is low, engineering files in the yaml format are used, and the construction rules are set, so that the engineering file writing can be simplified, and the construction tool using difficulty is reduced.
According to one embodiment of the present invention, the engineering file may be implemented as a link engineering file, or as an exquisite engineering file. The file name of the lingong engineering file can be written as lingong. Yaml, wherein yaml is the file identification of the exquisite engineering file. The linglong engineering file describes the metadata of the software package using yaml syntax. The software package is compiled to generate the software package of the application, namely, the application file is compiled.
According to one embodiment of the invention, an engineering file has a build specification comprising: product information, base environment information, dependency information, build system information, variable information, and source code information.
According to one embodiment of the invention, product information (Package) is used to describe the basic information of the build product, which includes fields as shown in table 1:
field name Description of the embodiments
id Unique names of the build products.
version A version of the product was constructed.
kind The types of the construction products include three types of app/run/lib.
description Detailed description of the construction product.
TABLE 1
According to one embodiment of the present invention, base environment information (Base or run) is used to describe the Base environment used for construction, and includes fields as shown in table 2:
field name Description of the embodiments
id Building a unique name of the environment.
version A version of the environment is constructed.
arch The architecture of the building environment (default to the current host architecture, which may be designated as other architectures).
TABLE 2
According to one embodiment of the invention, source information (Source) is used to describe the Source from which Source code was constructed, including fields as shown in Table 3:
field name Description of the embodiments
kind The type of the constructed source code is three types of archive/gate/localType (2).
url The url download address of the source code is constructed, and only the archive/git type needs to be filled in.
version And constructing a version of the source code. Only the git type needs to be filled in
commit And constructing a commit hash value of the source code. Only the git type needs to be filled in.
patch A patch path (path relative to the engineering file) for the source code is constructed.
TABLE 3 Table 3
According to one embodiment of the invention, dependency information (dependencies) is used to describe the dependency items required at compile time, and the compilation may have multiple dependency items. Which includes fields as shown in table 4:
field name Description of the embodiments
id The unique name of the dependency is constructed.
version A dependent version is constructed.
type The type of dependency is constructed.
TABLE 4 Table 4
According to one embodiment of the invention, variable information (Variable) is used to describe variables used in the build process, including the field table as shown in Table 5:
field name Description of the embodiments
conf_args The variables used by the build process describe the compilation parameters.
extra_args The variables used by the build process describe compiling additional parameters.
jobs Variables used by the build process describe the number of tasks.
build_dir The variables used by the build process describe the file directory in which the build is located.
TABLE 5
According to one embodiment of the invention, build system information (Build) is used to describe the type of Build system used for the Build, which includes a field table as shown in Table 6:
field name Description of the embodiments
kind Construction types include cmake/qmake/autopoles/manual, and the like.
manual Construction type override, which is used when an existing construction type cannot meet the requirements or requires custom construction rules.
TABLE 6
According to one embodiment of the present invention, the lingong. Yaml file may be constructed specifically by the following code:
package:
id: org.deepin.album
version: 5.9.8
kind: app
description: |
album for deepin os
runtime:
id: org.deepin.Runtime
version: 20.5.0
source:
kind: git
url: "http://gerrit.uniontech.com/deepin-album"
version: 5.9.8
commit: 21d153c3b0c8325351d9947adad7be3c341350d1
patch:
- patches/fix-cmake-include-dir-and-install-prefix.patch
depends:
- id: "udisks2-qt5"
version: 5.0.3
type: runtime
variable:
extra_args: |
-DCMAKE_BUILD_TYPE=Release \
-DAPP_VERSION=5.9.8 \
-DVERSION=5.9.8
build:
kind: cmake。
according to one embodiment of the present invention, the application compiling method of the present invention may be implemented by an application compiling apparatus. The application compilation apparatus is adapted to reside in a computing device.
Fig. 3 shows a schematic diagram of an application compiling apparatus 300 according to an exemplary embodiment of the invention. As shown in fig. 3, the application compiling apparatus 300 includes a compiling module 310, a container module 320, a server module 330, a file system module 340, and a code repository module 350.
According to one embodiment of the invention, the compilation module 310 may be embodied as a linking-builder, or as a ll-builder. The compiling module 310 is a source code constructing tool, and provides logic for constructing, testing, pushing and the like of an organization software package for implementing a compiled core program; and the container module 320 is invoked to realize the application construction environment for providing containerization at the compiling time, so that developers can conveniently construct consistent contents on different environments.
According to one embodiment of the invention, the compiling module can build the compiling application file according to the construction rule of the engineering file, define the compiling flow and support the generation of exquisite format software packages from the source code format construction. The compiling module supports cmake, qmake, automake and other common construction systems and supports other types of expansion; multiple source codes are supported, so that the source codes are conveniently introduced; the construction is carried out in a container environment provided by a link-box, so that the environment of a host machine is not influenced; using an oriented tree as a data storage tool, the content of each build can be recorded and saved, supporting repeatable builds.
According to one embodiment of the invention, the container module 320 may be embodied as a linglong-box, or called a ll-box. The container module 320 provides a container environment for a container engine designed according to the OCI standard, including an unprivileged color and anamespace isolation environment, for the execution of build scripts.
The server module 330 may be embodied as a link-server, or called a ll-server, and provides a back-end storage service (i.e., a link back-end storage service), and may use an octree to store package data, i.e., compiled products: compiling an application file; and provides warehouse management function, and realizes retrieval function based on accessing construction content.
The file system module 340 may be embodied as an overlayout file system for mounting and displaying build content.
Code repository module 350 may be embodied as an octree, which is a tool for transferring and managing file storage, and code repository module 350 may store application data through the octree differences as a local cache storage tool, i.e., a local code repository.
According to one embodiment of the invention, the compilation module 310 is provided with path variables that correspond to actual addresses in the computing device for participating in the compilation of applications. The correspondence of the path variable to the real address is shown in table 7:
Path variable Actual address Description of the invention
HOME /home/${USER} User home directory
PROJECT_ROOT Linglong. Yaml directory where file is located Engineering file root directory
PROJECT_TARGET ${PROJECT_ROOT}/.linglong-target Build process work directory
BUILDER_CACHE ${HOME}/.cache/linglong-builder Constructing a cache directory
BUILDER_REPO_ROOT ${BUILDER_CACHE}/.cache/linglong-builder/repo Local oriented tree storage path
TABLE 7
According to one embodiment of the invention, container module 320 sets container paths for application compilation in the container when constructing the container and associates with host paths (i.e., computing device paths) by setting path mappings. The path mapping relationship is shown in table 8:
host path Container path Description of the invention
${PROJECT_TARGET}/runtime /runtime Application runtimes and dependent mount directories
${PROJECT_TARGET}/source /source Application source code mounting path
${BUILDER_CACHE}/layers/org.deepin.base/files/usr{,etc,var} {/usr,/etc,/var} Base environment mounting path
TABLE 8
According to one embodiment of the invention, the compilation module 310 may implement various functions of the application compilation time by executing a variety of commands. Fig. 4 shows a functional schematic of a compiling module 310 according to an exemplary embodiment of the invention. As shown in fig. 4, the commands that the compiling module 310 can execute include an initialize engineering file command (create), a execute compiling flow command (build), a export build product command (export), a test build product command (run), and a push build product command (push).
Returning to FIG. 1, according to one embodiment of the invention, the compilation module 310 may implement steps 110-160 by executing compilation flow commands.
According to one embodiment of the invention, the project file is stored under a project catalog, which is created by executing an initialization project file command. The compilation module 310 may initialize an engineering catalog containing linglong. Yaml files by executing an initialize engineering file command:
$ ll-builder create org.deepin.demo
the directory structure generated is as follows:
├── org.deepin.demo
└── linglong.yaml。
FIG. 5 shows a schematic diagram of a compilation flow according to an exemplary embodiment of the present invention. As shown in fig. 5, at the beginning of construction, first, the engineering file under the current directory, i.e., the linglong. Yaml file, is read.
Returning to FIG. 1, step 120 is then performed to obtain a source code file based on the source code information.
According to one embodiment of the present invention, acquiring a source code file from source code information includes: analyzing a source code type field in the source code information to determine a source code type; and acquiring the source code file from the corresponding storage position according to the source code type. The source code types include: compression package (archive), remote code repository (git), and local code (local). The invention can set the source of the source code in the source code type field (ind) in the source code information of the engineering file. The invention can use a plurality of source codes, and can control the source code input by combining with other platforms (such as github, gerrit), thereby having higher safety.
When the source code type is a compressed packet, the compressed packet can be downloaded according to a download address recorded in a url field, and the compressed packet is decompressed to obtain a source code file;
when the source code type is a remote code warehouse, the code file can be downloaded from the remote code warehouse according to the download address recorded in the url field;
when the source code type is a native code, the source code file may be obtained from the native.
Subsequently, step 130 is performed to obtain a base environment file according to the base environment information.
According to one embodiment of the present invention, the basic environment information is determined according to a product type field of the product information, the product type field including an application (app), a runtime environment file (runtime file), a library file (lib), and when the product type field is the application, the basic environment information is the runtime environment information (runtime information); when the product type field is a runtime environment file or a library file, the base environment information is basic environment information (base information).
According to one embodiment of the invention, app represents a build product type in the linglong engineering file semantics, referring to an application in exquisite format; run is a description of the application running environment by lingong, and represents a type of construction product in the lingong engineering file, and mainly consists of qt and dtk related libraries; lib represents a type of build product in the semantic of the link engineering file, providing a static or dynamic library file.
As shown in fig. 5, acquiring the base environment file according to the base environment information includes: when the basic environment information is runtime environment information (runtime information), acquiring a runtime environment file (runtime file) according to the runtime environment information;
and then determining basic environment information (base information) according to the runtime environment information (run time information), acquiring a basic environment file (base file) according to the basic environment information, and taking the runtime environment file and the basic environment file as basic environment files.
When the basic environment information is basic environment information (base information), a basic environment file (base file) is acquired as a basic environment file according to the basic environment information. When the basic environment file is acquired, the base file of the corresponding version is acquired to the local.
Returning to FIG. 1, step 140 is then performed to obtain a dependent file based on the dependency information; specific: storing the dependent file to a local code repository to regenerate a compiled application file from the dependent file of the local code repository; the dependent files of the local code repository are stored to the build working directory for mounting to the container to generate compiled application files.
According to one embodiment of the invention, the local code repository may be provided by a code repository module, set according to an ostree storage tool.
According to one embodiment of the invention, when the dependent file is acquired, whether a history construction record exists is also judged; if the history building record exists, the dependent file recorded in the history building record is acquired. The history construction record is a compiling record for compiling the application file before the compiling, and the dependency file used by the successful compiling is recorded. The recorded dependent files can be stored in the form of characteristic values, such as hash values, and the corresponding dependent files can be determined and obtained through the characteristic values.
In the prior art, the debrian system builds a deb software package tool as dpkg. Debian is a linux system release with a package format of deb. A plurality of more automatic construction tools such as dbuild, pfluilder, cowluilder and the like are derived on the basis of dpkg. These tools can be further divided into two types depending on the type of build environment: based on host environment construction, such as dpkg, dbuild, etc. The type construction tool can compile only by installing corresponding construction dependencies in the host machine in advance, otherwise, the compiling fails; and the construction site is easy to be destroyed, the construction dependence consistency of each time of use cannot be ensured, and the repeatable construction implementation is affected. The invention not only can automatically acquire the dependent file for compiling during compiling, but also can save the dependent file used for compiling each time, thereby solving the technical problems.
Subsequently, step 150 is performed to generate a build script from the build system information, the base environment file, and the source code file.
According to one embodiment of the present invention, building system information includes cmake, qmake, automatic building tools (automatic) and custom building (manual), and generating a build script from the build system information, the base environment file and the source code file includes: based on different construction systems recorded by construction system information, a construction script is generated according to the basic environment file and the source code file.
According to one embodiment of the invention, the automatic build tools include build tools such as automake, autoconf. Custom construction manual performs custom construction for a user. The invention supports a plurality of modes of construction systems and generates corresponding construction scripts of each construction system.
Finally, step 160 is executed to set a container, and the build script is executed in the container according to the variable information and the dependent file to generate a compiled application file.
According to one embodiment of the invention, when setting up a container, the container module may be invoked by the compilation module to set up to execute a build script in the container. The build script organizes commands, such as make, gcc, etc., in the container and compiles the source code file to obtain the final compiled product, i.e., the compiled application file. The invention can provide safer construction environment without influencing the host machine.
According to one embodiment of the invention, the compiled application file may be implemented as a binary file, i.e., a binary package. The invention does not limit the specific file type of the compiling application file.
According to one embodiment of the invention, the compiled application file may be implemented in the lingong format, or exquisite, and may be run in a container according to the invention, which is arranged according to the container module.
In the prior art, construction application is performed based on a color environment, and the color is: is both a command of Linux and a system call for changing the root directory of the current environment to a folder, which is not visible to the current environment, and which is also called a color environment.
As shown in fig. 5, after the build is completed, the container is withdrawn.
According to one embodiment of the invention, after the compiling application file is successfully generated, the dependency file used by compiling is recorded, and a history construction record is generated, so that the dependency file is called according to the history construction record, the compiling application file is repeatedly constructed, and efficient and stable repeatable construction (producible) is realized; the repeatable build, i.e., build, is reproducible, and if given the same source code, build environment, and build instructions, an identical copy can be reconstructed without human intervention in the build process.
According to one embodiment of the invention, the compiled application file is also stored to a local code repository to find the compiled application file according to the local code repository.
According to one embodiment of the invention, files to be submitted, i.e., compiled application files, can be stored under corresponding directories by the file system module and the corresponding directories are mounted to the local code repository for submission to the server through the local code repository. When the compiling application file is submitted to the server, a level software package and a common software package are set for submitting. The file system module may be implemented as an overlayfs file system.
According to one embodiment of the invention, after the construction is completed, the compiling module further generates an info. Json file for recording the compiling related information. If the file is not constructed for the first time, updating the info. Json file generated by the previous construction. The info. Json file is a description file of the linglong software package, records meta information of the software package, such as the name of the software package, the version of the software package, the used linglong-run, etc. The link-run (i.e., run) is a description of the application running environment by link, and represents a type of build product in the link engineering file, consisting essentially of qt and dtk related libraries.
According to one embodiment of the present invention, the application compiling method further includes: executing the export build product command to export the build product to the engineering catalog.
According to one embodiment of the invention, a building product, namely an application compiling file, is stored in a local cache (cache) after the building is completed and is exported to an engineering directory through an export command.
According to one embodiment of the invention, the directory structure of the engineering directory is as follows:
$ tree -L 2 org.deepin.calculator
├── entries
│ ├── applications
│ └── icons
├── files
│ ├── bin
│ ├── include
│ ├── lib
│ └── share
├── info.json
├── linglong.yaml。
according to one embodiment of the present invention, the application compiling method further includes: executing the test build product command, comprising: determining the name of a software package according to the product information of the engineering file; inquiring whether a successfully constructed compiling application file exists in a local code warehouse according to the name of the software package; if the compiling application file exists, setting a container, running the compiling application file in the container according to the running environment file, and testing the compiling application file.
FIG. 6 shows a schematic diagram of a test build product according to an exemplary embodiment of the invention. As shown in fig. 6, when executing the test construction product command, reading an engineering file under the engineering directory, namely a link. Yaml configuration file, analyzing a package field in the engineering file to determine a software package name, and searching whether a successfully constructed compiling application file exists in an ostree;
If the test result does not exist, prompting that the test result, namely run action, can be tested only after the test result is successfully constructed;
if so, determining a runtime environment file (runtime file) and an application compiling file (namely a building product), calling a container module (namely a ll-box) to set a container, running the compiling application file according to the runtime environment file in the container, and testing the compiling application file. And after the test is finished, the container is withdrawn.
According to one embodiment of the present invention, the application compiling method further includes: executing a push build product command, comprising: establishing communication connection with a server, and acquiring an application identifier from the server; and generating a transmission file according to the application identifier and the compiled application file, and sending the transmission file to the server.
After the transmission file is sent to the server, verification information for verifying the application identifier in the transmission file by the server is also obtained; and determining an uploading result according to the verification information.
According to one embodiment of the invention, the server may be deployed in a computing device, and may also be deployed in other devices connected to the computing device, such as a server connected to the computing device. The invention does not limit the specific deployment mode of the server.
FIG. 7 shows a schematic diagram of pushing build products according to an exemplary embodiment of the invention. As shown in fig. 7, the compiling module first obtains the address of the server, i.e. the url of the server. The server address may be obtained from a link. Yaml configuration file or command line parameters.
And then, requesting an application identifier, namely a token, from the server according to the url of the server.
The server side sends a token to the compiling module.
After receiving the token, the compiling module attaches token information to the header of the compiling application file to generate a transmission file, and sends the transmission file to the server.
The server checks the transmission file, including token and received compiling application file, generates and sends check information, and is specific: if the verification is successful, the data is stored and the normal state code is returned; and if the verification fails, returning an error state code.
The compiling module analyzes the check information, determines an uploading result according to a normal state code or an error state code in the check information, prompts the current pushing state, and if the check information is the normal state code, the pushing is successful; if the check information is the error status code, the pushing fails.
The application compiling method in the invention is suitable for being executed in a computing device, and comprises the following steps: analyzing the engineering file to obtain a source code file, wherein the engineering file comprises basic environment information, dependency information, construction system information and variable information; acquiring a basic environment file according to basic environment information; acquiring a dependent file according to the dependent information; generating a construction script according to the construction system information, the basic environment file and the source code file; and setting a container, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file. By the application compiling method, the compiling application file can be generated through the simpler engineering file, the application compiling difficulty and complexity are reduced, and the application compiling efficiency is improved; and the container environment is used for construction during compiling, so that the influence of the compiling process on a host machine is avoided, and the safety is high.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to practitioners skilled in the art. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention.

Claims (11)

1. An application compilation method adapted to run in a computing device, the method comprising:
analyzing an engineering file, wherein the engineering file comprises: source code information, basic environment information, dependency information, construction system information, variable information and product information;
acquiring a source code file according to the source code information;
acquiring a basic environment file according to the basic environment information;
acquiring a dependent file according to the dependent information;
generating a construction script according to the construction system information, the basic environment file and the source code file;
Setting a container, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file;
the basic environment information is determined according to a product type field of the product information, wherein the product type field comprises an application, a runtime environment file and a library file, and when the product type field is the application, the basic environment information is the runtime environment information;
when the product type field is a runtime environment file or library file, the base environment information is basic environment information.
2. The method of claim 1, wherein the engineering file is stored under an engineering catalog, the engineering catalog created by executing an initialization engineering file command.
3. The method of claim 1, wherein the obtaining a source code file from the source code information comprises:
analyzing a source code type field in the source code information to determine a source code type;
and acquiring the source code file from the corresponding storage position according to the source code type.
4. The method of claim 3, wherein the source code type comprises: compression package, remote code repository, and local code.
5. The method of claim 1, wherein the obtaining a base environment file from the base environment information comprises:
when the basic environment information is the runtime environment information, acquiring a runtime environment file according to the runtime environment information;
and determining basic environment information according to the runtime environment information, acquiring a basic environment file according to the basic environment information, and taking the runtime environment file and the basic environment file as basic environment files.
6. The method of claim 5, wherein the method further comprises:
and when the basic environment information is basic environment information, acquiring a basic environment file according to the basic environment information, and taking the basic environment file as a basic environment file.
7. The method of any of claims 1-4, wherein the obtaining a dependency file from the dependency information comprises:
storing the dependent file to a local code warehouse so as to generate a compiling application file again according to the dependent file of the local code warehouse;
and storing the dependent files of the local code warehouse into a construction work directory so as to be mounted on the container to generate a compiling application file.
8. The method of claim 7, wherein the method further comprises:
judging whether a history construction record exists or not;
if the history building record exists, the dependent file recorded in the history building record is acquired.
9. An application compilation apparatus adapted to reside in a computing device, the apparatus comprising: the system comprises a compiling module, a container module, a code warehouse module, a file system module and a server module, wherein the compiling module is suitable for executing compiling flow commands and comprises:
analyzing the engineering file to obtain a source code file, wherein the engineering file comprises the following components: source code information, basic environment information, dependency information, construction system information and variable information;
acquiring a source code file according to the source code information;
acquiring a basic environment file according to the basic environment information;
acquiring a dependent file according to the dependent information;
generating a construction script according to the construction system information, the basic environment file and the source code file;
setting a container according to the container module, and executing a construction script in the container according to the variable information and the dependent file to generate a compiling application file;
the file system module is suitable for storing the compiling application file into a corresponding catalogue and mounting the corresponding catalogue into a local code warehouse;
The code warehouse module is suitable for providing a local code warehouse, storing the dependent file after acquiring the dependent file, storing the compiling application file after generating the compiling application file, and submitting the compiling application file to a server;
the server module is suitable for providing a server and storing the compiling application file submitted by the code warehouse module.
10. A computing device, comprising:
one or more processors;
a memory; and
one or more programs, wherein the one or more programs are stored in memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing the method of any of claims 1-8.
11. A computer readable storage medium storing one or more programs, wherein the one or more programs comprise instructions, which when executed by a computing device, cause the computing device to perform the method of any of claims 1-8.
CN202311255724.6A 2023-09-26 2023-09-26 Application compiling method and device, computing equipment and storage medium Active CN116991427B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311255724.6A CN116991427B (en) 2023-09-26 2023-09-26 Application compiling method and device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311255724.6A CN116991427B (en) 2023-09-26 2023-09-26 Application compiling method and device, computing equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116991427A CN116991427A (en) 2023-11-03
CN116991427B true CN116991427B (en) 2023-12-29

Family

ID=88525211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311255724.6A Active CN116991427B (en) 2023-09-26 2023-09-26 Application compiling method and device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116991427B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064595A (en) * 2021-03-22 2021-07-02 北京北信源软件股份有限公司 QT application program compiling method and device based on Docker mirror image
CN114138281A (en) * 2021-12-08 2022-03-04 京东科技控股股份有限公司 Compiling method, device, equipment and medium of software engineering
CN114816417A (en) * 2022-04-18 2022-07-29 北京凝思软件股份有限公司 Cross compiling method and device, computing equipment and storage medium
CN115185531A (en) * 2022-06-29 2022-10-14 统信软件技术有限公司 Application compiling method and device, computing equipment and storage medium
CN115639986A (en) * 2022-10-24 2023-01-24 阿里巴巴(中国)有限公司 Software package construction method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8949788B2 (en) * 2008-12-17 2015-02-03 Red Hat, Inc. Building and packaging software
US11863580B2 (en) * 2019-05-31 2024-01-02 Varmour Networks, Inc. Modeling application dependencies to identify operational risk

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064595A (en) * 2021-03-22 2021-07-02 北京北信源软件股份有限公司 QT application program compiling method and device based on Docker mirror image
CN114138281A (en) * 2021-12-08 2022-03-04 京东科技控股股份有限公司 Compiling method, device, equipment and medium of software engineering
CN114816417A (en) * 2022-04-18 2022-07-29 北京凝思软件股份有限公司 Cross compiling method and device, computing equipment and storage medium
CN115185531A (en) * 2022-06-29 2022-10-14 统信软件技术有限公司 Application compiling method and device, computing equipment and storage medium
CN115639986A (en) * 2022-10-24 2023-01-24 阿里巴巴(中国)有限公司 Software package construction method and device

Also Published As

Publication number Publication date
CN116991427A (en) 2023-11-03

Similar Documents

Publication Publication Date Title
US9928050B2 (en) Automatic recognition of web application
CN104793946B (en) Dispositions method and system are applied based on cloud computing platform
TWI556170B (en) Projecting native application programming interfaces of an operating system into other programming languages (2)
US20040059703A1 (en) Cascading behavior of package generation/installation based on variable parameters
CN106294113B (en) creation method and device based on programmable test service
US20070234328A1 (en) File handling for test environments
CN112035443B (en) Big data execution method, system, equipment and storage medium based on Linux platform
US8423994B2 (en) Recipe based application conversion
CN112286829B (en) Test script generation method and device
CN114780950B (en) Method, system, device and storage medium for cross-version compatible operation of application software
US20080141219A1 (en) Multiple inheritance facility for java script language
CN116049207A (en) Application SQL script processing method and device, processor and electronic equipment
CN117112060A (en) Component library construction method and device, electronic equipment and storage medium
CN116755713A (en) Application program generation method, device, equipment and storage medium
CN116450107B (en) Method and device for secondary development of software by low-code platform and electronic equipment
CN116991427B (en) Application compiling method and device, computing equipment and storage medium
CN105447040A (en) Binary file management and update method and device, and binary file management system
CN116991381B (en) Application cross compiling method and device, computing equipment and storage medium
CN114860202A (en) Project operation method, device, server and storage medium
CN112559444A (en) SQL (structured query language) file migration method and device, storage medium and equipment
US8615736B2 (en) Module facility for JAVASCRIPT language
US8453108B1 (en) Static, configurable kernel interface
CN117707543A (en) Application installation package manufacturing and installation method, computing device and storage medium
US20210240596A1 (en) Source code file retrieval
CN117762473A (en) Project development method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant