How to create an Snapshot Dependency programmatically?

I am working on a plug-in for TeamCity(build 21163).

In my plug-in, I want to set up an Snapshot Dependency between two build configurations which belong to the same project.

For example, I create two build configurations using the following code(Java):

SProject newProject = myProjectManager.createProject(“test”);

SBuildType newBuildType1 = newProject.createBuildType("testBuild1");

SBuildType newBuildType2 = newProject.createBuildType("testBuild2");

I have read the document “TeamCity Open API” for a long time, but I still have no idea about how to create an Snapshot Dependency between "newBuildType1 " and "newBuildType2 ".

Are "SBuildType.addDependency()" and "DependencyFactory.createDependency()" have something to do with the Snapshot Dependency?

Any suggestions will be highly appreciated.

Sun Ding

1 comment
Comment actions Permalink

I have solved this problem.

After demonstration, the method "SBuildType.addDependency(Dependency)" is indeed to add an Snapshot Dependency.

The parameter can be created by the method "DependencyFactory.createDependency(SBuildType dependedOnBuild)".

As "DependencyFactory" is an interface not a class, so we can use it rely on Sping AutoWriting.

0

Please sign in to leave a comment.