CN117992133A - Packet manager adaptation method, apparatus, device, storage medium and program product - Google Patents

Packet manager adaptation method, apparatus, device, storage medium and program product Download PDF

Info

Publication number
CN117992133A
CN117992133A CN202211328389.3A CN202211328389A CN117992133A CN 117992133 A CN117992133 A CN 117992133A CN 202211328389 A CN202211328389 A CN 202211328389A CN 117992133 A CN117992133 A CN 117992133A
Authority
CN
China
Prior art keywords
target
library
party
project
target library
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211328389.3A
Other languages
Chinese (zh)
Inventor
苟亚明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202211328389.3A priority Critical patent/CN117992133A/en
Publication of CN117992133A publication Critical patent/CN117992133A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a packet manager adaptation method, a device, equipment, a storage medium and a program product, relates to the technical field of cloud technology and software development, and can be applied to scenes such as software packet management, component update and the like. The method comprises the following steps: acquiring at least one third party library, and extracting interface classes of each third party library; taking a third party library of a package manager which cannot be adapted to the current project as a target library, calling or adding a supportable target implementation class in the package manager, converting the interface class of the target library into the target implementation class, storing the target library in a target project corresponding to the target implementation class, and calling the target library by the current project through dependence on the target project; obtaining a configuration file of a target library by analyzing the target item; the target plugins generated by the target library are processed based on the configuration file. The implementation of the application converts the compatibility and configuration of the third party library, can realize the realization of the automation of the third party library to the realization class of the package manager, and reduces the development cost.

Description

Packet manager adaptation method, apparatus, device, storage medium and program product
Technical Field
The application relates to the technical field of cloud technology and software development, in particular to a packet manager adaptation method, a device, equipment, a storage medium and a program product.
Background
The method is suitable for different business requirements, packet management platforms adopted in project engineering can be different, and the problem that a used third party library is increased continuously along with continuous iteration of software functions, regardless of which packet management platform is adopted, a proper third party library can exist in the process of business iteration, but the third party library does not support a corresponding packet management platform is considered; aiming at the problem, if the third party library needs to be continuously used in the prior art, a developer is required to additionally build a private warehouse to manage the third party library which does not support the adopted package management platform, so that the development cost is very high.
Disclosure of Invention
Embodiments of the present application provide a packet manager adaptation method, apparatus, device, storage medium, and program product for solving at least one of the above technical problems. The technical scheme is as follows:
In a first aspect, an embodiment of the present application provides a packet manager adaptation method, including:
Acquiring at least one third party library, and extracting interface classes of each third party library;
if the interface class is unable to adapt to the third party library of the package manager adopted by the current project, determining the third party library as a target library;
The method comprises the steps of calling or adding supportable target realization classes in the package manager aiming at the target library, converting interface classes of the target library into the target realization classes, and storing the target library in target items corresponding to the target realization classes; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented;
obtaining a configuration file of the target library by analyzing the target item;
and processing the target plugins generated by the target library based on the configuration file.
In a possible embodiment, the obtaining at least one third party library and extracting the interface class of each third party library includes:
Acquiring at least one third party library in the preloading process, and extracting interface classes of the third party library in a script scanning mode; the third party library is correspondingly provided with at least one version and a corresponding storage address;
The method for calling or adding the supportable target implementation class in the package manager for the target library, and converting the interface class of the target library into the target implementation class includes:
in the transformation process, aiming at the target library, calling or adding a supportable target implementation class in the package manager, and converting an interface class of the target library into a target implementation class, wherein the target implementation class supports adaptation and mapping between a first programming language and a second programming language; the first programming language is an object-oriented programming language of an extended C, and the second programming language is a computer programming language extended based on the first programming language.
In a possible embodiment, the obtaining the configuration file of the target library by parsing the target item includes:
reading an engineering file corresponding to the target item, and determining a dependent field of the target library;
Traversing a storage interval, and extracting the dependent data of the target library through the dependent field;
constructing a data set of the target library based on the dependent data;
and obtaining a configuration file of the target library based on the configuration items determined by the data set.
In a possible embodiment, the obtaining the configuration file of the target library by parsing the target item further includes:
Stripping the reference mode of the target library to obtain a shadow engineering of the target library;
and deploying the shadow engineering.
In a possible embodiment, the constructing the data set of the target library based on the dependent data includes:
Creating a dictionary set based on the dependent data, taking the constructed structure body as a key of the dictionary, and taking the constructed attribute value as a value of the dictionary;
Wherein the structure includes an extraction and escape function for a valid string that includes a null character; the attribute values are of enumerated type, and the construction of the attribute values includes converting the character strings, arrays and dictionary reads in the attribute table file into object types.
In a possible embodiment, the obtaining the configuration file of the target library based on the configuration item determined by the data set includes:
extracting configuration item information corresponding to preset fields in a dictionary set of the data set;
setting the configuration item information into a configuration file of a target project;
The configuration item information corresponding to the preset field comprises at least one of the following items:
The address of the dependent library pointed by the target library calling function; the dependency library generates a corresponding module file in the process of setting the configuration items;
the target library is stored in the binary name of the target project;
Compiling and setting the target library to be configured;
basic parameters of the target library;
And the version number of the target library.
In a possible embodiment, the processing, based on the configuration file, the target plugin generated by the target library includes:
packaging the target library into a target plug-in;
Compiling the target plug-in based on the configuration file and uploading the target plug-in;
And acquiring and installing the latest target plug-in.
In a possible embodiment, compiling the target plugin based on the configuration file includes:
Acquiring a target plug-in to be compiled;
if the dependence stack of the target plug-in is not empty, traversing all module files generated in the process of analyzing the target item, and after adding the module files which belong to the shadow engineering of the target library and depend on the target plug-in to the dependence tree, carrying out stack stripping processing on the target plug-in to generate configuration files of the dependence tree.
In a possible embodiment, the obtaining and installing the latest target plugin includes:
if the version number of the locally stored target plug-in is different from the version number of the target library, downloading a target compression package to which the target library belongs; the target compression packet is uploaded based on a dependency tree obtained by compiling and comprises target plug-ins corresponding to different version numbers and configuration information of the dependency tree;
The target plugin is installed based on the compression package.
In a second aspect, an embodiment of the present application provides a packet manager adaptation apparatus, including:
the acquisition module is used for acquiring at least one third party library and extracting interface classes of each third party library
The determining module is used for determining a third party library as a target library if the interface class cannot adapt to the third party library of the package manager adopted by the current project;
The conversion module is used for calling or adding supportable target realization classes in the packet manager aiming at the target library, converting interface classes of the target library into the target realization classes, and storing the target library in target items corresponding to the target realization classes; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented;
The analysis module is used for obtaining the configuration file of the target library by analyzing the target item;
And the processing module is used for processing the target plugins generated by the target library based on the configuration file.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a memory, a processor and a computer program stored on the memory, where the processor executes the computer program to implement the steps of the packet manager adaptation method provided in any one of the embodiments of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the packet manager adaptation method provided by any of the embodiments of the first aspect described above.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of the packet manager adaptation method provided by any of the embodiments of the first aspect.
The technical scheme provided by the embodiment of the application has the beneficial effects that:
Embodiments of the present application provide a packet manager adaptation method, apparatus, electronic device, computer-readable storage medium, and computer program product; specifically, when at least one third party library is obtained, the interface class of each third party library can be extracted, if it is determined that the interface class of one or more third party libraries cannot be adapted to the package manager adopted by the current project, the third party library which cannot be adapted to the interface class can be determined as a target library, the target implementation class supported by the third party library is called or added in the package manager aiming at the target library, then the interface class of the target library is converted into the target implementation class supported by the package manager adopted by the current project, and the converted target library is stored in the target project corresponding to the target implementation class; the method comprises the steps that a current project and a target project have a dependency relationship, and the current project can indirectly call a target library through the target project when being implemented; then, by parsing the target item, a configuration file corresponding to the target library can be obtained to further process the target plugin generated by the target library based on the configuration file. The implementation of the application can realize the interface conversion of the third party library of the package manager which cannot be adapted to the current project, realize the automatic realization class of the third party library to the package manager, effectively reduce the verification process of the project developer on the relation between the third party library and the package manager, and also avoid the need of constructing an extra private warehouse for managing the third party library which is not supported by the package manager by the developer, thereby being beneficial to reducing the development cost.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 is a schematic flow chart of a packet manager adaptation method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an operation environment of a packet manager adaptation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of interface conversion for a target library according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a framework for project analysis according to an embodiment of the present application;
FIG. 5 is a schematic flow chart of a project analysis project according to an embodiment of the present application;
FIG. 6 is a schematic flow chart of a compiling plug-in according to an embodiment of the present application;
Fig. 7 is a schematic flow chart of an uploading plug-in according to an embodiment of the present application;
FIG. 8 is a schematic flow chart of downloading and installing plug-ins according to an embodiment of the present application;
FIG. 9 is a flowchart of a packet manager adaptation method according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a packet manager adapting device according to an embodiment of the present application;
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the drawings in the present application. It should be understood that the embodiments described below with reference to the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and the technical solutions of the embodiments of the present application are not limited.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and "comprising," when used in this specification, specify the presence of stated features, information, data, steps, operations, elements, and/or components, but do not preclude the presence or addition of other features, information, data, steps, operations, elements, components, and/or groups thereof, all of which may be included in the present specification. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates that at least one of the items defined by the term, e.g., "a and/or B" may be implemented as "a", or as "B", or as "a and B".
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
The embodiment of the application relates to Cloud technology (Cloud technology), which is a hosting technology for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
The cloud technology is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied by the cloud computing business mode, can form a resource pool, and is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud computing (closed computing) refers to the delivery and usage mode of an IT infrastructure, meaning that required resources are obtained in an on-demand, easily scalable manner through a network; generalized cloud computing refers to the delivery and usage patterns of services, meaning that the required services are obtained in an on-demand, easily scalable manner over a network. Such services may be IT, software, internet related, or other services. Cloud Computing is a product of fusion of traditional computer and network technology developments such as Grid Computing (Grid Computing), distributed Computing (DistributedComputing), parallel Computing (Parallel Computing), utility Computing (Utility Computing), network storage (Network Storage Technologies), virtualization (Virtualization), load balancing (Load Balance), and the like. With the development of the internet, real-time data flow and diversification of connected devices, and the promotion of demands of search services, social networks, mobile commerce, open collaboration and the like, cloud computing is rapidly developed. Unlike the previous parallel distributed computing, the generation of cloud computing will promote the revolutionary transformation of the whole internet mode and enterprise management mode in concept.
The packet manager adaptation method provided by the embodiment of the application can relate to cloud computing and cloud services. Wherein the cloud service relates to the service of the package management platform; the developer can access the services provided by the platform through the API interface, and can also use the framework and the infrastructure (or the basic data) provided by the platform to deploy and operate the services required by the developer.
Optionally, the packet manager adaptation scheme provided by the embodiment of the application can be applied to the field of artificial intelligence cloud service. An artificial intelligence cloud service, also commonly referred to as AIaaS (AI AS A SERVICE, chinese is "AI as service"). The service mode of the artificial intelligent platform is the mainstream at present, specifically, the AIaaS platform can split several common AI services and provide independent or packed services at the cloud; this service mode is similar to an AI theme mall: all developers can access one or more artificial intelligence services provided by the use platform through an API interface, and partial deep developers can also use an AI framework and AI infrastructure provided by the platform to deploy and operate and maintain self-proprietary cloud artificial intelligence services.
The adaptation method of the package manager provided by the embodiment of the application can be applied to scenes of software package management, component update and the like.
The following terms that may be involved in embodiments of the present application are described:
Packet manager: also called as a software package management system, is a tool combination for automatically installing, configuring, uninstalling and upgrading a software package in a terminal (such as a computer), and can be widely applied to the installation and management of various system software and application software. In the embodiment of the application, the package management tool is also called.
Third party library: some basic capabilities used in software development, such as a network library, a picture library and a photographing library; in the embodiment of the application, a third party library of a package manager adopted by an interface class which cannot be adapted to a current project is called a target library; optionally, the third party library may also be a component or SDK (software development kit); in addition, a user who adopts the third party library may be referred to as a caller or an accessor.
Computer programming language: tools for programming, also known as programming languages, or development languages. Embodiments of the present application may relate to an object-oriented programming language (OC) that extends C and a Swift programming language that extends based on OC. The packet manager adaptation method provided by the embodiment of the application can adapt to a plurality of packet managers of the function library written in the two programming languages. It should be noted that the present application may also relate to processing in other computer programming languages, and the present application is not limited thereto.
Pod: the method is totally called CocoaPods, and CocoaPods in the development of application software of equipment terminals such as iOS, macOSX, iWatch, iPod can assist in conveniently searching, installing and managing third party libraries. CocoaPods is a package-dependent management tool specific to the third party package required for Xcode engineering (project). CocoaPods can improve participation and discoverability of third party open source Cocoa libraries. Wherein CocoaPods is centralized, all resource indexes are centralized in one warehouse, and when searching a third party library, indexes can be performed through a central server.
SPM: the full scale SWIFT PACKAGE MANAGER, similar to Pod, is used to manage third party libraries, but SPM only supports the Swift programming language as a management tool. With respect to the CocoaPods tool, the SPM is decentralised and can be downloaded in the corresponding repository for different resources.
Carthage: third party framework management tools (similar to cocoapods) that can be used to manage third party frameworks and dependencies, but without automatically modifying project files and generating configurations, give control over project structure and settings to the developer. Carthage may automatically program the third party framework to Dynamic framework (dynamic library). Compared with CocoaPods, the service is also decentralised, and depending on the source address of each third party library, the decentralised design makes packet management independent of the central server, and is not limited by the information quantity and stability of the central server (such as the problem of poor network access).
The technical solutions of the embodiments of the present application and technical effects produced by the technical solutions of the present application are described below by describing several exemplary embodiments. It should be noted that the following embodiments may be referred to, or combined with each other, and the description will not be repeated for the same terms, similar features, similar implementation steps, and the like in different embodiments.
Fig. 2 is a schematic diagram of an operation environment of a packet manager adaptation method according to an embodiment of the present application, where the environment may include a terminal 20 and a server 10.
Wherein the terminal 20 may run a client or a service platform. The terminal (which may also be referred to as a device) may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, etc. In one example, a developer may implement management of a third party library through terminal 20.
The server 10 is an independent physical server, may be a server cluster or a distributed system (such as a distributed cloud storage system) formed by a plurality of physical servers, and may also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms. In one example, a server may provide packet management services.
In a possible embodiment, the terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited herein. Such as terminal 20 may upload the third party library and its corresponding plug-ins to server 10 via network 30.
It may be understood that the packet manager adaptation method provided by the embodiment of the present application may be performed by a server for packet management, and accordingly, the packet manager adaptation device may also be provided in the server. Correspondingly, the method can be used for deploying a software development platform on the terminal, and the method for adapting the packet manager is executed by the terminal when the operation of the terminal meets the requirements. Regardless of which main body the packet manager adaptation method provided by the embodiment of the application is executed, the input result is consistent, the compatibility and configuration of the target library can be converted, the target library is assembled into a form supported by the packet manager by analyzing the engineering source code, and the target library is referenced to the function library of the current project.
The following specifically describes a packet manager adaptation method provided in an embodiment of the present application.
Specifically, as shown in fig. 1, the packet manager adaptation method provided by the embodiment of the present application includes the following steps S101 to S105:
step S101: and obtaining at least one third party library and extracting the interface class of each third party library.
Step S102: if the interface class is unable to adapt to the third party library of the package manager adopted by the current project, the third party library is determined to be the target library.
Step S103: aiming at a target library, invoking or adding supportable target realization classes in a package manager, converting interface classes of the target library into target realization classes, and storing the target library in target items corresponding to the target realization classes; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented.
Step S104: and obtaining the configuration file of the target library by analyzing the target item.
Step S105: and processing the target plugins generated by the target library based on the configuration file.
Specifically, if a developer adopts Pod management for a current project (such as a certain photographic product, which can be applied to a camera program of a terminal device), but a photographic component (a third party library) provided by a third party or a developer only supports a cartage tool, the interface of the third party library can be converted by the method provided by the embodiment of the application, so that the interface of the third party library is adapted to Pod management, and the developer does not need to additionally build a private warehouse for the third party library to manage the component provided by the third party, thereby effectively improving development efficiency and reducing development cost.
When the packet manager adapting method provided by the embodiment of the application is executed, the interface types of all the third party libraries can be extracted for one or more third party libraries currently acquired, then whether the interface types of the third party libraries are consistent with the interface types which can be identified by the packet manager adopted by the current project is judged, when the interface types are inconsistent, the third party libraries which cannot be adapted to the packet manager are determined as target libraries, interface conversion is carried out on the target libraries, and the converted target libraries are adapted to the packet manager adopted by the current project. Accordingly, the method provided by the embodiment of the present application may also be understood as a method for converting a component package management tool.
Optionally, the interface type of the third party library may support at least one package manager, for example, the photographing component provided by the third party a may support Pod, carthage, and SPM package management, and the photographing component provided by the third party B may support Pod management only. It is understood that an interface is an abstract type, which is also a collection of a set of methods; the interface can be done in a manner similar to the definition of rules, and the value of the interface type can be determined by the functions that can be implemented by the method. One type may implement multiple interfaces, and multiple types may implement one interface.
When it is determined that the interface class of the third party library cannot adapt to the packet manager adopted by the current project and determines the corresponding target library, the operation may be performed first for the packet manager, for example, the implementation class supported by the packet manager may be called (an empty interface may be called, i.e. an interface without any method is not defined, and variables of the empty interface type may store variables of any type), or the implementation class may be added in the packet manager; the interface class of the target library may then be replaced with a target implementation class supported by the package manager.
After the interface conversion is completed, the target library can be stored in the packet management platform according to the mode of the target implementation class. For example, a target library may be stored in Pods items (target items) for Pod, and subsequent indirect invocation of the target library may be accomplished by relying on Pods items for the current item (main item). In terms of the Pod principle, all the dependency libraries are stored in another item named Pods, and then the main item depends on Pods items, so that the source code management work task is moved from the main item to Pods items; the Pods item can ultimately be compiled into a file named libPods. A, and the main item can be relied upon on this. A file.
Optionally, after storage implementation, a connection request may be established in the packet manager for the target library.
Then, to call the target library in the current project, a configuration file corresponding to the target library can be obtained by analyzing the target project, and a target plug-in generated by the target library is processed based on the configuration file.
The following describes an interface conversion process of the third party library in the embodiment of the present application.
Specifically, the interface class can be extracted from the target library input in the package management platform through Xcode expansion capability, so that the automation of the target library is realized to the realization class supported by the package manager adopted by the current project.
In a possible embodiment, as shown in fig. 9, step S101 includes obtaining at least one third party library, and extracting interface classes of each third party library, including the following step A1:
Step A1: acquiring a third party library in the preloading process, and extracting interface classes of the third party library in a script scanning mode; the third party library is provided with at least one version and a corresponding storage address.
Specifically, in the stage of pre-loading preload, after the third party library is obtained, the third party library to be processed can be uploaded to a package management server, and the interface class of the third party library is extracted through the built-in scanning script of the package management server; and the interface class of the third party library can be extracted by adopting a script scanning mode. The interface classes include common methods, attributes, protocols, abstract classes, etc.
Alternatively, a scan interface may also be configured on the executing device, such as scanning the interface according to a packet path, where all interfaces in the project are scanned when scanning all is set.
Alternatively, since the third party library may have multiple versions and multiple storage addresses, the latest address of the third party library may be uploaded to the package management server during the preloading process, and the binary data or the source code of the third party library may be pulled by the server.
Optionally, the interface class of the third party library may also be synchronously provided by the third party when the third party library is provided, and when the third party library is applied, step S102 may be executed directly based on the obtained information to determine whether the packet manager adopted by the current project supports the interface class of the third party library; when the packet manager cannot be matched with the third party library, the following steps S103-S104 can be executed to perform interface conversion and mapping; when the package manager is matched with the third party library, the operations of installation, configuration, unloading, upgrading and the like can be directly implemented on the third party library through the package manager.
Accordingly, in step S103, for the target library, invoking or adding a supportable target implementation class in the package manager, and converting an interface class of the target library into the target implementation class, including the following step A2:
Step A2: in the transformation process, aiming at the target library, calling or adding a supportable target implementation class in the package manager, and converting an interface class of the target library into a target implementation class, wherein the target implementation class supports adaptation and mapping between a first programming language and a second programming language; the first programming language is an object-oriented programming language of an extended C, and the second programming language is a computer programming language extended based on the first programming language.
Specifically, in the transformation stage, when it is determined that the interface class of the target library cannot adapt to the packet manager adopted by the current project, the implementation class identified by the packet manager may be scheduled, and the implementation class may be added to the entry of the packet manager, so as to convert the interface class of the target library into the type identified by the packet manager. Among other things, conversion rules that adapt and map the OC programming language and the Swift programming language can be cached in the implementation classes that the packet manager can support. The block attribute or function parameter in the OC programming language can be converted into an anonymous function through a conversion rule, such as a shift programming language supported in SPM, so that interfaces of third party libraries developed by different programming languages are converted and mapped.
Optionally, the conversion of the interface can adopt a mode of displaying conversion, so that null is returned when the conversion fails, the condition of carrying out interface conversion on the target library is better perceived, the execution progress of the adaptation method of the packet manager is flexibly controlled, and the conversion efficiency of the packet management tool is improved.
In the embodiment of the present application, as shown in fig. 3, the interface class of the target library may be replaced with an implementation class corresponding to the target tool, so that the target library is adapted to the target tool. The application provides a scheme which belongs to a general-purpose package management tool conversion scheme. Illustrating: assuming that the package management platform of the current iOS project includes Pod (first tool), cartage (second tool), and SPM (third tool), its corresponding implementation classes may be Pod implementation class, cartage implementation class, and SPM implementation class; if the target library only supports SPM management and the current project adopts the Pod tool, the interface class of the target library can be extracted, and after the Pod implementation class is added on the Pod tool, the interface class of the target library is converted into the Pod implementation class.
The following describes a process of parsing project engineering in an embodiment of the present application.
Specifically, the project may be parsed by xcodepro, as shown in fig. 4, where the parsing process includes reading the project file, separating the dependency data, constructing the data set, setting the configuration item, deploying the shadow project, and so on.
In a possible embodiment, as shown in fig. 5 and fig. 9, the configuration file of the target library is obtained by parsing the target item in step S104, and includes the following steps B1 to B4:
Step B1: and reading an engineering file corresponding to the target item, and determining a dependent field of the target library.
Specifically, xcodeproj project files corresponding to the target item may be read, and the xcodeproj project file may be a project file created by Xcode and having a suffix name xcworkspace or xcodeproj. The engineering file may be displayed as a series of section sections of key value pairs after being read by xcodepro. Wherein the read dependency field may include at least one of:
bundleid: an identification indicating project projects, the identification having uniqueness by which project developers can mark projects that exist in a target library;
Resources: indicating resource file data, taking a value as an array, and acquiring resources required by a target library from the array;
main. Store Board: an entry page indicating program launch in the front-end file;
buildSettings: indicating the compilation setting information.
Step B2: traversing the storage interval, and extracting the dependent data of the target library through the dependent field.
Specifically, as shown in fig. 5, in the process of separating the dependent data, since the storage positions of the target library to be converted and other third party libraries are in the storage interval (also called a storage center) of the main engineering, the storage interval can be traversed, and the dependent data relied on in the target library to be converted can be extracted through the dependent field. For example: when the target library is a target component, the dependent data is component data, and the dependent data may include data such as a component name, a version number, an initialization address, and the like.
Step B3: constructing a data set of the target library based on the dependent data.
Specifically, as shown in fig. 5, the data set of the target library may be constructed based on the basic data provided by the storage center and the dependency data (corresponding to the dependency library, which may be a dependency component) separated in step B2.
Optionally, constructing the data set of the target library based on the dependent data in step B3 includes the following step B31:
Step B31: creating a dictionary set based on the dependent data, and taking the constructed structure body as a key of the dictionary and the constructed attribute value as a value of the dictionary.
Wherein the structure includes an extraction and escape function for a valid string that includes a null character; the attribute values are of enumerated type, and the construction of the attribute values includes converting the character strings, arrays and dictionary reads in the attribute table file into object types.
Specifically, the process of creating the dictionary set includes:
Constructing a structure CommentedString and taking the structure as a key of a dictionary;
Attribute values PlistValue are constructed and used as dictionary value values.
The structure CommentedString contains the extraction result and the escape function of the valid character string, including blank characters, keywords such as "self", "false", "wire", "", "_", "/", etc.
The attribute value PlistValue is an enumeration type, and can be converted into an object type aiming at character strings, arrays and dictionary reading in an attribute list plist file, so as to provide basic service for generating configuration items.
Step B4: and obtaining a configuration file of the target library based on the configuration items determined by the data set.
Specifically, as shown in fig. 5, the configuration file of the target library may be determined based on the configuration item information obtained in the step B3 and the basic data provided by the storage center.
Optionally, the obtaining the configuration file of the target library in step B4 based on the configuration item determined by the data set includes the following steps B41-B42:
step B41: and extracting configuration item information corresponding to preset fields in the dictionary set of the data set.
Specifically, a value corresponding to a preset field of the dictionary set in the data set may be extracted.
The configuration item information corresponding to the preset field comprises at least one of the following items:
The address of the dependent library pointed by the target library calling function; the dependency library generates a corresponding module file in the process of setting the configuration items; specifically, the preset field may be an isa, which represents the address of the dependent library to which the third party library call function points, in the course of which the dependent library may generate a module file module. The module file module may be a functional fragment in the form of a single file, for example, the portal file may be referred to as a portal module or a main module.
The target library is stored in the binary name of the target project; in particular, the preset field may be a name, which represents a binary name stored in the project by the third party library.
Compiling and setting the target library to be configured; specifically, the preset field may be buildSettings, which indicates a compiled setting that the library needs to be configured, for example: resource group configuration, log information, link settings, signature settings, etc.
Basic parameters of the target library; in particular, the preset field may be argu, which represents the basic parameters required by the third party library.
And the version number of the target library. Specifically, the preset field may be version, which represents a version number of the third party library.
Optionally, the configuration item may also include other element information, such as DEPENDENCYNAME, indicating the name of the resolution dependency; the configuration items can be adjusted, added, deleted or updated according to requirements for some optional elements, and the application is not limited in this regard.
Step B42: and setting the configuration item information into a configuration file of the target project.
Specifically, the configuration item information related to the target library is set into the configuration file config of the target project.
Specifically, step S102 further includes steps B5 to B6:
Step B5: and stripping the reference mode of the target library to obtain the shadow engineering of the target library.
Step B6: and deploying the shadow engineering.
Specifically, firstly, the referencing mode of the target library is stripped from the original base, a shadow project corresponding to the target library can be generated, and then the shadow project is deployed into the package management service, so that the subsequent compiling and linking operation is convenient.
In the embodiment of the application, the project shadow is changed, so that the intrusion into the existing project can be avoided. In the scene that some multiple developers update engineering simultaneously, the shadow engineering is deployed, so that the influence on the sub project engineering developed by other developers can be effectively avoided.
The following describes a procedure for processing plug-ins generated by a third party library in an embodiment of the present application.
Specifically, as shown in fig. 6, 7, and 8, compiling, uploading, downloading, and installing processes may be performed for a target plug-in obtained by packaging (packaging) a third party library.
In a possible embodiment, as shown in fig. 9, the processing, in step S105, of the target plug-in generated by the target library based on the configuration file includes the following steps C1-C3:
Step C1: and packaging the target library into a target plug-in.
Specifically, after the third party library is parsed, a configuration file config is generated, and the corresponding target library can be packaged (packed) into a target plug-in plug in.
Step C2: compiling the target plug-in based on the configuration file and uploading the target plug-in.
Specifically, in the compiling process, the dependency tree of the third party library may start from a module file module generated by a preset field (isa field), and store the library dependency relationship in the engineering with a stack structure. After obtaining the corresponding dependency tree (generating the dependency tree json file), the corresponding plug-ins may be uploaded based on the content of the dependency tree.
The method comprises the steps of determining an uploaded plug-in set according to a dependency tree, obtaining a version number of each plug-in, and combining a plug-in list and dependency tree configuration information (such as a configuration list) into a compression package (such as a zip file).
Optionally, compiling the target plugin in step C2 based on the configuration file includes the following steps C21-C22:
Step C21: and obtaining a target plug-in to be compiled.
Step C22: if the dependence stack of the target plug-in is not empty, traversing all module files generated in the process of analyzing the target item, and after adding the module files which belong to the shadow engineering of the target library and depend on the target plug-in to the dependence tree, carrying out stack stripping processing on the target plug-in to generate configuration files of the dependence tree.
Specifically, as shown in fig. 6, in the process of compiling the plug-ins, firstly determining a shadow plug-in to be compiled and deployed, then judging whether the dependency stack is empty, if not, traversing all module files modules, then adding the modules into the dependency tree, and executing the target plug-in to pop out, thereby generating the config file of the dependency tree.
Taking source code written in swift programming language as an example, compiling the plug-in can be performed through three stages of parameter analysis, AST compiling and AST grammar tree generation. The compiling process is to parse the template to generate an AST file, which belongs to an abstract syntax tree and is a tree representation form of an abstract syntax structure of the source code.
Step C3: and acquiring and installing the latest target plug-in.
Specifically, after compiling the target plug-in, the installation process of the target plug-in may be completed.
Optionally, the latest target plug-in is acquired and installed in the step C3, which comprises the following steps C31-C32:
Step C31: if the version number of the locally stored target plug-in is different from the version number of the target library, downloading a target compression package to which the target library belongs; the target compression packet is uploaded based on the dependency tree obtained by compiling and comprises target plug-ins corresponding to different version numbers and configuration information of the dependency tree.
Step C32: the target plugin is installed based on the compression package.
Specifically, as shown in fig. 8, first, it is checked whether a local target plug-in exists, if so, it is determined whether the version number needs to be updated, and when it is determined that the update is needed, a compression package (zip file) to which the target plug-in belongs is downloaded, and the compression package is decompressed to a specified directory to complete the installation.
Taking a Pod tool as an example for illustration, checking whether a Pod for introducing a new target library is contained in the installation process of the Pod, if so, continuing to judge whether the Pod belongs to a specified version, if so, checking whether the saved version is the same as the new specified version, if so, skipping, and if not, updating; if the version is not specified, the update is not checked to be skipped directly, and if the library is not contained, the corresponding library is downloaded and the file of the corresponding version is saved. Wherein when new pods are downloaded and installed, the installed version can be written in the file for each pod to know each installed version and lock the version files; when running pod install, only the dependencies listed in the file may be resolved. For the listed pods, the specified version can be downloaded; versions that match their content may be searched for unlisted pods. When the pod install is executed, a pod file can be generated, and the existence of the file can enable the current project to be commonly developed by a plurality of developers without the problem of version disorder.
It can be understood that the installation of the plug-in is due to the change of the function library depending on the project, and as in the embodiment of the present application, the target library is added in the function library.
In the embodiment of the application, on one hand, the interface class is extracted from the third party library input by the package management platform in a script scanning mode through the expansion capability of the Xcode, so that the realization class of the package manager can be automatically docked by the third party library, and the manual verification process is reduced. On the other hand, by analyzing project projects through xcodepro tools, dependency relations of the third party library can be generated into dependency trees and configuration items, and project shadow is changed, so that the invasion of the existing projects can be effectively avoided. In yet another aspect, a standardized compiling configuration file config is provided, a third party library is packaged into a plug-in, and compiling, uploading, downloading and installing processes are performed, so that an access process can be effectively simplified, and a target library is successfully introduced into a part of a function library serving as a current project.
The following specifically describes a packet manager adaptation method provided by the embodiment of the present application in connection with an application example.
Application example 1
Project formulation: a developer of a financial customer, such as a developer of bank a.
The current project: and the iOS project developed by the Swift development language is adopted, and the component management is carried out by adopting an SPM mode.
Component requirements: payment component (in this application, the payment component is exemplified as a target library).
Third party provided components: the payment component provided by company B supports Pod, cartage and SPM management; the payment component provided by company C supports Pod management. That is, the acquired third party library includes a payment component provided by company B and a payment component provided by company C.
The research results of the developer for the payment components provided by the B company and the C company show that the flexibility and the payment security of the payment components provided by the C company are higher than those of the payment components provided by the B company, but the payment components provided by the C company do not support the SPM management.
Based on the above investigation result, the developer considers that the payment security is very important in the financial industry, prefers the payment component provided by the company C, and in order to save development cost, processes the payment component provided by the company C by using the package manager adaptation method provided by the embodiment of the present application, so as to assemble the payment component into a form supported by the target package management.
It can be appreciated that the above-described research activities can be performed on-line by the project formulator, and the target library that needs to be interface-converted is determined directly from several third party libraries. In addition, the project maker can directly input the payment component provided by the company B and the payment component provided by the company C into the execution program of the packet manager adaptation method provided by the embodiment of the application, and the judgment of the adaptation problem is completed on line through the step S102, so as to determine a target library which cannot be adapted with the packet manager from a plurality of third party libraries; the processing of the operation can effectively improve the efficiency of project development, reduce additional investigation behaviors and improve the quality of developed projects.
Specifically, the target library to be converted is a payment component provided by company C, and the target implementation class is an SPM implementation class. The payment component can be transmitted into the packet management server, the interface class of the payment component is extracted in a script scanning mode, and the latest storage address of the payment component can be synchronously uploaded to the server by considering that three versions and corresponding storage addresses exist in the payment component, and binary data or source codes of the payment component are pulled through the server. Then, implementation classes can be added in SPM management adopted by the current project, so that the SPM tool can be connected with the payment component, and the interface class of the payment component is converted into the SPM implementation class which can be identified by the SPM tool; in addition, in the case of supporting a shift programming language in the SPM, considering the different programming languages, the SPM implementation class may be cached with a conversion rule for the programming language, such as converting a block attribute or a function parameter in the OC programming language into an anonymous function. On this basis, the payment component may be deposited in the packet management platform (such as the memory center shown in fig. 5) in the SPM implementation class manner at the request start startRequest stage, and the connection request is started to be established for the payment component in the packet manager. After the compatibility and configuration of the payment component are converted, the payment component can be assembled into a form supported by the SPM tool by parsing the engineering source code of the current item (since the payment component is stored in the target item corresponding to the SPM implementation class, the item has a dependency relationship with the current item, and the invocation of the payment component can be indirectly implemented by the main item depending on the target item).
Application example two
Regarding iOS projects, the present application is not limited in this regard as management tools that iOS may employ include Pod, cartage, and SPM (as just one example, but may be other supported management tools). Company A is taken as a provider of the components, the written components 1 support Pod management, the components 2 support SPM management, in order to improve the use flexibility of the components 1 and 2 and the probability of being adopted by a project developer, source code files of the current project can be obtained under the condition of obtaining the consent of the project developer, and the package manager adapting method provided by the embodiment of the application respectively carries out adapting processing on package management tools supported by the components 1 and 2 so as to assemble and obtain components corresponding to the forms supported by the package management tools adopted by the current project, and feeds back updated project files which are adopted by the components 1 and 2 in the main project to the project developer.
Specifically, the current project employs a cartage tool that is not supported by both component 1 and component 2 developed by company a. On the basis, if the current operation resources of the device are sufficient, two components can be input simultaneously to carry out the adaptation processing of the packet manager. After the two components are processed in the step S101, the two components are automatically docked with the implementation class supported by the cartage tool, and the two components are respectively stored in the items corresponding to the cartage, the step S104 and the step S105 may be implemented synchronously. Optionally, the project file storing the components after interface conversion is analyzed, and configuration of the two components can be completed in the analysis process. In addition, as shown in fig. 6, the processing may be performed on the plug-ins to be compiled and deployed (the plug-in 1 formed by encapsulating the component 1 and the plug-in 2 formed by encapsulating the component 2) at the same time, then as shown in fig. 7, all the plug-in sets may be uploaded (may include the plug-in 1 and the plug-in 2) according to the generated configuration file of the dependency tree, and the corresponding configuration information of the two plug-ins are packaged in the same compressed package, so that when the updated functional component is introduced into the card library, the installation of the two plug-ins may be completed by processing a compressed package.
It should be noted that, in the alternative embodiment of the present application, related data (such as basic data, a storage address of a third party library, and a version number of the third party library) and the like, when the above embodiment of the present application is applied to a specific product or technology, permission or consent of a use object needs to be obtained, and collection, use and processing of related data need to comply with related laws and regulations and standards of related countries and regions. That is, in the embodiment of the present application, if data related to the subject is involved, the data needs to be obtained through the subject authorization consent and in accordance with the relevant laws and regulations and standards of the country and region.
An embodiment of the present application provides a packet manager adaptation apparatus, as shown in fig. 10, the packet manager adaptation apparatus 100 may include: the device comprises an acquisition module 101, a determination module 102, a conversion module 103, a resolution module 104 and a processing module 105.
The acquiring module 101 is configured to acquire at least one third party library, and extract an interface class of each third party library; a determining module 102, configured to determine a third party library as a target library if there is a third party library of a package manager that cannot be adapted to a current project by an interface class; a conversion module 101, configured to call or add a supportable target implementation class in the packet manager for the target library, convert an interface class of the target library into the target implementation class, and store the target library in a target item corresponding to the target implementation class; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented; the parsing module 104 is configured to obtain a configuration file of the target library by parsing the target item; and a processing module 105, configured to process the target plugin generated by the target library based on the configuration file.
In a possible embodiment, the obtaining module 101 is specifically configured to, when used for performing obtaining at least one third party library and extracting an interface class of each third party library:
Acquiring at least one third party library in the preloading process, and extracting interface classes of the third party library in a script scanning mode; the third party library is correspondingly provided with at least one version and a corresponding storage address;
The conversion module 103 is specifically configured to, when executing the method for calling or adding the supportable target implementation class in the package manager for the target library, convert the interface class of the target library into the target implementation class:
in the transformation process, aiming at the target library, calling or adding a supportable target implementation class in the package manager, and converting an interface class of the target library into a target implementation class, wherein the target implementation class supports adaptation and mapping between a first programming language and a second programming language; the first programming language is an object-oriented programming language of an extended C, and the second programming language is a computer programming language extended based on the first programming language.
In a possible embodiment, the parsing module 104 is specifically configured to, when configured to execute a configuration file of the target library obtained by parsing the target item:
reading an engineering file corresponding to the target item, and determining a dependent field of the target library;
Traversing a storage interval, and extracting the dependent data of the target library through the dependent field;
constructing a data set of the target library based on the dependent data;
and obtaining a configuration file of the target library based on the configuration items determined by the data set.
In a possible embodiment, the parsing module 104, when configured to execute a configuration file of the target library obtained by parsing the target item, is further specifically configured to:
Stripping the reference mode of the target library to obtain a shadow engineering of the target library;
and deploying the shadow engineering.
In a possible embodiment, the parsing module 104 is specifically configured to, when configured to execute the constructing the data set of the target library based on the dependent data:
Creating a dictionary set based on the dependent data, taking the constructed structure body as a key of the dictionary, and taking the constructed attribute value as a value of the dictionary;
Wherein the structure includes an extraction and escape function for a valid string that includes a null character; the attribute values are of enumerated type, and the construction of the attribute values includes converting the character strings, arrays and dictionary reads in the attribute table file into object types.
In a possible embodiment, the parsing module 104 is specifically configured to, when configured to execute a configuration file for obtaining the target library based on the configuration item determined by the data set:
extracting configuration item information corresponding to preset fields in a dictionary set of the data set;
setting the configuration item information into a configuration file of a target project;
The configuration item information corresponding to the preset field comprises at least one of the following items:
The address of the dependent library pointed by the target library calling function; the dependency library generates a corresponding module file in the process of setting the configuration items;
the target library is stored in the binary name of the target project;
Compiling and setting the target library to be configured;
basic parameters of the target library;
And the version number of the target library.
In a possible embodiment, the processing module 105 is specifically configured to, when configured to execute processing, based on the configuration file, a target plug-in generated by the target library:
packaging the target library into a target plug-in;
Compiling the target plug-in based on the configuration file and uploading the target plug-in;
And acquiring and installing the latest target plug-in.
In a possible embodiment, the processing module 105 is specifically configured, when configured to execute compiling the target plugin based on the configuration file, to:
Acquiring a target plug-in to be compiled;
if the dependence stack of the target plug-in is not empty, traversing all module files generated in the process of analyzing the target item, and after adding the module files which belong to the shadow engineering of the target library and depend on the target plug-in to the dependence tree, carrying out stack stripping processing on the target plug-in to generate configuration files of the dependence tree.
In a possible embodiment, the processing module 105, when used for executing obtaining the latest target plugin and installing, is specifically configured to:
if the version number of the locally stored target plug-in is different from the version number of the target library, downloading a target compression package to which the target library belongs; the target compression packet is uploaded based on a dependency tree obtained by compiling and comprises target plug-ins corresponding to different version numbers and configuration information of the dependency tree;
The target plugin is installed based on the compression package.
The device of the embodiment of the present application may perform the method provided by the embodiment of the present application, and its implementation principle is similar, and actions performed by each module in the device of the embodiment of the present application correspond to steps in the method of the embodiment of the present application, and detailed functional descriptions of each module of the device may be referred to the descriptions in the corresponding methods shown in the foregoing, which are not repeated herein.
The basic data, the storage address of the third party library, the version number of the third party library and other data related to the embodiment of the application can be stored through a block chain technology. The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains a certain amount of processed data that is used to verify the validity of its information (anti-counterfeit) and to generate the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to realize the steps of a packet manager adaptation method, and compared with the related technology, the method can realize the following steps: when at least one third party library is obtained, the interface class of each third party library can be extracted, if the fact that the interface class of one or more third party libraries cannot be adapted to the package manager adopted by the current project is determined, the third party library which cannot be adapted to the interface class can be determined as a target library, the target realization class supported by the third party library can be called or increased in the package manager aiming at the target library, then the interface class of the target library is converted into the target realization class supported by the package manager adopted by the current project, and the converted target library is stored in a target project corresponding to the target realization class; the method comprises the steps that a current project and a target project have a dependency relationship, and the current project can indirectly call a target library through the target project when being implemented; then, by parsing the target item, a configuration file corresponding to the target library can be obtained to further process the target plugin generated by the target library based on the configuration file. The implementation of the application can realize the interface conversion of the third party library of the package manager which cannot be adapted to the current project, realize the automatic realization class of the third party library to the package manager, effectively reduce the verification process of the project developer on the relation between the third party library and the package manager, and also avoid the need of constructing an extra private warehouse for managing the third party library which is not supported by the package manager by the developer, thereby being beneficial to reducing the development cost.
In an alternative embodiment, there is provided an electronic device, as shown in fig. 11, the electronic device 4000 shown in fig. 11 includes: a processor 4001 and a memory 4003. Wherein the processor 4001 is coupled to the memory 4003, such as via a bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004, the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data, etc. It should be noted that, in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit ), general purpose Processor, DSP (DIGITAL SIGNAL Processor, data signal Processor), ASIC (Application SPECIFIC INTEGRATED Circuit), FPGA (Field Programmable GATE ARRAY ) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 4001 may also be a combination that implements computing functionality, e.g., comprising one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 4002 may include a path to transfer information between the aforementioned components. Bus 4002 may be a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 11, but not only one bus or one type of bus.
Memory 4003 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (ELECTRICALLY ERASABLE PROGRAMMABLE READ ONLY MEMORY ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be Read by a computer.
The memory 4003 is used for storing a computer program for executing an embodiment of the present application, and is controlled to be executed by the processor 4001. The processor 4001 is configured to execute a computer program stored in the memory 4003 to realize the steps shown in the foregoing method embodiment.
Among them, electronic devices include, but are not limited to: server, terminal, on-vehicle equipment.
Embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor, implements the steps of the foregoing method embodiments and corresponding content.
The embodiment of the application also provides a computer program product, which comprises a computer program, wherein the computer program can realize the steps and corresponding contents of the embodiment of the method when being executed by a processor.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims and in the above figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate, such that the embodiments of the application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although various operation steps are indicated by arrows in the flowcharts of the embodiments of the present application, the order in which these steps are implemented is not limited to the order indicated by the arrows. In some implementations of embodiments of the application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages can be flexibly configured according to the requirement, which is not limited by the embodiment of the present application.
The foregoing is merely an optional implementation manner of some of the implementation scenarios of the present application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the present application are adopted without departing from the technical ideas of the scheme of the present application, and the implementation manner is also within the protection scope of the embodiments of the present application.

Claims (12)

1. A method of packet manager adaptation, comprising:
Acquiring at least one third party library, and extracting interface classes of each third party library;
if the interface class is unable to adapt to the third party library of the package manager adopted by the current project, determining the third party library as a target library;
The method comprises the steps of calling or adding supportable target realization classes in the package manager aiming at the target library, converting interface classes of the target library into the target realization classes, and storing the target library in target items corresponding to the target realization classes; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented;
obtaining a configuration file of the target library by analyzing the target item;
and processing the target plugins generated by the target library based on the configuration file.
2. The method of claim 1, wherein the obtaining at least one third party library and extracting interface classes for each third party library comprises:
Acquiring at least one third party library in the preloading process, and extracting interface classes of the third party library in a script scanning mode; the third party library is correspondingly provided with at least one version and a corresponding storage address;
The method for calling or adding the supportable target implementation class in the package manager for the target library, and converting the interface class of the target library into the target implementation class includes:
in the transformation process, aiming at the target library, calling or adding a supportable target implementation class in the package manager, and converting an interface class of the target library into a target implementation class, wherein the target implementation class supports adaptation and mapping between a first programming language and a second programming language; the first programming language is an object-oriented programming language of an extended C, and the second programming language is a computer programming language extended based on the first programming language.
3. The method of claim 1, wherein the obtaining the configuration file of the target library by parsing the target item comprises:
reading an engineering file corresponding to the target item, and determining a dependent field of the target library;
Traversing a storage interval, and extracting the dependent data of the target library through the dependent field;
constructing a data set of the target library based on the dependent data;
and obtaining a configuration file of the target library based on the configuration items determined by the data set.
4. A method according to claim 1 or 3, wherein the obtaining the configuration file of the target library by parsing the target item further comprises:
Stripping the reference mode of the target library to obtain a shadow engineering of the target library;
and deploying the shadow engineering.
5. A method according to claim 3, wherein said constructing a data set of said target library based on said dependent data comprises:
Creating a dictionary set based on the dependent data, taking the constructed structure body as a key of the dictionary, and taking the constructed attribute value as a value of the dictionary;
Wherein the structure includes an extraction and escape function for a valid string that includes a null character; the attribute values are of enumerated type, and the construction of the attribute values includes converting the character strings, arrays and dictionary reads in the attribute table file into object types.
6. The method of claim 5, wherein the deriving the configuration file for the target library based on the configuration items determined from the data set comprises:
extracting configuration item information corresponding to preset fields in a dictionary set of the data set;
setting the configuration item information into a configuration file of a target project;
The configuration item information corresponding to the preset field comprises at least one of the following items:
The address of the dependent library pointed by the target library calling function; the dependency library generates a corresponding module file in the process of setting the configuration items;
the target library is stored in the binary name of the target project;
Compiling and setting the target library to be configured;
basic parameters of the target library;
And the version number of the target library.
7. The method of claim 1, wherein the processing the target plugin generated by the target library based on the configuration file comprises:
packaging the target library into a target plug-in;
Compiling the target plug-in based on the configuration file and uploading the target plug-in;
And acquiring and installing the latest target plug-in.
8. The method of claim 7, wherein compiling the target plugin based on the configuration file comprises:
Acquiring a target plug-in to be compiled;
if the dependence stack of the target plug-in is not empty, traversing all module files generated in the process of analyzing the target item, and after adding the module files which belong to the shadow engineering of the target library and depend on the target plug-in to the dependence tree, carrying out stack stripping processing on the target plug-in to generate configuration files of the dependence tree.
9. The method of claim 8, wherein the obtaining and installing the latest target plugin comprises:
if the version number of the locally stored target plug-in is different from the version number of the target library, downloading a target compression package to which the target library belongs; the target compression packet is uploaded based on a dependency tree obtained by compiling and comprises target plug-ins corresponding to different version numbers and configuration information of the dependency tree;
The target plugin is installed based on the compression package.
10. A packet manager adaptation apparatus, comprising:
the acquisition module is used for acquiring at least one third party library and extracting interface classes of each third party library;
the determining module is used for determining a third party library as a target library if the interface class cannot adapt to the third party library of the package manager adopted by the current project;
The conversion module is used for calling or adding supportable target realization classes in the packet manager aiming at the target library, converting interface classes of the target library into the target realization classes, and storing the target library in target items corresponding to the target realization classes; the current project has a dependency relationship with the target project, and the target library is called through the target project when the current project is implemented;
The analysis module is used for obtaining the configuration file of the target library by analyzing the target item;
And the processing module is used for processing the target plugins generated by the target library based on the configuration file.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method according to any one of claims 1-9.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1-9.
CN202211328389.3A 2022-10-27 2022-10-27 Packet manager adaptation method, apparatus, device, storage medium and program product Pending CN117992133A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211328389.3A CN117992133A (en) 2022-10-27 2022-10-27 Packet manager adaptation method, apparatus, device, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211328389.3A CN117992133A (en) 2022-10-27 2022-10-27 Packet manager adaptation method, apparatus, device, storage medium and program product

Publications (1)

Publication Number Publication Date
CN117992133A true CN117992133A (en) 2024-05-07

Family

ID=90889782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211328389.3A Pending CN117992133A (en) 2022-10-27 2022-10-27 Packet manager adaptation method, apparatus, device, storage medium and program product

Country Status (1)

Country Link
CN (1) CN117992133A (en)

Similar Documents

Publication Publication Date Title
CN110109681B (en) Method and system for converting codes between different platforms
CN110764748B (en) Code calling method, device, terminal and storage medium
CN111324619B (en) Object updating method, device, equipment and storage medium in micro-service system
CN114035805A (en) Code conversion method, apparatus, medium, and device for pre-compiler
CN110727417A (en) Data processing method and device
CN113885849A (en) Application development method and device based on industrial internet platform and terminal equipment
CN116560683A (en) Software updating method, device, equipment and storage medium
CN111984264A (en) Static library generation method and device
CN115794214B (en) Application module metadata management method, device, storage medium and apparatus
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN110704041A (en) Software development method and device
CN110659022A (en) Method for automatically calling Python script based on Java
CN113590179B (en) Plug-in detection method and device, electronic equipment and storage medium
CN117992133A (en) Packet manager adaptation method, apparatus, device, storage medium and program product
CN114625372A (en) Automatic component compiling method and device, computer equipment and storage medium
CN113704120A (en) Data transmission method, device, equipment and storage medium
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN113468446A (en) Method, system and equipment for supporting identification of third-party two-dimensional code data
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN113608996B (en) Mirror image compiling test method, system, device and readable storage medium
CN117555533B (en) Code generation method, electronic device and storage medium
CN117093286B (en) Plug-in generation method, device, equipment and computer readable storage medium
KR102258241B1 (en) Server side data component for support of development and management and method for perform the data component
CN117519814A (en) Sharing method and device
CN116700735A (en) Application program construction method, system and storage medium

Legal Events

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