Software development kit compilation method and apparatus

By performing Objective-C wrapping and processing of common umbrella header files on Swift modules in iOS application development, the problems of core code leakage and low compilation efficiency in mixed Swift and Objective-C environments are solved, achieving safer and more efficient software development kit compilation.

CN122111436APending Publication Date: 2026-05-29BEIJING WODONG TIANJUN INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
Filing Date
2024-11-22
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In iOS application development, in a mixed Swift and Objective-C environment, existing build methods have the problems of core code leakage risk and low compilation efficiency. In particular, the core component header files contain a large amount of Swift and Objective-C code, resulting in excessive package size and low compilation efficiency.

Method used

By performing an Objective-C wrapper on the Swift module, a common umbrella header file is generated, and this header file is processed after compilation to ensure that it only contains pre-configured, exposed declarations. At the same time, upper-level components are compiled independently to avoid importing the header files of core components.

Benefits of technology

It reduces the risk of core code leakage, reduces package size, improves compilation efficiency, and simplifies the calling logic of upper-level components to core components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111436A_ABST
    Figure CN122111436A_ABST
Patent Text Reader

Abstract

The application discloses a software development package compiling method and device, and relates to the technical field of computers. A specific implementation of the method comprises the following steps: performing encapsulation based on a second programming language on a first type of module of any core component in a software development package, extracting a header file of the first type of module and a header file of a second type of module after the encapsulation to generate a common umbrella header file of the core component; and after compiling core component source code and upper layer component source code in the software development package into an executable file, processing the common umbrella header file of any core component in the software development package, so that the common umbrella header file only contains declaration content configured in advance for the core component. The implementation can effectively reduce the risk of core code leakage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for compiling a software development kit. Background Technology

[0002] In iOS mobile application development, the stability and security of the SDK (Software Development Kit) that implements various functions are crucial. In practice, SDK development may occur in a mixed Swift and Objective-C (ObjC) environment. Due to the complex interactions between components in such mixed environments, existing build methods often include significant amounts of Swift and Objective-C code in the core component header files to improve usability, posing a high risk of core code leakage. Furthermore, for upper-level components that depend on core components, compilation in these mixed environments often requires including all header files of the dependent core components, resulting in excessively large package sizes and low compilation efficiency. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a software development kit compilation method and apparatus, which can effectively reduce the risk of core code leakage.

[0004] To achieve the above objectives, according to one aspect of the present invention, a method for compiling a software development kit (SDK) is provided. The SSD to be compiled includes multiple components, each component including at least one module, and the same module being written in the same programming language; the components include a core component and upper-level components that depend on the core component.

[0005] The software development kit (SDK) compilation method of this invention includes: encapsulating a first type of module of any core component in the SSD using a second programming language; extracting the header files of the encapsulated first type of module and the second type of module to generate a common umbrella header file for the core component; wherein the first type of module is a module written in a first programming language, and the second type of module is a module written in a second programming language; after compiling the source code of the core component and the source code of the upper-level component in the SSD into an executable file, processing the common umbrella header file of any core component in the SSD so that the common umbrella header file contains only the declaration content pre-configured for the core component.

[0006] Optionally, in any core component of the software development kit, the header files of the first type of module, the header files of the second type of module, and the common umbrella header file of the core component, after being encapsulated, are files based on a second programming language.

[0007] Optionally, the method further includes: before generating the common umbrella header file of the core component, compiling the source code of the first type of module and the source code of the second type of module of any core component in the software development kit to obtain the executable file of the core component.

[0008] Optionally, the method further includes: after generating the common umbrella header file of the core component, configuring the dependency relationship between any upper-level component in the software development kit and the core component, performing independent compilation on the upper-level component to obtain the executable file of the upper-level component; and generating the header file of the upper-level component.

[0009] Optionally, performing independent compilation on the upper-level component includes: performing compilation based on the pre-configured internal source code files and internal header files of any upper-level component in the software development kit.

[0010] Optionally, the method further includes: after processing the common umbrella header file of any core component in the software development kit, generating a module mapping file for the core component based on the processed common umbrella header file; wherein the module mapping file contains a module identifier in the core component and a header file identifier in the processed common umbrella header file.

[0011] Optionally, the software development kit is used on the iOS operating system, with Swift as the first programming language and Objective-C as the second programming language.

[0012] To achieve the above objectives, according to another aspect of the present invention, a software development kit (SDK) compilation apparatus is provided. The SSD to be compiled includes multiple components, each component including at least one module, and the same module being written in the same programming language; the components include a core component and upper-level components that depend on the core component.

[0013] The software development kit (SDK) compilation apparatus of this invention includes: a packaging unit, configured to perform packaging based on a second programming language on a first type of module of any core component in the SSD, and extract the header file of the packaged first type of module and the header file of the second type of module to generate a common umbrella header file of the core component; wherein the first type of module is a module written in a first programming language and the second type of module is a module written in a second programming language; and a header file processing unit, configured to process the common umbrella header file of any core component in the SSD after compiling the source code of the core component and the source code of the upper-level component in the SSD into an executable file, so that the common umbrella header file contains only the declaration content pre-configured for the core component.

[0014] To achieve the above objectives, according to another aspect of the present invention, an electronic device is provided.

[0015] An electronic device according to the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the software development kit compilation method provided by the present invention.

[0016] To achieve the above objectives, according to another aspect of the present invention, a computer-readable storage medium is provided.

[0017] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the software development kit compilation method provided by the present invention.

[0018] According to the technical solution of the present invention, the embodiments described above have the following advantages or beneficial effects: During the compilation of the software development kit, the first type of module (written in Swift) of any core component is encapsulated using Objective-C. The header files of the encapsulated first type of module and the second type of module (written in Objective-C) are extracted to generate the common umbrella header file of the core component. After the source code of the core component and the source code of the upper-level component in the software development kit are compiled into executable files, the common umbrella header file of any core component is processed so that it contains only the exposed declarations pre-configured for the core component. In this way, by encapsulating the first type of modules in the core component using Objective-C, we can prevent these modules from directly exposing their internal core code. Furthermore, we unify the access methods of both the first and second types of modules within the core component to Objective-C, and standardize the header files of each module and the common umbrella header file of the core component to Objective-C format. Compared to existing techniques where compiled header files contain a large amount of Swift and Objective-C code, this approach avoids Swift code in the compiled header files and reduces Objective-C code, thereby further reducing the risk of core code leakage. In addition, by processing the common umbrella header file of the core component to ensure it only contains pre-configured, exposing declarations for the core component, the compiled output only exposes pre-configured public APIs (Application Programming Interfaces), further preventing core code leakage. In addition, by encapsulating the first type of module in the core component using Objective-C and unifying the access methods for the two types of modules within the core component, the logic for each upper-layer component to call the core component can be simplified. As a result, it is not necessary to include the header files of the core components that it depends on during compilation. Instead, it can be compiled independently based only on its own source code files and header files, thereby reducing the package size and improving compilation efficiency.

[0019] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0020] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein: Figure 1 This is a schematic diagram of the main steps of the software development kit compilation method in an embodiment of the present invention; Figure 2 This is a schematic diagram of the architecture of the software development kit compilation method in an embodiment of the present invention; Figure 3This is a schematic diagram illustrating the specific execution steps of the software development kit compilation method in this embodiment of the invention; Figure 4 This is a schematic diagram of the components of the software development kit compilation device in an embodiment of the present invention; Figure 5 This is a schematic diagram of the electronic device structure used to implement the software development kit compilation method in the embodiments of the present invention. Detailed Implementation

[0021] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0022] It should be noted that, unless otherwise specified, the embodiments of the present invention and the technical features thereof can be combined with each other.

[0023] Figure 1 This is a schematic diagram illustrating the main steps of the software development kit compilation method in this embodiment of the invention.

[0024] like Figure 1 As shown, the software development kit (SDK) compilation method of this invention can be executed by a program module or functional module (hereinafter referred to as the execution subject) running on a terminal device (such as a personal computer PC, a smart mobile terminal, etc.). In this invention embodiment, the SSD to be compiled may include multiple components, each component including at least one module, and the same module is written using the same programming language between a first programming language and a second programming language. In practical applications, the above SSD can be applied to the iOS operating system, with Swift as the first programming language and Objective-C as the second programming language. The above components may include core components and upper-level components that depend on the core components. The core components provide basic and underlying services such as network interaction, images, videos, log reporting, and database read / write, and can also be called a core component library; in contrast to the core components, the upper-level components are used to achieve specific business purposes and are also called business components, business component libraries, and upper-level component libraries. This invention embodiment can be applied to scenarios where Swift and Objective-C are used together in the same project, and the SSD can be written in a mixture of Swift and Objective-C.

[0025] It's understandable that the component interaction logic in the above mixed-language environment is quite complex. To improve component usability, existing build methods typically include a significant amount of Swift and Objective-C code in the core component header files, posing a high risk of core code leakage. Furthermore, Swift modules themselves carry the risk of core code leakage. In addition, for upper-level components that depend on core components, to compile in the above mixed-language environment, it's often necessary to include all the header files of the dependent core components to perform the compilation, resulting in excessively large package sizes and low compilation efficiency. The following explanation will attempt to address these issues.

[0026] The specific execution steps of the software development kit compilation method according to this invention are as follows, which can be found in [reference needed]. Figure 2 The architecture shown. Step S101: Perform encapsulation based on the second programming language on the first type module of any core component in the software development kit, and extract the header files of the encapsulated first type module and the second type module to generate the common umbrella header file of the core component.

[0027] In this embodiment of the invention, the executing entity performs Objective-C-based encapsulation on the first type of module (i.e., the Swift module) in any core component of the software development kit. That is, it encapsulates an Objective-C layer outside the Swift module to enable Objective-C-based interface access. On the other hand, the executing entity can extract the header files of the encapsulated Swift module and the header files of the Objective-C module. It can be understood that the header files of both types of modules are Objective-C-based files (e.g., files with the suffix public.h).

[0028] Next, the executing entity can compile the Swift module source code and Objective-C module source code of any core component in the software development kit to obtain the executable file of that core component. For example, the executable file is a binary file. Afterward, the executing entity can generate the public umbrella header file for that core component based on the previously extracted, encapsulated header files of the Swift module and Objective-C module. In iOS and macOS development, an umbrella header file is a specific type of public header file whose purpose is to include header files that need to be exposed in a framework or library, covering and containing the required public interfaces. For example, the suffix of a public umbrella header file can be public-umbrella.h. Based on the Objective-C layer encapsulation of the Swift module, in any core component of the software development kit, the header files of the encapsulated first-type module, the header files of the second-type module, and the public umbrella header file of that core component are all Objective-C based files.

[0029] Thus, by encapsulating the Swift modules in the core components using Objective-C, this invention prevents the Swift modules from directly exposing their internal core code. Furthermore, it unifies the access methods of the Swift and Objective-C modules within the core components to Objective-C, and also unifies the header files of each module and the common umbrella header file of the core components to Objective-C format. Compared to existing technologies where the compiled header files contain a large amount of Swift and Objective-C code, this invention avoids Swift code appearing in the compiled header files and reduces Objective-C code, thereby further reducing the risk of core code leakage.

[0030] Step S102: After compiling the source code of the core components and the source code of the upper-level components in the software development kit into executable files, process the common umbrella header file of any core component in the software development kit so that the common umbrella header file only contains the declaration content pre-configured for the core component.

[0031] In this embodiment of the invention, the above declarations are exposing declarations. The executing entity can first compile the source code of the upper-level components in the software development kit into binary executable files. Preferably, after the above common umbrella header files, the executing entity can configure the dependency relationship between any upper-level component in the software development kit and the core component, and perform independent compilation on the upper-level component to obtain the executable file of the upper-level component. Subsequently, the executing entity generates the header file of the upper-level component. In one embodiment, the above independent compilation means that the executing entity performs compilation based on the pre-configured internal source code file (i.e., its own source code file) and internal header file (i.e., its own header file) of any upper-level component in the software development kit, without needing to introduce the header file of the dependent core component to perform compilation. In this way, by performing Objective-C-based encapsulation on the first type of modules in the core component and unifying the access methods of the two types of modules inside the core component, the logic of calling the core component can be simplified for each upper-level component. Therefore, it is not necessary to introduce the header file of the core component it depends on during compilation. Independent compilation can be performed only based on its own source code file and header file, thereby reducing the package size and improving compilation efficiency.

[0032] In some embodiments, after the above compilation and execution are completed, the executing entity can process the public umbrella header file of any core component in the software development kit, so that the public umbrella header file only contains the exposed declarations pre-configured for that core component. It can be understood that the exposed declarations refer to pre-configured method declarations or interface declarations that do not pose a risk of core code leakage. For example, the executing entity can first copy the pre-configured exposed declarations to a newly created public header file, then delete the previous public umbrella header file, and the new public header file becomes the processed public umbrella header file; for example, the suffix could be umbrella.h. In this way, by processing the public umbrella header file of the core component, so that it only contains the exposed declarations pre-configured for that core component, the compiled output can only expose the pre-configured public APIs, thereby further avoiding core code leakage and ensuring core code security.

[0033] In one optional technical solution, after processing the public umbrella header files, the executing entity can generate a module map file (i.e., a modulemap file) for the core components based on the processed public umbrella header files. This module map file contains module identifiers from the core components and header file identifiers (exposed header file identifiers) from the processed public umbrella header files. In some embodiments, the module map file may also include header file import rules. The module map file allows for precise control over which header files can be exposed, enabling the software development kit (SDK) to hide internal implementation details and expose only necessary interfaces to developers. This helps protect the core code, reduces direct external dependencies on internal APIs, and makes maintenance and updates easier in future versions.

[0034] Subsequently, in some embodiments, the execution entity may optimize the compilation artifacts, namely, clean up redundant files in the compilation process and restore the project configuration, thereby further optimizing the overall build process.

[0035] In the technical solution of this invention embodiment, a compilation method based on modular control is proposed. This method optimizes the class exposure mechanism and dependency management in the Swift and Objective-C mixed compilation environment, and can effectively control the size of the SDK and compilation efficiency without sacrificing encapsulation and security.

[0036] The following describes a specific embodiment of the present invention; see [link to specific embodiment]. Figure 2 and Figure 3 .

[0037] In mobile application development, the stability and security of the SDK are paramount. SDKs often consist of multiple interdependent components, such as core components and various upper-level components. Existing build methods typically involve including all necessary source code and resources within each component to ensure they can run independently in different applications. However, in component-based development, effectively hiding the core code implementation in a mixed Swift and Objective-C environment while ensuring the compactness and efficiency of upper-level components presents a significant technical challenge.

[0038] Existing SDK compilation methods in hybrid environments have the following problems: First, the risk of core code exposure: In hybrid environments, when core components and upper-layer components need to interact, existing technologies often result in unnecessary exposure of core code or sensitive functions. This not only increases security risks but also makes it difficult to protect intellectual property. Second, low compilation efficiency: Due to the lack of effective resource isolation and management mechanisms, existing build systems often need to repeatedly compile the same code and resources when processing multiple components, leading to excessively long compilation times and reduced development efficiency. Third, increased package size: Existing build methods, due to the lack of targeted resource management, often result in the final application containing a large amount of unnecessary code and resources, thus unnecessarily increasing the application size and affecting user download and usage experience.

[0039] This invention utilizes automated scripts to achieve efficient modular compilation and encapsulation of the iOS operating system SDK. During the compilation of core components, the script first executes `pod install` to install necessary dependencies, and then uses the `xcodebuild` command to build the SDK for both real devices and simulators. To protect the core code, the script filters and exposes only critical public header files, while creating necessary umbrella header files and module mapping files to ensure that private parts are not accessed externally. For upper-layer components, the script adopts a similar strategy, compiling each component separately. This not only reduces the final application package size but also ensures that upper-layer components can independently use the core library's functionality. Through this refined header file management and resource optimization scheme, this embodiment of the invention not only improves the SDK's compilation efficiency but also enhances code encapsulation and security. Furthermore, the script is also responsible for cleaning up redundant files during the compilation process and restoring project configurations, further optimizing the overall build process. The specific execution steps of this embodiment are as follows: Figure 3 As shown.

[0040] Step S301: Core Component Header File Management. In this embodiment, the Swift module and Objective-C module in the core component are isolated. The entry file of the Swift module is encapsulated in Objective-C to execute Objective-C-based calls, and the common header files of the Swift module, such as a-public.h, are extracted. This prevents the Swift module from exposing its internal core code, making it easier for external access and calls. Through the above encapsulation based on Objective-C, this embodiment allows both Swift and Objective-C projects to access the public Objective-C interfaces through the import method of the umbrella header file. Subsequently, the execution entity combines the header files of the Swift module and the Objective-C module into the complete header files of the core component.

[0041] Step S302: Core Component Compilation. In this step, the iOS Framework is built using xcodebuild in the command-line environment. This is executed on both a real iPhone (arm64 architecture) and an iPhone simulator (x86_64 and arm64 architectures). The configuration information is as follows: First, configure the bitcode generation mode (a code trimming operation). Second, disable automatic linking to facilitate processing and ensure that module dependencies are not automatically linked. Third, configure the build library to be allowed as a module dependency by other projects. Fourth, specify the build architecture for either the real device or the simulator. Afterward, the executable can generate default public header files in the Framework, i.e., the aforementioned public umbrella header files.

[0042] Step S303: Compiling Upper-Level Components. In this step, the execution entity first compiles each upper-level component independently, relying on the full header file of the core component (A-public-umbrella.h). Simultaneously, it configures the dependencies on the core component. The relevant configurations are as follows: First, configure the source code files required by the current module. Second, configure the header files required by the current module. Third, configure the dependencies on the core component. Afterward, the execution entity compiles the source code of the upper-level components. During compilation, only the source code files of the components themselves need to be included. Compared to existing methods that also require including all header files of the core component, the component package size is significantly reduced.

[0043] Step S304: Header File Management. In this step, the executing entity first modifies the common umbrella header file of the core component. It customizes the common umbrella header file using a script, adjusting its exposed content to ensure that only public APIs are exposed in the compiled output. For example, the script is configured as follows: First, the executing entity copies the required common header files (i.e., the aforementioned exposed declarations) from the core component header files to the output directory. Second, the executing entity performs relevant operations to create the common header file and writes the exposed declarations, forming the processed common umbrella header file. Third, the executing entity deletes the original common umbrella header file. Afterward, the executing entity optimizes the compiled output, i.e., cleans up redundant files during the compilation process and restores the project configuration, further optimizing the overall build process.

[0044] This embodiment offers the following advantages: First, an efficient inter-module isolation mechanism: This embodiment proposes a unique modular approach that effectively isolates core components from upper-level components in a mixed Swift and Objective-C environment. This isolation mechanism not only protects the security of the core code but also reduces unnecessary resource and code exposure. Second, automated compilation process optimization: By controlling the compilation process through automated scripts, compilation efficiency is significantly improved. The scripts automatically handle the dependencies between core and upper-level components, header file selection, and exposure tasks, thereby simplifying the build process and reducing the error rate. Third, intelligent header file management: This embodiment intelligently manages header file exposure through scripts, exposing only necessary public APIs while hiding private and internal code. This approach not only improves SDK security but also makes the SDK more compact and efficient. Fourth, optimized compilation artifact size: This embodiment significantly reduces the size of the compilation artifact by optimizing resource sharing and dependency management between modules, which not only helps reduce the size of the final application but also improves application download and startup performance. Fifth, flexibility and scalability: This embodiment offers high flexibility and scalability, enabling developers to flexibly select modules according to project needs and easily extend and maintain the SDK.

[0045] It should be noted that the technical solutions of this invention, including the collection, updating, analysis, processing, use, transmission, and storage of user personal information, all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.

[0046] For the foregoing method embodiments, they are described as a series of actions for ease of description. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, and some steps may actually be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential for implementing the present invention.

[0047] To facilitate better implementation of the above-described solutions of the embodiments of the present invention, related apparatus for implementing the above-described solutions is also provided below.

[0048] Please see Figure 4 As shown, the software development kit compilation device 400 provided in this embodiment of the invention may include: an encapsulation unit 401 and a header file processing unit 402.

[0049] The software development kit (SDK) to be compiled includes multiple components, each component including at least one module, and the same module is written in the same programming language. Each component includes a core component and upper-level components that depend on the core component. The encapsulation unit 401 is used to encapsulate a first-type module of any core component in the SSD using a second programming language, extracting the header files of the encapsulated first-type module and the second-type module to generate a common umbrella header file for the core component. The first-type module is a module written in the first programming language, and the second-type module is a module written in the second programming language. The header file processing unit 402, after compiling the source code of the core component and the source code of the upper-level component in the SSD into an executable file, processes the common umbrella header file of any core component in the SSD so that the common umbrella header file contains only the declarations pre-configured for the core component.

[0050] Optionally, in any core component of the software development kit, the header files of the first type of module, the header files of the second type of module, and the common umbrella header file of the core component, after being encapsulated, are files based on a second programming language.

[0051] In an embodiment of the present invention, the apparatus may include a core component compilation unit, configured to: compile the source code of a first type of module and the source code of a second type of module of any core component in the software development kit before generating the common umbrella header file of the core component to obtain an executable file of the core component.

[0052] Preferably, the apparatus may include an upper-layer component compilation unit, configured to: after generating the common umbrella header file of the core component, configure the dependency relationship of any upper-layer component in the software development kit on the core component, perform independent compilation on the upper-layer component to obtain the executable file of the upper-layer component, and generate the header file of the upper-layer component.

[0053] As a preferred embodiment, the upper-level component compilation unit is used to: perform compilation based on the pre-configured internal source code files and internal header files of any upper-level component in the software development kit.

[0054] In one embodiment, the header file processing unit 402 is further configured to: after processing the common umbrella header file of any core component in the software development kit, generate a module mapping file for the core component based on the processed common umbrella header file; wherein the module mapping file contains the module identifier of the core component and the header file identifier in the processed common umbrella header file.

[0055] Furthermore, in this embodiment of the invention, the software development kit is applied to the iOS operating system, the first programming language is Swift, and the second programming language is Objective-C.

[0056] According to the technical solution of the present invention, when compiling a software development kit, an Objective-C-based encapsulation is performed on a first type of module (written in Swift) of any core component, and the header files of the first type of module and the second type of module (written in Objective-C) after the above encapsulation are extracted to generate a common umbrella header file of the core component; thereafter, after compiling the source code of the core component and the source code of the upper-level component in the software development kit into an executable file, the common umbrella header file of any core component is processed so that the common umbrella header file only contains the exposed declaration content pre-configured for the core component. In this way, by encapsulating the first type of modules in the core component using Objective-C, we can prevent these modules from directly exposing their internal core code. Furthermore, we unify the access methods of both the first and second types of modules within the core component to Objective-C, and standardize the header files of each module and the common umbrella header file of the core component into Objective-C format. Compared to existing techniques where compiled header files contain a large amount of Swift and Objective-C code, this approach avoids Swift code in the compiled header files and reduces Objective-C code, thereby further reducing the risk of core code leakage. In addition, by processing the common umbrella header file of the core component to ensure it only contains pre-configured, exposing declarations for the core component, the compiled output only exposes pre-configured public APIs, further preventing core code leakage. In addition, by encapsulating the first type of module in the core component using Objective-C and unifying the access methods for the two types of modules within the core component, the logic for each upper-layer component to call the core component can be simplified. As a result, it is not necessary to include the header files of the core components that it depends on during compilation. Instead, it can be compiled independently based only on its own source code files and header files, thereby reducing the package size and improving compilation efficiency.

[0057] The present invention also provides an electronic device. The electronic device according to an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the software development kit compilation method provided by the present invention.

[0058] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing an electronic device according to embodiments of the present invention. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0059] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the computer system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0060] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.

[0061] In particular, according to the embodiments disclosed in this invention, the processes described in the above main step diagrams can be implemented as computer software programs. For example, embodiments of this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the main step diagrams. In the above embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit 501, it performs the functions defined in the system of this invention.

[0062] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0063] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0064] The units described in the embodiments of the present invention can be implemented in software or hardware. The described units can also be located in a processor; for example, a processor can be described as including a packaging unit and a header file processing unit. The names of these units do not necessarily limit the specific unit; for example, the packaging unit can also be described as "a unit that provides a common umbrella header file to the header file processing unit."

[0065] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the steps performed by the device include: encapsulating a first type of module of any core component in the software development kit (SDK) using a second programming language; extracting the header files of the encapsulated first type of module and the header files of the second type of module to generate a common umbrella header file for the core component; wherein the first type of module is a module written using the first programming language, and the second type of module is a module written using the second programming language; after compiling the source code of the core component and the source code of the upper-level component in the SSD into an executable file, processing the common umbrella header file of any core component in the SSD so that the common umbrella header file contains only declarations pre-configured for the core component.

[0066] In the technical solution of this invention embodiment, when compiling the software development kit, the first type of module (written in Swift) of any core component is encapsulated using Objective-C. The header files of the first type of module and the second type of module (written in Objective-C) after the encapsulation are extracted to generate the common umbrella header file of the core component. After that, after compiling the source code of the core component and the source code of the upper-level component in the software development kit into an executable file, the common umbrella header file of any core component is processed so that the common umbrella header file only contains the exposed declaration content pre-configured for the core component. In this way, by encapsulating the first type of modules in the core component using Objective-C, we can prevent these modules from directly exposing their internal core code. Furthermore, we unify the access methods of both the first and second types of modules within the core component to Objective-C, and standardize the header files of each module and the common umbrella header file of the core component into Objective-C format. Compared to existing techniques where compiled header files contain a large amount of Swift and Objective-C code, this approach avoids Swift code in the compiled header files and reduces Objective-C code, thereby further reducing the risk of core code leakage. In addition, by processing the common umbrella header file of the core component to ensure it only contains pre-configured, exposing declarations for the core component, the compiled output only exposes pre-configured public APIs, further preventing core code leakage. In addition, by encapsulating the first type of module in the core component using Objective-C and unifying the access methods for the two types of modules within the core component, the logic for each upper-layer component to call the core component can be simplified. As a result, it is not necessary to include the header files of the core components that it depends on during compilation. Instead, it can be compiled independently based only on its own source code files and header files, thereby reducing the package size and improving compilation efficiency.

[0067] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for compiling a software development kit, characterized in that, The software development kit to be compiled includes multiple components, each component includes at least one module, and the same module is written in the same programming language; the components include core components and upper-level components that depend on the core components; the method includes: For any core component in the software development kit, the first type of module is encapsulated using a second programming language, and the header files of the encapsulated first type of module and the second type of module are extracted to generate a common umbrella header file for the core component; wherein, the first type of module is a module written using the first programming language, and the second type of module is a module written using the second programming language; After compiling the source code of the core components and the source code of the upper-level components in the software development kit into executable files, the common umbrella header file of any core component in the software development kit is processed so that the common umbrella header file contains only the declaration content pre-configured for that core component.

2. The method according to claim 1, characterized in that, The same module in the software development kit to be compiled is written using the same programming language in the first and second programming languages.

3. The method according to claim 2, characterized in that, In any core component of the software development kit, the header files of the first type of module, the header files of the second type of module, and the common umbrella header file of the core component are files based on the second programming language.

4. The method according to claim 2, characterized in that, The method further includes: Before generating the common umbrella header file for the core component, the source code of the first type of module and the source code of the second type of module of any core component in the software development kit are compiled to obtain the executable file of the core component.

5. The method according to claim 3, characterized in that, The method further includes: After generating the common umbrella header file of the core component, configure the dependency relationship between any upper-level component in the software development kit and the core component, perform independent compilation on the upper-level component to obtain the executable file of the upper-level component, and generate the header file of the upper-level component.

6. The method according to claim 5, characterized in that, The process of independently compiling the upper-level component includes: Compilation is performed based on the pre-configured internal source code files and internal header files of any upper-level component in the software development kit.

7. The method according to claim 2, characterized in that, The method further includes: After processing the common umbrella header file of any core component in the software development kit, a module mapping file for that core component is generated based on the processed common umbrella header file; wherein, the module mapping file contains the module identifier of the core component and the header file identifier in the processed common umbrella header file.

8. A software development kit compilation device, characterized in that, The software development kit to be compiled includes multiple components, each component includes at least one module, and the same module is written in the same programming language; the components include a core component and upper-level components that depend on the core component; the device includes: The encapsulation unit is used to encapsulate a first type of module of any core component in the software development kit based on a second programming language, and to extract the header files of the encapsulated first type of module and the header files of the second type of module to generate a common umbrella header file of the core component; wherein, the first type of module is a module written in the first programming language, and the second type of module is a module written in the second programming language; The header file processing unit is used to process the common umbrella header file of any core component in the software development kit after compiling the source code of the core component and the source code of the upper-level component in the software development kit into an executable file, so that the common umbrella header file contains only the declaration content pre-configured for the core component.

9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.