私たちのプロジェクトでブランチ作成のプロセスを自動化したいと考えています。以下は、Anthill Web UI を使用して手動で実行されている手順です。Anthill には約 250 の Java プロジェクトがあり、そのワークフローは RB-16.4.5 のようなリリース名にちなんで名付けられています。
ステップ 1: RB-16.4.5 のような現在のブランチで各プロジェクトのワークフローをコピーします。
ステップ 2:ワークフロー名を RB-16.4.6 のような新しいブランチ名に編集し、ソース URL をsomelocation/branches/16.4.6/projects/ProjectAのような最新のブランチ名に変更します。
ステップ 3:多くのプロジェクトで、Anthill に依存関係を追加しました。そのため、最新のブランチ プロジェクトでそれらを更新したいと考えています。そのため、 ProjectA RB-16.4.5などの古いブランチ名を持つ古い依存関係を削除し、作成された新しいワークフローの [管理] タブに移動して、新しい依存関係を追加し、フォルダー名が ProjectA RB-16.4.6の新しいプロジェクトを検索します。
今、私が書いたコードは最初の 2 つのステップで正常に動作していますが、ステップ 3 のコードを書く方法を見つけることができません。上で作成した新しいワークフローの最新の依存関係プロジェクトを取得する方法がわかりません。Anthill のドキュメントから。Dependency の名前を新しい名前に設定または変更することはできません。
http://download.boulder.ibm.com/ibmdl/pub/software/rationalsdp/documentation/product_doc/UrbanCode/AnthillPro/remoting/api/index.htmlで入手できる公式の Java Remoting API を確認しました。
AnthillClient client;
String currentBranch="RB-16.4.5";
String newBranch="RB-16.4.6";
UnitofWork uow=client.createUnitOfWork();
Folder[] allFolders=FolderFactory.getInstance().restoreAll();
Project[] myProjects={};
for(int i=0;i<allFolders.length;i++){
if(allFolders[i].getName().equals("MyPrjFolder")){
myProjects=allFolders[i].getProjects();
break;
}
//For each project copy the workflow and set New branch name & Source URL
for(int j=0;j<myProjects.length;j++){
Workflow flow=WorkflowLookup.getForProjectAndName(myProjects[j],newBranch);
Workflow newworkFlow=flow.duplicateForCopy(myProjects[j]);
newworkFlow.setUnitOfWork(uow);
newworkFlow.setName(newBranch);
newworkFlow.setNew(true);
newworkFlow.setActive(true);
SvnSourceConfig svnConfig=
(SvnSourceConfig) newWorkFlow.getBuildProfile().getSourceConfig();
SvnModule[] svnModule=svnConfig.getModuleArray();
String sourceURL=svnModule[0].getUrl();
svnModule[0].setUrl(sourceURL.replace(currentBranch,newBranch));
// Store the dependencies of old project branch in a list
Dependency
existingDependencies=flow.getBuildProfile().getAnthillDependencyArray();
someList.add(existingDependencies);
}
/*Now how do i set the Dependencies for each Project with new Project of
the new Branch if i have already stored the old dependecies of projects*/
// Code to create and add dependency should be something like
// How do i get the newDependency value which refers to the Project under new workflow created
Dependency newDependency=null;
newDependency= Dependency.createDependency(existingDependencies[i].getDependent),newDependency.getDependency());
}