WO2021135497A1 - 基于Android的同份源代码兼容各客户需求的方法和装置 - Google Patents

基于Android的同份源代码兼容各客户需求的方法和装置 Download PDF

Info

Publication number
WO2021135497A1
WO2021135497A1 PCT/CN2020/120672 CN2020120672W WO2021135497A1 WO 2021135497 A1 WO2021135497 A1 WO 2021135497A1 CN 2020120672 W CN2020120672 W CN 2020120672W WO 2021135497 A1 WO2021135497 A1 WO 2021135497A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
source code
customized
customer
subfolder
Prior art date
Application number
PCT/CN2020/120672
Other languages
English (en)
French (fr)
Inventor
何晓帆
付毫
赵守福
徐李超
余威
Original Assignee
晶晨半导体(深圳)有限公司
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 晶晨半导体(深圳)有限公司 filed Critical 晶晨半导体(深圳)有限公司
Publication of WO2021135497A1 publication Critical patent/WO2021135497A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • 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

Definitions

  • This application relates to the technical field of code collaborative sharing, and in particular to a method and device compatible with the needs of various customers for the same source code based on Android.
  • Continuous delivery is a software engineering technique that allows the delivery process of software products to be continuously delivered in a short period of time to ensure that the software source code can be stably and continuously maintained in a state of change at any time. Its goal is to make software construction, testing and release faster and more frequent. This approach can reduce the cost and time of software development and reduce risks.
  • each project has differences. If each project wants to achieve a complete delivery process, it needs to customize the corresponding delivery process according to the difference of each project of the customer, and the development of the software company. Software products need to be modified and adjusted in response to customers in details, functions, pages, etc., and then delivered to customers, resulting in software companies needing to pay a lot of manpower and time costs to adjust and modify, and sometimes even a large number of unforeseen bugs due to modification and adjustment.
  • This application aims to solve the technical problem that when the source code is modified according to different customer requirements, the code of each branch needs to be modified, which causes a waste of time and labor costs.
  • This application proposes an Android-based method for the same source code to be compatible with the needs of various customers, including:
  • the source code sharing model is a pre-trained neural network model
  • the customer patch file is a customized code generated by text analysis according to customer needs
  • the step of importing the source code sharing model and the client patch file into the subfolder includes:
  • a customer patch file is prepared according to the components to be adjusted and the corresponding component adjustment requirements.
  • the step of importing the client patch file into the source code using a patch script pre-stored in the source code sharing model to generate customized source code corresponding to the subfolder includes:
  • the source code sharing model is used to convert the component adjustment requirements in the customer patch file into a customized code segment, and the benchmarked code segment is related to the customized code segment according to the association between the component to be adjusted and the component adjustment requirement Joint
  • the step of identifying the code segment in the source code that is to be aligned with the component to be adjusted in the client patch file includes:
  • a second code label with the same code as the first code label is located from the source code, and the code related to the second code label in the source code is determined to be a code segment.
  • step of integrating the customized source code into the subfolder includes:
  • the customized source code generated by copying from the code database, deleting the customer patch file that has been added to the source code in the code database, and retaining the source code;
  • This application also proposes an Android-based device compatible with the needs of various customers with the same source code, including:
  • the creation unit is used to create a subfolder in a folder pre-associated with the code database, where the code database stores the source code;
  • the first import unit is used to import a source code sharing model and a client patch file into the subfolder, wherein the source code sharing model is a pre-trained neural network model, and the client patch file is generated by text analysis according to client needs Customized code;
  • the second import unit is configured to import the client patch file into the source code using a patch script pre-stored in the source code sharing model to generate customized source code corresponding to the subfolder;
  • An integration unit for integrating the customized source code into the subfolder, and compressing and packaging the subfolder to generate a code data package
  • the delivery unit is used to deliver the code data package.
  • devices compatible with the needs of various customers based on the same source code of Android include:
  • the semantic analysis unit is used to use the BERT model to semantically analyze the pre-acquired customer demand text to identify the component adjustment requirements corresponding to each component to be adjusted, and the customer demand text is in the form of text data;
  • the patch production unit is used to produce customer patch files according to the components to be adjusted and corresponding component adjustment requirements.
  • the second introduction unit includes:
  • the identification module is used to identify the code segment in the source code that is to be adjusted against the component to be adjusted in the client patch file;
  • the code conversion module is used to use the source code sharing model to convert the component adjustment requirements in the customer patch file into a customized code segment, and to compare the code segment after the target according to the association between the component to be adjusted and the component adjustment requirement Associated with customized code snippets;
  • the import module is used to use the patch script in the source code sharing model to correspondingly import the customized code segment into the benchmarked code segment through the git import instruction, until all the customized code segments are correspondingly imported into the code segment , The formation of customized source code.
  • the identification module includes:
  • the label generation sub-module is configured to generate the corresponding first code label according to the preset functionality of the component to be adjusted;
  • the code locating sub-module is used to locate a second code label with the same code as the first code label from the source code according to the first code label, and determine that the code related to the second code label in the source code is Code snippet.
  • the device compatible with the needs of each customer based on the same source code of Android includes:
  • the deletion unit is used to delete the customized source code stored in the aforementioned source code sharing model.
  • This application provides a method and device based on Android that the same source code is compatible with the needs of various customers, and has the following beneficial effects:
  • the same source code in the code database can be realized.
  • FIG. 1 is a schematic flow diagram of an embodiment of a method for the same source code based on Android to be compatible with the needs of various customers in this application;
  • FIG. 2 is a schematic flow diagram of an embodiment of a method for the same source code based on Android to be compatible with the needs of various customers according to this application;
  • Figure 3 is a schematic diagram of the components in the application method for the same source code based on Android to be compatible with the needs of various customers;
  • Figure 4 is a structural block diagram of a device compatible with the needs of various customers based on the same source code of Android in this application.
  • FIG. 1 is a schematic flow diagram of the method for the same source code based on Android to be compatible with the needs of various customers in the first embodiment of this application;
  • This application proposes a server, the server includes a server processing terminal, the server is the execution subject, and the server executes an Android-based method that is compatible with the needs of various customers with the same source code.
  • This application proposes an Android-based method for the same source code to be compatible with the needs of various customers, including:
  • the code database is set on the server.
  • the server receives the source code uploaded by the development cluster and stores the source code in the code database.
  • the server associates the code database with a folder, so that the server can import the source code in the code database into the folder through the folder; based on this, in order to achieve the same source code compatible with various customer needs, in the folder Set up subfolders, the number of subfolders is consistent with the number of corresponding customers, and the naming of the subfolders is named after the customer name or code; after creating and naming the corresponding number of subfolders, follow-up will be based on the needs of each customer
  • the code is adjusted and modified to obtain the customized source code corresponding to each customer, and then the customized source code is imported into the corresponding subfolder for integration, and finally delivered, so as to achieve the effect of the same source code compatible with the needs of each customer.
  • S2 Import the source code sharing model and customer patch files into the subfolder, where the source code sharing model is a pre-trained neural network model, and the customer patch file is a customized code generated by text analysis according to customer needs;
  • the server After the server creates the corresponding subfolder according to the client, it imports the source code sharing model and the client patch file into the subfolder.
  • the source code sharing model is a neural network model pre-trained by the staff in the server, and the client patch file is described above.
  • the file is a code text generated according to customer needs;
  • the training method of the above source code sharing model is:
  • the server obtains the model construction code text input by the staff to construct a preliminary model of the code text based on the model.
  • the preliminary model includes a text storage layer, a code temporary storage layer, and a code conversion layer.
  • the text storage layer is used to record customer demand text, code
  • the temporary storage layer is used to temporarily store the source code, and the code conversion layer is used to generate the corresponding code text according to the functional requirements of the text;
  • the preliminary model receives several training texts input by the staff.
  • the training text includes functional requirements text, such as: adjusting the background color to red, moving the logo up by 10px, etc.
  • the patch script pre-stored in the source code sharing model is used to import the client patch file into the source code.
  • FIG. 2 is a schematic flow diagram of step S3 of the application method for the same source code based on Android to be compatible with the needs of various customers.
  • the specific implementation is as follows:
  • the customer patch file includes the components to be adjusted and the component adjustment requirements.
  • Figure 3 is a schematic diagram of the components to be adjusted in the customer patch file;
  • the component to be adjusted is a component that needs to be adjusted in the source code requested by the customer.
  • the component adjustment requirements The content text to be adjusted for the component;
  • S32 Use the source code sharing model to convert the component adjustment requirements in the customer patch file into a customized code segment, and associate the benchmarked code segment with the customized code segment according to the association between the components to be adjusted and the component adjustment requirements;
  • the code segment after the benchmarking is associated with the customized code segment to facilitate Later, the customized code segment will be adjusted and modified to the code segment after benchmarking to achieve functional adjustments.
  • the patch script in the source code sharing model is used to import the customized code segment corresponding to the benchmarked code segment through the git import instruction, until all the customized code segments are correspondingly imported into the code segment to form the customized source code.
  • the source code sharing model adopts the git import instruction through the patch script to import the customized code segment into the code segment after the benchmarking.
  • the above git import instruction is the existing technology, and this manual will not repeat it;
  • the customized source code is formed. It can be understood that the customized source code is temporarily stored in the code temporary storage layer in the source code sharing model.
  • S4 Integrate the customized source code into a subfolder, and compress and package the subfolder to generate a code data package;
  • the server After the server generates the customized source code corresponding to the text required by the customer through the source code sharing model, it retrieves the customized source code from the code temporary storage layer in the source code sharing model and integrates it into a subfolder. The files are compressed and packaged to form a code data package.
  • the server delivers the code data package to the client's target host to implement the delivery process.
  • the step of importing the source code sharing model and the client patch file into the subfolder it includes:
  • the customer demand text is in the form of text data
  • the above-mentioned BERT model is Google's open source semantic recognition model in 2018. Through its semantic analysis of customer demand text, the component adjustment requirements corresponding to each component to be adjusted are obtained.
  • the step of identifying the code segment in the source code that is aligned with the component to be adjusted in the client patch file includes:
  • a second code label with the same code as the first code label is located from the source code, and the code related to the second code label in the source code is determined as a code segment.
  • the above-mentioned component to be adjusted may be a component such as a logo.
  • the first code tag generated by the server includes first code tags such as ⁇ div logo> and ⁇ class logo>; according to the first code
  • the label determines the second code label of the same code from the source code of the code temporary storage layer. After the second code label in the source code is determined through the first code label, the server can adjust the customized code segment corresponding to the component adjustment requirements It is added to the code segment associated with the second code label to achieve component adjustment.
  • the way to adjust the customized code segment to the code segment associated with the second code label add the following git command through the patch script, the purpose of adding is to execute the xxx/auto_patch/auto_patch.sh script during lunch Type the customized code segment into the code segment (where xxx is the name of the subfolder)
  • step of integrating the customized source code in the subfolder includes:
  • the server copies the source code in the code database and imports it into the code temporary storage layer in the source code sharing model. After the generated customized source code is integrated into the subfolder, the server temporarily stores the code of the source code sharing model. The customized source code in the layer is deleted.
  • FIG. 4 a structural block diagram of an Android-based device compatible with various customer needs based on the same source code is proposed for this application.
  • An Android-based device compatible with the needs of various customers with the same source code includes:
  • the creation unit 1 is used to create a subfolder in a folder pre-associated with the code database, where the code database stores the source code;
  • the first import unit 2 is used to import the source code sharing model and the customer patch file into the subfolder, where the source code sharing model is a pre-trained neural network model, and the customer patch file is a customized code generated by text analysis according to customer needs;
  • the second import unit 3 is used to import the client patch file into the source code by using the patch script pre-stored in the source code sharing model to generate the customized source code corresponding to the subfolder;
  • the integration unit 4 is used to integrate the customized source code into a subfolder, and compress and package the subfolder to generate a code data package;
  • Delivery unit 5 is used to deliver code data packages.
  • the device based on the same source code of Android that is compatible with the needs of various customers includes:
  • the semantic analysis unit is used to use the BERT model to semantically analyze the pre-acquired customer demand text to identify the component adjustment requirements corresponding to each component to be adjusted.
  • the customer demand text is in the form of text data;
  • Patch production unit used to make customer patch files according to the components to be adjusted and the corresponding component adjustment requirements
  • the above-mentioned second introduction unit 3 includes:
  • the identification module is used to identify the code segment of the source code and the component to be adjusted in the customer patch file;
  • the code conversion module is used to use the source code sharing model to convert the component adjustment requirements in the customer patch file into a customized code segment, and correlate the target code segment with the customized code segment according to the association between the components to be adjusted and the component adjustment requirements Joint
  • the import module is used to use the patch script in the source code sharing model to import the customized code snippets into the benchmarked code snippets through git import instructions, until all the customized code snippets are imported into the code snippets to form customization Source code.
  • the aforementioned identification module includes:
  • the label generation sub-module is used to generate the corresponding first code label according to the preset functionality of the component to be adjusted;
  • the code positioning sub-module is used to locate the second code label with the same code as the first code label from the source code according to the first code label, and determine that the code related to the second code label in the source code is a code segment
  • the device based on the same source code of Android that is compatible with the needs of various customers includes:
  • the deletion unit is used to delete the customized source code stored in the aforementioned source code sharing model.
  • the patch script in the source code sharing model imports the customer patch file into the source code to generate customized source code associated with the subfolder, so as to customize the corresponding code according to customer requirements; finally, integrate the customized source code In a subfolder, compress and package the subfolder to generate a code data package, and then deliver the code data package.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Library & Information Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请提供了一种基于Android的同份源代码兼容各客户需求的方法和装置,运用于代码协同共享领域,其方法包括:在与代码数据库预关联的文件夹中创建子文件夹,以根据不同的客户创建对应的文件夹;然后,向子文件夹中导入源码共享模型和客户patch文件,并采用预存于源码共享模型中的patch脚本将客户patch文件导入至源代码中,以生成与子文件夹对应关联的定制化源代码,从而根据客户要求实现对应代码的定制;最终,将定制化源代码整合于子文件夹中,并将子文件夹进行压缩打包生成代码数据包,再交付代码数据包,通过将代码数据库中的定制后的源代码整合至对应的客户子文件夹中,实现代码数据库中同份源代码能够兼容各客户需求的效果。

Description

基于Android的同份源代码兼容各客户需求的方法和装置 技术领域
本申请涉及代码协同共享技术领域,特别涉及为一种基于Android的同份源代码兼容各客户需求的方法和装置。
背景技术
持续交付(Continuous delivery,CD),是一种软件工程手法,让软件产品的交付过程在一个短周期内进行持续交付,以保证软件源代码可以稳定、持续的保持在随时变动的状况。它的目标在于让软件的构建、测试与发布变得更快以及更频繁,这种方式可以减少软件开发的成本与时间,减少风险。
对于现有持续交付,每个项目都存在差异性,每个项目若想实现完整的交付流程,则需要根据客户每个项目的差异性而专门定制对应的交付流程,以及售卖软件企业所研发的软件产品在细节、功能、页面等需要应客户进行修改调整,之后交付客户,导致软件企业需要付出大量人力成本、时间成本进行调整修改,有时甚至会因为修改调整出现大量不可预见的bug问题。
使用现有的交付技术方案,需要对每个项目单独设计部署流程,虽然程序有使用共性,但是因为每个项目的复杂性和多样性,每承接一个项目,都需要根据项目的复杂度,花费数天的工作量定制对应的交付模型。
发明内容
本申请旨在解决根据不同的客户要求对源代码修改时,各个分支的代码均需修改,从而造成时间和人力成本浪费的技术问题,现提供一种基于Android的同份源代码兼容各客户需求的方法和装置。
本申请为解决技术问题采用如下技术手段:
本申请提出一种基于Android的同份源代码兼容各客户需求的方法,包括:
在与代码数据库预关联的文件夹中创建子文件夹,其中所述代码数据库存储源代码;
向所述子文件夹中导入源码共享模型和客户patch文件,其中所述源码共享模型为预训练的神经网络模型,所述客户patch文件为根据客户需要文本解析生成的定制化代码;
采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码;
将所述定制化源代码整合于所述子文件夹中,并将所述子文件夹进行压缩打包生成代码数据包;
交付所述代码数据包。
进一步地,所述向所述子文件夹中导入源码共享模型和客户patch文件的步骤之前,包括:
采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,所述客户需求文本为文本数据形式;
根据所述待调整组件与对应的组件调整要求制成客户patch文件。
进一步地,所述采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码的步骤包括:
识别所述源代码中与所述客户patch文件中的待调整组件对标的代码段;
采用所述源代码共享模型将所述客户patch文件中组件调整要求转换为定制化代码段,并根据所述待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
采用所述源码共享模型中的patch脚本通过git的导入指令将所述定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
进一步地,所述识别所述源代码中与所述客户patch文件中的待调整组件对标的代码段的步骤包括:
根据所述待调整组件的预设功能性生成对应的第一代码标签;
根据所述第一代码标签从所述源代码中定位出与第一代码标签相同代码的第二代码标签,确定所述源代码中与第二代码标签相关的代码为代码段。
进一步地,所述将所述定制化源代码整合于所述子文件夹中的步骤包括:
从所述代码数据库中复制以生成的定制化源代码,删除在所述代码数据库中已添加至源代码的客户patch文件且保留源代码;
将复制出的定制化源代码整合于所述所述子文件夹中。
本申请还提出一种基于Android的同份源代码兼容各客户需求的装置,包括:
创建单元,用于在与代码数据库预关联的文件夹中创建子文件夹,其中所述代码数据库存储源代码;
第一导入单元,用于向所述子文件夹中导入源码共享模型和客户patch文件,其中所述源码共享模型为预训练的神经网络模型,所述客户patch文件为根据客户需要文本解析生成的定制化代码;
第二导入单元,用于采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码;
整合单元,用于将所述定制化源代码整合于所述子文件夹中,并将所述子文件夹进行压缩打包生成代码数据包;
交付单元,用于交付所述代码数据包。
进一步地,基于Android的同份源代码兼容各客户需求的装置包括:
语义分析单元,用于采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,所述客户需求文本为文本数据形式;
Patch制作单元,用于根据所述待调整组件与对应的组件调整要求制成客户patch文件。
进一步地,所述第二导入单元包括:
识别模块,用于识别所述源代码中与所述客户patch文件中的待调整组件对标的代码段;
代码转换模块,用于采用所述源代码共享模型将所述客户patch文件中组件调整要求转换为定制化代码段,并根据所述待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
导入模块,用于采用所述源码共享模型中的patch脚本通过git的导入指令将所述定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
进一步地,所述识别模块包括:
标签生成子模块,用于根据所述待调整组件的预设功能性生成对应的第一代码标签;
代码定位子模块,用于根据所述第一代码标签从所述源代码中定位出与第一代码标签相同代码的第二代码标签,确定所述源代码中与第二代码标签相关的代码为代码段。
进一步地,所述基于Android的同份源代码兼容各客户需求的装置包括:
删除单元,用于将存储在上述源码共享模型中的定制化源代码删除。
本申请提供了基于Android的同份源代码兼容各客户需求的方法和装置,具有以下有益效果:
在与代码数据库预关联的文件夹中创建子文件夹,以根据不同的客户创建对应的文件夹;然后,向子文件夹中导入源码共享模型和客户patch文件,并采用预存于源码共享模型中的patch脚本将客户patch文件导入至源代码中,以生成与子文件夹对应关联的定制化源代码,从而根据客户要求实现对应代码的定制;最终,将定制化源代码整合于子文件夹中,并将子文件夹进行压缩打包生成代码数据包,再交付代码数据包,通过将代码数据库中的定制后的源代码整合至对应的客户子文件夹中,实现代码数据库中同份源代码能够兼容各客户需求的效果,达到解决根据不同的客户要求对源代码修改时,各个分支的代码均需修改,以造成时间和人力成本浪费问题的效果。
附图说明
图1为本申请基于Android的同份源代码兼容各客户需求的方法一个实施例的流程示意图;
图2为本申请基于Android的同份源代码兼容各客户需求的方法一个实施例的流程示意图;
图3为本申请基于Android的同份源代码兼容各客户需求的方法中组件的示意图;
图4为本申请基于Android的同份源代码兼容各客户需求的装置的结构框图。
本申请为目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
下面将结合本申请的实施例中的附图,对本申请的实施例中的技术方案进 行清楚、完整地描述,显然,所描述的实施例仅仅是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
参考附图1,为本申请第一实施例中的基于Android的同份源代码兼容各客户需求的方法的流程示意图;
本申请提出一种服务器,服务器包括服务器处理终端,以该服务器作为执行主体,服务器执行基于Android的同份源代码兼容各客户需求的方法。
本申请提出一种基于Android的同份源代码兼容各客户需求的方法,包括:
S1,在与代码数据库预关联的文件夹中创建子文件夹,其中代码数据库存储源代码;
代码数据库设于服务器,当开发集群将源代码编码完成时,服务器接收开发集群上传的源代码,并将源代码存储于代码数据库中。
服务器将代码数据库与一文件夹进行关联,使服务器能够通过文件夹将代码数据库中的源代码导入至该文件夹内;基于此,为实现同份源代码兼容各客户需求,在该文件夹中设立子文件夹,子文件夹与对应客户数量一致,且子文件夹的命名以客户名称或编码进行命名;在创建对应数量的子文件夹并命名后,后续会根据各客户的需求对应进行源代码的调整修改,从而得到各个客户对应的定制化源代码,随后将定制化源代码导入至与其相对应的子文件夹中整合,最终交付,从而实现同份源代码兼容各客户需求的效果。
S2,向子文件夹中导入源码共享模型和客户patch文件,其中源码共享模型为预训练的神经网络模型,客户patch文件为根据客户需要文本解析生成的定制化代码;
在服务器根据客户创建对应的子文件夹后,向子文件夹中导入源码共享模型和客户patch文件,具体的,上述源码共享模型为工作人员在服务器内预先训练的神经网络模型,上述的客户patch文件为根据客户需求生成的代码文本;
上述源码共享模型的训练方法为:
服务器获取工作人员输入的模型构建代码文本,以根据模型构建代码文本构成初步模型,该初步模型包括文本存储层、代码暂存层和代码转化层,其中文本存储层用于记录客户需求文本,代码暂存层用于暂时存储源代码,代码转化层用于根据文本的功能性要求生成对应的代码文本;
初步模型接收工作人员输入的若干训练文本,该训练文本包括功能性要求 文本,功能性要求文本例如:调整背景颜色为红色,将logo上移10px等。
采用文本存储层存储上述若干训练文本,代码暂存层复制代码数据库中的源代码进行暂存,代码转换层根据训练文本的功能性要求进行代码转换,代码转换例如:调整背景颜色为红色,即为background=255,0,0;将文本存储层、代码暂存层和代码转化层相关联,从而构建得到源码共享模型。
S3,采用预存于源码共享模型中的patch脚本将客户patch文件导入至源代码中,以生成与子文件夹对应关联的定制化源代码;
在服务器将源码共享模型和客户patch文件导入至对应的子文件夹后,采用预存于源码共享模型中的Patch脚本将客户patch文件导入至源代码中。
由上述可知,源码共享模型中的代码暂存层存储有源代码,服务器通过patch脚本将客户patch文件写入至该代码暂存层内源代码中,从而生成定制化源代码;如附图2,附图2为本申请的基于Android的同份源代码兼容各客户需求的方法步骤S3的流程示意图,具体实施方式如下:
S31,识别源代码中与客户patch文件中的待调整组件对标的代码段;
客户patch文件包括待调整组件和组件调整要求,参考附图3,即为客户patch文件的待调整组件的示意图;待调整组件为客户要求的源代码中需要进行调整的某一组件,组件调整要求为要求该组件调整的内容文本;
S32,采用源代码共享模型将客户patch文件中组件调整要求转换为定制化代码段,并根据待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
由上述可知,源代码共享模型中的代码转换层根据组件调整要求的功能性转换为对应的定制化代码段。
因为待调整组件与组件调整要求是由同一客户patch文件拆分而来具备关联性,则根据待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联,以便于后续将定制化代码段调整修改至对标后的代码段中,实现功能性调整。
S33,采用源码共享模型中的patch脚本通过git的导入指令将定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
源码共享模型通过patch脚本采用git导入指令,将定制化代码段对应的导入至对标后的代码段中,上述的git导入指令为现有技术,本说明书不做赘述;
待所有的制化代码段对应导入至源代码的代码段后,形成定制化源代码。可以理解,该定制化源代码暂存于源码共享模型中的代码暂存层。
S4,将定制化源代码整合于子文件夹中,并将子文件夹进行压缩打包生成代码数据包;
服务器通过源码共享模型生成与客户要求文本对应的定制化源代码后,从源代码共享模型中的代码暂存层中调取定制化源代码,并整合至子文件夹中,随后服务器对该子文件件进行压缩打包,从而形成代码数据包。
S5,交付代码数据包。
服务器将代码数据包交付至客户的目标主机,实现交付过程。
在一个实施例中,向子文件夹中导入源码共享模型和客户patch文件的步骤之前,包括:
采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,客户需求文本为文本数据形式;
根据待调整组件与对应的组件调整要求制成客户patch文件。
上述的BERT模型为谷歌2018年开源的语义识别模型,通过其语义分析客户需求文本,得到各待调整组件对应的组件调整要求。
在一个实施例中,识别源代码中与客户patch文件中的待调整组件对标的代码段的步骤包括:
根据待调整组件的预设功能性生成对应的第一代码标签;
根据第一代码标签从源代码中定位出与第一代码标签相同代码的第二代码标签,确定源代码中与第二代码标签相关的代码为代码段。
上述的待调整组件可以是logo等组件,例如:当待调整组件为logo时,则服务器生成的第一代码标签包括<div logo>、<class logo>等第一代码标签;根据该第一代码标签从代码暂存层的源代码中确定出相同代码的第二代码标签,当通过第一代码标签确定源代码中的第二代码标签后,服务器能够将组件调整要求对应的定制化代码段调整添加至第二代码标签相关联的代码段中,从而实现组件调节。
将定制化代码段调整添加至第二代码标签相关联的代码段中的方式:通过patch脚本添加如下git指令,添加的目的是为了在lunch的时候,可以执行到xxx/auto_patch/auto_patch.sh脚本将定制化代码段打入代码段中(其中,xxx是子文件夹的名称)
+AUTO_PATCH_XXX:=xxx/auto_patch/auto_patch.sh
+HAVE_XXX_SHELL_FILE:=$(shell test-f$(AUTO_PATCH_HAIER_ALIBABA)&&echo yes)
+ifeq($(HAVE_XXX_SHELL_FILE),yes)
+$(warning$(shell($(AUTO_PATCH_XXX))))
+endif
在一个实施例中,将定制化源代码整合于子文件夹中的步骤之后包括:
将存储在上述源码共享模型中的定制化源代码删除。
由上述可知,服务器将代码数据库中的源代码复制导入至源码共享模型中的代码暂存层中,当生成好的定制化源代码整合至子文件夹之后,服务器将源码共享模型的代码暂存层中的定制化源代码删除。
参考附图4,为本申请提出的一种基于Android的同份源代码兼容各客户需求的装置的结构框图,
一种基于Android的同份源代码兼容各客户需求的装置包括:
创建单元1,用于在与代码数据库预关联的文件夹中创建子文件夹,其中代码数据库存储源代码;
第一导入单元2,用于向子文件夹中导入源码共享模型和客户patch文件,其中源码共享模型为预训练的神经网络模型,客户patch文件为根据客户需要文本解析生成的定制化代码;
第二导入单元3,用于采用预存于源码共享模型中的patch脚本将客户patch文件导入至源代码中,以生成与子文件夹对应关联的定制化源代码;
整合单元4,用于将定制化源代码整合于子文件夹中,并将子文件夹进行压缩打包生成代码数据包;
交付单元5,用于交付代码数据包。
在一个实施例中,基于Android的同份源代码兼容各客户需求的装置包括:
语义分析单元,用于采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,客户需求文本为文本数据形式;
Patch制作单元,用于根据待调整组件与对应的组件调整要求制成客户patch文件
在一个实施例中,上述第二导入单元3包括:
识别模块,用于识别源代码中与客户patch文件中的待调整组件对标的代 码段;
代码转换模块,用于采用源代码共享模型将客户patch文件中组件调整要求转换为定制化代码段,并根据待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
导入模块,用于采用源码共享模型中的patch脚本通过git的导入指令将定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
在一个实施例中,上述识别模块包括:
标签生成子模块,用于根据待调整组件的预设功能性生成对应的第一代码标签;
代码定位子模块,用于根据第一代码标签从源代码中定位出与第一代码标签相同代码的第二代码标签,确定源代码中与第二代码标签相关的代码为代码段
在一个实施例中,基于Android的同份源代码兼容各客户需求的装置包括:
删除单元,用于将存储在上述源码共享模型中的定制化源代码删除。
综上所述,在与代码数据库预关联的文件夹中创建子文件夹,以根据不同的客户创建对应的文件夹;然后,向子文件夹中导入源码共享模型和客户patch文件,并采用预存于源码共享模型中的patch脚本将客户patch文件导入至源代码中,以生成与子文件夹对应关联的定制化源代码,从而根据客户要求实现对应代码的定制;最终,将定制化源代码整合于子文件夹中,并将子文件夹进行压缩打包生成代码数据包,再交付代码数据包,通过将代码数据库中的定制后的源代码整合至对应的客户子文件夹中,实现代码数据库中同份源代码能够兼容各客户需求的效果。
尽管已经示出和描述了本申请的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本申请的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本申请的范围由所附权利要求及其等同物限定。

Claims (10)

  1. 一种基于Android的同份源代码兼容各客户需求的方法,其特征在于,包括:
    在与代码数据库预关联的文件夹中创建子文件夹,其中所述代码数据库存储源代码;
    向所述子文件夹中导入源码共享模型和客户patch文件,其中所述源码共享模型为预训练的神经网络模型,所述客户patch文件为根据客户需要文本解析生成的定制化代码;
    采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码;
    将所述定制化源代码整合于所述子文件夹中,并将所述子文件夹进行压缩打包生成代码数据包;
    交付所述代码数据包。
  2. 根据权利要求1所述的基于Android的同份源代码兼容各客户需求的方法,其特征在于,所述向所述子文件夹中导入源码共享模型和客户patch文件的步骤之前,包括:
    采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,所述客户需求文本为文本数据形式;
    根据所述待调整组件与对应的组件调整要求制成客户patch文件。
  3. 根据权利要求2所述的基于Android的同份源代码兼容各客户需求的方法,其特征在于,所述采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码的步骤包括:
    识别所述源代码中与所述客户patch文件中的待调整组件对标的代码段;
    采用所述源代码共享模型将所述客户patch文件中组件调整要求转换为定制化代码段,并根据所述待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
    采用所述源码共享模型中的patch脚本通过git的导入指令将所述定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
  4. 根据权利要求3所述的基于Android的同份源代码兼容各客户需求的方 法,其特征在于,所述识别所述源代码中与所述客户patch文件中的待调整组件对标的代码段的步骤包括:
    根据所述待调整组件的预设功能性生成对应的第一代码标签;
    根据所述第一代码标签从所述源代码中定位出与第一代码标签相同代码的第二代码标签,确定所述源代码中与第二代码标签相关的代码为代码段。
  5. 根据权利要求1所述的基于Android的同份源代码兼容各客户需求的方法,其特征在于,所述将所述定制化源代码整合于所述子文件夹中的步骤之后包括:
    将存储在上述源码共享模型中的定制化源代码删除。
  6. 一种基于Android的同份源代码兼容各客户需求的装置,其特征在于,包括:
    创建单元,用于在与代码数据库预关联的文件夹中创建子文件夹,其中所述代码数据库存储源代码;
    第一导入单元,用于向所述子文件夹中导入源码共享模型和客户patch文件,其中所述源码共享模型为预训练的神经网络模型,所述客户patch文件为根据客户需要文本解析生成的定制化代码;
    第二导入单元,用于采用预存于所述源码共享模型中的patch脚本将所述客户patch文件导入至所述源代码中,以生成与所述子文件夹对应关联的定制化源代码;
    整合单元,用于将所述定制化源代码整合于所述子文件夹中,并将所述子文件夹进行压缩打包生成代码数据包;
    交付单元,用于交付所述代码数据包。
  7. 根据权利要求6所述的基于Android的同份源代码兼容各客户需求的装置,其特征在于,包括:
    语义分析单元,用于采用BERT模型语义分析预获取的客户需求文本,以识别出各待调整组件对应的组件调整要求,所述客户需求文本为文本数据形式;
    Patch制作单元,用于根据所述待调整组件与对应的组件调整要求制成客户patch文件。
  8. 根据权利要求7所述的基于Android的同份源代码兼容各客户需求的装置,其特征在于,所述第二导入单元包括:
    识别模块,用于识别所述源代码中与所述客户patch文件中的待调整组件 对标的代码段;
    代码转换模块,用于采用所述源代码共享模型将所述客户patch文件中组件调整要求转换为定制化代码段,并根据所述待调整组件与组件调整要求的关联使对标后的代码段与定制化代码段相关联;
    导入模块,用于采用所述源码共享模型中的patch脚本通过git的导入指令将所述定制化代码段对应的导入至对标后的代码段中,直至所有制化代码段对应导入至代码段后,形成定制化源代码。
  9. 根据权利要求8所述的基于Android的同份源代码兼容各客户需求的装置,其特征在于,所述识别模块包括:
    标签生成子模块,用于根据所述待调整组件的预设功能性生成对应的第一代码标签;
    代码定位子模块,用于根据所述第一代码标签从所述源代码中定位出与第一代码标签相同代码的第二代码标签,确定所述源代码中与第二代码标签相关的代码为代码段。
  10. 根据权利要求6所述的基于Android的同份源代码兼容各客户需求的装置,其特征在于,包括:
    删除单元,用于将存储在上述源码共享模型中的定制化源代码删除。
PCT/CN2020/120672 2020-01-02 2020-10-13 基于Android的同份源代码兼容各客户需求的方法和装置 WO2021135497A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010009182.4A CN111198713B (zh) 2020-01-02 2020-01-02 基于Android的同份源代码兼容各客户需求的方法和装置
CN202010009182.4 2020-01-02

Publications (1)

Publication Number Publication Date
WO2021135497A1 true WO2021135497A1 (zh) 2021-07-08

Family

ID=70746835

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/120672 WO2021135497A1 (zh) 2020-01-02 2020-10-13 基于Android的同份源代码兼容各客户需求的方法和装置

Country Status (2)

Country Link
CN (1) CN111198713B (zh)
WO (1) WO2021135497A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117742769A (zh) * 2024-02-19 2024-03-22 浙江金网信息产业股份有限公司 基于信创规则库的源码智能分析引擎

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111198713B (zh) * 2020-01-02 2023-11-28 晶晨半导体(深圳)有限公司 基于Android的同份源代码兼容各客户需求的方法和装置
CN113282284A (zh) * 2021-06-24 2021-08-20 成都科来网络技术有限公司 一种适配多定制化项目的打包方法及打包系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040230964A1 (en) * 2003-02-13 2004-11-18 Waugh Lawrence Taylor System and method for managing source code and acquiring metrics in software development
KR101747424B1 (ko) * 2016-02-04 2017-06-27 주식회사 제이티엘소프트 애플리케이션 설계와 구현을 통합하는 객체 지향 프로그래밍 장치, 및 방법
CN106909391A (zh) * 2017-02-28 2017-06-30 东软集团股份有限公司 应用程序的定制方法及装置
CN108241493A (zh) * 2018-01-09 2018-07-03 政采云有限公司 分布式软件系统的自动化持续集成与交付方法、装置和系统
CN109669692A (zh) * 2018-12-21 2019-04-23 深圳Tcl新技术有限公司 源码共享方法、服务器、计算机可读存储介质及系统
CN111198713A (zh) * 2020-01-02 2020-05-26 晶晨半导体(深圳)有限公司 基于Android的同份源代码兼容各客户需求的方法和装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10574692B2 (en) * 2016-05-30 2020-02-25 Christopher Nathan Tyrwhitt Drake Mutual authentication security system with detection and mitigation of active man-in-the-middle browser attacks, phishing, and malware and other security improvements
CN106407113B (zh) * 2016-09-09 2018-12-11 扬州大学 一种基于Stack Overflow和commit库的bug定位方法
CN106874195A (zh) * 2017-01-18 2017-06-20 环球智达科技(北京)有限公司 一种针对android应用的bug修复和持续交付方案
CN109492106B (zh) * 2018-11-13 2022-05-13 扬州大学 一种文本代码相结合的缺陷原因自动分类方法
CN109933364A (zh) * 2019-02-25 2019-06-25 晶晨半导体(上海)股份有限公司 一种代码管理方法
CN110147452B (zh) * 2019-05-17 2022-03-01 北京理工大学 一种基于层级bert神经网络的粗粒度情感分析方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040230964A1 (en) * 2003-02-13 2004-11-18 Waugh Lawrence Taylor System and method for managing source code and acquiring metrics in software development
KR101747424B1 (ko) * 2016-02-04 2017-06-27 주식회사 제이티엘소프트 애플리케이션 설계와 구현을 통합하는 객체 지향 프로그래밍 장치, 및 방법
CN106909391A (zh) * 2017-02-28 2017-06-30 东软集团股份有限公司 应用程序的定制方法及装置
CN108241493A (zh) * 2018-01-09 2018-07-03 政采云有限公司 分布式软件系统的自动化持续集成与交付方法、装置和系统
CN109669692A (zh) * 2018-12-21 2019-04-23 深圳Tcl新技术有限公司 源码共享方法、服务器、计算机可读存储介质及系统
CN111198713A (zh) * 2020-01-02 2020-05-26 晶晨半导体(深圳)有限公司 基于Android的同份源代码兼容各客户需求的方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117742769A (zh) * 2024-02-19 2024-03-22 浙江金网信息产业股份有限公司 基于信创规则库的源码智能分析引擎
CN117742769B (zh) * 2024-02-19 2024-04-30 浙江金网信息产业股份有限公司 基于信创规则库的源码智能分析引擎

Also Published As

Publication number Publication date
CN111198713A (zh) 2020-05-26
CN111198713B (zh) 2023-11-28

Similar Documents

Publication Publication Date Title
WO2021135497A1 (zh) 基于Android的同份源代码兼容各客户需求的方法和装置
US11790155B2 (en) Electronic signing using action responsive document copy generation
USRE49119E1 (en) System and method for rules-based control of custody of electronic signature transactions
US20190123889A1 (en) Document flow tracking using blockchain
US9971754B2 (en) Method for associating third party content with online document signing
US7693851B2 (en) Systems and methods for implementing a shared space in a provider-tenant environment
US20160139916A1 (en) Build Deployment Automation for Information Technology Mangement
US20130232229A1 (en) Distribution of Application Files
WO2020155776A1 (zh) 一种基于核心模块的应用程序的生成方法及设备
JP2004503841A (ja) レガシコンピュータシステムからxmlデータをレポートするための方法とシステム
WO2020155775A1 (zh) 一种基于核心开发环境的应用程序的生成方法及设备
CN104750796A (zh) 一种BS系统下导出Word的方法
US20160171626A1 (en) Systems and methods for employing document pre-tag auditing in transaction rooms for digital transactions
CN103914487A (zh) 文档的采集、标识及关联的系统
CN108664247A (zh) 一种页面模板数据交互的方法及装置
Dunglas Persistence in PHP with the Doctrine ORM
US10846263B2 (en) Systems and methods for implementing content aware file management labeling
US10803093B2 (en) Systems and methods for enabling a file management label to persist on a data file
CN111310425B (zh) 清单智能化的系统实现方法和智能清单系统
US10600008B2 (en) System implementing electronic case versioning
US20130275866A1 (en) Synchronization of off-line reports and off-line mobile content packages
JP6614565B2 (ja) 報告書作成システム
KR102118093B1 (ko) 얼굴 인식 기반 등장인물 정보 제공 시스템의 워크플로우 처리방법
US20220391430A1 (en) Centralized universal media object management
WO2017040426A1 (en) Systems and methods for master-client virtual workspace communication and management

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20909832

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 28/10/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20909832

Country of ref document: EP

Kind code of ref document: A1