Search in sources :

Example 11 with GitVersion

use of jetbrains.buildServer.buildTriggers.vcs.git.GitVersion in project teamcity-git by JetBrains.

the class GitVersionProvider method version.

@DataProvider
public static Object[][] version(Method testMethod) throws Exception {
    String gitPath = getGitPath();
    GitVersion version = new AgentGitFacadeImpl(gitPath).version().call();
    RequiredGitVersion requirement = testMethod.getAnnotation(RequiredGitVersion.class);
    if (requirement == null)
        requirement = testMethod.getDeclaringClass().getAnnotation(RequiredGitVersion.class);
    if (requirement == null) {
        return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
    } else {
        GitVersion minRequired = GitVersion.parse("git version " + requirement.min());
        if (version.isLessThan(minRequired)) {
            return new Object[0][];
        } else {
            return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
        }
    }
}
Also used : AgentGitFacadeImpl(jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) DataProvider(org.testng.annotations.DataProvider)

Aggregations

GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)11 GitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.command.GitCommandLine)5 AgentGitFacadeImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl)3 File (java.io.File)2 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)2 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)2 AgentGitCommandLine (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitCommandLine)2 GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)2 FetchCommandImpl (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.FetchCommandImpl)2 StubContext (jetbrains.buildServer.buildTriggers.vcs.git.command.impl.StubContext)2 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)2 NotNull (org.jetbrains.annotations.NotNull)2 SkipException (org.testng.SkipException)2 Test (org.testng.annotations.Test)2 BuildAgentEx (jetbrains.buildServer.serverSide.BuildAgentEx)1 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)1 VcsException (jetbrains.buildServer.vcs.VcsException)1 DataProvider (org.testng.annotations.DataProvider)1