Binary file generation method and related equipment
By obtaining bytecode objects and target environment information and using the data conversion model to serialize bytecode objects, the problem of preparing multiple build environments when building package releases on different platforms is solved, improving the efficiency of building and publishing and saving resources.
Patent Information
- Application Number
- CN202311508874.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2025-05-13
AI Technical Summary
When building different platforms to publish packages, the existing technology requires the preparation of construction environments for multiple different platforms, resulting in inefficiency and waste of resources.
By obtaining the bytecode object and target environment information, the data conversion model is used to serialize the bytecode object into binary data suitable for the target environment, thereby generating a binary file suitable for the target environment.
It solves the problem that multiple build environments are required when building packages on different platforms, improves the efficiency of building and publishing binary files, and saves machine resources.
Smart Images

Figure CN119987853A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer and communication technology, and in particular to a binary file generation method and related equipment. Background Art
[0002] One of the projects currently being developed by the team is in Ruby. For the sake of source code protection, the source code files will be converted into Ruby bytecode serial binary files for release. Although Ruby bytecode is cross-platform, its serialized binary files are not platform-independent, so when building release packages for different platforms, it is necessary to prepare build environments for multiple different platforms. Summary of the invention
[0003] The embodiments of the present application provide a binary file generation method and related devices, thereby overcoming the problem of the prior art that, when building release packages for different platforms, it is necessary to prepare construction environments for multiple different platforms, at least to a certain extent.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a binary file generation method is provided, comprising: in response to a first operation of a user, obtaining a bytecode object; in response to a second operation of the user, retrieving target environment information from an environment library; according to the target environment information, serializing the bytecode object into target data, the target data being binary data suitable for the target environment; and obtaining a target file according to the target data.
[0006] In one embodiment of the present application, the target environment information includes a target environment code and target environment parameters, and the step of retrieving the target environment information from the environment library in response to the user's second operation specifically includes: determining the target environment code in response to the user's second operation; and retrieving the target environment parameters from the environment library according to the target environment code.
[0007] In one embodiment of the present application, calling the target environment parameters in the environment library according to the target environment code specifically includes: querying the environment library according to the target environment code; if the corresponding target environment parameters are found, calling the target environment parameters.
[0008] In one embodiment of the present application, serializing the bytecode object into target data according to the target environment information specifically includes: loading the target environment parameters to obtain a target architecture; and serializing the bytecode object according to the target architecture to obtain the target data.
[0009] In one embodiment of the present application, the target environment information includes a target environment code, and serializing the bytecode object into target data based on the target environment information specifically includes: inputting the bytecode object and the target environment code into the data conversion model, the data conversion model includes multiple data conversion sub-models, each of the data conversion sub-models corresponds to a target environment code; calling the corresponding data conversion sub-model based on the target environment code; inputting the bytecode object into the data conversion sub-model to obtain the target data.
[0010] In one embodiment of the present application, the method also includes: obtaining a bytecode object sample set, the bytecode object sample set including multiple bytecode object samples, each of the bytecode object samples being marked with corresponding target data; inputting the bytecode object samples in the bytecode object sample set into the data conversion sub-model one by one, and the data conversion sub-model outputting corresponding target data; adjusting parameters of the data conversion sub-model according to the corresponding target data output by the data conversion model and the marked target data until the training end condition is met, thereby obtaining a trained data conversion sub-model.
[0011] In one embodiment of the present application, obtaining a target file according to the target data specifically includes: determining a format of the target file according to the target environment information; and processing the target data according to the format of the target file to obtain the target file.
[0012] According to one aspect of an embodiment of the present application, the binary file generation device includes: an object acquisition module, used to acquire a bytecode object in response to a first operation of a user; an information retrieval module, used to retrieve target environment information from an environment library in response to a second operation of the user; a data conversion module, used to serialize the bytecode object into target data according to the target environment information, wherein the target data is binary data suitable for the target environment; and a file generation module, used to obtain a target file according to the target data.
[0013] In one embodiment of the present application, the target environment information includes a target environment code and target environment parameters, and the information retrieval module 520 specifically includes: a code determination submodule, used to determine the target environment code in response to the user's second operation; a parameter retrieval submodule, used to retrieve the target environment parameters in the environment library according to the target environment code.
[0014] In one embodiment of the present application, the parameter retrieval submodule specifically includes: a code query unit, used to query in the environment library according to the target environment code; a parameter retrieval unit, used to retrieve the target environment parameters if the corresponding target environment parameters are queried.
[0015] In one embodiment of the present application, the data conversion module 530 specifically includes: a parameter loading subunit, used to load the target environment parameters to obtain the target architecture; and serialize the bytecode object according to the target architecture to obtain the target data.
[0016] In one embodiment of the present application, the target environment information includes a target environment code, and the data conversion module 530 specifically includes: a model input submodule, used to input the bytecode object and the target environment code into the data conversion model, the data conversion model includes multiple data conversion submodels, each of the data conversion submodels corresponds to a target environment code; a model calling submodule, used to call the corresponding data conversion submodel according to the target environment code; a data conversion submodule, used to input the bytecode object into the data conversion submodel to obtain the target data.
[0017] In one embodiment of the present application, the binary file generation device also includes: a sample acquisition module, used to acquire a bytecode object sample set, the bytecode object sample set includes multiple bytecode object samples, each of the bytecode object samples is marked with corresponding target data; a sample input module, used to input the bytecode object samples in the bytecode object sample set into the data conversion sub-model one by one, and the data conversion sub-model outputs the corresponding target data; a model training module, used to adjust the parameters of the data conversion sub-model according to the corresponding target data output by the data conversion model and the marked target data, until the training end condition is met, and a trained data conversion sub-model is obtained.
[0018] In one embodiment of the present application, the file generation module 540 specifically includes: a format determination submodule, used to determine the format of the target file according to the target environment information; and a data processing submodule, used to process the target data according to the format of the target file to obtain the target file.
[0019] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the binary file generation method as described in the above embodiment is implemented.
[0020] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; 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 binary file generation method as described in the above embodiment.
[0021] In the technical solutions provided in some embodiments of the present application, bytecode objects and target environment information are first obtained in response to various operations of the user, and then based on the target environment information, the bytecode objects are serialized into target data, and finally, the target data is packaged to obtain a target file. Among them, the target data is binary data suitable for the target environment, and the target file is a binary file suitable for the target environment. Through the introduction of environmental information, when the bytecode object is converted into a binary file, it can not only generate a binary file suitable for the current platform environment, but also generate a binary file suitable for other platform environments according to the target environment information. There is no need to build a corresponding platform environment in order to generate a corresponding binary file, which solves the problem of preparing to build multiple different platform environments when building different platform release packages, improves the efficiency of building and publishing binary files, and saves machine resources.
[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0024] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;
[0025] Figure 2 A schematic flow chart of a binary file generation method provided in an embodiment of the present application is shown.
[0026] Figure 3 Shown according to Figure 2 A specific implementation flow chart of step S200 in the binary file generation method shown in the corresponding embodiment.
[0027] Figure 4 Shown according to Figure 2 A specific implementation flow chart of step S400 in the binary file generation method shown in the corresponding embodiment.
[0028] Figure 5 A schematic diagram of the structure of a binary file generation device provided in an embodiment of the present application.
[0029] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0031] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0032] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0033] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0034] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0035] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.
[0036] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0037] The user can use the terminal device to interact with the server 105 through the network 104 to receive or send messages, etc. The server 105 can be a server that provides various services. For example, the user uses the terminal device 103 (or the terminal device 101 or 102) to upload the bytecode object and the target environment information to the server 105, and the server 105 can serialize the bytecode object into target data according to the target environment information, and the target data is binary data suitable for the target environment; according to the target data, the target file is obtained.
[0038] It should be noted that the binary file generation method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the binary file generation device is generally arranged in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, so as to execute the binary file generation solution provided in the embodiment of the present application.
[0039] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0040] Figure 2 A flowchart of a binary file generation method according to an embodiment of the present application is shown. The binary file generation method can be executed by a server, which can be Figure 1 Refer to the server shown in . Figure 2 As shown, the binary file generation method at least includes:
[0041] Step S100: In response to a first operation of a user, a bytecode object is obtained.
[0042] Step S200: In response to a second operation of the user, target environment information is retrieved from the environment library.
[0043] Step S300: serialize the bytecode object into target data according to the target environment information, where the target data is binary data suitable for the target environment.
[0044] Step S400, obtaining a target file according to the target data.
[0045] In an embodiment of the present application, the bytecode object and the target environment information are first obtained in response to various operations of the user, and then the bytecode object is serialized into target data based on the target environment information, and finally, the target data is packaged to obtain a target file. Among them, the target data is binary data suitable for the target environment, and the target file is a binary file suitable for the target environment. Through the introduction of environmental information, when the bytecode object is converted into a binary file, it can not only generate a binary file suitable for the current platform environment, but also generate a binary file suitable for other platform environments according to the target environment information. There is no need to build a corresponding platform environment in order to generate a corresponding binary file, which solves the problem of preparing to build multiple different platform environments when building different platform release packages, improves the efficiency of building and publishing binary files, and saves machine resources.
[0046] In step S100, the user's first operation may be to edit or delete a bytecode object, or to import or retrieve a bytecode object file.
[0047] For example, in some embodiments, the bytecode object is written by the user in real time, so the user's first operation may be to write the bytecode object. After the bytecode is written, it is sent to the server to execute subsequent steps.
[0048] In other embodiments, the bytecode object may also be obtained by calling, that is, the user directly selects a bytecode object file that has been written, and the server directly calls the file.
[0049] In step S200, the second operation of the user may be selection or importing of environmental information, such as clicking on corresponding environmental information or inputting a corresponding environmental code.
[0050] The target environment information includes the target environment code and the target environment parameters. The target environment code is the index of the target environment parameters, which can be the target environment name, target environment label, target environment ID, etc. The target environment parameters are parameters related to the target environment, and according to the target environment parameters, binary data suitable for the corresponding target environment can be obtained.
[0051] Specifically, in some embodiments, the specific implementation of step S200 can be found in Figure 3 . Figure 3 is based on Figure 2 The detailed description of step S200 in the binary file generation method shown in the corresponding embodiment, in the binary file generation method, the target environment information includes a target environment code and a target environment parameter, and step S200 may include the following steps:
[0052] Step S210: determining a target environment code in response to a second operation of the user.
[0053] Step S220: Retrieve the target environment parameters from the environment library according to the target environment code.
[0054] In an embodiment of the present application, the user's second operation may be selection or import of environmental information, such as clicking on corresponding environmental information or inputting a corresponding environmental code.
[0055] The target environment information includes the target environment code and the target environment parameters. The target environment code is the index of the target environment parameters, which can be the target environment name, target environment label, target environment ID, etc. The target environment parameters are parameters related to the target environment, and according to the target environment parameters, binary data suitable for the corresponding target environment can be obtained.
[0056] The embodiment of the present application first obtains the target environment code specified or input by the user, and then retrieves the target environment parameters based on the target environment code.
[0057] In step S210, the environment code is an index of the target environment parameter, which may specifically be a target environment name, a target environment tag, a target environment ID, etc. The second operation of the user may be to input an environment code, in which case the environment code input by the user is the target environment code, and the second operation of the user may also be to select a target environment, in response to the user's selection, determine a code corresponding to the target environment selected by the user, which is the target environment code.
[0058] After the target environment code is determined, in step S220, the target environment code is used as an index to retrieve the corresponding target environment parameters in the environment library. The specific method for retrieving the target environment parameters can be referred to in the following embodiment.
[0059] Specifically, in some embodiments, the specific implementation of step S220 can refer to the following embodiments. Figure 3 The detailed description of step S220 in the binary file generation method shown in the corresponding embodiment, in the binary file generation method, step S220 may include the following steps:
[0060] According to the target environment code, a query is performed in the environment library.
[0061] If the corresponding target environment parameters are found, the target environment parameters are retrieved.
[0062] If the corresponding target environment parameters cannot be found, the message "No callable parameters" is returned.
[0063] In an embodiment of the present application, a query is performed in the environment library according to the target environment code. If there are corresponding target environment parameters in the environment library, the target environment parameters are directly retrieved. If the corresponding target environment parameters cannot be found, information indicating that there are no callable parameters is returned to prompt the user that there are no corresponding environment parameters for calling. The information indicating that there are no callable parameters can be a prompt phrase, a prompt picture, or a text box to be edited.
[0064] When the information without callable parameters is a text box to be edited, the user can edit and input the corresponding environment parameters in the text box. After the user completes the editing, the environment parameters edited by the user are called as the target environment parameters. At the same time, further, the target environment parameters can also be associated with the target environment code previously input by the user and stored in the environment library, so that the user can call the corresponding environment parameters through the target environment code next time.
[0065] In other embodiments, if the corresponding target environment parameters cannot be found, the parameters related to the target environment code can be crawled on the network, and the corresponding environment parameters can be obtained after the parameters are sorted.
[0066] In step S300, the bytecode object is serialized according to the corresponding environment information to convert it into binary data suitable for the target environment, namely, target data. There are many ways to serialize the bytecode object, and the following embodiments may be used for details.
[0067] Specifically, in some embodiments, the specific implementation of step S300 can refer to the following embodiments. Figure 3 The detailed description of step S300 in the binary file generation method shown in the corresponding embodiment, in the binary file generation method, step S300 may include the following steps:
[0068] The target environment parameters are loaded to obtain the target architecture.
[0069] According to the target architecture, the bytecode object is serialized to obtain the target data.
[0070] In an embodiment of the present application, the target environment parameters are first loaded to obtain the corresponding environment architecture, namely the target environment architecture, and then the bytecode object is serialized based on the target environment architecture to obtain binary data suitable for the target environment, namely the target data.
[0071] Specifically, in other embodiments, the specific implementation of step S300 can refer to the following embodiments. Figure 2The detailed description of step S300 in the binary file generation method shown in the corresponding embodiment, in the binary file generation method, the target environment information includes the target environment code, and step S300 may include the following steps:
[0072] The bytecode object and the target environment code are input into the data conversion model, wherein the data conversion model includes a plurality of data conversion sub-models, each of which corresponds to a target environment code.
[0073] According to the target environment code, the corresponding data conversion sub-model is called.
[0074] The bytecode object is input into the data conversion sub-model to obtain target data.
[0075] In the embodiment of the present application, the conversion is performed through a data conversion model, and the data conversion model may include multiple data conversion sub-models. Different data conversion sub-models may convert the same bytecode object into different binary data, suitable for different environments. When in use, the bytecode object and the target environment code are input into the data conversion model, and the data conversion model calls the corresponding data conversion sub-model according to the input target environment code, and the data conversion sub-model performs data conversion to convert the bytecode object into target data.
[0076] Specifically, the data conversion sub-model can be composed of a text neural network and a parsing network, wherein the text neural network can be a long short-term memory network, a recurrent attention network, or other recurrent neural networks or deep learning networks. In the process of data conversion, the input layer of the data conversion sub-model receives the bytecode object and vectorizes the bytecode object into a bytecode vector, and then inputs the bytecode vector into the text neural network layer for processing to obtain a byte vector and a sentence vector, and then inputs the byte vector and the sentence vector into the parsing network, and the parsing network outputs a parsing vector. The output layer of the data conversion sub-model outputs the target data according to the parsing vector.
[0077] The training method of the above data conversion sub-model includes:
[0078] A bytecode object sample set is obtained, wherein the bytecode object sample set includes a plurality of bytecode object samples, each of which is marked with corresponding target data.
[0079] The bytecode object samples in the bytecode object sample set are input into the data conversion sub-model one by one, and the data conversion sub-model outputs corresponding target data.
[0080] According to the target data corresponding to the output of the data conversion model and the marked target data, the parameters of the data conversion sub-model are adjusted until the training end condition is met to obtain a trained data conversion sub-model.
[0081] There may be multiple conditions for the end of training.
[0082] In one embodiment, according to the target data corresponding to the output of the data conversion model and the marked target data, the parameters of the data conversion sub-model are adjusted until the training end condition is met to obtain a trained data conversion sub-model, which specifically includes:
[0083] If, in the bytecode object sample set, only bytecode object samples not exceeding a predetermined proportion are input into the data conversion model, and the corresponding target data obtained are consistent with the marked target data, the parameters of the data conversion sub-model are adjusted.
[0084] If more than a predetermined proportion of bytecode object samples in the bytecode object sample set are input into the data conversion model, and the corresponding target data obtained is consistent with the marked target data, the training is terminated to obtain a trained data conversion sub-model.
[0085] In another embodiment, according to the target data corresponding to the data conversion model output and the marked target data, the parameters of the data conversion sub-model are adjusted until the training end condition is met to obtain a trained data conversion sub-model, which specifically includes:
[0086] A loss function is determined based on the target data corresponding to the data conversion model output and the labeled target data.
[0087] The parameters of the data conversion sub-model are adjusted according to the loss function until the loss function meets the training end condition, thereby obtaining a trained data conversion sub-model.
[0088] The loss function satisfies the training termination condition specifically when the loss function does not change after multiple rounds of iterations, that is, the loss function converges, or when the loss function is less than a predetermined loss threshold, such as 0.001.
[0089] That is, in one embodiment, the parameters of the data conversion sub-model are adjusted according to the loss function until the loss function converges, and the training is completed to obtain a trained data conversion sub-model.
[0090] In another embodiment, the parameters of the data conversion sub-model are adjusted according to the loss function until the loss function is less than a predetermined loss threshold, and the training is terminated to obtain a trained data conversion sub-model.
[0091] It can be understood that in some embodiments, there can be multiple training end conditions. As long as one of the training end conditions is met, the training of the data conversion sub-model is terminated, and a well-circulated data conversion sub-model is obtained. The specific training end condition can be any of the training end conditions mentioned in the above embodiment, and this application is not limited here.
[0092] In step S400, after the target data is obtained, the target data may be processed to obtain a corresponding target file. If the target data is binary data, the target file is a binary file.
[0093] Specifically, in some embodiments, the specific implementation of step S400 can be found in Figure 4 . Figure 4 is based on Figure 2 The detailed description of step S400 in the binary file generation method shown in the corresponding embodiment, in the binary file generation method, step S400 may include the following steps:
[0094] Step S410: determining the format of the target file according to the target environment information.
[0095] Step S420: Process the target data according to the format of the target file to obtain the target file.
[0096] In an embodiment of the present application, the format of the target file is first determined according to the target environment information, and then the target data is processed according to the format of the target file to obtain the corresponding target file to ensure that the target file is suitable for the target environment.
[0097] In step S410, the target environment information includes a target environment code and target environment parameters. The format of the target file may be determined by determining a corresponding file template in the environment library according to the target environment code. The format of the corresponding file template is the format of the target file.
[0098] The format of the target file can also be determined by generating a target file template according to the target environment parameters, and the format of the template file template is the format of the target file. Specifically, it can filter parameters related to the environment format in the target environment parameters, and generate a target file template according to the target environment parameters related to the environment format, and the format of the template file template is the format of the target file.
[0099] In step S420, the target data is processed according to the format of the target file, and the generated file is the target file. Specifically, the file template in step S410 can be used as a template, and the template data can be filled into the file template accordingly, so as to obtain the corresponding target file.
[0100] In other embodiments, the target file may be generated through a file model, specifically by inputting the target data and the target environment parameters into the file model, and the file model outputs the corresponding target file.
[0101] The file model includes a format determination sub-model and a file generation sub-model. After the file model receives the target data and target environment parameters, the target environment parameters are first input into the format determination sub-model, and the format determination sub-model outputs the corresponding format parameters. Then, the format parameters and the target data are input into the file generation sub-model together to obtain the target file.
[0102] The training method of the file model may specifically include:
[0103] A file parameter sample set is obtained, wherein the file parameter sample set includes a plurality of file parameter samples, each of which is marked with a corresponding target file, and each of which includes target data and corresponding environmental parameters. The file parameter samples are input into a file model one by one, and the file model outputs a corresponding target file. If the target file obtained after inputting the file model only for a predetermined proportion of the file parameter samples in the file parameter sample set is consistent with the marked file on the sample, the parameters of the file model are adjusted. If the target file obtained after inputting the file model for a predetermined proportion of the file parameter samples in the file parameter sample set is consistent with the marked file on the sample, the training is terminated, and a trained file model is obtained.
[0104] The following describes an apparatus embodiment of the present application, which can be used to execute the binary file generation method in the above embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above embodiment of the binary file generation method of the present application.
[0105] Figure 5 A block diagram of a binary file generating device according to an embodiment of the present application is shown.
[0106] Reference Figure 5 As shown, a binary file generating device 500 according to an embodiment of the present application includes:
[0107] The object acquisition module 510 is used to acquire a bytecode object in response to a first operation of a user;
[0108] The information retrieval module 520 is used to retrieve target environment information from the environment library in response to a second operation of the user;
[0109] A data conversion module 530, configured to serialize the bytecode object into target data according to the target environment information, wherein the target data is binary data suitable for the target environment;
[0110] The file generation module 540 is used to obtain a target file according to the target data.
[0111] In one embodiment of the present application, the target environment information includes a target environment code and target environment parameters, and the information retrieval module 520 specifically includes: a code determination submodule, used to determine the target environment code in response to the user's second operation; a parameter retrieval submodule, used to retrieve the target environment parameters in the environment library according to the target environment code.
[0112] In one embodiment of the present application, the parameter retrieval submodule specifically includes: a code query unit, used to query in the environment library according to the target environment code; a parameter retrieval unit, used to retrieve the target environment parameters if the corresponding target environment parameters are queried.
[0113] In one embodiment of the present application, the data conversion module 530 specifically includes: a parameter loading subunit, used to load the target environment parameters to obtain the target architecture; and serialize the bytecode object according to the target architecture to obtain the target data.
[0114] In one embodiment of the present application, the target environment information includes a target environment code, and the data conversion module 530 specifically includes: a model input submodule, used to input the bytecode object and the target environment code into the data conversion model, the data conversion model includes multiple data conversion submodels, each of the data conversion submodels corresponds to a target environment code; a model calling submodule, used to call the corresponding data conversion submodel according to the target environment code; a data conversion submodule, used to input the bytecode object into the data conversion submodel to obtain the target data.
[0115] In one embodiment of the present application, the binary file generation device also includes: a sample acquisition module, used to acquire a bytecode object sample set, the bytecode object sample set includes multiple bytecode object samples, each of the bytecode object samples is marked with corresponding target data; a sample input module, used to input the bytecode object samples in the bytecode object sample set into the data conversion sub-model one by one, and the data conversion sub-model outputs the corresponding target data; a model training module, used to adjust the parameters of the data conversion sub-model according to the corresponding target data output by the data conversion model and the marked target data, until the training end condition is met, and a trained data conversion sub-model is obtained.
[0116] In one embodiment of the present application, the file generation module 540 specifically includes: a format determination submodule, used to determine the format of the target file according to the target environment information; and a data processing submodule, used to process the target data according to the format of the target file to obtain the target file.
[0117] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0118] It should be noted that Figure 6 The computer system of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0119] like Figure 6 As shown, the computer system includes a central processing unit (CPU) 1801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1802 or the program loaded from the storage part 1808 to the random access memory (RAM) 1803, such as executing the method described in the above embodiment. In RAM 1803, various programs and data required for system operation are also stored. CPU 1801, ROM 1802 and RAM 1803 are connected to each other through bus 1804. Input / output (I / O) interface 1805 is also connected to bus 1804.
[0120] The following components are connected to the I / O interface 1805: an input section 1806 including a keyboard, a mouse, etc.; an output section 1807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1808 including a hard disk, etc.; and a communication section 1809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to the I / O interface 1805 as needed. A removable medium 1811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1810 as needed so that a computer program read therefrom is installed into the storage section 1808 as needed.
[0121] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1809, and / or installed from a removable medium 1811. When the computer program is executed by a central processing unit (CPU) 1801, various functions defined in the system of the present application are executed.
[0122] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0123] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0125] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0126] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0127] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0128] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0129] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for generating a binary file, characterized in that: The binary file generation method comprises: In response to a first operation of the user, obtaining a bytecode object; In response to a second operation of the user, retrieving target environment information from the environment library; According to the target environment information, the bytecode object is serialized into target data, where the target data is binary data suitable for the target environment; A target file is obtained according to the target data.
2. The binary file generation method according to claim 1, characterized in that: The target environment information includes a target environment code and a target environment parameter. The step of retrieving the target environment information from the environment library in response to the second operation of the user specifically includes: In response to a second operation by the user, determining a target environment code; According to the target environment code, the target environment parameters are retrieved from the environment library.
3. The binary file generation method according to claim 2, characterized in that: The step of retrieving the target environment parameters from the environment library according to the target environment code specifically includes: According to the target environment code, query is performed in the environment library; If the corresponding target environment parameters are found, the target environment parameters are retrieved.
4. The binary file generation method according to claim 2, characterized in that: The serializing the bytecode object into target data according to the target environment information specifically includes: Loading the target environment parameters to obtain the target architecture; According to the target architecture, the bytecode object is serialized to obtain the target data.
5. The binary file generation method according to claim 1, characterized in that: The target environment information includes a target environment code, and serializing the bytecode object into target data according to the target environment information specifically includes: Inputting the bytecode object and the target environment code into the data conversion model, wherein the data conversion model includes a plurality of data conversion sub-models, each of the data conversion sub-models corresponding to a target environment code; According to the target environment code, calling the corresponding data conversion sub-model; The bytecode object is input into the data conversion sub-model to obtain target data.
6. The binary file generation method according to claim 5, characterized in that: The method further comprises: Acquire a bytecode object sample set, the bytecode object sample set comprising a plurality of bytecode object samples, each of the bytecode object samples being marked with corresponding target data; Inputting the bytecode object samples in the bytecode object sample set into the data conversion sub-model one by one, and the data conversion sub-model outputs corresponding target data; According to the target data corresponding to the output of the data conversion model and the marked target data, the parameters of the data conversion sub-model are adjusted until the training end condition is met to obtain a trained data conversion sub-model.
7. The binary file generation method according to claim 1, characterized in that: The step of obtaining a target file according to the target data specifically includes: Determining the format of the target file according to the target environment information; The target data is processed according to the format of the target file to obtain the target file.
8. A binary file generating device, characterized in that: The binary file generating device comprises: An object acquisition module, used for acquiring a bytecode object in response to a first operation of a user; An information retrieval module, configured to retrieve target environment information from an environment library in response to a second operation of the user; A data conversion module, used for serializing the bytecode object into target data according to the target environment information, wherein the target data is binary data suitable for the target environment; The file generation module is used to obtain a target file according to the target data.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the binary file generation method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the binary file generation method according to any one of claims 1 to 7.