CN114003210A - SDK-based multi-application program adaptation method, device, equipment and medium - Google Patents

SDK-based multi-application program adaptation method, device, equipment and medium Download PDF

Info

Publication number
CN114003210A
CN114003210A CN202111274190.2A CN202111274190A CN114003210A CN 114003210 A CN114003210 A CN 114003210A CN 202111274190 A CN202111274190 A CN 202111274190A CN 114003210 A CN114003210 A CN 114003210A
Authority
CN
China
Prior art keywords
folder
sdk
environment variable
application
software development
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111274190.2A
Other languages
Chinese (zh)
Inventor
陈棚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pingan Payment Technology Service Co Ltd
Original Assignee
Pingan Payment Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pingan Payment Technology Service Co Ltd filed Critical Pingan Payment Technology Service Co Ltd
Priority to CN202111274190.2A priority Critical patent/CN114003210A/en
Publication of CN114003210A publication Critical patent/CN114003210A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to research and development management, and provides a method, a device, equipment and a medium for adapting multiple application programs based on an SDK (software development kit). A global macro and a compiling item are initially created according to a project creation instruction, then an acquired software development kit to be packaged is stored in a first folder to update the first folder, an acquired resource file is imported into a second folder to update the second folder, an access layer is initially created, an original environment variable of a native project code is acquired, an SDK environment variable of the software development kit to be packaged is acquired, a difference environment variable is acquired according to the difference of the two to assign values to the environment variable of the access layer, and finally the environment variables of the first folder, the second folder and the access layer are compiled to obtain compiled output data. The SDK is used in a plug-in integration mode, a plurality of application programs can be adapted only by maintaining one set of service source codes, and the adaptation efficiency is improved.

Description

SDK-based multi-application program adaptation method, device, equipment and medium
Technical Field
The present invention relates to the field of development technologies of research and development management, and in particular, to a method and an apparatus for adapting multiple applications based on SDK, a computer device, and a storage medium.
Background
An applet is an application that can be used without downloading and installing, and is essentially a Software Development tool (Software Development Kit, abbreviated as SDK) that packages a section of program and then embeds the program into a designated application program. However, for different applications, the applet needs to be encoded according to corresponding requirements and then can be embedded into the corresponding application, and the applet cannot be directly compatible with the application used for adaptation and directly embedded into each application, which results in that the adaptation of the applet to the target application needs to be encoded according to the actual situation, and the adaptation efficiency is low.
Disclosure of Invention
The embodiment of the invention provides a multi-application program adaptation method, a device, computer equipment and a storage medium based on SDK, aiming at solving the problems that in the prior art, small programs can be embedded into corresponding application programs after being coded according to corresponding requirements aiming at different application programs, so that the small programs need to be coded according to actual situations for adapting target application programs, and the adaptation efficiency is low.
In a first aspect, an embodiment of the present invention provides an SDK-based multi-application adaptation method, which includes:
in response to a project creation instruction, initially creating a global macro and a compiled item according to the project creation instruction;
initially creating a first folder, and saving the acquired software development kit to be packaged to the first folder to update the first folder; wherein the first folder that is initially created is an empty folder;
initially creating a second folder, and importing the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder;
initially creating an access layer; wherein, the initial value of the environment variable of the access layer is null;
acquiring an original environment variable of a native project code, acquiring an SDK environment variable of a software development kit to be packaged, acquiring a difference environment variable according to the difference between the SDK environment variable and the original environment variable, and assigning a value to the environment variable of the access layer through the difference environment variable; the SDK environment variables are software development toolkit environment variables; and
and compiling the first folder, the second folder and the environment variables of the access layer to obtain compiled output data.
In a second aspect, an embodiment of the present invention provides an SDK-based multi-application adaptation apparatus, which includes:
a first initial creating unit, configured to, in response to a project creating instruction, initially create a global macro and a compiled item according to the project creating instruction;
the second initial creating unit is used for initially creating a first folder and saving the acquired software development kit to be packaged to the first folder so as to update the first folder; wherein the first folder that is initially created is an empty folder;
a third initial creating unit, configured to initially create a second folder, and import the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder;
a fourth initial creating unit, configured to initially create an access stratum; wherein, the initial value of the environment variable of the access layer is null;
the environment variable acquiring unit is used for acquiring an original environment variable of a native project code, acquiring an SDK environment variable of a software development kit to be packaged, acquiring a difference environment variable according to the difference between the SDK environment variable and the original environment variable, and assigning a value to the environment variable of the access layer through the difference environment variable; the SDK environment variables are software development toolkit environment variables; and
and the compiling output unit is used for compiling the first folder, the second folder and the environment variables of the access layer to obtain compiling output data.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the SDK-based multi-application adaptation method according to the first aspect.
In a fourth aspect, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the SDK-based multi-application adaptation method according to the first aspect.
The embodiment of the invention provides a multi-application program adapting method, a device, computer equipment and a storage medium based on SDK (software development kit). A global macro and a compiling item are initially created according to a project creation instruction, then an acquired software development kit to be packaged is stored in a first folder to update the first folder, an acquired resource file is imported into a second folder to update the second folder, an access layer is initially created, an original environment variable of a native project code is acquired, an SDK environment variable of the software development kit to be packaged is acquired, a difference environment variable is acquired according to the difference of the two to assign values to the environment variable of the access layer, and finally the environment variables of the first folder, the second folder and the access layer are compiled to obtain compiling output data. The SDK is used in a plug-in integration mode, a plurality of application programs can be adapted only by maintaining one set of service source codes, and the adaptation efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of an SDK-based multi-application adaptation method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an SDK-based multi-application adaptation method according to an embodiment of the present invention;
FIG. 3 is a schematic block diagram of an SDK-based multi-application adaptation apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of an SDK-based multi-application adaptation method according to an embodiment of the present invention; fig. 2 is a flowchart illustrating an SDK-based multi-application adaptation method according to an embodiment of the present invention, where the SDK-based multi-application adaptation method is applied to a server or a client, and the method is executed by application software installed in the server or the client.
As shown in fig. 2, the method includes steps S101 to S106.
S101, responding to a project creating instruction, and initially creating a global macro and a compiling item according to the project creating instruction.
In this embodiment, the technical solution of the present application can be implemented by using a user side or a server as an execution subject. For example, the user side is taken as an execution subject to illustrate in the present application, when a user uses a terminal such as a notebook computer or a desktop computer to edit an SDK package that can adapt to all application programs, a new project needs to be created first according to a project creation instruction, and then a global macro and a compilation item are initially created in the new project to construct a data base for a subsequently created project.
In one embodiment, the step S101 of initially creating a global macro according to the item creation instruction includes:
a header file is initially created, and a macro definition within the header file is initially created.
In this embodiment, the global macro needs to be created initially in the project, specifically, a Header file (i.e., a Header file) is created first, then macro definition is performed in the Header file, and finally a prefix (i.e., a prefix file) is searched in the buildset (i.e., the compilation setting) of the Header file, the prefix Header is found, a value is double-clicked, the Header file is dragged in, and the prefix file is set as a pre-compiled file, so that the process of the global macro is completed.
In one embodiment, the initially creating a macro definition within a header file includes:
and defining the screen size, the color, the application, the font and the inline function in the header file.
Wherein, the macro definition is performed in the Header file, and the following definitions can be specifically performed:
a1) a definition of SCREEN size (e.g., # define SCREEN _ BOUNDS ([ UIScreen mainScreen ]. BOUNDS));
a2) defining colors (e.g., # define RGBA (r, g, b, a) ([ UIColor color WithRed (r)/255.green (g)/255.blue (b)/255.alpha: a)));
a3) defining an application (e.g., [ [ application shared application ] delete ]));
a4) defining the font (e.g., # define BOLDSYSTEMFONT (FONTSIZE) [ UIFONT BOLDSystemFontOfSize: FONTSIZE ]);
a5) the definition of the INLINE function (e.g., # define RYJKIT _ STATIC _ INLINE STATIC INLINE) is performed.
The global macro creation is completed and the initial creation of the compilation item is also performed, wherein the compilation item can be understood as a specific data in the iOS, can be understood as a data which is necessarily included in the iOS output product, and can be more specifically understood as a compilation entry.
S102, initially creating a first folder, and storing the acquired software development kit to be packaged into the first folder to update the first folder; wherein the first folder that is initially created is an empty folder.
In this embodiment, in order to implement adaptation to different applications, a first folder with an empty initial value may be created in a new project for storing a to-be-packaged software development kit (that is, an SDK file to be packaged, which may also be understood as a to-be-packaged source code file), and the to-be-packaged software development kit includes a plurality of sub-software development kits for adapting to each application, for example, a first sub-software development kit for the application 1, a second sub-software development kit for the application 2, and the like. Because the source code files adapting to different application programs are stored in the new project in advance, the adaptability of the compiled output data is effectively improved. During specific implementation, a first folder with the file name of TARGET can be created, and then the SDK file to be packaged is imported into the TARGET for storage.
In an embodiment, step S102 further includes:
if the time interval between the current system time and the last updating time is equal to a preset acquisition period, acquiring a preset target address, and acquiring data according to the target address to obtain an application name set;
and acquiring the sub-source code file corresponding to each application name in the application name set, and forming a software development kit to be packaged according to the sub-source code file corresponding to each application name in the application name set.
In this embodiment, in order to increase the adaptability of the compiled output data, an application name set (corresponding to the hit application ranking list set) may be acquired by collecting a target address according to a certain period (for example, according to the preset collection period, more specifically, setting the collection period to be one week), then corresponding sub-source code files may be acquired one by one according to the application names included in the application name set, so as to form a software development kit to be packaged, and a source code file of the hit application may be acquired more comprehensively and packaged into a new project. For example, the application name set includes a smart city APP, a smart education APP, and the like, so as to be applied to scenes such as smart education, and promote the construction of the smart city.
S103, initially creating a second folder, and importing the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder.
In this embodiment, in order to adapt to different applications, a second folder with an empty initial value may be created in the new project for storing the resource file.
In one embodiment, step S103 includes:
if the size of the resource file is determined not to exceed a preset file size threshold, importing the resource file into the second folder to update the second folder;
and if the size of the resource file is determined not to exceed the file size threshold, acquiring a network path uploaded to a network server for storage by the resource file, and storing the network path to the second folder to update the second folder.
The small program has certain requirements on the volume of the code packet, the requirements cannot be larger than 2048kb (namely cannot exceed 2M), but the space occupied by some resource files of the project, such as static resources, is very large, at this time, the resource files need to be uploaded to a network server to obtain a network path (the network path is http:// or https://), and the network path is used as corresponding conversion data of the resource files and is stored in a second folder. Because the original resource file is not directly stored in the second folder, the volume of the whole code packet of the new project does not exceed 2M, and the requirement of occupying smaller volume is met.
In an embodiment, step S103 further includes, before:
and acquiring a sub-resource file corresponding to each application name in the application name set, and correspondingly converting the sub-resource file corresponding to each application name in the application name set into a network path to form a resource file.
In this embodiment, in order to increase the adaptability of the compiled output data, the application name set (corresponding to the hit application ranking list set) may be acquired by collecting the target address according to a certain period (for example, according to the preset collection period, more specifically, setting the collection period to be one week), and then the corresponding sub-resource files are acquired one by one according to the application names included in the application name set to form the resource file, so that the resource file of the hit application is more comprehensively acquired and packaged into a new project.
S104, initially establishing an access layer; and the initial value of the environment variable of the access layer is a null value.
In this embodiment, the access layer in the application may be understood as an interface (for example, if the wechat applet is used, the interface includes a data interface, a location interface, a media interface, a network interface, a device interface, an interface, and the like), which is used for interacting with a user to obtain user data. Because some data are only configured by default when the access stratum is initially created, the initial value is null when the environment variable of the access stratum is not assigned.
S105, obtaining an original environment variable of a native project code, obtaining an SDK environment variable of a software development kit to be packaged, obtaining a difference environment variable according to the difference between the SDK environment variable and the original environment variable, and assigning a value to the environment variable of the access layer through the difference environment variable; and the SDK environment variables are software development toolkit environment variables.
In this embodiment, since the new project includes the native project code in addition to the newly added code file and the resource file, at this time, the original environment variable of the native project code may be obtained first, the SDK environment variable of the software development kit to be packaged in the first folder may be obtained, then the SDK environment variable and the original environment variable may be compared to obtain difference data therebetween, and finally the difference environment variable may be obtained from the difference data. Once the difference environment variable is obtained, the environment variable of the access layer can be assigned quickly, and the attribute setting of the access layer is completed.
In one embodiment, step S105 includes:
acquiring sub-environment variables of each sub-software development kit in the software development kit to be packaged;
and comparing each sub-environment variable with the original environment variable to obtain a sub-difference environment variable corresponding to each sub-software development kit, and forming a difference environment variable by the sub-difference environment variable corresponding to each sub-software development kit.
In the present embodiment, the environment variables generally include development, experience, and formal environments. Configuration files such as develoop. js, release. js and triple. js are included in the sub-environment variables of each sub-software development kit, so that development and formal environments are distinguished. When creating the sub-environment variables of each sub-software development kit in detail, a config folder is newly created under a root directory of a new project, and a plurality of different environment configuration files such as env/dev.json and env/prod.json are respectively created under the config folder so as to respectively place configuration information of the environment; then establishing a project config.js file for placing default configuration in a root directory, and introducing the project config.js file into app.js, thereby realizing the introduction of configuration information into the project; secondly, adding two command lines in the packages of the items, starting different environments, establishing switches in a root directory, and processing configuration information by using nodes; and finally, when different command lines are input, dynamically writing the corresponding environment configuration information into a default configuration file and introducing the environment configuration information into the project.
In an embodiment, step S105 is preceded by:
the native project code is saved in a pre-created initial folder.
In this embodiment, in order to perform assignment of environment variables quickly, the native project code needs to be saved in the initial folders other than the first folder and the second folder in advance to implement initial code import of a new project. And various other attribute data of the new item, such as the initial environment variables, may be saved in the initial folder.
And S106, compiling the first folder, the second folder and the environment variables of the access layer to obtain compiled output data.
In this embodiment, when the code data import of the first folder is completed, the resource file import of the second folder is completed, and the environment variable assignment of the access layer is completed, the complete data file of the new project may be compiled to obtain the compiled output data. And then the compiled output data can be directly embedded into various hot application programs for direct use without specially adapting the application programs.
The method realizes that the SDK is integrally used through plug-in, a plurality of application programs can be adapted only by maintaining one set of service source codes, the adaptation efficiency is improved, the SDK is distinguished through global macro control, customized services are realized in corresponding macros, and service and environment decoupling is realized through the transmission of environment parameters of an access layer.
The embodiment of the invention also provides an SDK-based multi-application adaptation device, which is used for executing any embodiment of the SDK-based multi-application adaptation method. Specifically, referring to fig. 3, fig. 3 is a schematic block diagram of an SDK-based multi-application adaptation apparatus 100 according to an embodiment of the present invention. The device can be configured in a desktop computer, a tablet computer, a portable computer, and the like, and also can be configured in a server.
As shown in fig. 3, the SDK-based multi-application adaptation apparatus 100 includes a first initial creating unit 101, a second initial creating unit 102, a third initial creating unit 103, a fourth initial creating unit 104, an environment variable acquiring unit 105, and a compiling output unit 106.
A first initial creating unit 101, configured to, in response to a project creating instruction, initially create a global macro and a compiled item according to the project creating instruction.
In this embodiment, the technical solution of the present application can be implemented by using a user side or a server as an execution subject. For example, the user side is taken as an execution subject to illustrate in the present application, when a user uses a terminal such as a notebook computer or a desktop computer to edit an SDK package that can adapt to all application programs, a new project needs to be created first according to a project creation instruction, and then a global macro and a compilation item are initially created in the new project to construct a data base for a subsequently created project.
In an embodiment, the first initial creating unit 101 is further configured to:
a header file is initially created, and a macro definition within the header file is initially created.
In this embodiment, the global macro needs to be created initially in the project, specifically, a Header file (i.e., a Header file) is created first, then macro definition is performed in the Header file, and finally a prefix (i.e., a prefix file) is searched in the buildset (i.e., the compilation setting) of the Header file, the prefix Header is found, a value is double-clicked, the Header file is dragged in, and the prefix file is set as a pre-compiled file, so that the process of the global macro is completed.
In an embodiment, the first initial creating unit 101 is further configured to:
and defining the screen size, the color, the application, the font and the inline function in the header file.
Wherein, the macro definition is performed in the Header file, and the following definitions can be specifically performed:
a1) a definition of SCREEN size (e.g., # define SCREEN _ BOUNDS ([ UIScreen mainScreen ]. BOUNDS));
a2) defining colors (e.g., # define RGBA (r, g, b, a) ([ UIColor color WithRed (r)/255.green (g)/255.blue (b)/255.alpha: a)));
a3) defining an application (e.g., [ [ application shared application ] delete ]));
a4) defining the font (e.g., # define BOLDSYSTEMFONT (FONTSIZE) [ UIFONT BOLDSystemFontOfSize: FONTSIZE ]);
a5) the definition of the INLINE function (e.g., # define RYJKIT _ STATIC _ INLINE STATIC INLINE) is performed.
The global macro creation is completed and the initial creation of the compilation item is also performed, wherein the compilation item can be understood as a specific data in the iOS, can be understood as a data which is necessarily included in the iOS output product, and can be more specifically understood as a compilation entry.
A second initial creating unit 102, configured to initially create a first folder, and store the acquired software development kit to be packaged into the first folder to update the first folder; wherein the first folder that is initially created is an empty folder.
In this embodiment, in order to implement adaptation to different applications, a first folder with an empty initial value may be created in a new project for storing a to-be-packaged software development kit (that is, an SDK file to be packaged, which may also be understood as a to-be-packaged source code file), and the to-be-packaged software development kit includes a plurality of sub-software development kits for adapting to each application, for example, a first sub-software development kit for the application 1, a second sub-software development kit for the application 2, and the like. Because the source code files adapting to different application programs are stored in the new project in advance, the adaptability of the compiled output data is effectively improved. During specific implementation, a first folder with the file name of TARGET can be created, and then the SDK file to be packaged is imported into the TARGET for storage.
In one embodiment, the SDK based multi-application adaptation device 100 further comprises:
the system comprises an application name set acquisition unit, a storage unit and a processing unit, wherein the application name set acquisition unit is used for acquiring a preset target address and acquiring data according to the target address to obtain an application name set if the time interval between the current system time and the last updating time is equal to a preset acquisition period;
and the SDK to be packaged acquisition unit is used for acquiring the sub-source code file corresponding to each application name in the application name set and forming a software development kit to be packaged according to the sub-source code file corresponding to each application name in the application name set.
In this embodiment, in order to increase the adaptability of the compiled output data, an application name set (corresponding to the hit application ranking list set) may be acquired by collecting a target address according to a certain period (for example, according to the preset collection period, more specifically, setting the collection period to be one week), then corresponding sub-source code files may be acquired one by one according to the application names included in the application name set, so as to form a software development kit to be packaged, and a source code file of the hit application may be acquired more comprehensively and packaged into a new project.
A third initial creating unit 103, configured to initially create a second folder, and import the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder.
In this embodiment, in order to adapt to different applications, a second folder with an empty initial value may be created in the new project for storing the resource file.
In an embodiment, the third initial creating unit 103 includes:
the first import unit is used for importing the resource file into the second folder to update the second folder if the size of the resource file is determined not to exceed a preset file size threshold;
and the second import unit is used for acquiring a network path uploaded to a network server for storage if the size of the resource file is determined not to exceed the file size threshold, and storing the network path to the second folder for updating the second folder.
The small program has certain requirements on the volume of the code packet, the requirements cannot be larger than 2048kb (namely cannot exceed 2M), but the space occupied by some resource files of the project, such as static resources, is very large, at this time, the resource files need to be uploaded to a network server to obtain a network path (the network path is http:// or https://), and the network path is used as corresponding conversion data of the resource files and is stored in a second folder. Because the original resource file is not directly stored in the second folder, the volume of the whole code packet of the new project does not exceed 2M, and the requirement of occupying smaller volume is met.
In one embodiment, the SDK based multi-application adaptation device 100 further comprises:
and the resource file acquisition unit is used for acquiring the sub-resource file corresponding to each application name in the application name set and correspondingly converting the sub-resource file corresponding to each application name in the application name set into a network path to form a resource file.
In this embodiment, in order to increase the adaptability of the compiled output data, the application name set (corresponding to the hit application ranking list set) may be acquired by collecting the target address according to a certain period (for example, according to the preset collection period, more specifically, setting the collection period to be one week), and then the corresponding sub-resource files are acquired one by one according to the application names included in the application name set to form the resource file, so that the resource file of the hit application is more comprehensively acquired and packaged into a new project.
A fourth initial creating unit 104, configured to initially create an access stratum; and the initial value of the environment variable of the access layer is a null value.
In this embodiment, the access layer in the application may be understood as an interface (for example, if the wechat applet is used, the interface includes a data interface, a location interface, a media interface, a network interface, a device interface, an interface, and the like), which is used for interacting with a user to obtain user data. Because some data are only configured by default when the access stratum is initially created, the initial value is null when the environment variable of the access stratum is not assigned.
The environment variable acquiring unit 105 is configured to acquire an original environment variable of a native project code, acquire an SDK environment variable of a software development kit to be packaged, acquire a difference environment variable according to a difference between the SDK environment variable and the original environment variable, and assign a value to the environment variable of the access layer through the difference environment variable; and the SDK environment variables are software development toolkit environment variables.
In this embodiment, since the new project includes the native project code in addition to the newly added code file and the resource file, at this time, the original environment variable of the native project code may be obtained first, the SDK environment variable of the software development kit to be packaged in the first folder may be obtained, then the SDK environment variable and the original environment variable may be compared to obtain difference data therebetween, and finally the difference environment variable may be obtained from the difference data. Once the difference environment variable is obtained, the environment variable of the access layer can be assigned quickly, and the attribute setting of the access layer is completed.
In one embodiment, the environment variable acquiring unit 105 includes:
the sub-environment variable acquisition unit is used for acquiring the sub-environment variables of each sub-software development kit in the software development kit to be packaged;
and the sub-difference environment variable combination unit is used for comparing each sub-environment variable with the original environment variable to obtain a corresponding sub-difference environment variable of each sub-software development kit, and the sub-difference environment variables corresponding to each sub-software development kit form a difference environment variable.
In the present embodiment, the environment variables generally include development, experience, and formal environments. Configuration files such as develoop. js, release. js and triple. js are included in the sub-environment variables of each sub-software development kit, so that development and formal environments are distinguished. When creating the sub-environment variables of each sub-software development kit in detail, a config folder is newly created under a root directory of a new project, and a plurality of different environment configuration files such as env/dev.json and env/prod.json are respectively created under the config folder so as to respectively place configuration information of the environment; then establishing a project config.js file for placing default configuration in a root directory, and introducing the project config.js file into app.js, thereby realizing the introduction of configuration information into the project; secondly, adding two command lines in the packages of the items, starting different environments, establishing switches in a root directory, and processing configuration information by using nodes; and finally, when different command lines are input, dynamically writing the corresponding environment configuration information into a default configuration file and introducing the environment configuration information into the project.
In one embodiment, the SDK based multi-application adaptation device 100 further comprises:
and the native project code importing unit is used for saving the native project code in an initial folder created in advance.
In this embodiment, in order to perform assignment of environment variables quickly, the native project code needs to be saved in the initial folders other than the first folder and the second folder in advance to implement initial code import of a new project. And various other attribute data of the new item, such as the initial environment variables, may be saved in the initial folder.
And the compiling output unit 106 is configured to compile the first folder, the second folder and the environment variable of the access layer to obtain compiling output data.
In this embodiment, when the code data import of the first folder is completed, the resource file import of the second folder is completed, and the environment variable assignment of the access layer is completed, the complete data file of the new project may be compiled to obtain the compiled output data. And then the compiled output data can be directly embedded into various hot application programs for direct use without specially adapting the application programs.
The device has realized using SDK through plug-in components ization integration, only need maintain one set of business source code can adapt a plurality of application, has improved adaptation efficiency, distinguishes SDK through global macro control moreover, realizes the customization business in corresponding macro, passes through the access layer and transmits environmental parameter, realizes business and environmental decoupling.
The above-described SDK based multi-application adaptation means may be implemented in the form of a computer program which can be run on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 may be a server or a server cluster. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), and a big data and artificial intelligence platform. The user side can be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
Referring to fig. 4, the computer apparatus 500 includes a processor 502, a memory, which may include a storage medium 503 and an internal memory 504, and a network interface 505 connected by a device bus 501.
The storage medium 503 may store an operating device 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform an SDK-based multi-application adaptation method.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute the SDK-based multi-application adaptation method.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 4 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 500 to which aspects of the present invention may be applied, and that a particular computing device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run the computer program 5032 stored in the memory to implement the SDK-based multi-application adaptation method disclosed in the embodiment of the present invention.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 4 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 4, and are not described herein again.
It should be understood that, in the embodiment of the present invention, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a nonvolatile computer-readable storage medium or a volatile computer-readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the SDK based multi-application adaptation method disclosed by the embodiments of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a background server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A multi-application program adapting method based on SDK is characterized by comprising the following steps:
in response to a project creation instruction, initially creating a global macro and a compiled item according to the project creation instruction;
initially creating a first folder, and saving the acquired software development kit to be packaged to the first folder to update the first folder; wherein the first folder that is initially created is an empty folder;
initially creating a second folder, and importing the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder;
initially creating an access layer; wherein, the initial value of the environment variable of the access layer is null;
acquiring an original environment variable of a native project code, acquiring an SDK environment variable of a software development kit to be packaged, acquiring a difference environment variable according to the difference between the SDK environment variable and the original environment variable, and assigning a value to the environment variable of the access layer through the difference environment variable; the SDK environment variables are software development toolkit environment variables; and
and compiling the first folder, the second folder and the environment variables of the access layer to obtain compiled output data.
2. The SDK-based multi-application adaptation method of claim 1, wherein the initially creating a global macro according to the project creation instruction comprises:
a header file is initially created, and a macro definition within the header file is initially created.
3. The SDK based multi-application adaptation method of claim 2, wherein the initially creating the macro definition within the header file comprises:
and defining the screen size, the color, the application, the font and the inline function in the header file.
4. The SDK-based multi-application adaptation method of claim 1, wherein before initially creating the first folder and saving the obtained software development kit to be packaged to the first folder for updating the first folder, further comprising:
if the time interval between the current system time and the last updating time is equal to a preset acquisition period, acquiring a preset target address, and acquiring data according to the target address to obtain an application name set;
and acquiring the sub-source code file corresponding to each application name in the application name set, and forming a software development kit to be packaged according to the sub-source code file corresponding to each application name in the application name set.
5. The SDK-based multi-application adaptation method of claim 1, wherein before initially creating the second folder and importing the obtained resource files into the second folder to update the second folder, further comprising:
and acquiring a sub-resource file corresponding to each application name in the application name set, and correspondingly converting the sub-resource file corresponding to each application name in the application name set into a network path to form a resource file.
6. The SDK-based multi-application adaptation method according to claim 1, wherein the obtaining of the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged, obtaining the difference environment variables according to the differences between the SDK environment variables and the original environment variables, and assigning the environment variables of the access layer by the difference environment variables comprises:
acquiring sub-environment variables of each sub-software development kit in the software development kit to be packaged;
and comparing each sub-environment variable with the original environment variable to obtain a sub-difference environment variable corresponding to each sub-software development kit, and forming a difference environment variable by the sub-difference environment variable corresponding to each sub-software development kit.
7. The SDK-based multi-application adaptation method of claim 1, wherein the importing the obtained resource file into the second folder to update the second folder comprises:
if the size of the resource file is determined not to exceed a preset file size threshold, importing the resource file into the second folder to update the second folder;
and if the size of the resource file is determined not to exceed the file size threshold, acquiring a network path uploaded to a network server for storage by the resource file, and storing the network path to the second folder to update the second folder.
8. An SDK-based multi-application adaptation apparatus, comprising:
a first initial creating unit, configured to, in response to a project creating instruction, initially create a global macro and a compiled item according to the project creating instruction;
the second initial creating unit is used for initially creating a first folder and saving the acquired software development kit to be packaged to the first folder so as to update the first folder; wherein the first folder that is initially created is an empty folder;
a third initial creating unit, configured to initially create a second folder, and import the acquired resource file into the second folder to update the second folder; wherein the second folder that is initially created is an empty folder;
a fourth initial creating unit, configured to initially create an access stratum; wherein, the initial value of the environment variable of the access layer is null;
the environment variable acquiring unit is used for acquiring an original environment variable of a native project code, acquiring an SDK environment variable of a software development kit to be packaged, acquiring a difference environment variable according to the difference between the SDK environment variable and the original environment variable, and assigning a value to the environment variable of the access layer through the difference environment variable; the SDK environment variables are software development toolkit environment variables; and
and the compiling output unit is used for compiling the first folder, the second folder and the environment variables of the access layer to obtain compiling output data.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the SDK based multi-application adaptation method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to carry out the SDK based multi-application adaptation method of any one of claims 1 to 7.
CN202111274190.2A 2021-10-29 2021-10-29 SDK-based multi-application program adaptation method, device, equipment and medium Pending CN114003210A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111274190.2A CN114003210A (en) 2021-10-29 2021-10-29 SDK-based multi-application program adaptation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111274190.2A CN114003210A (en) 2021-10-29 2021-10-29 SDK-based multi-application program adaptation method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114003210A true CN114003210A (en) 2022-02-01

Family

ID=79925537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111274190.2A Pending CN114003210A (en) 2021-10-29 2021-10-29 SDK-based multi-application program adaptation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114003210A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880020A (en) * 2022-06-01 2022-08-09 北京百度网讯科技有限公司 Software development kit management method, related device and computer program product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880020A (en) * 2022-06-01 2022-08-09 北京百度网讯科技有限公司 Software development kit management method, related device and computer program product

Similar Documents

Publication Publication Date Title
CN109391509A (en) A kind of method, system and the application server of more new application
CN107797826B (en) Rule configuration method based on rule engine, terminal and equipment
CN104731589A (en) Automatic generation method and device of user interface (UI)
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
CN105159788B (en) Method and system for dynamically sharing resources between Android applications
CN111897520A (en) Front-end project framework construction method and device, computer equipment and storage medium
CN109669692B (en) Source code sharing method, server, computer readable storage medium and system
CN105373406B (en) Application layout dynamic switching method and system based on Android platform
CN110543327A (en) Service component multiplexing method and device, computer equipment and storage medium
CN110780897A (en) Code changing method and device
CN108920157B (en) Nginx software installation method and device, computer equipment and storage medium
CN105516154A (en) Security policy configuration method and device applied to SEAndroid (Security-Enhanced Android) system
CN109213533A (en) A kind of advertisement SDK dynamic loading method, device and terminal
CN114003210A (en) SDK-based multi-application program adaptation method, device, equipment and medium
CN110989986A (en) Software template-based software generation method and device and computer equipment
CN113485722A (en) Application program shelf loading method and processing method for application store and computer equipment
CN112596746A (en) Application installation package generation method and device, computer equipment and storage medium
JP2014164545A (en) Deployment method and program
CN112269635A (en) Method and system for configuring functional module, electronic device and storage medium
CN112714148A (en) Interface configuration method, device, equipment and medium
US11017032B1 (en) Document recovery utilizing serialized data
US20180165376A1 (en) Configuration resolution for transitive dependencies
KR20150137766A (en) System and method for creating stack of virtual machine
RU2786200C1 (en) System and method for installing a personalised application on a mobile device
CN112486556B (en) Method, system, terminal and storage medium for server to be compatible with BMC

Legal Events

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