Resource packaging method, apparatus, device, and computer readable medium

By deconstructing and reorganizing the source code of the Android SDK and packaging it into a resource package, the problem of excessive SDK packages is solved, the access process for business users is simplified and the access cost is reduced, and an automated solution for obfuscation and package splitting is provided.

CN116414433BActive Publication Date: 2026-11-06BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111652947.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2026-11-06
Estimated Expiration
2041-12-30

Smart Images

  • Figure CN116414433B_ABST
    Figure CN116414433B_ABST
Patent Text Reader

Abstract

The application relates to a resource packaging method, device and equipment and a computer readable medium. The method comprises the following steps: obtaining target resources of a target project, wherein the target resources comprise code resources corresponding to multiple sub-projects of the target project; tracing a sub-project where the target resources are located, and deconstructing and reclassifying files in the sub-project to obtain multiple reorganized intermediate files; and merging the multiple intermediate files into one resource package to package the target resources of the target project. The application solves the technical problem of excessive number of SDK packages by deconstructing all source code function modules before actual packaging, reclassifying and reorganizing the deconstructed function modules, and finally packaging the reorganized files into one SDK resource package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet software development technology, and in particular to a resource packaging method, apparatus, device and computer-readable medium. Background Technology

[0002] With the widespread adoption of Android technology, Android Studio, an integrated development environment (IDE) for Android Apps (Applications), is increasingly favored by developers due to its high development efficiency. When creating components in Android Studio, developers can choose the type. When choosing the Android Library format to build a component, it can be packaged into an AAR (AndroidArchive) file. Typically, developing a complex business process SDK (Software Development Kit) project is similar to developing a regular application project. To facilitate project management for developers, an SDK is usually divided into multiple modules based on functionality, ultimately packaged into multiple AAR files, such as base.aar, login.aar, and pay.aar, which are then provided to the business side for unified integration.

[0003] However, multiple AAR packages increase the integration costs for businesses. Therefore, reducing the number of AAR packages to lower integration costs for businesses has become an urgent problem to be solved.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a resource packaging method, apparatus, device, and computer-readable medium to solve the technical problem of excessive number of packages in SDK packaging.

[0006] According to one aspect of the embodiments of this application, this application provides a resource packaging method, including: Obtain the target resources of the target project, which include the code resources corresponding to the multiple sub-projects of the target project; The process involves tracing the sub-project containing the target resource, deconstructing and reorganizing the files within that sub-project to obtain multiple reorganized intermediate files; and... Multiple intermediate files are merged into a single resource package to package the target resources of the target project.

[0007] Optionally, trace the sub-project where the target resource is located, and deconstruct and reorganize the files in the sub-project, including: Identify the functional module to which each code resource in the target resource belongs, and create the first project, where sub-projects include functional modules; Copy the application manifest file corresponding to each functional module to the first project. The application manifest file stores the configuration information of the functional modules; and... The build function is called to build the first project, resulting in the merged application manifest file of the target project. The intermediate files include the merged application manifest file.

[0008] Optionally, tracing the sub-project where the target resource is located and deconstructing and reorganizing the files in the sub-project also includes: Identify the remote repositories that each functional module depends on, and create a second project; Copy the source code files and library files corresponding to each functional module to the second project, and configure the remote repositories that each functional module depends on to the second project; and, The construction function is called to build the second project, resulting in the merged resource file of the target project. The intermediate files include the merged resource file.

[0009] Optionally, multiple intermediate files can be merged into a single resource package to package the target resources of the target project, including: Call the package function to package the merged application manifest file and merged resource file into a resource package.

[0010] Optionally, after merging multiple intermediate files into a single resource package, the method further includes: Integrate the resource package into the demo project to generate the first demo program of the target project from the demo project; Test the first demonstration program; If the test passes, the target resources are modified according to preset rules, and the modified target resources are repackaged to obtain the obfuscated package of the target project. The obfuscated package is integrated into the demo project to generate a second demo program for the target project; and, Test the second demo program, and if the test passes, send the obfuscated package to the target business party.

[0011] Optionally, if the test passes, modifying the target resource according to preset rules includes: Determine the keywords to be replaced and the random replacement characters, where the keywords include class names, function names, and constant strings; Extract the source code file of the target project from the target resource, and replace the keywords appearing in the source code file with random replacement characters.

[0012] Optionally, before sending the obfuscated packet to the target business party, the method further includes: Obtain the distribution rule configuration file and extract the distribution rule configuration data from the distribution rule configuration file; Modify the source code files of the target project in the target resources according to the distribution rules and configuration data.

[0013] Optionally, the target resource includes a first resource corresponding to the core functional code resource of the target project and a second resource corresponding to the basic resource on which the first resource depends. The method further includes: The target resource is subdivided according to the target resource subdivision rules, and the second resource obtained from the subdivision is extracted. Obtain the subpackaged resources of the original base code. The subpackaged resources are generated by applying the base resource subpackaged rules to the original base code separately. The second resource, after being processed by the target resource sub-packaging rules, is compared and verified with the sub-packaged resources of the original base code; If the second resource obtained by subpackaging using the target resource subpackaging rules is inconsistent with the subpackaged resource verification of the original basic code, the target resource subpackaging rules shall be adjusted according to the basic resource subpackaging rules.

[0014] According to another aspect of the embodiments of this application, this application provides a resource packaging apparatus, including: The resource acquisition module is used to acquire the target resources of the target project, including the code resources corresponding to multiple sub-projects of the target project. The resource reorganization module is used to trace the sub-project where the target resource is located, and to deconstruct and reorganize the files in the sub-project to obtain multiple reorganized intermediate files; and, The resource packaging module is used to merge multiple intermediate files into a single resource package to package the target resources of the target project.

[0015] According to another aspect of the embodiments of this application, this application provides an electronic device, including a memory, a processor, a communication interface and a communication bus. The memory stores a computer program that can run on the processor. The memory and the processor communicate with each other through the communication bus and the communication interface. When the processor executes the computer program, it implements the steps of the above method.

[0016] According to another aspect of the embodiments of this application, this application also provides a computer-readable medium having processor-executable non-volatile program code that causes the processor to perform the above-described method.

[0017] Compared with related technologies, the technical solutions provided in this application have the following advantages: The technical solution of this application involves obtaining the target resources of a target project, wherein the target resources include code resources corresponding to multiple sub-projects of the target project; tracing the sub-projects where the target resources are located, and deconstructing and reorganizing the files in the sub-projects to obtain multiple reorganized intermediate files; and merging the multiple intermediate files into a resource package to package the target resources of the target project. This application solves the technical problem of excessive number of SDK packages by processing the SDK source code project, deconstructing all functional modules of the source code before actual packaging, then reorganizing them, and finally packaging the reorganized files into an SDK resource package. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a diagram illustrating the packaging of source code in related technologies. Figure 2 This is a schematic diagram of the hardware environment for an optional resource packaging method provided according to an embodiment of this application; Figure 3 This is a schematic flowchart of an optional resource packaging method provided according to an embodiment of this application; Figure 4 This is a schematic diagram illustrating an optional resource packaging method according to an embodiment of this application; Figure 5 This is a block diagram of an optional resource packaging device according to an embodiment of this application; Figure 6 This is a schematic diagram of an optional electronic device structure provided in an embodiment of this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustration and has no specific meaning in itself. Therefore, "module" and "part" may be used interchangeably.

[0023] First, the key terms mentioned in the embodiments of this application will be explained: SDK stands for Software Development Kit. It is generally a collection of development tools used by software engineers to create application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.

[0024] AAR: The name comes from Android Archive, and as the name suggests, it's a binary archive file for Android library projects. Using Android Studio, you can easily generate an AAR file. When developing Android applications in Eclipse, if you want to package your code, you only have the option of a JAR file. However, a JAR can only package Java code files. If you want to use a library with layouts and resources, in addition to putting the JAR in the libs folder, you also need to import the relevant resources and configuration files, which is quite inelegant. With the advent of Android Studio, a new method emerged: packaging AAR files. This not only packages Java files but also includes AndroidManifest.xml and resource files, etc. To use it, simply importing an AAR file is sufficient, which is very convenient.

[0025] APK: APK is short for Android Package, which is an Android installation package. APK is a file format similar to Symbian Sis or Sisx. It can be installed by directly transferring the APK file to an Android emulator or Android phone for execution. For an Android application's code to run on an Android device, it must first be compiled and then packaged into a file that the Android system can recognize and run. This file format that the Android system can recognize and run is called an "APK". An APK file contains compiled code files (.dex files), resources, assets, certificates, and a manifest file.

[0026] In related technologies, such as Figure 1As shown, to facilitate project management for developers, an SDK is typically divided into multiple functional modules based on its features. During packaging, each functional module is also packaged into a separate AAR file. The number of AAR files corresponds to the number of functional modules in the entire SDK project. Providing an SDK to business users requires them to integrate the AAR file for each function within that SDK to use all its functionalities, which undoubtedly increases the cost for business users to integrate the SDK.

[0027] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a resource packaging method is provided, which can be particularly applied to Android SDK packaging.

[0028] Optionally, in the embodiments of this application, the above-described resource packaging method can be applied to, for example... Figure 2 The hardware environment shown consists of terminal 201 and server 203. Figure 2 As shown, server 203 is connected to terminal 201 via a network and can be used to provide services to the terminal or clients installed on the terminal. Database 205 can be set up on the server or independently of the server to provide data storage services for server 203. The network mentioned above includes, but is not limited to, wide area network, metropolitan area network or local area network. Terminal 201 includes, but is not limited to, PC, mobile phone, tablet computer, etc.

[0029] One method in this application embodiment can be executed by server 203, or it can be executed jointly by server 203 and terminal 201, such as... Figure 3 As shown, the method may include the following steps: Step S302: Obtain the target resources of the target project, wherein the target resources include the code resources corresponding to multiple sub-projects of the target project; Step S304: Trace the sub-project where the target resource is located, and deconstruct and reorganize the files in the sub-project to obtain multiple reorganized intermediate files; and, Step S306: Merge multiple intermediate files into a resource package to package the target resources of the target project.

[0030] Through steps S302 to S306, this application processes the source code of the SDK, deconstructs all functional modules separated from the source code before actual packaging, then reorganizes them, and finally packages the reorganized files into an SDK resource package. This solves the technical problem of excessive number of SDK packages, further simplifies the access process for business users, and reduces access costs.

[0031] In step S302, the target project is the SDK project, which is the SDK software developed by the SDK provider. The SDK provider provides the SDK software to the business party, allowing the business party to use the SDK software to develop its specific business applications. The aforementioned target resource is the source code resource of the SDK software, which includes multiple functional modules implemented by the SDK software, i.e., sub-projects under the target project.

[0032] In step S304, this application does not package each functional module individually, but rather deconstructs each functional module, then categorizes and reorganizes all the deconstructed source code resources, and in step S306 merges the reorganized source code resources into a single resource package, resulting in a single resource package for the SDK software. In related technologies, SDK packaging often involves packaging each functional module as a separate package, requiring business users to integrate each functional module's package individually, which is complex and incurs high time and manpower costs. However, as... Figure 4 As shown, the technical solution of this application deconstructs and reorganizes the SDK source code project, so that the final SDK software package consists of only one resource package. Business users only need to access one resource package to use the complete SDK software functions, which simplifies the access process for business users and reduces access costs.

[0033] Optionally, in step S304, tracing the sub-project where the target resource is located and deconstructing and reorganizing the files in the sub-project includes: Step 1: Determine the functional module to which each code resource in the target resource belongs, and create the first project, where sub-projects include functional modules; Step 2: Copy the application manifest file corresponding to each functional module to the first project. The application manifest file stores the configuration information of the functional modules; and... Step 3: Call the build function to build the first project and obtain the merged application manifest file of the target project. The intermediate files include the merged application manifest file.

[0034] The resource packaging method provided in this application can be applied to packaging Android SDK resources. Each Android application (including SDK software) must have one or more AndroidManifest.xml files (i.e., application manifest files). The AndroidManifest.xml file records the application's unique identifier, describes the activities and services of the application's components, and records the application's required access permissions and dependent libraries. Each functional module's corresponding sub-project has its own AndroidManifest.xml file. Therefore, in step S304, to deconstruct and reorganize the files in all sub-projects, the first step is to reorganize the AndroidManifest.xml files of each functional module. This involves tracing the sub-project where each code resource resides, determining the functional module to which each code resource belongs, copying the application manifest file corresponding to each functional module to the first project, and, depending on the Gradle environment, calling the build function to build the first project to obtain the merged application manifest file of the target project, which is the total AndroidManifest.xml file for all functional modules under this SDK.

[0035] The reorganization requires not only of AndroidManifest.xml, but also of the specific source code and dependent libraries of each functional module. Therefore, step S304, which involves tracing the sub-project where the target resource is located and deconstructing and reorganizing the files in the sub-project, also includes: Step 1: Determine the remote repositories that each functional module depends on and create a second project; Step 2: Copy the source code files and library files corresponding to each functional module to the second project, and configure the remote repositories that each functional module depends on to the second project; and, Step 3: Call the build function to build the second project and obtain the merged resource file of the target project. The intermediate files include the merged resource file.

[0036] In this embodiment of the application, when developing the SDK, the remote repositories that each functional module depends on are configured. Therefore, a second project is created at this time, the remote repositories that all functional modules depend on are configured on the second project, and the source code files and library files corresponding to each functional module are copied to the second project. Finally, the Gradle environment is used to call the build function to build the second project and obtain the merged resource file of the target project.

[0037] In this embodiment, the entire SDK is treated as a single functional module. The SDK's source code files are deconstructed and reorganized, resulting in an AndroidManifest.xml file and its source code, which are essentially treated as a single functional module. At this point, the entire SDK's AndroidManifest.xml file and the SDK's merged resource files can be combined into a single resource package according to the standard packaging process. Specifically, in step S306, multiple intermediate files are merged into a single resource package to package the target resources of the target project, including: Call the package function to package the merged application manifest file and merged resource file into a resource package.

[0038] To prevent business users from decompiling the SDK and obtaining its business logic, the SDK resource package needs to be obfuscated before being sent to the business users.

[0039] Optionally, after merging multiple intermediate files into a single resource package, the method further includes: Step 1: Connect the resource package to the demo project to generate the first demo program of the target project. Step 2: Test the first demonstration program; Step 3: If the test passes, modify the target resources according to the preset rules, and repackage the modified target resources to obtain the obfuscated package of the target project; Step 4: Integrate the obfuscated package into the demo project to generate a second demo program for the target project; and, Step 5: Test the second demonstration program, and if the test passes, send the obfuscated package to the target business party.

[0040] In this embodiment, the SDK's functionality is first tested. This involves simulating a business user integrating the resource package into a demo project to generate a first demo program for the target project. This first demo program is the SDK software obtained after the business user compiles the SDK resource package. The first demo program is then tested. If the test passes, it indicates the SDK resource package is functioning correctly. The target resources can then be modified according to preset rules, and the modified resources are repackaged to obtain an obfuscated package for the target project. The obfuscated package is also an SDK resource package, but it hides the SDK's business logic. For example, the class `Login.class` might become `A.class` after obfuscation, thus avoiding exposing the SDK's business logic. After obtaining the obfuscated package, the SDK software compiled from it also needs to be tested to prevent errors after obfuscation. Therefore, the obfuscated package is integrated into the demo project to generate a second demo program for the target project. The second demo program is then tested, and if the test passes, the obfuscated package is sent to the target business user.

[0041] Optionally, if the test passes, modifying the target resource according to preset rules includes: Step 1: Determine the keywords to be replaced and the random replacement characters. The keywords include class names, function names, and constant strings. Step 2: Extract the source code file of the target project from the target resource, and replace the keywords appearing in the source code file with random replacement characters.

[0042] In this embodiment of the application, the preset rule for generating the obfuscated package may be keyword replacement, in which keywords representing business logic in the SDK source code are replaced with random characters for obfuscation.

[0043] Businesses typically have their own distribution requirements, such as displaying their logo image and name when launching the application, and prohibiting the SDK provider's name from appearing. Therefore, before sending the obfuscated package to the business, it is necessary to repackage the obfuscated package according to the business's distribution rules, that is, modify the original SDK obfuscated package into a channel package that meets the business's distribution requirements.

[0044] Optionally, before sending the obfuscated packet to the target business party, the method further includes: Step 1: Obtain the distribution rule configuration file and extract the distribution rule configuration data from the distribution rule configuration file; Step 2: Modify the source code files of the target project in the target resources according to the release rules configuration data.

[0045] In this embodiment of the application, the aforementioned issuance rule configuration file is used to record the issuance rules required by the business party.

[0046] The aforementioned subcontracting process inevitably requires modification of the target resources. Furthermore, SDKs are subcontracted even during development, with different functional modules assigned to different development teams. Each team needs to develop its own additional functional code based on the core functional code of the target project. This core functional code depends on the underlying code, which must remain unchanged regardless of subcontracting methods; otherwise, the core functionality will fail, and the entire target project will malfunction. Therefore, it is necessary to perform subcontracting verification of the target resources to ensure that the underlying code has not changed.

[0047] Optionally, the target resource includes a first resource corresponding to the core functional code resource of the target project and a second resource corresponding to the basic resource on which the first resource depends. The method further includes: Step 1: Subdivide the target resource according to the target resource subdivision rules, and extract the second resource obtained from the subdivision process; Step 2: Obtain the sub-package resources of the original base code. The sub-package resources are generated by applying the base resource sub-package rules to the original base code separately. Step 3: Compare and verify the second resource obtained by applying the target resource sub-packaging rules with the sub-packaged resources of the original base code; Step 4: If the second resource obtained by applying the target resource sub-packaging rules is inconsistent with the sub-packaged resource of the original basic code, adjust the target resource sub-packaging rules according to the basic resource sub-packaging rules.

[0048] In this embodiment, the target resource sub-packaging rule is the sub-packaging rule set according to the business party's distribution requirements before the SDK resource package is sent to the business party. The basic resource sub-packaging rule is the sub-packaging rule used when sub-packaging to different development teams during SDK development. During sub-packaging verification, the target resource is first sub-packaged according to the target resource sub-packaging rule, and the sub-packaged second resource (i.e., the basic code on which the core function code depends) is extracted. The sub-packaged resource generated after applying the basic resource sub-packaging rule to the original basic code is obtained. Then, the sub-packaged second resource is compared and verified with the sub-packaged resource. If the MD5 code is compared and the verification is consistent, it means that the basic code has not changed. If the verification is inconsistent, it means that the sub-packaging has caused changes to the basic code, and the target resource sub-packaging rule needs to be adjusted according to the basic resource sub-packaging rule.

[0049] This application processes the SDK's source code, deconstructing all functional modules from the source code before actual packaging, then reorganizing them, and finally packaging the reorganized files into a single SDK resource package. This solves the technical problem of excessive SDK package size, further simplifying the integration process for business users and reducing integration costs. Furthermore, it provides automated solutions for obfuscating and repackaging packages, meeting business needs while preventing the leakage of SDK provider secrets.

[0050] According to another aspect of the embodiments of this application, such as Figure 5 As shown, a resource packaging device is provided, comprising: The resource acquisition module 501 is used to acquire the target resources of the target project, wherein the target resources include the code resources corresponding to multiple sub-projects of the target project; Resource reorganization module 503 is used to trace the sub-project where the target resource is located, and to deconstruct and reorganize the files in the sub-project to obtain multiple reorganized intermediate files; and, The resource packaging module 505 is used to merge multiple intermediate files into a single resource package to package the target resources of the target project.

[0051] It should be noted that the resource acquisition module 501 in this embodiment can be used to execute step S302 in this application embodiment, the resource reorganization module 503 in this embodiment can be used to execute step S304 in this application embodiment, and the resource packaging module 505 in this embodiment can be used to execute step S306 in this application embodiment.

[0052] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented either through software or through hardware.

[0053] Optionally, this resource reorganization module is specifically used for: Identify the functional module to which each code resource in the target resource belongs, and create the first project, where sub-projects include functional modules; Copy the application manifest file corresponding to each functional module to the first project. The application manifest file stores the configuration information of the functional modules; and... The build function is called to build the first project, resulting in the merged application manifest file of the target project. The intermediate files include the merged application manifest file.

[0054] Optionally, this resource reorganization module is also used for: Identify the remote repositories that each functional module depends on, and create a second project; Copy the source code files and library files corresponding to each functional module to the second project, and configure the remote repositories that each functional module depends on to the second project; and, The construction function is called to build the second project, resulting in the merged resource file of the target project. The intermediate files include the merged resource file.

[0055] Optionally, this resource packaging module is specifically used for: Call the package function to package the merged application manifest file and merged resource file into a resource package.

[0056] Optionally, the resource packaging apparatus further includes an obfuscation package generation module, used for: Integrate the resource package into the demo project to generate the first demo program of the target project from the demo project; Test the first demonstration program; If the test passes, the target resources are modified according to preset rules, and the modified target resources are repackaged to obtain the obfuscated package of the target project. The obfuscated package is integrated into the demo project to generate a second demo program for the target project; and, Test the second demo program, and if the test passes, send the obfuscated package to the target business party.

[0057] Optionally, this obfuscation package generation module is specifically used for: Determine the keywords to be replaced and the random replacement characters, where the keywords include class names, function names, and constant strings; Extract the source code file of the target project from the target resource, and replace the keywords appearing in the source code file with random replacement characters.

[0058] Optionally, the resource packaging device further includes a sub-packaging module for: Obtain the distribution rule configuration file and extract the distribution rule configuration data from the distribution rule configuration file; Modify the source code files of the target project in the target resources according to the distribution rules and configuration data.

[0059] Optionally, the target resource includes a first resource corresponding to the core functional code resource of the target project and a second resource corresponding to the basic resources on which the first resource depends. The resource packaging device further includes a sub-package verification module for: The target resource is subdivided according to the target resource subdivision rules, and the subdivided second resource is extracted. Obtain the sub-packaged resources of the second resource. The sub-packaged resources are generated by applying the basic resource sub-packaged rules to the second resource separately. The second resource after subcontracting is compared and verified with the subcontracted resource; If the second resource after subpackaging is inconsistent with the subpackaged resource, the target resource subpackaging rule shall be adjusted according to the basic resource subpackaging rule.

[0060] This application processes the SDK's source code, deconstructing all functional modules from the source code before actual packaging, then reorganizing them, and finally packaging the reorganized files into a single SDK resource package. This solves the technical problem of excessive SDK package size, further simplifying the integration process for business users and reducing integration costs. Furthermore, it provides automated solutions for obfuscating and repackaging packages, meeting business needs while preventing the leakage of SDK provider secrets.

[0061] According to another aspect of the embodiments of this application, this application provides an electronic device, such as... Figure 6 As shown, the system includes a memory 601, a processor 603, a communication interface 605, and a communication bus 607. The memory 601 stores a computer program that can run on the processor 603. The memory 601 and the processor 603 communicate through the communication interface 605 and the communication bus 607. When the processor 603 executes the computer program, it implements the steps of the above method.

[0062] The memory and processor in the aforementioned electronic devices communicate with each other via a communication bus and a communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0063] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0064] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be 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, or discrete hardware components.

[0065] According to another aspect of the embodiments of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of any of the above embodiments.

[0066] Optionally, in embodiments of this application, the computer-readable medium is configured to store program code for the processor to perform the following steps: Obtain the target resources of the target project, which include the code resources corresponding to the multiple sub-projects of the target project; The process involves tracing the sub-project containing the target resource, deconstructing and reorganizing the files within that sub-project to obtain multiple reorganized intermediate files; and... Multiple intermediate files are merged into a single resource package to package the target resources of the target project.

[0067] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0068] In specific implementation, the embodiments of this application can be referred to the above embodiments and have corresponding technical effects.

[0069] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0070] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0071] 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, or a combination of computer software and electronic hardware. 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 application.

[0072] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0073] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0074] 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 this embodiment according to actual needs.

[0075] In addition, the functional units in the various embodiments of this application 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.

[0076] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, or a 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks. It should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0077] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for packaging resources, characterized in that, include: Obtain the target resources of the target project, wherein the target resources include code resources corresponding to multiple sub-projects of the target project; Tracing the sub-project where the target resource resides, and deconstructing and reorganizing the files within that sub-project to obtain multiple reorganized intermediate files; and, The multiple intermediate files are merged into a single resource package to package the target resources of the target project; The target resource includes a first resource corresponding to the core functional code resource of the target project and a second resource corresponding to the basic resource on which the first resource depends. The method further includes: The target resource is divided into sub-packages according to the target resource sub-package rules, and the second resource obtained from the sub-package process is extracted. Obtain the subpackaged resources of the original basic code, wherein the subpackaged resources are generated by applying basic resource subpackaged rules to the original basic code separately; The second resource obtained by applying the target resource sub-packaging rules is compared and verified with the sub-packaged resource of the original basic code; If the second resource obtained by subpackaging using the target resource subpackaging rules is inconsistent with the subpackaged resource verification of the original basic code, the target resource subpackaging rules shall be adjusted according to the basic resource subpackaging rules.

2. The method according to claim 1, characterized in that, The step of tracing the sub-project where the target resource is located and deconstructing and reorganizing the files in the sub-project includes: Identify the functional module to which each code resource in the target resources belongs, and create a first project, wherein the sub-project includes the functional module; Copy the application manifest file corresponding to each functional module to the first project, wherein the application manifest file is used to store the configuration information of the functional module; and, The first project is built by calling the build function to obtain the merged application manifest file of the target project, wherein the intermediate file includes the merged application manifest file.

3. The method according to claim 2, characterized in that, The step of tracing the sub-project where the target resource is located, and deconstructing and reorganizing the files in the sub-project, also includes: Identify the remote repositories that each of the aforementioned functional modules depends on, and create a second project; Copy the source code files and library files corresponding to each functional module to the second project, and configure the remote repository that each functional module depends on to the second project; and... The second project is constructed by calling the construction function to obtain the merged resource file of the target project, wherein the intermediate file includes the merged resource file.

4. The method according to claim 3, characterized in that, The step of merging multiple intermediate files into a single resource package to package the target resources of the target project includes: The packaging function is invoked to package the merged application manifest file and the merged resource file into the resource package.

5. The method according to claim 1, characterized in that, After merging the multiple intermediate files into a single resource package, the method further includes: The resource package is integrated into the demo project to generate the first demo program of the target project. The first demonstration program was tested; If the test passes, the target resource is modified according to preset rules, and the modified target resource is repackaged to obtain the obfuscated package of the target project; The obfuscated package is integrated into the demo project to generate a second demo program for the target project; and, The second demonstration program is tested, and if the test passes, the obfuscated package is sent to the target business party.

6. The method according to claim 5, characterized in that, The modification of the target resource according to preset rules upon successful testing includes: Determine the keywords to be replaced and the random replacement characters, wherein the keywords include class names, function names, and constant strings; Extract the source code file of the target project from the target resource, and replace the keywords appearing in the source code file with the random replacement characters.

7. The method according to claim 5, characterized in that, Before sending the obfuscated packet to the target business party, the method further includes: Obtain the issuance rule configuration file and extract the issuance rule configuration data from the issuance rule configuration file; The source code files of the target project in the target resource are modified according to the release rule configuration data.

8. A resource packaging apparatus for implementing the resource packaging method as described in any one of claims 1 to 7, characterized in that, include: Obtain the target resources of the target project, wherein the target resources include code resources corresponding to multiple sub-projects of the target project; Tracing the sub-project where the target resource resides, and deconstructing and reorganizing the files within that sub-project to obtain multiple reorganized intermediate files; and, Multiple intermediate files are merged into a single resource package to package the target resources of the target project.

9. An electronic device comprising a memory, a processor, a communication interface, and a communication bus, wherein the memory stores a computer program executable on the processor, and the memory and the processor communicate via the communication bus and the communication interface, characterized in that... When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.

10. A computer-readable medium having processor-executable non-volatile program code, characterized in that, The program code causes the processor to execute the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Application obfuscation method and device, server and storage medium

    CN111177662A

  • Channel package packaging method and device and computer equipment

    CN112416353A

  • Multi-component merging and packaging method and device

    CN112612511A