WO2019134287A1 - Version information management method, electronic device and readable storage medium - Google Patents

Version information management method, electronic device and readable storage medium Download PDF

Info

Publication number
WO2019134287A1
WO2019134287A1 PCT/CN2018/082169 CN2018082169W WO2019134287A1 WO 2019134287 A1 WO2019134287 A1 WO 2019134287A1 CN 2018082169 W CN2018082169 W CN 2018082169W WO 2019134287 A1 WO2019134287 A1 WO 2019134287A1
Authority
WO
WIPO (PCT)
Prior art keywords
version information
preset
memory space
component
file
Prior art date
Application number
PCT/CN2018/082169
Other languages
French (fr)
Chinese (zh)
Inventor
张磊
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019134287A1 publication Critical patent/WO2019134287A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Definitions

  • the present invention relates to the field of electronic technologies, and in particular, to a version information management method, an electronic device, and a readable storage medium.
  • the embodiment of the invention provides a version information management method, an electronic device and a readable storage medium, which are used for quickly recording the version information of components participating in the compilation, so that relevant personnel can quickly and directly view the components participating in the compilation.
  • the version information can greatly improve the efficiency of problem location.
  • the present invention provides a version information management method, including:
  • the version information of the component is written into the preset memory space until the version information of all the components is written into the preset memory space.
  • the version information of the component is written into the preset memory space, including:
  • the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair
  • the key name is the identity of the component
  • the key value in the key-value pair is the version number of the component.
  • the script file corresponding to the one or more components is written based on gradle
  • the operating system of the electronic device is an Android system
  • the preset type is a JAVA type
  • the preset memory space is The version information is converted to a preset type of version file, including:
  • the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form,
  • the key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
  • the method further includes:
  • the version file of the preset type is displayed in a case where the user performs a preset operation for viewing the version file of the preset type.
  • the method further includes:
  • a version file of the preset type is displayed if a compile error occurs when compiling the script file for each of the one or more components.
  • an embodiment of the present invention provides an electronic device, where the electronic device includes:
  • a determining unit for determining one or more components participating in the script compilation
  • a writing unit configured to write version information of the component to the preset memory space when the script file of each component of the one or more components is compiled, until the version information of all components is written The preset memory space;
  • a conversion unit configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
  • the writing unit is configured to:
  • the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair
  • the key name is the identity of the component
  • the key value in the key-value pair is the version number of the component.
  • the script file corresponding to the one or more components is written based on gradle
  • the operating system of the electronic device is an Android system
  • the preset type is a JAVA type
  • the converting unit is configured to:
  • the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form,
  • the key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
  • the electronic device further includes:
  • a first display unit configured to: after converting the version information in the preset memory space into a version file of a preset type, storing the version file of the preset type into a preset storage space; In the case of a preset operation for viewing a version file of the preset type, a version file of the preset type is displayed.
  • the electronic device further includes:
  • a first display unit configured to: after converting the version information in the preset memory space into a version file of a preset type, if the script file of each component of the one or more components is compiled In the case of a compile error, the version file of the preset type is displayed.
  • an embodiment of the present invention provides an electronic device, where the electronic device includes a processor, and the processor is configured to implement version information management as described in the foregoing first embodiment when executing a computer program stored in a memory. The steps of the method.
  • an embodiment of the present invention provides a readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the version information management method as described in the foregoing first embodiment is implemented. step.
  • FIG. 1 is a flowchart of a version information management method in a first embodiment of the present invention
  • FIG. 2 is a schematic diagram of an electronic device in a second embodiment of the present invention.
  • FIG. 3 is a schematic diagram of an electronic device in a third embodiment of the present invention.
  • the embodiment of the invention provides a version information management method, an electronic device and a readable storage medium, which are used for quickly recording the version information of components participating in the compilation, so that relevant personnel can quickly and directly view the components participating in the compilation.
  • the version information can greatly improve the efficiency of problem location.
  • the version information management method includes: applying a preset memory space; determining one or more components participating in the script compilation; and verifying the version information of the component when compiling the script file of each component of the one or more components Writing the preset memory space until the version information of all components is written into the preset memory space; converting the version information in the preset memory space into a preset type version file, the preset type A type readable by the operating system of an electronic device.
  • a first embodiment of the present invention provides a version information management method, where the version information management method includes the following steps:
  • S102 Determine one or more components that participate in script compilation
  • S104 Convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
  • the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type.
  • the electronic device is installed with an Android operating system
  • the operating system is a JAVA-based operating system
  • the compiled script of the Android operating system application is written based on gradle, which is a compiled language.
  • gradle which is a compiled language.
  • each application includes multiple components, each component contains a compiled script file build.gradle, there is a version in the script file build.gradle indicating the component Variable information of the information.
  • a component corresponding to the application includes a plurality of components, and each component includes multiple versions, and the version information defined in each component compilation script is parsed by file parsing, and then The parsed version information is stored accordingly.
  • This method needs to store the version information of all the components corresponding to the application. Since the application will face upgrade and related debugging, the components participating in the compilation can be added, deleted, and changed as needed. When there are changes to the components involved in the compilation, the version information of the recorded components cannot be dynamically adjusted. That is, the version information of each component of the entire application is stored in the prior art. In the event of a compilation error, manually locate the version information corresponding to the component in question. Since the application can have up to hundreds of components, the labor cost of locating the problem component is high.
  • the main description is based on gradle to dynamically record the version number information of each component participating in the current compilation. Since each component contains a compiled script file build.gradle, there is variable information in the compiled script file build.gradle indicating the version information of the component.
  • step S101 before compiling, a preset memory space allVersion is applied in advance, and the memory space is an independent memory space, which is a global variable for storing version information of all components participating in the compilation. .
  • steps S102 and S103 are performed. Since the script files of each component know their own version information, the global variable allVersion is first obtained before the application compiling script starts executing. When the compiling component is compiled, the adding method in the global variable is called. The version information of the currently compiled component is written into the preset memory space allVersion. When all the components participating in the compilation are compiled, the version information of each component participating in the compiled component is written to the preset memory space. allVersion.
  • the version information corresponding to each component participating in the compilation is written into the preset memory space
  • the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value is aligned.
  • the key is named the identity of the component
  • the key value in the key-value pair is the version number of the component.
  • the preset memory space is applied in the data format of the MAP key value pair.
  • the name of the component A participating in the compilation is A
  • the version number of the component is A1.
  • the add method add adds the version information of the component to the preset memory space allVersion as a key value pair.
  • the key value is A
  • the value corresponding to the key name is A1. In this way, the version information of each component participating in the compilation can be written into the preset memory space in a key value pair manner.
  • This reverse design idea eliminates the need to traverse the file to obtain version information as in the prior art, and directly copies the corresponding version information to the preset memory space requested when the component is compiled.
  • the version information of the components participating in the compilation can be dynamically recorded, so that when the compilation error occurs, the version information of the preset memory space can be read, and the component in question can be quickly located.
  • the version information of all the components involved in the compilation is written into the preset memory space, since the way of writing the version information is based on gradle, the Android operating system installed by the electronic device cannot parse the corresponding version information, so it is necessary to The version information in the preset memory space is converted into a JAVA type file readable by the Android operating system.
  • the next step S104 mainly describes how to transfer the version information of all components participating in the compilation based on the preset memory space written by gradle into the corresponding Java file. Since gradle does not provide the business function of gradle and JAVA to directly interact, only a configuration information function is provided. In the prior art, the gradle script and the JAVA code cannot be directly interacted. The method in this embodiment mainly utilizes the configuration information in the gadle. Function to implement this function.
  • the version information stored in the preset memory space is written into the Android configuration file BuildConfig.java file by calling the configuration information function buildConfigField in the gradle script.
  • the version information of each component participating in the compilation stored in the preset storage space is written in a key value pair manner.
  • the configuration information function buildConfigField is called to write the version information to the Android configuration file BuildConfig.java file
  • the variable form is written, and the key name in the key-value pair of each version information is converted into the variable name of the variable, and the key value in the key-value pair is converted into the value of the variable.
  • the version information of all the components participating in the compilation is written in the generated configuration BuildConfig.java file, so that the gradle-based version information of all components participating in the compilation is converted into a JAVA file.
  • the following two ways of presenting the JAVA file are provided, but not limited to.
  • the first type storing the version file of the preset type to a preset storage space
  • the version file of the preset type is displayed in a case where the user performs a preset operation for viewing the version file of the preset type.
  • the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner.
  • the JAVA file is stored in a preset storage space, and the preset storage space may be a position where the hidden entrance is deep, and an egg function is also provided correspondingly.
  • the preset storage space and the preset operation may be set according to actual needs, and the present application does not limit the application.
  • the user can quickly and easily obtain the version information of all the current components.
  • the method of directly calling the egg page can be View version information for each component of the current software.
  • the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the JAVA file is stored to a preset storage space. If an error occurs during compilation of the application, the compilation fails, or when the application runs incorrectly, the version file of the preset type is automatically displayed, so that the user can quickly and easily obtain the version information of all the current components.
  • a second embodiment of the present invention provides an electronic device, where the electronic device includes:
  • the application unit 201 is configured to apply for a preset memory space
  • a determining unit 202 configured to determine one or more components participating in the script compilation
  • the writing unit 203 is configured to: when compiling the script file of each component of the one or more components, write version information of the component to the preset memory space until the version information of all components is written Entering the preset memory space;
  • the converting unit 204 is configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
  • the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type.
  • the electronic device is installed with an Android operating system
  • the operating system is a JAVA-based operating system
  • the compiled script of the Android operating system application is written based on gradle, which is a compiled language.
  • gradle which is a compiled language.
  • each application includes multiple components, each component contains a compiled script file build.gradle, there is a version in the script file build.gradle indicating the component Variable information of the information.
  • a component corresponding to the application includes a plurality of components, and each component includes multiple versions, and the version information defined in each component compilation script is parsed by file parsing, and then The parsed version information is stored accordingly.
  • This method needs to store the version information of all the components corresponding to the application. Since the application will face upgrade and related debugging, the components participating in the compilation can be added, deleted, and changed as needed. When there are changes to the components involved in the compilation, the version information of the recorded components cannot be dynamically adjusted. That is, the version information of each component of the entire application is stored in the prior art. In the event of a compilation error, manually locate the version information corresponding to the component in question. Since the application can have up to hundreds of components, the labor cost of locating the problem component is high.
  • the main description is based on gradle to dynamically record the version number information of each component participating in the current compilation. Since each component contains a compiled script file build.gradle, there is variable information in the compiled script file build.gradle indicating the version information of the component.
  • a preset memory space allVersion is applied in advance, and the memory space is an independent memory space, which is a global variable for storing versions of all components participating in the compilation. information.
  • the determining unit 202 determines one or more components participating in the compilation. Since the script file of each component knows its own version information, the writing unit 203 first acquires the global variable allVersion before the application compiling script starts executing, and calls the global variable when compiling the component participating in the compilation. The adding method writes the version information of the currently compiled component into the applied preset memory space allVersion. When all the compiling components are compiled, the version information of each component in the compiling component is written to The default memory space is allVersion.
  • the version information corresponding to each component participating in the compilation is written into the preset memory space
  • the version information of the component is written into the preset memory space in the form of a key value pair, wherein the The key in the key-value pair is the identifier of the component, and the key-value in the key-value pair is the version number of the component.
  • the preset memory space is applied in the data format of the MAP key value pair.
  • the name of the component A participating in the compilation is A
  • the version number of the component is A1.
  • the add method add adds the version information of the component to the preset memory space allVersion as a key value pair.
  • the key value is A
  • the value corresponding to the key name is A1. In this way, the version information of each component participating in the compilation can be written into the preset memory space in a key value pair manner.
  • This reverse design idea eliminates the need to traverse the file to obtain version information as in the prior art, and directly copies the corresponding version information to the preset memory space requested when the component is compiled.
  • the version information of the components participating in the compilation can be dynamically recorded, so that when the compilation error occurs, the version information of the preset memory space can be read, and the component in question can be quickly located.
  • the version information of all the components involved in the compilation is written into the preset memory space, since the way of writing the version information is based on gradle, the Android operating system installed by the electronic device cannot parse the corresponding version information, so it is necessary to The version information in the preset memory space is converted into a JAVA type file readable by the Android operating system.
  • gradle does not provide the business function of gradle and JAVA to directly interact, only a configuration information function is provided.
  • the gradle script and the JAVA code cannot be directly interacted.
  • the electronic device method mainly utilizes the configuration in the gadle. Information function to implement this function.
  • the conversion unit 204 writes the version information stored in the preset memory space to the Android configuration file BuildConfig.java file by calling the configuration information function buildConfigField in the gradle script. Since the version information of each component participating in the compilation of the preset storage space is written in a key value pair, the conversion unit 204 calls the configuration information function buildConfigField to write the version information to the Android configuration file BuildConfig.java file. When it is written as a variable, the key name in the key-value pair of each version information is converted into the variable name of the variable, and the key value in the key-value pair is converted into the value of the variable. Through such an operation, after the compilation is completed, the version information of all the components participating in the compilation is written in the generated configuration BuildConfig.java file, so that the gradle-based version information of all components participating in the compilation is converted into a JAVA file.
  • the following two ways of presenting the JAVA file are provided, but not limited to.
  • the first type the first display unit stores the version file of the preset type to a preset storage space; and displays the preset when the user performs a preset operation for viewing the version file of the preset type.
  • the version file of the type is a preset storage space.
  • the first display unit stores the JAVA file to a preset storage space, and the preset storage space may be a position where the hidden entrance is deep, and an egg function is further disposed correspondingly.
  • the preset storage space and the preset operation may be set according to actual needs, and the present application does not limit the application.
  • the user can quickly and easily obtain the version information of all the current components.
  • the method of directly calling the egg page can be View version information for each component of the current software.
  • the second presentation unit is configured to display the version file of the preset type if a compile error occurs when compiling the script file of each of the one or more components.
  • the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the first display unit stores the JAVA file to a preset storage space. If an error occurs during compilation of the application, the compilation fails, or when the application runs incorrectly, the version file of the preset type is automatically displayed, so that the user can quickly and easily obtain the version information of all the current components.
  • a third embodiment of the present invention provides an electronic device, where the electronic device includes: a processor 301, a memory 302, and is stored in the memory and operable on the processor.
  • a computer program such as a program corresponding to the version information management method in the first embodiment. The steps in the path detection in the first embodiment described above are implemented when the processor executes the computer program. Alternatively, the processor implements the functions of the modules/units in the electronic device of the second embodiment described above when the computer program is executed.
  • the computer program can be partitioned into one or more modules/units that are stored in the memory and executed by the processor to perform the present invention.
  • the one or more modules/units may be a series of computer program instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer program in the computer device.
  • the computer program can be divided into functions of an application unit, a determination unit, a write unit, and a conversion unit, and the specific functions of each unit are as follows:
  • a determining unit for determining one or more components participating in the script compilation
  • a writing unit configured to write version information of the component to the preset memory space when the script file of each component of the one or more components is compiled, until the version information of all components is written The preset memory space;
  • a conversion unit configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
  • the electronic device can include, but is not limited to, a processor, a memory. It will be understood by those skilled in the art that the schematic diagram 3 is merely an example of a computer device and does not constitute a limitation on an electronic device, and may include more or less components than those illustrated, or may combine certain components or different components.
  • the electronic device may further include an input and output device, a network access device, a bus, and the like.
  • the processor 301 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like, which is the control center of the computer device, which is connected to various parts of the entire computer device using various interfaces and lines.
  • the memory 302 can be used to store the computer program and/or module, the processor implementing the method by running or executing a computer program and/or module stored in the memory, and invoking data stored in the memory Various functions of a computer device.
  • the memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored. Data created according to the use of the mobile phone (such as audio data, video data, etc.).
  • the memory may include a high-speed random access memory, and may also include non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a Secure Digital (SD) card.
  • non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a Secure Digital (SD) card.
  • Flash Card at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • processor 301 included in the electronic device further has the following functions:
  • the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair
  • the key name is the identity of the component
  • the key value in the key-value pair is the version number of the component.
  • processor 301 included in the electronic device further has the following functions:
  • the path detection function After the path detection function is called by the path detection function to call the detection method function corresponding to the preset instantiation object, if the path detection is successful, the preset compilation script is compiled; if the path detection fails, the compilation failure result is returned. .
  • processor 301 included in the electronic device further has the following functions:
  • the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is JAVA type, and the conversion unit is configured to:
  • the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form,
  • the key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
  • processor 301 included in the electronic device further has the following functions:
  • the version file of the preset type is stored to a preset storage space; and the user performs a view for viewing the preset In the case of a preset operation of a version file of a type, a version file of the preset type is displayed.
  • processor 301 included in the electronic device further has the following functions:
  • the version information in the preset memory space is converted into a version file of a preset type, if a compile error occurs when compiling the script file of each component of the one or more components, The version file of the preset type.
  • a fourth embodiment of the present invention provides a computer readable storage medium having stored thereon a computer program, and the functional unit integrated by the electronic device in the second embodiment of the present invention is implemented in the form of a software functional unit and is independent When the product is sold or used, it can be stored in a computer readable storage medium.
  • the present invention implements all or part of the flow of the version information management method of the first embodiment described above, and may also be completed by a computer program to instruct related hardware, and the computer program may be stored in a computer readable manner.
  • the computer program when executed by the processor, implements the steps of the various method embodiments described above.
  • the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form.
  • the computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM). , random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media.
  • RAM random access memory
  • computer readable media Does not include electrical carrier signals and telecommunication signals.
  • a plurality of interfaces are pre-created in the interface library of the electronic device, and each of the interfaces defines a detection method function, and each detection method function corresponds to a preset rule, and further, is detected during compilation.
  • the path of the ARouter satisfies one or more preset rules, only the interface object corresponding to the rule needs to be instantiated in the detection manager, and then a path detection function is created, and the detection method function in the instantiated object is called by the path detection function. The legitimacy of the path can be detected.
  • An automatic detection method for path legitimacy in the ARouter which reduces the communication failure caused by the non-standard path in the ARouter during the software to run, and then spends a lot of time to troubleshoot the problem, greatly improving the development efficiency and reducing the labor cost.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

Provided in the present invention are a version information management method, an electronic device and a readable storage medium, which are used for quickly and uniformly recording version information of components which take part in compiling, thereby facilitating relevant personnel quickly and directly viewing the version information of each of the components which take part in compiling, and greatly improving the efficiency of problem positioning. The version information management method comprises: applying for a preset memory space; determining one or more components which take part in script compiling; when a script file of each component among the one or more components is compiled, writing the version information of the components into the preset memory space until the version information of all the components is written into the preset memory space; and converting the version information in the preset memory space into a version file of a preset type, the preset type being a type readable by an operating system of an electronic device.

Description

一种版本信息管理方法、电子设备及可读存储介质Version information management method, electronic device and readable storage medium 技术领域Technical field
本发明涉及电子技术领域,尤其涉及一种版本信息管理方法、电子设备及可读存储介质。The present invention relates to the field of electronic technologies, and in particular, to a version information management method, an electronic device, and a readable storage medium.
背景技术Background technique
在安卓平台的应用程序开发过程中,会使用组件化相关的技术来对应用程序进行改造。在组件化过程中,需要对应用程序的各个组件进行编译调试,在编译时可能会出现问题导致编译不通过,此时,需要定位出现问题的组件,进而需要获知组件的版本信息。在现有技术中,仅能获知整个应用程序的版本信息,进而通过多级的查询定位到参与当前编译的组件的版本号信息,这种方式定位组件版本信息的方式非常繁琐,当参与编译的组件数量较大时,无法直接快速获取到大量组件的版本信息,而是需要通过整个应用程序的版本信息来进行人工映射关系的查找才能最终定位得到出现问题的组件的版本信息。In the application development process of the Android platform, component-related technologies are used to transform the application. In the process of componentization, it is necessary to compile and debug the various components of the application. At compile time, there may be problems causing the compilation to fail. In this case, it is necessary to locate the component in question, and then need to know the version information of the component. In the prior art, only the version information of the entire application can be known, and then the version number information of the component participating in the current compilation is located through a multi-level query. This way of locating the component version information is very cumbersome, when participating in the compilation. When the number of components is large, you cannot directly obtain the version information of a large number of components. Instead, you need to search the manual mapping relationship through the version information of the entire application to finally locate the version information of the component in question.
发明内容Summary of the invention
本发明实施例提供了一种版本信息管理方法、电子设备及可读存储介质,用于快速的将参与编译的组件的版本信息进行统一记录,便于相关人员快速且直接查看到参与编译的各组件的版本信息,能够极大的提高问题定位的效率。The embodiment of the invention provides a version information management method, an electronic device and a readable storage medium, which are used for quickly recording the version information of components participating in the compilation, so that relevant personnel can quickly and directly view the components participating in the compilation. The version information can greatly improve the efficiency of problem location.
第一方面,本发明提供了一种版本信息管理方法,包括:In a first aspect, the present invention provides a version information management method, including:
申请预设内存空间;Apply for a preset memory space;
确定参加脚本编译的一个或多个组件;Determining one or more components participating in the script compilation;
在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space until the version information of all the components is written into the preset memory space. ;
将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。Converting the version information in the preset memory space into a version file of a preset type, the preset type being a type readable by an operating system of the electronic device.
可选的,所述在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,包括:Optionally, when the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space, including:
在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair The key name is the identity of the component, and the key value in the key-value pair is the version number of the component.
可选的,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型,所述将所述预设内存空间中的版本信息转换为预设类型的版本文件,包括:Optionally, the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type, where the preset memory space is The version information is converted to a preset type of version file, including:
在编译脚本中调用配置信息函数向安卓***的配置文件中写入所述预设内存空间中所有的版本信息,其中,以变量形式写入所述预设内存空间中每个版本信息时,将与该版本信息对应的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与所述变量的值。In the compile script, the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form, The key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
可选的,在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,所述方法还包括:Optionally, after the converting the version information in the preset memory space into a version file of a preset type, the method further includes:
将所述预设类型的版本文件存储至预设存储空间;Saving the preset type of version file to a preset storage space;
在用户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。The version file of the preset type is displayed in a case where the user performs a preset operation for viewing the version file of the preset type.
可选的,在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,所述方法还包括:Optionally, after the converting the version information in the preset memory space into a version file of a preset type, the method further includes:
如果对所述一个或多个组件中每个组件的脚本文件进行编译时出现编译错误情况下,展示所述预设类型的版本文件。A version file of the preset type is displayed if a compile error occurs when compiling the script file for each of the one or more components.
第二方面,本发明实施例提供一种电子设备,所述电子设备包括:In a second aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes:
申请单元,用于申请预设内存空间;Application unit for applying for a preset memory space;
确定单元,用于确定参加脚本编译的一个或多个组件;a determining unit for determining one or more components participating in the script compilation;
写入单元,用于在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;a writing unit, configured to write version information of the component to the preset memory space when the script file of each component of the one or more components is compiled, until the version information of all components is written The preset memory space;
转换单元,用于将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。And a conversion unit, configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
可选的,所述写入单元用于:Optionally, the writing unit is configured to:
在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair The key name is the identity of the component, and the key value in the key-value pair is the version number of the component.
可选的,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型,所述转换单元用于:Optionally, the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type, and the converting unit is configured to:
在编译脚本中调用配置信息函数向安卓***的配置文件中写入所述预设内存空间中所有的版本信息,其中,以变量形式写入所述预设内存空间中每个版本信息时,将与该版本信息对应的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与所述变量的值。In the compile script, the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form, The key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
可选的,所述电子设备还包括:Optionally, the electronic device further includes:
第一展示单元,用于在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,将所述预设类型的版本文件存储至预设存储空间;在用 户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。a first display unit, configured to: after converting the version information in the preset memory space into a version file of a preset type, storing the version file of the preset type into a preset storage space; In the case of a preset operation for viewing a version file of the preset type, a version file of the preset type is displayed.
可选的,所述电子设备还包括:Optionally, the electronic device further includes:
第一展示单元,用于在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,如果对所述一个或多个组件中每个组件的脚本文件进行编译时出现编译错误情况下,展示所述预设类型的版本文件。a first display unit, configured to: after converting the version information in the preset memory space into a version file of a preset type, if the script file of each component of the one or more components is compiled In the case of a compile error, the version file of the preset type is displayed.
第三方面,本发明实施例提供一种电子设备,所述电子设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如前述第一方面实施例中所述的版本信息管理方法的步骤。In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes a processor, and the processor is configured to implement version information management as described in the foregoing first embodiment when executing a computer program stored in a memory. The steps of the method.
第四方面,本发明实施例提供了一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如前述第一方面实施例中所述的版本信息管理方法的步骤。In a fourth aspect, an embodiment of the present invention provides a readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the version information management method as described in the foregoing first embodiment is implemented. step.
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:The above one or more technical solutions in the embodiments of the present application have at least one or more of the following technical effects:
在本发明实施例的技术方案中,在进行编译之前,预先申请预设内存空间,然后确定参加脚本编译的一个或多个组件;在对一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入预设内存空间,直至所有组件的版本信息均写入预设内存空间,最后,将预设内存空间中的版本信息转换为电子设备的操作***可读类型的版本文件。这样,由于每次进行编译时,都需要申请个内存空间存储参加编译的各组件的版本信息,并且将内存空间中的版本信息转化为操作***可读类型的版本文件,当编译出现问题时,用户可通过查看该版本文件就可以快速定位到出现问题的组件,极大的提高问题定位的效率和方便用户和开发者之间进行有效的信息沟通。In the technical solution of the embodiment of the present invention, before compiling, pre-applying a preset memory space, and then determining one or more components participating in the script compilation; compiling the script file of each component in one or more components The version information of the component is written into the preset memory space until the version information of all the components is written into the preset memory space, and finally, the version information in the preset memory space is converted into the operating system readable type of the electronic device. Version file. In this way, each time you compile, you need to apply for a memory space to store the version information of each component participating in the compilation, and convert the version information in the memory space into a version file of the operating system readable type. When there is a problem in the compilation, By viewing the version file, the user can quickly locate the component in question, greatly improving the efficiency of problem location and facilitating effective information communication between the user and the developer.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为本发明第一实施例中的一种版本信息管理方法的流程图;1 is a flowchart of a version information management method in a first embodiment of the present invention;
图2为本发明第二实施例中的电子设备的示意图;2 is a schematic diagram of an electronic device in a second embodiment of the present invention;
图3为本发明第三实施例中电子设备的示意图。3 is a schematic diagram of an electronic device in a third embodiment of the present invention.
具体实施方式Detailed ways
本发明实施例提供了一种版本信息管理方法、电子设备及可读存储介质,用于快速的将参与编译的组件的版本信息进行统一记录,便于相关人员快速且直接查看到参与编译的各组件的版本信息,能够极大的提高问题定位的效率。该版本信息管理方法包括:申请预设内存空间;确定参加脚本编译的一个或多个组件;在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。The embodiment of the invention provides a version information management method, an electronic device and a readable storage medium, which are used for quickly recording the version information of components participating in the compilation, so that relevant personnel can quickly and directly view the components participating in the compilation. The version information can greatly improve the efficiency of problem location. The version information management method includes: applying a preset memory space; determining one or more components participating in the script compilation; and verifying the version information of the component when compiling the script file of each component of the one or more components Writing the preset memory space until the version information of all components is written into the preset memory space; converting the version information in the preset memory space into a preset type version file, the preset type A type readable by the operating system of an electronic device.
下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以及实施例中的技术特征可以相互组合。The technical solutions of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments. It is understood that the specific features of the embodiments and the embodiments of the present application are the detailed description of the technical solutions of the present application, and are not limited to the technical solutions of the present application. In the case of no conflict, the technical features in the embodiments of the present application and the embodiments may be combined with each other.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this context is merely an association describing the associated object, indicating that there may be three relationships, for example, A and / or B, which may indicate that A exists separately, and both A and B exist, respectively. B these three situations. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.
实施例Example
请参考图1,本发明第一实施例提供一种版本信息管理方法,该版本信息管理方法包括如下步骤:Referring to FIG. 1, a first embodiment of the present invention provides a version information management method, where the version information management method includes the following steps:
S101:申请预设内存空间;S101: Applying a preset memory space;
S102:确定参加脚本编译的一个或多个组件;S102: Determine one or more components that participate in script compilation;
S103:在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;S103: When compiling a script file of each component of the one or more components, writing version information of the component to the preset memory space until version information of all components is written to the preset Memory space
S104:将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。S104: Convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
其中,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型。The script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type.
具体的,在本实施例中,电子设备安装了安卓操作***,该操作***为基于JAVA的操作***,安卓操作***的应用程序的编译脚本是基于gradle来进行编写的,gradle是一种编译语言。在进行应用程序设计时,采用组件化技术,每个应用程序包括多个组件,每个组件中都含有一个编译的脚本文件build.gradle,在脚本文件build.gradle中有一个指示该组件的版本信息的变量信息。Specifically, in this embodiment, the electronic device is installed with an Android operating system, the operating system is a JAVA-based operating system, and the compiled script of the Android operating system application is written based on gradle, which is a compiled language. . In the application design, using component technology, each application includes multiple components, each component contains a compiled script file build.gradle, there is a version in the script file build.gradle indicating the component Variable information of the information.
在现有技术中,在开发应用程序时,与该应用程序对应的组件包括多个,每个组件又包括多个版本,通过文件解析的方式来解析各个组件编译脚本中定义的版本信息,然后将解析好的版本信息进行相应的存储,这种方式需要存储应用程序对应的所有组件的版本信息,由于应用程序会面临升级以及相关调试,参与编译的组件可按需要进行增加或删除以及变更,在参与编译的组件有变化时,无法动态地调整记录的组件的版本信息。即:现有技术中存储的是整个应用程序的各组件的版本信息。在出现编译错误时,通过人工定位出现问题的组件对应的版本信息。由于应用程序对应的组件可多达上百个,导致定位出问题组件的人工成本较高。In the prior art, when an application is developed, a component corresponding to the application includes a plurality of components, and each component includes multiple versions, and the version information defined in each component compilation script is parsed by file parsing, and then The parsed version information is stored accordingly. This method needs to store the version information of all the components corresponding to the application. Since the application will face upgrade and related debugging, the components participating in the compilation can be added, deleted, and changed as needed. When there are changes to the components involved in the compilation, the version information of the recorded components cannot be dynamically adjusted. That is, the version information of each component of the entire application is stored in the prior art. In the event of a compilation error, manually locate the version information corresponding to the component in question. Since the application can have up to hundreds of components, the labor cost of locating the problem component is high.
在本实施例中,主要描述基于gradle来动态记录参与当前编译的各个组件的版本号信息。由于每一个组件中都含有一个编译的脚本文件build.gradle,在编译脚本文件build.gradle中有指示该组件的版本信息的变量信息。在本实施例中,通过步骤S101,在进行编译之前,预先申请一个预设内存空间allVersion,该内存空间是一个独立的内存空间,为一个全局变量,用于存储参与编译的所有组件的版本信息。In this embodiment, the main description is based on gradle to dynamically record the version number information of each component participating in the current compilation. Since each component contains a compiled script file build.gradle, there is variable information in the compiled script file build.gradle indicating the version information of the component. In this embodiment, in step S101, before compiling, a preset memory space allVersion is applied in advance, and the memory space is an independent memory space, which is a global variable for storing version information of all components participating in the compilation. .
在通过步骤S101申请好内存空间以后,执行步骤S102与S103。由于各个组件的脚本文件是知道自己的版本信息的,所以,在应用程序编译脚本开始执行之前首先获取到全局变量allVersion,在对参与编译的组件进行编译时,调用该全局变量中的添加方法将当前编译的组件的版本信息写入申请好的预设内存空间allVersion中,在所有参加编译的组件均编译完成时,所有参加编译的组件中每个组件的版本信息均写入至预设内存空间allVersion。After the memory space is applied through step S101, steps S102 and S103 are performed. Since the script files of each component know their own version information, the global variable allVersion is first obtained before the application compiling script starts executing. When the compiling component is compiled, the adding method in the global variable is called. The version information of the currently compiled component is written into the preset memory space allVersion. When all the components participating in the compilation are compiled, the version information of each component participating in the compiled component is written to the preset memory space. allVersion.
进一步,在将参与编译的各个组件对应的版本信息写入预设内存空间时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。Further, when the version information corresponding to each component participating in the compilation is written into the preset memory space, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value is aligned. The key is named the identity of the component, and the key value in the key-value pair is the version number of the component.
具体的,以MAP键值对的数据格式申请预设内存空间,比如:参与编译的组件A的名称为A,该组件的版本号为A1,在编译该组件的脚本文件时,调用全局变量allVersion中的添加方法add将该组件的版本信息以键值对的方式写入该预设内存空间allVersion。键值名为A,该键值名对应的值为A1。通过这样的方式可将参与编译的各组件的版本信息以键值对的方式写入预设内存空间。Specifically, the preset memory space is applied in the data format of the MAP key value pair. For example, the name of the component A participating in the compilation is A, and the version number of the component is A1. When the script file of the component is compiled, the global variable allVersion is called. The add method add adds the version information of the component to the preset memory space allVersion as a key value pair. The key value is A, and the value corresponding to the key name is A1. In this way, the version information of each component participating in the compilation can be written into the preset memory space in a key value pair manner.
这种反向的设计思路使得不用像现有技术再去遍历文件来获取版本信息,直接在组件编译时将自己对应的版本信息复制到申请到的预设内存空间即可。可动态地记录参与编译的组件的版本信息,进而在编译出现错误时能够通过读取该预设内存空间的版本信息,即可快速定位到出问题的组件。This reverse design idea eliminates the need to traverse the file to obtain version information as in the prior art, and directly copies the corresponding version information to the preset memory space requested when the component is compiled. The version information of the components participating in the compilation can be dynamically recorded, so that when the compilation error occurs, the version information of the preset memory space can be read, and the component in question can be quickly located.
进一步,由于将参与编译的所有组件的版本信息写入预设内存空间后,由 于写入版本信息的方式是基于gradle编写,电子设备安装的安卓操作***无法解析出对应的版本信息,所以需要将预设内存空间中的版本信息转换为安卓操作***可读的JAVA类型的文件。Further, since the version information of all the components involved in the compilation is written into the preset memory space, since the way of writing the version information is based on gradle, the Android operating system installed by the electronic device cannot parse the corresponding version information, so it is necessary to The version information in the preset memory space is converted into a JAVA type file readable by the Android operating system.
接下来步骤S104主要描述如何将基于gradle编写的预设内存空间中的参与编译的所有组件的版本信息转存到对应的Java文件中。由于gradle没有提供gradle和JAVA直接进行交互的业务功能,仅仅提供了一个配置信息函数,现有技术中无法直接让gradle脚本和JAVA代码进行交互,本实施例中的方法主要利用gadle中的配置信息函数来实现该功能。The next step S104 mainly describes how to transfer the version information of all components participating in the compilation based on the preset memory space written by gradle into the corresponding Java file. Since gradle does not provide the business function of gradle and JAVA to directly interact, only a configuration information function is provided. In the prior art, the gradle script and the JAVA code cannot be directly interacted. The method in this embodiment mainly utilizes the configuration information in the gadle. Function to implement this function.
具体的,通过在gradle脚本中调用配置信息函数buildConfigField来向安卓的配置文件BuildConfig.java文件中写入预设内存空间中存储的版本信息。由于预设存储空间存储的参与编译的各组件的版本信息以键值对的方式写入,进而,在调用配置信息函数buildConfigField来向安卓的配置文件BuildConfig.java文件中写入版本信息时,以变量形式写入,每个版本信息的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与变量的值。通过这样的操作,编译完成后会在生成的配置BuildConfig.java文件中写入所有参与编译的各组件的版本信息,这样就完成了将参与编译的所有组件的基于gradle版本信息转换为JAVA文件。Specifically, the version information stored in the preset memory space is written into the Android configuration file BuildConfig.java file by calling the configuration information function buildConfigField in the gradle script. The version information of each component participating in the compilation stored in the preset storage space is written in a key value pair manner. Further, when the configuration information function buildConfigField is called to write the version information to the Android configuration file BuildConfig.java file, The variable form is written, and the key name in the key-value pair of each version information is converted into the variable name of the variable, and the key value in the key-value pair is converted into the value of the variable. Through such an operation, after the compilation is completed, the version information of all the components participating in the compilation is written in the generated configuration BuildConfig.java file, so that the gradle-based version information of all components participating in the compilation is converted into a JAVA file.
进一步,在将参与编译的所有组件的基于gradle版本信息转换为JAVA文件之后,提供但不限于下述两种展示该JAVA文件的方式。Further, after converting the gradle-based version information of all components participating in the compilation into a JAVA file, the following two ways of presenting the JAVA file are provided, but not limited to.
第一种:将所述预设类型的版本文件存储至预设存储空间;The first type: storing the version file of the preset type to a preset storage space;
在用户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。The version file of the preset type is displayed in a case where the user performs a preset operation for viewing the version file of the preset type.
具体的,在本实施例中,继续沿用上述示例,通过上述方式已经将参与编译的所有组件的基于gradle版本信息转换为JAVA文件BuildConfig.java中。然后,将该JAVA文件存储至预设存储空间,该预设存储空间可以是一个隐藏入口很深的位置,对应还设置有一个彩蛋功能。比如:在我的页面-关于软件-查看版本信息,对版本信息长按的时候会弹出一个页面,该页面上将展示参与编译的所有组件的版本信息。在具体实施过程中,预设存储空间以及预设操作可根据实际需要进行设定,在此,本申请不做限制。Specifically, in the embodiment, the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the JAVA file is stored in a preset storage space, and the preset storage space may be a position where the hidden entrance is deep, and an egg function is also provided correspondingly. For example: on my page - about software - view version information, a long press on the version information will pop up a page that will display the version information of all components involved in the compilation. In the specific implementation process, the preset storage space and the preset operation may be set according to actual needs, and the present application does not limit the application.
通过这种增加彩蛋功能的方式,用户能够快速方便获取到当前所有组件的版本信息,一旦应用程序出现异常的时候,需要获取应用程序当前组件的信息时,可以通过直接唤出彩蛋页面的方式来查看当前软件的各个组件的版本信息。Through this method of adding the egg function, the user can quickly and easily obtain the version information of all the current components. Once the application is abnormal, when the information of the current component of the application needs to be obtained, the method of directly calling the egg page can be View version information for each component of the current software.
第二种:如果对所述一个或多个组件中每个组件的脚本文件进行编译时出 现编译错误情况下,展示所述预设类型的版本文件。Second: If a compile error occurs when compiling the script file for each of the one or more components, the version file of the preset type is displayed.
具体的,在本实施例中,继续沿用上述示例,通过上述方式已经将参与编译的所有组件的基于gradle版本信息转换为JAVA文件BuildConfig.java中。然后,将该JAVA文件存储至预设存储空间。如果在对应用程序进行编译期间出现错误,编译不通过,或者在应用程序运行错误时,自动展示该预设类型的版本文件,以便于用户能够快速方便获取到当前所有组件的版本信息。Specifically, in the embodiment, the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the JAVA file is stored to a preset storage space. If an error occurs during compilation of the application, the compilation fails, or when the application runs incorrectly, the version file of the preset type is automatically displayed, so that the user can quickly and easily obtain the version information of all the current components.
在本发明实施例的技术方案中,在进行编译之前,预先申请预设内存空间,然后确定参加脚本编译的一个或多个组件;在对一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入预设内存空间,直至所有组件的版本信息均写入预设内存空间,最后,将预设内存空间中的版本信息转换为电子设备的操作***可读类型的版本文件。这样,由于每次进行编译时,都需要申请个内存空间存储参加编译的各组件的版本信息,并且将内存空间中的版本信息转化为操作***可读类型的版本文件,当编译出现问题时,用户可通过查看该版本文件就可以快速定位到出现问题的组件,极大的提高问题定位的效率和方便用户和开发者之间进行有效的信息沟通。In the technical solution of the embodiment of the present invention, before compiling, pre-applying a preset memory space, and then determining one or more components participating in the script compilation; compiling the script file of each component in one or more components The version information of the component is written into the preset memory space until the version information of all the components is written into the preset memory space, and finally, the version information in the preset memory space is converted into the operating system readable type of the electronic device. Version file. In this way, each time you compile, you need to apply for a memory space to store the version information of each component participating in the compilation, and convert the version information in the memory space into a version file of the operating system readable type. When there is a problem in the compilation, By viewing the version file, the user can quickly locate the component in question, greatly improving the efficiency of problem location and facilitating effective information communication between the user and the developer.
请参见图2,本发明的第二实施例提供了一种电子设备,所述电子设备包括:Referring to FIG. 2, a second embodiment of the present invention provides an electronic device, where the electronic device includes:
申请单元201,用于申请预设内存空间;The application unit 201 is configured to apply for a preset memory space;
确定单元202,用于确定参加脚本编译的一个或多个组件;a determining unit 202, configured to determine one or more components participating in the script compilation;
写入单元203,用于在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;The writing unit 203 is configured to: when compiling the script file of each component of the one or more components, write version information of the component to the preset memory space until the version information of all components is written Entering the preset memory space;
转换单元204,用于将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。The converting unit 204 is configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
其中,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型。The script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type.
具体的,在本实施例中,电子设备安装了安卓操作***,该操作***为基于JAVA的操作***,安卓操作***的应用程序的编译脚本是基于gradle来进行编写的,gradle是一种编译语言。在进行应用程序设计时,采用组件化技术,每个应用程序包括多个组件,每个组件中都含有一个编译的脚本文件build.gradle,在脚本文件build.gradle中有一个指示该组件的版本信息的变量信息。Specifically, in this embodiment, the electronic device is installed with an Android operating system, the operating system is a JAVA-based operating system, and the compiled script of the Android operating system application is written based on gradle, which is a compiled language. . In the application design, using component technology, each application includes multiple components, each component contains a compiled script file build.gradle, there is a version in the script file build.gradle indicating the component Variable information of the information.
在现有技术中,在开发应用程序时,与该应用程序对应的组件包括多个,每个组件又包括多个版本,通过文件解析的方式来解析各个组件编译脚本中定 义的版本信息,然后将解析好的版本信息进行相应的存储,这种方式需要存储应用程序对应的所有组件的版本信息,由于应用程序会面临升级以及相关调试,参与编译的组件可按需要进行增加或删除以及变更,在参与编译的组件有变化时,无法动态地调整记录的组件的版本信息。即:现有技术中存储的是整个应用程序的各组件的版本信息。在出现编译错误时,通过人工定位出现问题的组件对应的版本信息。由于应用程序对应的组件可多达上百个,导致定位出问题组件的人工成本较高。In the prior art, when an application is developed, a component corresponding to the application includes a plurality of components, and each component includes multiple versions, and the version information defined in each component compilation script is parsed by file parsing, and then The parsed version information is stored accordingly. This method needs to store the version information of all the components corresponding to the application. Since the application will face upgrade and related debugging, the components participating in the compilation can be added, deleted, and changed as needed. When there are changes to the components involved in the compilation, the version information of the recorded components cannot be dynamically adjusted. That is, the version information of each component of the entire application is stored in the prior art. In the event of a compilation error, manually locate the version information corresponding to the component in question. Since the application can have up to hundreds of components, the labor cost of locating the problem component is high.
在本实施例中,主要描述基于gradle来动态记录参与当前编译的各个组件的版本号信息。由于每一个组件中都含有一个编译的脚本文件build.gradle,在编译脚本文件build.gradle中有指示该组件的版本信息的变量信息。在本实施例中,通过申请单元201,在进行编译之前,预先申请一个预设内存空间allVersion,该内存空间是一个独立的内存空间,为一个全局变量,用于存储参与编译的所有组件的版本信息。In this embodiment, the main description is based on gradle to dynamically record the version number information of each component participating in the current compilation. Since each component contains a compiled script file build.gradle, there is variable information in the compiled script file build.gradle indicating the version information of the component. In this embodiment, through the application unit 201, before compiling, a preset memory space allVersion is applied in advance, and the memory space is an independent memory space, which is a global variable for storing versions of all components participating in the compilation. information.
在通过申请单元201申请好内存空间以后,确定单元202确定参与编译的一个或多个组件。由于各个组件的脚本文件是知道自己的版本信息的,所以,写入单元203在应用程序编译脚本开始执行之前首先获取到全局变量allVersion,在对参与编译的组件进行编译时,调用该全局变量中的添加方法将当前编译的组件的版本信息写入申请好的预设内存空间allVersion中,在所有参加编译的组件均编译完成时,所有参加编译的组件中每个组件的版本信息均写入至预设内存空间allVersion。After applying for a memory space by the application unit 201, the determining unit 202 determines one or more components participating in the compilation. Since the script file of each component knows its own version information, the writing unit 203 first acquires the global variable allVersion before the application compiling script starts executing, and calls the global variable when compiling the component participating in the compilation. The adding method writes the version information of the currently compiled component into the applied preset memory space allVersion. When all the compiling components are compiled, the version information of each component in the compiling component is written to The default memory space is allVersion.
进一步,写入单元203在将参与编译的各个组件对应的版本信息写入预设内存空间时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。Further, when the version information corresponding to each component participating in the compilation is written into the preset memory space, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the The key in the key-value pair is the identifier of the component, and the key-value in the key-value pair is the version number of the component.
具体的,以MAP键值对的数据格式申请预设内存空间,比如:参与编译的组件A的名称为A,该组件的版本号为A1,在编译该组件的脚本文件时,调用全局变量allVersion中的添加方法add将该组件的版本信息以键值对的方式写入该预设内存空间allVersion。键值名为A,该键值名对应的值为A1。通过这样的方式可将参与编译的各组件的版本信息以键值对的方式写入预设内存空间。Specifically, the preset memory space is applied in the data format of the MAP key value pair. For example, the name of the component A participating in the compilation is A, and the version number of the component is A1. When the script file of the component is compiled, the global variable allVersion is called. The add method add adds the version information of the component to the preset memory space allVersion as a key value pair. The key value is A, and the value corresponding to the key name is A1. In this way, the version information of each component participating in the compilation can be written into the preset memory space in a key value pair manner.
这种反向的设计思路使得不用像现有技术再去遍历文件来获取版本信息,直接在组件编译时将自己对应的版本信息复制到申请到的预设内存空间即可。可动态地记录参与编译的组件的版本信息,进而在编译出现错误时能够通过读取该预设内存空间的版本信息,即可快速定位到出问题的组件。This reverse design idea eliminates the need to traverse the file to obtain version information as in the prior art, and directly copies the corresponding version information to the preset memory space requested when the component is compiled. The version information of the components participating in the compilation can be dynamically recorded, so that when the compilation error occurs, the version information of the preset memory space can be read, and the component in question can be quickly located.
进一步,由于将参与编译的所有组件的版本信息写入预设内存空间后,由 于写入版本信息的方式是基于gradle编写,电子设备安装的安卓操作***无法解析出对应的版本信息,所以需要将预设内存空间中的版本信息转换为安卓操作***可读的JAVA类型的文件。Further, since the version information of all the components involved in the compilation is written into the preset memory space, since the way of writing the version information is based on gradle, the Android operating system installed by the electronic device cannot parse the corresponding version information, so it is necessary to The version information in the preset memory space is converted into a JAVA type file readable by the Android operating system.
接下来主要描述如何将基于gradle编写的预设内存空间中的参与编译的所有组件的版本信息转存到对应的Java文件中。由于gradle没有提供gradle和JAVA直接进行交互的业务功能,仅仅提供了一个配置信息函数,现有技术中无法直接让gradle脚本和JAVA代码进行交互,本实施例中电子设备方法主要利用gadle中的配置信息函数来实现该功能。Next, it mainly describes how to transfer the version information of all components participating in the compilation based on the preset memory space written by gradle to the corresponding Java file. Since gradle does not provide the business function of gradle and JAVA to directly interact, only a configuration information function is provided. In the prior art, the gradle script and the JAVA code cannot be directly interacted. In this embodiment, the electronic device method mainly utilizes the configuration in the gadle. Information function to implement this function.
具体的,转换单元204通过在gradle脚本中调用配置信息函数buildConfigField来向安卓的配置文件BuildConfig.java文件中写入预设内存空间中存储的版本信息。由于预设存储空间存储的参与编译的各组件的版本信息以键值对的方式写入,进而,转换单元204在调用配置信息函数buildConfigField来向安卓的配置文件BuildConfig.java文件中写入版本信息时,以变量形式写入,每个版本信息的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与变量的值。通过这样的操作,编译完成后会在生成的配置BuildConfig.java文件中写入所有参与编译的各组件的版本信息,这样就完成了将参与编译的所有组件的基于gradle版本信息转换为JAVA文件。Specifically, the conversion unit 204 writes the version information stored in the preset memory space to the Android configuration file BuildConfig.java file by calling the configuration information function buildConfigField in the gradle script. Since the version information of each component participating in the compilation of the preset storage space is written in a key value pair, the conversion unit 204 calls the configuration information function buildConfigField to write the version information to the Android configuration file BuildConfig.java file. When it is written as a variable, the key name in the key-value pair of each version information is converted into the variable name of the variable, and the key value in the key-value pair is converted into the value of the variable. Through such an operation, after the compilation is completed, the version information of all the components participating in the compilation is written in the generated configuration BuildConfig.java file, so that the gradle-based version information of all components participating in the compilation is converted into a JAVA file.
进一步,在将参与编译的所有组件的基于gradle版本信息转换为JAVA文件之后,提供但不限于下述两种展示该JAVA文件的方式。Further, after converting the gradle-based version information of all components participating in the compilation into a JAVA file, the following two ways of presenting the JAVA file are provided, but not limited to.
第一种:第一展示单元将所述预设类型的版本文件存储至预设存储空间;在用户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。The first type: the first display unit stores the version file of the preset type to a preset storage space; and displays the preset when the user performs a preset operation for viewing the version file of the preset type. The version file of the type.
具体的,在本实施例中,继续沿用上述示例,通过上述方式已经将参与编译的所有组件的基于gradle版本信息转换为JAVA文件BuildConfig.java中。然后,第一展示单元将该JAVA文件存储至预设存储空间,该预设存储空间可以是一个隐藏入口很深的位置,对应还设置有一个彩蛋功能。比如:在我的页面-关于软件-查看版本信息,对版本信息长按的时候会弹出一个页面,该页面上将展示参与编译的所有组件的版本信息。在具体实施过程中,预设存储空间以及预设操作可根据实际需要进行设定,在此,本申请不做限制。Specifically, in the embodiment, the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the first display unit stores the JAVA file to a preset storage space, and the preset storage space may be a position where the hidden entrance is deep, and an egg function is further disposed correspondingly. For example: on my page - about software - view version information, a long press on the version information will pop up a page that will display the version information of all components involved in the compilation. In the specific implementation process, the preset storage space and the preset operation may be set according to actual needs, and the present application does not limit the application.
通过这种增加彩蛋功能的方式,用户能够快速方便获取到当前所有组件的版本信息,一旦应用程序出现异常的时候,需要获取应用程序当前组件的信息时,可以通过直接唤出彩蛋页面的方式来查看当前软件的各个组件的版本信息。Through this method of adding the egg function, the user can quickly and easily obtain the version information of all the current components. Once the application is abnormal, when the information of the current component of the application needs to be obtained, the method of directly calling the egg page can be View version information for each component of the current software.
第二种:第二展示单元用于如果对所述一个或多个组件中每个组件的脚本 文件进行编译时出现编译错误情况下,展示所述预设类型的版本文件。Second: The second presentation unit is configured to display the version file of the preset type if a compile error occurs when compiling the script file of each of the one or more components.
具体的,在本实施例中,继续沿用上述示例,通过上述方式已经将参与编译的所有组件的基于gradle版本信息转换为JAVA文件BuildConfig.java中。然后,第一展示单元将该JAVA文件存储至预设存储空间。如果在对应用程序进行编译期间出现错误,编译不通过,或者在应用程序运行错误时,自动展示该预设类型的版本文件,以便于用户能够快速方便获取到当前所有组件的版本信息。Specifically, in the embodiment, the above example is continued, and the gradle-based version information of all components participating in the compilation has been converted into the JAVA file BuildConfig.java by the above manner. Then, the first display unit stores the JAVA file to a preset storage space. If an error occurs during compilation of the application, the compilation fails, or when the application runs incorrectly, the version file of the preset type is automatically displayed, so that the user can quickly and easily obtain the version information of all the current components.
请参见图3,本发明的第三实施例提供了一种电子设备,该实施例的电子设备包括:处理器301、存储器302以及存储在所述存储器中并可在所述处理器上运行的计算机程序,例如第一实施例中版本信息管理方法对应的程序。所述处理器执行所述计算机程序时实现上述第一实施例中各路径检测中的步骤。或者,所述处理器执行所述计算机程序时实现上述第二实施例的电子设备中各模块/单元的功能。Referring to FIG. 3, a third embodiment of the present invention provides an electronic device, where the electronic device includes: a processor 301, a memory 302, and is stored in the memory and operable on the processor. A computer program such as a program corresponding to the version information management method in the first embodiment. The steps in the path detection in the first embodiment described above are implemented when the processor executes the computer program. Alternatively, the processor implements the functions of the modules/units in the electronic device of the second embodiment described above when the computer program is executed.
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器中,并由所述处理器执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述计算机装置中的执行过程。例如,所述计算机程序可以被分割成申请单元、确定单元、写入单元和转换单元的功能,各单元具体功能如下:Illustratively, the computer program can be partitioned into one or more modules/units that are stored in the memory and executed by the processor to perform the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer program in the computer device. For example, the computer program can be divided into functions of an application unit, a determination unit, a write unit, and a conversion unit, and the specific functions of each unit are as follows:
申请单元,用于申请预设内存空间;Application unit for applying for a preset memory space;
确定单元,用于确定参加脚本编译的一个或多个组件;a determining unit for determining one or more components participating in the script compilation;
写入单元,用于在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;a writing unit, configured to write version information of the component to the preset memory space when the script file of each component of the one or more components is compiled, until the version information of all components is written The preset memory space;
转换单元,用于将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。And a conversion unit, configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
所述电子设备可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,所述示意图3仅仅是计算机装置的示例,并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备还可以包括输入输出设备、网络接入设备、总线等。The electronic device can include, but is not limited to, a processor, a memory. It will be understood by those skilled in the art that the schematic diagram 3 is merely an example of a computer device and does not constitute a limitation on an electronic device, and may include more or less components than those illustrated, or may combine certain components or different components. For example, the electronic device may further include an input and output device, a network access device, a bus, and the like.
所称处理器301可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编 程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述计算机装置的控制中心,利用各种接口和线路连接整个计算机装置的各个部分。The processor 301 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like, which is the control center of the computer device, which is connected to various parts of the entire computer device using various interfaces and lines.
所述存储器302可用于存储所述计算机程序和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现所述计算机装置的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作***、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、视频数据等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 302 can be used to store the computer program and/or module, the processor implementing the method by running or executing a computer program and/or module stored in the memory, and invoking data stored in the memory Various functions of a computer device. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored. Data created according to the use of the mobile phone (such as audio data, video data, etc.). In addition, the memory may include a high-speed random access memory, and may also include non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a Secure Digital (SD) card. , Flash Card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
进一步,该电子设备所包括的处理器301还具有以下功能:Further, the processor 301 included in the electronic device further has the following functions:
在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair The key name is the identity of the component, and the key value in the key-value pair is the version number of the component.
进一步,该电子设备所包括的处理器301还具有以下功能:Further, the processor 301 included in the electronic device further has the following functions:
在所述通过所述路径检测函数调用所述预设实例化对象对应的检测方法函数对路径进行检测之后,如果路径检测成功,则编译预设编译脚本;如果路径检测失败,则返回编译失败结果。After the path detection function is called by the path detection function to call the detection method function corresponding to the preset instantiation object, if the path detection is successful, the preset compilation script is compiled; if the path detection fails, the compilation failure result is returned. .
进一步,该电子设备所包括的处理器301还具有以下功能:Further, the processor 301 included in the electronic device further has the following functions:
所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型,所述转换单元用于:The script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is JAVA type, and the conversion unit is configured to:
在编译脚本中调用配置信息函数向安卓***的配置文件中写入所述预设内存空间中所有的版本信息,其中,以变量形式写入所述预设内存空间中每个版本信息时,将与该版本信息对应的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与所述变量的值。In the compile script, the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form, The key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
进一步,该电子设备所包括的处理器301还具有以下功能:Further, the processor 301 included in the electronic device further has the following functions:
在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,将所述预设类型的版本文件存储至预设存储空间;在用户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。After the version information in the preset memory space is converted into a version file of a preset type, the version file of the preset type is stored to a preset storage space; and the user performs a view for viewing the preset In the case of a preset operation of a version file of a type, a version file of the preset type is displayed.
进一步,该电子设备所包括的处理器301还具有以下功能:Further, the processor 301 included in the electronic device further has the following functions:
在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之 后,如果对所述一个或多个组件中每个组件的脚本文件进行编译时出现编译错误情况下,展示所述预设类型的版本文件。After the version information in the preset memory space is converted into a version file of a preset type, if a compile error occurs when compiling the script file of each component of the one or more components, The version file of the preset type.
本发明第四实施例提供了一种计算机可读存储介质,其上存储有计算机程序,本发明第二实施例中的所述电子设备集成的功能单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述第一实施例的版本信息管理方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。A fourth embodiment of the present invention provides a computer readable storage medium having stored thereon a computer program, and the functional unit integrated by the electronic device in the second embodiment of the present invention is implemented in the form of a software functional unit and is independent When the product is sold or used, it can be stored in a computer readable storage medium. Based on such understanding, the present invention implements all or part of the flow of the version information management method of the first embodiment described above, and may also be completed by a computer program to instruct related hardware, and the computer program may be stored in a computer readable manner. In the storage medium, the computer program, when executed by the processor, implements the steps of the various method embodiments described above. Wherein, the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form. The computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM). , random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
在本发明实施例的技术方案中,电子设备的接口库中预先创建有多个接口,每个接口中定义有检测方法函数,每个检测方法函数对应一个预设规则,进而,在编译期间检测ARouter的路径是否满足一个或多个预设规则时,在检测管理器中仅需要实例化该规则对应的接口对象,然后创建路径检测函数,通过该路径检测函数调用实例化对象中的检测方法函数即可对路径的合法性进行检测。提供一种ARouter中路径合法性的自动检测方法,减少了软件到运行期间因ARouter中路径不规范导致通信失败,进而花费大量的时间排查问题,极大的提高了开发效率,降低了人工成本。In the technical solution of the embodiment of the present invention, a plurality of interfaces are pre-created in the interface library of the electronic device, and each of the interfaces defines a detection method function, and each detection method function corresponds to a preset rule, and further, is detected during compilation. When the path of the ARouter satisfies one or more preset rules, only the interface object corresponding to the rule needs to be instantiated in the detection manager, and then a path detection function is created, and the detection method function in the instantiated object is called by the path detection function. The legitimacy of the path can be detected. An automatic detection method for path legitimacy in the ARouter is provided, which reduces the communication failure caused by the non-standard path in the ARouter during the software to run, and then spends a lot of time to troubleshoot the problem, greatly improving the development efficiency and reducing the labor cost.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (10)

  1. 一种版本信息管理方法,其特征在于,包括:A version information management method, comprising:
    申请预设内存空间;Apply for a preset memory space;
    确定参加脚本编译的一个或多个组件;Determining one or more components participating in the script compilation;
    在对确定参加脚本编译的所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;Compiling the script file of each component of the one or more components that are determined to participate in the script compilation, writing the version information of the component to the preset memory space until the version information of all components is written Preset memory space;
    将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。Converting the version information in the preset memory space into a version file of a preset type, the preset type being a type readable by an operating system of the electronic device.
  2. 如权利要求1所述的方法,其特征在于,所述在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,包括:The method according to claim 1, wherein when compiling a script file of each component of the one or more components, writing version information of the component to the preset memory space, include:
    在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair The key name is the identity of the component, and the key value in the key-value pair is the version number of the component.
  3. 如权利要求2所述的方法,其特征在于,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型,所述将所述预设内存空间中的版本信息转换为预设类型的版本文件,包括:The method according to claim 2, wherein the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is JAVA type, Converting the version information in the preset memory space into a version file of a preset type, including:
    在编译脚本中调用配置信息函数向安卓***的配置文件中写入所述预设内存空间中所有的版本信息,其中,以变量形式写入所述预设内存空间中每个版本信息时,将与该版本信息对应的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与所述变量的值。In the compile script, the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form, The key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
  4. 如权利要求1-3中任一权利要求所述的方法,其特征在于,在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,所述方法还包括:The method according to any one of claims 1 to 3, wherein after the converting the version information in the preset memory space into a version file of a preset type, the method further comprises:
    将所述预设类型的版本文件存储至预设存储空间;Saving the preset type of version file to a preset storage space;
    在用户进行用于查看所述预设类型的版本文件的预设操作情况下,展示所述预设类型的版本文件。The version file of the preset type is displayed in a case where the user performs a preset operation for viewing the version file of the preset type.
  5. 如权利要求1-3中任一权利要求所述的方法,其特征在于,在所述将所述预设内存空间中的版本信息转换为预设类型的版本文件之后,所述方法还包括:The method according to any one of claims 1 to 3, wherein after the converting the version information in the preset memory space into a version file of a preset type, the method further comprises:
    如果对所述一个或多个组件中每个组件的脚本文件进行编译时出现编译错误情况下,展示所述预设类型的版本文件。A version file of the preset type is displayed if a compile error occurs when compiling the script file for each of the one or more components.
  6. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    申请单元,用于申请预设内存空间;Application unit for applying for a preset memory space;
    确定单元,用于确定参加脚本编译的一个或多个组件;a determining unit for determining one or more components participating in the script compilation;
    写入单元,用于在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息写入所述预设内存空间,直至所有组件的版本信息均写入所述预设内存空间;a writing unit, configured to write version information of the component to the preset memory space when the script file of each component of the one or more components is compiled, until the version information of all components is written The preset memory space;
    转换单元,用于将所述预设内存空间中的版本信息转换为预设类型的版本文件,所述预设类型为电子设备的操作***可读的类型。And a conversion unit, configured to convert the version information in the preset memory space into a version file of a preset type, where the preset type is a type readable by an operating system of the electronic device.
  7. 如权利要求6所述的电子设备,其特征在于,所述写入单元用于:The electronic device of claim 6 wherein said writing unit is for:
    在对所述一个或多个组件中每个组件的脚本文件进行编译时,将该组件的版本信息以键值对的形式写入所述预设内存空间,其中,所述键值对中的键名为该组件的标识,所述键值对中的键值为该组件的版本号。When the script file of each component of the one or more components is compiled, the version information of the component is written into the preset memory space in the form of a key value pair, wherein the key value pair The key name is the identity of the component, and the key value in the key-value pair is the version number of the component.
  8. 如权利要求7所述的电子设备,其特征在于,所述一个或多个组件对应的脚本文件基于gradle编写,所述电子设备的操作***为安卓***,所述预设类型为JAVA类型,所述转换单元用于:The electronic device according to claim 7, wherein the script file corresponding to the one or more components is written based on gradle, the operating system of the electronic device is an Android system, and the preset type is a JAVA type. The conversion unit is used to:
    在编译脚本中调用配置信息函数向安卓***的配置文件中写入所述预设内存空间中所有的版本信息,其中,以变量形式写入所述预设内存空间中每个版本信息时,将与该版本信息对应的键值对中的键名转化为变量的变量名称,该键值对中的键值转化为与所述变量的值。In the compile script, the configuration information function is called to write all version information in the preset memory space to the configuration file of the Android system, where each version information in the preset memory space is written in a variable form, The key name in the key-value pair corresponding to the version information is converted into the variable name of the variable, and the key value in the key-value pair is converted to the value of the variable.
  9. 一种电子设备,其特征在于,所述电子设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如权利要求1-5中任一项所述的版本信息管理方法的步骤。An electronic device, comprising: a processor, wherein the processor is configured to perform the steps of the version information management method according to any one of claims 1 to 5 when the computer program stored in the memory is executed .
  10. 一种可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1-5中任一项所述的版本信息管理方法的步骤。A readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to implement the steps of the version information management method according to any one of claims 1-5.
PCT/CN2018/082169 2018-01-04 2018-04-08 Version information management method, electronic device and readable storage medium WO2019134287A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810008834.5 2018-01-04
CN201810008834.5A CN108170465B (en) 2018-01-04 2018-01-04 Version information management method, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2019134287A1 true WO2019134287A1 (en) 2019-07-11

Family

ID=62517247

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/082169 WO2019134287A1 (en) 2018-01-04 2018-04-08 Version information management method, electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN108170465B (en)
WO (1) WO2019134287A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110858147B (en) * 2018-08-24 2023-12-29 深圳市优必选科技有限公司 MCU information acquisition method and terminal equipment
CN110389781B (en) * 2019-05-31 2023-04-28 深圳赛安特技术服务有限公司 Version control-based localtorage cache implementation method, device and storage medium
CN111078225B (en) * 2019-11-21 2023-07-28 贝壳技术有限公司 Thermal reloading method and device, electronic equipment and storage medium
CN113342344B (en) * 2021-04-26 2024-02-27 贝壳找房(北京)科技有限公司 Flutter compiling flow intervention method and device
CN113590213B (en) * 2021-06-24 2023-04-25 深圳开源互联网安全技术有限公司 Component maintenance method, electronic device and storage medium
CN113821436B (en) * 2021-09-23 2023-08-29 北京天融信网络安全技术有限公司 Method and device for generating test script

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929600A (en) * 2012-06-13 2013-02-13 许继集团有限公司 ELF (executable and linkable format)-based monitoring system version recognition method
CN104881604A (en) * 2014-02-27 2015-09-02 中兴通讯股份有限公司 Method and apparatus for operating versions files
CN105447040A (en) * 2014-08-29 2016-03-30 阿里巴巴集团控股有限公司 Binary file management and update method and device, and binary file management system
US9454363B1 (en) * 2013-03-15 2016-09-27 Data Systems International, Inc. Mobile application development system and method
CN106201481A (en) * 2016-06-30 2016-12-07 传线网络科技(上海)有限公司 Assembly management method and apparatus in application development system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294514A (en) * 2013-06-26 2013-09-11 深圳Tcl新技术有限公司 System software release integrated method, compiling server and system
CN103729184B (en) * 2013-12-29 2017-05-17 国云科技股份有限公司 Software component combining and constructing method
US10282186B2 (en) * 2014-06-13 2019-05-07 Blackberry Limited Managing software suite component versions
CN104142846A (en) * 2014-08-06 2014-11-12 汉柏科技有限公司 Method and device for compiling program scripts
CN104881311B (en) * 2015-05-28 2018-06-08 南京南瑞继保电气有限公司 The judgment method and device of a kind of edition compatibility
CN106775845A (en) * 2016-11-30 2017-05-31 用友优普信息技术有限公司 A kind of method of software installation upgrading
CN106598673B (en) * 2016-12-16 2021-01-01 武汉斗鱼网络科技有限公司 Application program upgrading method and system
CN107577469B (en) * 2017-08-21 2019-12-17 厦门悦讯信息科技股份有限公司 software packaging and publishing management method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929600A (en) * 2012-06-13 2013-02-13 许继集团有限公司 ELF (executable and linkable format)-based monitoring system version recognition method
US9454363B1 (en) * 2013-03-15 2016-09-27 Data Systems International, Inc. Mobile application development system and method
CN104881604A (en) * 2014-02-27 2015-09-02 中兴通讯股份有限公司 Method and apparatus for operating versions files
CN105447040A (en) * 2014-08-29 2016-03-30 阿里巴巴集团控股有限公司 Binary file management and update method and device, and binary file management system
CN106201481A (en) * 2016-06-30 2016-12-07 传线网络科技(上海)有限公司 Assembly management method and apparatus in application development system

Also Published As

Publication number Publication date
CN108170465B (en) 2021-01-01
CN108170465A (en) 2018-06-15

Similar Documents

Publication Publication Date Title
WO2019134287A1 (en) Version information management method, electronic device and readable storage medium
CN109918055B (en) Application program generation method and device
US8793662B2 (en) Runtime code hooking for print driver and functionality testing
US9558016B2 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
US20050004973A1 (en) Reflection-based processing of input parameters for commands
WO2019227641A1 (en) Application testing method, apparatus, terminal device and medium
US11704139B2 (en) Service processing method and apparatus, electronic device, and storage medium
CN110716714B (en) Component creation method, device, computer system and computer readable storage medium
US9324063B2 (en) Contextual solicitation in a starter application
US10275234B2 (en) Selective bypass of code flows in software program
CN111078637B (en) Script file online method and device, computer equipment and storage medium
US10747514B2 (en) Reduced save and restore instructions for call-clobbered registers
WO2024152665A1 (en) Code construction method and apparatus, and computer device and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
WO2021129331A1 (en) Control method and control device for enabling operations of application program in multiple systems
CN110874216A (en) Complete code generation method, device, equipment and storage medium
WO2021022702A1 (en) Log insertion method and apparatus, computer apparatus and storage medium
CN115048083A (en) Visualization method and device for assembly, storage medium and electronic equipment
WO2019134286A1 (en) Path detection method, electronic device, and readable storage medium
CN113672465A (en) Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
US10671397B2 (en) Reduced save and restore instructions for call-clobbered registers
US20240103853A1 (en) Code maintenance system
TWI730384B (en) Image testing method, device, computer device and readbale storage medium
CN107479899B (en) File processing method and device, storage medium and processor
US10635731B2 (en) System for generating and executing editable multiple-step requests

Legal Events

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

Ref document number: 18898572

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18898572

Country of ref document: EP

Kind code of ref document: A1