Multi-application adaptation method, device and equipment based on SDK, and medium
By initially creating global macros and compilation items, saving the software development kit and resource files to be packaged, and obtaining and assigning access layer environment variables, the problem of low adaptation efficiency of mini programs in different applications is solved, and efficient adaptation of multiple applications is achieved.
Patent Information
- Application Number
- CN202111274190.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-10-29
AI Technical Summary
Mini programs need to be coded according to the specific requirements of different applications before they can be embedded, resulting in low adaptation efficiency.
By initially creating global macros and compilation items, saving the software development kit and resource files to be packaged, obtaining and assigning access layer environment variables, and compiling to generate compilation output data, plug-in integration is achieved.
This allows for adaptation to multiple applications by maintaining only one set of business source code, thus improving adaptation efficiency.
Smart Images

Figure CN114003210B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of development technology in R&D management, and in particular to a method, apparatus, computer device and storage medium for adapting multiple applications based on SDK. Background Technology
[0002] A mini-program is an application that can be used without downloading or installing. Essentially, it's a program packaged into a Software Development Kit (SDK) and embedded into a specified application. However, mini-programs require specific coding requirements before embedding into different applications. They cannot directly adapt to and embed into all applications, leading to inefficient adaptation processes. Summary of the Invention
[0003] This invention provides a method, apparatus, computer device, and storage medium for adapting multiple applications based on an SDK. It aims to solve the problem in the prior art that, for different applications, the mini-program needs to be encoded according to specific requirements before it can be embedded into the corresponding application. This results in low adaptation efficiency because the mini-program needs to be encoded according to the actual situation to adapt to the target application.
[0004] In a first aspect, embodiments of the present invention provide a multi-application adaptation method based on an SDK, comprising:
[0005] In response to the project creation instruction, global macros and compilation items are initially created according to the project creation instruction;
[0006] Initially, a first folder is created, and the obtained software development kit to be packaged is saved to the first folder to update the first folder; wherein, the first folder is initially created as an empty folder;
[0007] Initially, a second folder is created, and the acquired resource files are imported into the second folder to update it; the initially created second folder is empty.
[0008] Initially create the access layer; wherein, the environment variables of the access layer are initially empty;
[0009] The system retrieves the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. Based on the differences between the SDK environment variables and the original environment variables, it obtains difference environment variables and assigns values to the environment variables of the access layer using these difference environment variables. The SDK environment variables are software development kit environment variables.
[0010] The compilation output data is obtained by compiling the environment variables of the first folder, the second folder, and the access layer.
[0011] Secondly, embodiments of the present invention provide an SDK-based multi-application adaptation device, comprising:
[0012] The first initial creation unit is used to initially create global macros and compilation items according to the project creation instruction in response to the project creation instruction;
[0013] The second initial creation unit is used to initially create the first folder and save the obtained software development kit to be packaged to the first folder to update the first folder; wherein, the initially created first folder is an empty folder;
[0014] The third initial creation unit is used to initially create the second folder and import the acquired resource files into the second folder to update the second folder; wherein, the initially created second folder is an empty folder;
[0015] The fourth initial creation unit is used to initially create the access layer; wherein the environment variables of the access layer are initially empty.
[0016] An environment variable acquisition unit is used to acquire the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. It acquires difference environment variables based on the differences between the SDK environment variables and the original environment variables, and assigns values to the environment variables of the access layer using these difference environment variables. The SDK environment variables are software development kit environment variables.
[0017] The compilation output unit is used to compile the environment variables of the first folder, the second folder, and the access layer to obtain compilation output data.
[0018] Thirdly, embodiments of the present invention provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the SDK-based multi-application adaptation method described in the first aspect.
[0019] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, causes the processor to perform the SDK-based multi-application adaptation method described in the first aspect.
[0020] This invention provides a method, apparatus, computer device, and storage medium for adapting multiple applications based on an SDK. First, global macros and compilation items are initially created according to project creation instructions. Then, the acquired software development kit (SDK) to be packaged is saved to a first folder to update the first folder. The acquired resource files are imported to a second folder to update the second folder. An access layer is initially created, and the original environment variables of the native project code and the SDK environment variables of the SSD to be packaged are obtained. Difference environment variables are obtained based on the differences between the two and used to assign values to the environment variables of the access layer. Finally, the environment variables of the first folder, the second folder, and the access layer are compiled to obtain the compiled output data. This achieves the integration and use of the SDK through plug-in architecture, requiring only one set of business source code to adapt to multiple applications, thus improving adaptation efficiency. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram illustrating an application scenario of the SDK-based multi-application adaptation method provided in this embodiment of the invention.
[0023] Figure 2 A flowchart illustrating the SDK-based multi-application adaptation method provided in this embodiment of the invention;
[0024] Figure 3 A schematic block diagram of an SDK-based multi-application adaptation device provided in an embodiment of the present invention;
[0025] Figure 4 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0029] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0030] Please see Figure 1 and Figure 2 , Figure 1 This is a schematic diagram illustrating an application scenario of the SDK-based multi-application adaptation method provided in this embodiment of the invention. Figure 2 This is a flowchart illustrating the SDK-based multi-application adaptation method provided in an embodiment of the present invention. The SDK-based multi-application adaptation method is applied to a server or a user terminal, and is executed by application software installed on the server or user terminal.
[0031] like Figure 2 As shown, the method includes steps S101 to S106.
[0032] S101. In response to the project creation instruction, initially create global macros and compilation items according to the project creation instruction.
[0033] In this embodiment, the technical solution of this application can be implemented by either the user terminal or the server as the execution subject. For example, this application uses the user terminal as the execution subject to illustrate that when a user uses a terminal such as a laptop or desktop computer to edit an SDK package that can be adapted to all applications, they first need to create a new project according to the project creation instructions, and then initially create global macros and compilation items in the new project to build a data foundation for subsequent project creation.
[0034] In one embodiment, step S101, which involves initially creating a global macro based on the project creation instruction, includes:
[0035] Initialize the header file and the macro definitions within it.
[0036] In this embodiment, the initial step in the project is to create a global macro. Specifically, first, a Header file is created, then the macro is defined within the Header file, and finally, the prefix file is searched for in the Header file's buildSettings. Once the prefix header is found, its value is double-clicked, the Header file is dragged in, and it is set as a precompiled file, thus completing the process of creating a global macro.
[0037] In one embodiment, the macro definitions within the initial creation header file include:
[0038] The header file contains the definitions for screen size, color, application, font, and inline functions.
[0039] Macros can be defined within the Header file, specifically as follows:
[0040] a1) Define the screen size (e.g., #define SCREEN_BOUNDS([UIScreen mainScreen].bounds));
[0041] a2) Define the color (e.g., #define RGBA(r,g,b,a)([UIColor colorWithRed:(r) / 255.green:(g) / 255.blue:(b) / 255.alpha:a]));
[0042] a3) Define the application (e.g., #define kAppDelegate([[UIApplication sharedApplication]delegate]));
[0043] a4) Define the font (e.g., #define BOLDSYSTEMFONT(FONTSIZE)[UIFontboldSystemFontOfSize:FONTSIZE]);
[0044] a5) Define inline functions (e.g., #define RYJKIT_STATIC_INLINE static inline).
[0045] While creating global macros, the initial creation of compilation items must also be performed. Here, compilation items can be understood as specific data in iOS, data that must be included in the iOS output, or more specifically, the compilation entry point.
[0046] S102. Initially create a first folder and save the obtained software development kit to be packaged to the first folder to update the first folder; wherein, the initially created first folder is an empty folder.
[0047] In this embodiment, to achieve adaptation to different applications, a first folder with an initial empty value can be created in the new project to store the software development kit (SDK file to be packaged, which can also be understood as the source code file to be packaged). The SSDK file to be packaged includes several sub-SDK files adapted to each application, such as a first sub-SDK file for application 1, a second sub-SDK file for application 2, etc. Since the source code files adapted to different applications are pre-saved in the new project, the compatibility of the compiled output data is effectively improved. Specifically, a first folder named TARGET can be created, and the SDK file to be packaged is imported into TARGET for storage.
[0048] In one embodiment, the method further includes the following step before step S102:
[0049] If it is determined that the time interval between the current system time and the previous update time is equal to the preset collection period, the preset target address is obtained, and data is collected based on the target address to obtain the application name set;
[0050] Obtain the sub-source code file corresponding to each application name in the application name set, and assemble the software development kit to be packaged based on the sub-source code file corresponding to each application name in the application name set.
[0051] In this embodiment, to increase the adaptability of the compiled output data, an application name set (corresponding to a popular application ranking list) can be collected from the target address at a certain period (such as according to the preset collection period mentioned above, more specifically, the collection period can be set to one week). Then, according to the application names included in the application name set, the corresponding sub-source code files are obtained one by one to form a software development kit to be packaged, thus obtaining the source code files of popular applications more comprehensively and packaging them into the new project. For example, the application name set includes smart city apps, smart education apps, etc., to be applied in smart education and other scenarios, thereby promoting the construction of smart cities.
[0052] S103. Initially create a second folder and import the acquired resource files into the second folder to update the second folder; wherein, the initially created second folder is an empty folder.
[0053] In this embodiment, in order to adapt to different applications, a second folder with an initial value of empty can be created in the new project to store resource files.
[0054] In one embodiment, step S103 includes:
[0055] If it is determined that the size of the resource file does not exceed the preset file size threshold, the resource file is imported into the second folder to update the second folder;
[0056] If it is determined that the size of the resource file does not exceed the file size threshold, the network path of the resource file uploaded to the network server is obtained, and the network path is stored in the second folder to update the second folder.
[0057] Because WeChat Mini Programs have a size limit for the code package (not exceeding 2048kb, or 2MB), but some resource files, such as static resources, can be quite large, it's necessary to upload these resource files to a web server to obtain their web paths (e.g., http: / / or https: / / ). These web paths are then used as the corresponding converted data for the resource files and saved in a second folder. Since the original resource files aren't stored directly in the second folder, the overall code package size of the new project won't exceed 2MB, thus meeting the requirement of a small file size.
[0058] In one embodiment, the method further includes the following steps before step S103:
[0059] Obtain the sub-resource file corresponding to each application name in the application name set, and convert the sub-resource file corresponding to each application name in the application name set into a network path to form a resource file.
[0060] In this embodiment, in order to increase the adaptability of the compiled output data, the application name set (corresponding to the popular application ranking list) can still be collected from the target address at a certain period (such as according to the above-mentioned preset collection period, more specifically, the collection period is set to one week). Then, according to the application names included in the application name set, the corresponding sub-resource files are obtained one by one to form a resource file, thereby realizing a more comprehensive acquisition of the resource files of popular applications and packaging them into the new project.
[0061] S104. Initially create the access layer; wherein, the initial values of the environment variables of the access layer are empty.
[0062] In this embodiment, the access layer in the application can be understood as an interface (taking WeChat Mini Program as an example, the interfaces include data interface, location interface, media interface, network interface, device interface, and UI interface, etc.), used to interact with the user to obtain user data. Since only some data is configured by default when the access layer is initially created, its initial value is empty if the environment variables of the access layer are not assigned values.
[0063] S105. Obtain the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. Obtain the difference environment variables based on the difference between the SDK environment variables and the original environment variables, and assign values to the environment variables of the access layer through the difference environment variables; wherein, the SDK environment variables are software development kit environment variables.
[0064] In this embodiment, since the new project includes not only newly added code and resource files but also native project code, we can first obtain the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged in the first folder. Then, we can compare the SDK environment variables with the original environment variables to obtain the difference data between them. Finally, we can obtain the difference environment variables from the difference data. Once the difference environment variables are obtained, we can quickly assign values to the environment variables of the access layer to complete the attribute settings of the access layer.
[0065] In one embodiment, step S105 includes:
[0066] Obtain the sub-environment variables of each sub-software development kit in the software development kit to be packaged;
[0067] Each sub-environment variable is compared with the original environment variable to obtain the corresponding sub-difference environment variable for each sub-software development kit. The difference environment variable is composed of the corresponding sub-difference environment variables for each sub-software development kit.
[0068] In this embodiment, environment variables generally include three environments: development, trial, and production. Each sub-software development kit (SDK) includes configuration files such as `develop.js`, `release.js`, and `trial.js` to distinguish between development and production environments. Specifically, when creating the sub-environment variables for each SSD, a `config` folder is first created in the root directory of the new project. Within the `config` folder, several different environment configuration files, such as `env / dev.json` and `env / prod.json`, are created to store the configuration information for that environment. Then, a `projectConfig.js` file containing the default configuration is created in the root directory and imported into `app.js`, thus importing the configuration information into the project. Next, two command lines are added to the `scripts` section of the project's `package.json` to start different environments, and a `switch.js` file is created in the root directory to process the configuration information using Node.js. Finally, when different command lines are entered, the corresponding environment configuration information is dynamically written to the default configuration file and imported into the project.
[0069] In one embodiment, the method further includes the following steps before step S105:
[0070] Save the native project code in a pre-created initial folder.
[0071] In this embodiment, to quickly assign values to environment variables, the original project code needs to be saved in an initial folder that is neither the first nor the second folder to import the initial code of the new project. Furthermore, various other attribute data of the new project, such as initial environment variables, can also be saved in this initial folder.
[0072] S106. Compile the environment variables of the first folder, the second folder, and the access layer to obtain the compilation output data.
[0073] In this embodiment, after importing the code data into the first folder, importing the resource files into the second folder, and assigning values to the environment variables in the access layer, the complete data files of the new project can be compiled to obtain the compiled output data. This compiled output data can then be directly embedded into various popular applications for use without requiring specific application adaptation.
[0074] This method enables the use of SDKs through plug-in integration. Only one set of business source code needs to be maintained to adapt to multiple applications, which improves the adaptation efficiency. Moreover, the SDKs are differentiated by global macro control, and customized business is implemented in the corresponding macros. Environmental parameters are passed through the access layer to achieve decoupling between business and environment.
[0075] This invention also provides an SDK-based multi-application adaptation device, which is used to execute any of the aforementioned SDK-based multi-application adaptation methods. Specifically, please refer to... Figure 3 , Figure 3 This is a schematic block diagram of an SDK-based multi-application adaptation device 100 provided in an embodiment of the present invention. This device can be configured in user terminals such as desktop computers, tablet computers, and laptops, or it can be configured in a server.
[0076] Among them, such as Figure 3 As shown, the SDK-based multi-application adaptation device 100 includes a first initial creation unit 101, a second initial creation unit 102, a third initial creation unit 103, a fourth initial creation unit 104, an environment variable acquisition unit 105, and a compilation output unit 106.
[0077] The first initial creation unit 101 is used to initially create global macros and compilation items according to the project creation instruction in response to the project creation instruction.
[0078] In this embodiment, the technical solution of this application can be implemented by either the user terminal or the server as the execution subject. For example, this application uses the user terminal as the execution subject to illustrate that when a user uses a terminal such as a laptop or desktop computer to edit an SDK package that can be adapted to all applications, they first need to create a new project according to the project creation instructions, and then initially create global macros and compilation items in the new project to build a data foundation for subsequent project creation.
[0079] In one embodiment, the first initial creation unit 101 is further configured to:
[0080] Initialize the header file and the macro definitions within it.
[0081] In this embodiment, the initial step in the project is to create a global macro. Specifically, first, a Header file is created, then the macro is defined within the Header file, and finally, the prefix file is searched for in the Header file's buildSettings. Once the prefix header is found, its value is double-clicked, the Header file is dragged in, and it is set as a precompiled file, thus completing the process of creating a global macro.
[0082] In one embodiment, the first initial creation unit 101 is further configured to:
[0083] The header file contains the definitions for screen size, color, application, font, and inline functions.
[0084] Macros can be defined within the Header file, specifically as follows:
[0085] a1) Define the screen size (e.g., #define SCREEN_BOUNDS([UIScreen mainScreen].bounds));
[0086] a2) Define the color (e.g., #define RGBA(r,g,b,a)([UIColor colorWithRed:(r) / 255.green:(g) / 255.blue:(b) / 255.alpha:a]));
[0087] a3) Define the application (e.g., #define kAppDelegate([[UIApplication sharedApplication]delegate]));
[0088] a4) Define the font (e.g., #define BOLDSYSTEMFONT(FONTSIZE)[UIFontboldSystemFontOfSize:FONTSIZE]);
[0089] a5) Define inline functions (e.g., #define RYJKIT_STATIC_INLINE static inline).
[0090] While creating global macros, the initial creation of compilation items must also be performed. Here, compilation items can be understood as specific data in iOS, data that must be included in the iOS output, or more specifically, the compilation entry point.
[0091] The second initial creation unit 102 is used to initially create a first folder and save the obtained software development kit to be packaged to the first folder to update the first folder; wherein, the initially created first folder is an empty folder.
[0092] In this embodiment, to achieve adaptation to different applications, a first folder with an initial empty value can be created in the new project to store the software development kit (SDK file to be packaged, which can also be understood as the source code file to be packaged). The SSDK file to be packaged includes several sub-SDK files adapted to each application, such as a first sub-SDK file for application 1, a second sub-SDK file for application 2, etc. Since the source code files adapted to different applications are pre-saved in the new project, the compatibility of the compiled output data is effectively improved. Specifically, a first folder named TARGET can be created, and the SDK file to be packaged is imported into TARGET for storage.
[0093] In one embodiment, the SDK-based multi-application adaptation device 100 further includes:
[0094] The application name set acquisition unit is used to acquire a preset target address if it is determined that the time interval between the current system time and the previous update time is equal to a preset collection period, and to collect data based on the target address to obtain an application name set.
[0095] The SDK acquisition unit is used to acquire the sub-source code file corresponding to each application name in the application name set, and to assemble the software development kit to be packaged based on the sub-source code file corresponding to each application name in the application name set.
[0096] In this embodiment, in order to increase the adaptability of the compiled output data, the application name set (corresponding to the popular application ranking list) can be collected from the target address at a certain period (such as according to the above-mentioned preset collection period, more specifically, the collection period is set to one week). Then, according to the application names included in the application name set, the corresponding sub-source code files are obtained one by one to form a software development kit to be packaged, so as to obtain the source code files of popular applications more comprehensively and package them into the new project.
[0097] The third initial creation unit 103 is used to initially create the second folder and import the acquired resource files into the second folder to update the second folder; wherein, the initially created second folder is an empty folder.
[0098] In this embodiment, in order to adapt to different applications, a second folder with an initial value of empty can be created in the new project to store resource files.
[0099] In one embodiment, the third initial creation unit 103 includes:
[0100] The first import unit is used to import the resource file into the second folder to update the second folder if it is determined that the size of the resource file does not exceed a preset file size threshold.
[0101] The second import unit is used to, if it is determined that the size of the resource file does not exceed the file size threshold, obtain the network path of the resource file uploaded to the network server for storage, and store the network path in the second folder to update the second folder.
[0102] Because WeChat Mini Programs have a size limit for the code package (not exceeding 2048kb, or 2MB), but some resource files, such as static resources, can be quite large, it's necessary to upload these resource files to a web server to obtain their web paths (e.g., http: / / or https: / / ). These web paths are then used as the corresponding converted data for the resource files and saved in a second folder. Since the original resource files aren't stored directly in the second folder, the overall code package size of the new project won't exceed 2MB, thus meeting the requirement of a small file size.
[0103] In one embodiment, the SDK-based multi-application adaptation device 100 further includes:
[0104] The resource file acquisition unit is used to acquire the sub-resource file corresponding to each application name in the application name set, and convert the sub-resource file corresponding to each application name in the application name set into a network path to form a resource file.
[0105] In this embodiment, in order to increase the adaptability of the compiled output data, the application name set (corresponding to the popular application ranking list) can still be collected from the target address at a certain period (such as according to the above-mentioned preset collection period, more specifically, the collection period is set to one week). Then, according to the application names included in the application name set, the corresponding sub-resource files are obtained one by one to form a resource file, thereby realizing a more comprehensive acquisition of the resource files of popular applications and packaging them into the new project.
[0106] The fourth initial creation unit 104 is used to initially create the access layer; wherein the environment variables of the access layer are initially empty.
[0107] In this embodiment, the access layer in the application can be understood as an interface (taking WeChat Mini Program as an example, the interfaces include data interface, location interface, media interface, network interface, device interface, and UI interface, etc.), used to interact with the user to obtain user data. Since only some data is configured by default when the access layer is initially created, its initial value is empty if the environment variables of the access layer are not assigned values.
[0108] The environment variable acquisition unit 105 is used to acquire the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. It acquires the difference environment variables based on the difference between the SDK environment variables and the original environment variables, and assigns values to the environment variables of the access layer through the difference environment variables; wherein, the SDK environment variables are software development kit environment variables.
[0109] In this embodiment, since the new project includes not only newly added code and resource files but also native project code, we can first obtain the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged in the first folder. Then, we can compare the SDK environment variables with the original environment variables to obtain the difference data between them. Finally, we can obtain the difference environment variables from the difference data. Once the difference environment variables are obtained, we can quickly assign values to the environment variables of the access layer to complete the attribute settings of the access layer.
[0110] In one embodiment, the environment variable acquisition unit 105 includes:
[0111] The sub-environment variable acquisition unit is used to acquire the sub-environment variables of each sub-software development kit in the software development kit to be packaged;
[0112] The sub-difference environment variable combination unit is used to compare each sub-environment variable with the original environment variable to obtain the corresponding sub-difference environment variable for each sub-software development kit, and the difference environment variable is composed of the corresponding sub-difference environment variables for each sub-software development kit.
[0113] In this embodiment, environment variables generally include three environments: development, trial, and production. Each sub-software development kit (SDK) includes configuration files such as `develop.js`, `release.js`, and `trial.js` to distinguish between development and production environments. Specifically, when creating the sub-environment variables for each SSD, a `config` folder is first created in the root directory of the new project. Within the `config` folder, several different environment configuration files, such as `env / dev.json` and `env / prod.json`, are created to store the configuration information for that environment. Then, a `projectConfig.js` file containing the default configuration is created in the root directory and imported into `app.js`, thus importing the configuration information into the project. Next, two command lines are added to the `scripts` section of the project's `package.json` to start different environments, and a `switch.js` file is created in the root directory to process the configuration information using Node.js. Finally, when different command lines are entered, the corresponding environment configuration information is dynamically written to the default configuration file and imported into the project.
[0114] In one embodiment, the SDK-based multi-application adaptation device 100 further includes:
[0115] The Native Project Code Import unit is used to save native project code in a pre-created initial folder.
[0116] In this embodiment, to quickly assign values to environment variables, the original project code needs to be saved in an initial folder that is neither the first nor the second folder to import the initial code of the new project. Furthermore, various other attribute data of the new project, such as initial environment variables, can also be saved in this initial folder.
[0117] The compilation output unit 106 is used to compile the first folder, the second folder, and the environment variables of the access layer to obtain compilation output data.
[0118] In this embodiment, after importing the code data into the first folder, importing the resource files into the second folder, and assigning values to the environment variables in the access layer, the complete data files of the new project can be compiled to obtain the compiled output data. This compiled output data can then be directly embedded into various popular applications for use without requiring specific application adaptation.
[0119] This device enables the use of SDKs through plug-in integration. Only one set of business source code needs to be maintained to adapt to multiple applications, which improves the adaptation efficiency. Moreover, the SDKs are differentiated through global macro control, and customized business is implemented in the corresponding macros. Environmental parameters are passed through the access layer to achieve decoupling between business and environment.
[0120] The aforementioned SDK-based multi-application adapter can be implemented as a computer program, which can be used in, for example... Figure 4 It runs on the computer device shown.
[0121] Please see Figure 4 , Figure 4 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device 500 is a server, or it can be a server cluster. The server can be a standalone server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The user terminal can be an electronic device with communication capabilities, such as a smartphone, tablet, laptop, desktop computer, personal digital assistant, or wearable device.
[0122] See Figure 4 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a device bus 501, wherein the memory may include a storage medium 503 and internal memory 504.
[0123] The storage medium 503 may store the operating device 5031 and the computer program 5032. When the computer program 5032 is executed, it causes the processor 502 to execute an SDK-based multi-application adaptation method.
[0124] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.
[0125] The internal memory 504 provides an environment for the execution of the computer program 5032 in the storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the SDK-based multi-application adaptation method.
[0126] This network interface 505 is used for network communication, such as providing data transmission. Those skilled in the art will understand that... Figure 4The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device 500 to which the present invention is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0127] The processor 502 is used to run a computer program 5032 stored in a memory to implement the SDK-based multi-application adaptation method disclosed in this embodiment of the invention.
[0128] Those skilled in the art will understand that Figure 4 The embodiments of the computer device shown do not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. For example, in some embodiments, the computer device may include only memory and a processor. In such embodiments, the structure and function of the memory and processor are different from those shown. Figure 4 The embodiments shown are consistent and will not be repeated here.
[0129] It should be understood that, in this embodiment of the invention, the processor 502 may be a Central Processing Unit (CPU), or it may 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. The general-purpose processor may be a microprocessor or any conventional processor.
[0130] In another embodiment of the present invention, a computer-readable storage medium is provided. This computer-readable storage medium may be a non-volatile 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 in the embodiments of the present invention.
[0131] Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.
[0132] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Units with the same function may be grouped into one unit. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, or may be electrical, mechanical, or other forms of connection.
[0133] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0134] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0135] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a backend server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks.
[0136] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A multi-application adaptation method based on SDK, characterized in that, include: In response to the project creation instruction, global macros and compilation items are initially created according to the project creation instruction; Initially, a first folder is created, and the obtained software development kit to be packaged is saved to the first folder to update the first folder; wherein, the first folder is initially created as an empty folder; Initially, a second folder is created, and the acquired resource files are imported into the second folder to update it; the initially created second folder is empty. Initially create the access layer; wherein, the environment variables of the access layer are initially empty; The system retrieves the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. Based on the differences between the SDK environment variables and the original environment variables, it obtains difference environment variables and assigns values to the environment variables of the access layer using these difference environment variables. The SDK environment variables are software development kit environment variables. The compilation output data is obtained by compiling the environment variables of the first folder, the second folder, and the access layer; Before obtaining 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 based on the difference between the SDK environment variables and the original environment variables, and assigning values to the environment variables of the access layer through the difference environment variables, the process further includes: Save the native project code in a pre-created initial folder.
2. The SDK-based multi-application adaptation method according to claim 1, characterized in that, The initial creation of global macros according to the project creation instructions includes: Initialize the header file and the macro definitions within it.
3. The SDK-based multi-application adaptation method according to claim 2, characterized in that, The macro definitions in the initial creation header file include: The header file contains the definitions for screen size, color, application, font, and inline functions.
4. The SDK-based multi-application adaptation method according to claim 1, characterized in that, Before initially creating the first folder and saving the obtained software development kit to be packaged to the first folder to update the first folder, the process also includes: If it is determined that the time interval between the current system time and the previous update time is equal to the preset collection period, the preset target address is obtained, and data is collected based on the target address to obtain the application name set; Obtain the sub-source code file corresponding to each application name in the application name set, and assemble the software development kit to be packaged based on the sub-source code file corresponding to each application name in the application name set.
5. The SDK-based multi-application adaptation method according to claim 4, characterized in that, Before initially creating the second folder and importing the acquired resource files into the second folder to update the second folder, the process also includes: Obtain the sub-resource file corresponding to each application name in the application name set, and convert 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, characterized in that, The process of obtaining 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 based on the differences between the SDK environment variables and the original environment variables, and assigning values to the environment variables of the access layer through the difference environment variables includes: Obtain the sub-environment variables of each sub-software development kit in the software development kit to be packaged; Each sub-environment variable is compared with the original environment variable to obtain the corresponding sub-difference environment variable for each sub-software development kit. The difference environment variable is composed of the corresponding sub-difference environment variables for each sub-software development kit.
7. The SDK-based multi-application adaptation method according to claim 1, characterized in that, The step of importing the acquired resource files into the second folder to update the second folder includes: If it is determined that the size of the resource file does not exceed the preset file size threshold, the resource file is imported into the second folder to update the second folder; If it is determined that the size of the resource file does not exceed the file size threshold, the network path of the resource file uploaded to the network server is obtained, and the network path is stored in the second folder to update the second folder.
8. A multi-application adaptation device based on an SDK, characterized in that, include: The first initial creation unit is used to initially create global macros and compilation items according to the project creation instruction in response to the project creation instruction; The second initial creation unit is used to initially create the first folder and save the obtained software development kit to be packaged to the first folder to update the first folder; wherein, the initially created first folder is an empty folder; The third initial creation unit is used to initially create the second folder and import the acquired resource files into the second folder to update the second folder; wherein, the initially created second folder is an empty folder; The fourth initial creation unit is used to initially create the access layer; wherein the environment variables of the access layer are initially empty. An environment variable acquisition unit is used to acquire the original environment variables of the native project code and the SDK environment variables of the software development kit to be packaged. It acquires difference environment variables based on the differences between the SDK environment variables and the original environment variables, and assigns values to the environment variables of the access layer using these difference environment variables. The SDK environment variables are software development kit environment variables. The compilation output unit is used to compile the first folder, the second folder, and the environment variables of the access layer to obtain compilation output data; Before the environment variable acquisition unit, the system further includes: The Native Project Code Import unit is used to save native project code in a pre-created initial folder.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the SDK-based multi-application adaptation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the SDK-based multi-application adaptation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Channel adaptation method and device for applet and electronic device
CN110764791A