PerforceVcsRoot

Perforce VCS root

Example. Defines a Perforce VCS root for a Perforce stream with automatic monitoring of sub-streams.

object StreamBasedRootWithSubStreams : PerforceVcsRoot({
name = "Stream-based root with sub-streams"
port = "perforce:1666"

mode = stream {
streamName = "//streams/project/mainline"
enableFeatureBranches = true
branchSpec = """
+://streams/project/(*)
-://streams/project/release1.0
""".trimIndent()
}

// Create a non-stream workspace but allow using TeamCity checkout rules.
// When false (default), TeamCity creates a stream workspace which allows commit back to P4
nonStreamWorkspace = true

userName = "tcAdmin"
password = "credentialsJSON:******"

// Instead of polling, consider using commit hooks:
// https://www.jetbrains.com.cn/en-us/help/teamcity/configuring-vcs-post-commit-hooks-for-teamcity.html#Setting+up+post-commit+hook+on+Perforce+server
pollInterval = 120
})

Example. Defines a Perforce VCS root with some client mapping and some custom workspace options.

object MainRoot : PerforceVcsRoot({
name = "Main root"

port = "perforce:1666"
mode = clientMapping {
mapping = """
//depot/MyProject/... //team-city-agent/...
//depot/Library1/... //team-city-agent/lib1/...
//depot/Library2/... //team-city-agent/lib2/...
-//depot/Library2/xxx/... //team-city-agent/lib1/xxx/...
""".trimIndent()
}

workspaceOptions = """
Options: noallwrite clobber nocompress unlocked nomodtime rmdir
Host: %teamcity.agent.hostname%
SubmitOptions: revertunchanged
LineEnd: local
""".trimIndent()

userName = "tcAdmin"
password = "credentialsJSON:******"
})

Example. Defines a Perforce VCS root with checkout mapping based on a specific non-stream client. Also, an explicit p4 clean will be run for each checkout, and utf8 encoding will be used when obtaining sources from the Perforce server.

object ClientBasedRoot : PerforceVcsRoot({
name = "Client-based root"
port = "perforce:1666"

mode = client {
clientName = "teamcityClient"
}

userName = "tcAdmin"
password = "credentialsJSON:******"

runP4Clean = true
charsetName = "utf8"
})

Constructors

Link copied to clipboard
constructor(init: PerforceVcsRoot.() -> Unit)
constructor()

Types

Link copied to clipboard

Properties

Link copied to clipboard

A charset to use on the client machine

Link copied to clipboard
Link copied to clipboard
open override var id: Id?

VCS root id. It appears in the web UI and is used in urls. If the VCS root has a uuid specified, then the id can be changed at any time. If uuid is omitted, then TeamCity treats a VCS root with a changed id as a new VCS root, all data associated with the old root will be lost (e.g. a commits graph). Id can also be used by some settings, e.g. as a part of parameter reference. If you change the id, you should find all its occurrences in the current project and change them too. Id must be unique across all VCS roots on the server. If id is missing, it will be generated from the class name (if the class is not from the jetbrains.buildServer.configs.kotlin package).

Link copied to clipboard

A mode of Perforce connection

Link copied to clipboard

VCS root name

Link copied to clipboard

When set, the created Perforce workspace on agent will not be stream-enabled. The option allows using arbitrary checkout rules, but prohibits commits from agent into the stream.

Link copied to clipboard

A path to p4 executable

Link copied to clipboard

Helper for creating references to parameters of this VCS root

Link copied to clipboard
Link copied to clipboard

A password for Perforce connection

Link copied to clipboard

VCS root polling interval, in seconds

Link copied to clipboard
var port: String?

A Perforce server address in the "host:port" format

Link copied to clipboard

Whether TeamCity should run 'p4 clean' command before the build

Link copied to clipboard

Whether TeamCity should track files on the Perforce server on sync

Link copied to clipboard

Enables support for files with UTF-16 encoding

Link copied to clipboard

Additional options for the p4 sync command

Link copied to clipboard

VCS type

Link copied to clipboard

A username for Perforce connection

Link copied to clipboard
Link copied to clipboard

VCS root uuid. TeamCity uses it to identify the VCS root. If uuid changes, TeamCity considers it to be a new entity. If uuid is missing, it is reconstructed from VCS root id. Uuid must be unique across all entities on the server.

Link copied to clipboard

Functions

Link copied to clipboard
fun booleanParameter(customName: String? = null, trueValue: String? = "true", falseValue: String? = "false"): DelegateProvider<Boolean?>
Link copied to clipboard
fun clear()
Link copied to clipboard

Connect to to Perforce using the specified client name

Link copied to clipboard

Connect to Perforce using the specified client mapping

Link copied to clipboard
fun <T : CompoundParam<T>> compoundParameter(customName: String? = null): DelegateProvider<T>
Link copied to clipboard
fun <T : Parametrized> copyParamsTo(target: T): T

Copies parameters of this object to the specified target

Link copied to clipboard
open fun create(): VcsRoot

Creates an instance of this VCS root via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.

Link copied to clipboard
fun doubleParameter(customName: String? = null): DelegateProvider<Double>
Link copied to clipboard
fun <E : Enum<E>> enumParameter(customName: String? = null, mapping: Map<E, String?>? = null): DelegateProvider<E>
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun findRawParam(paramName: String): Parameter?
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun hasParam(paramName: String): Boolean
Link copied to clipboard
fun id(id: String)

Sets the id to the specified value. Type of the id depends on the context in which DSL is executed: it is RelativeId when DSL context is relative, otherwise it is AbsoluteId.

Link copied to clipboard
fun intParameter(customName: String? = null): DelegateProvider<Int>
Link copied to clipboard
fun param(name: String, value: String)

Adds parameter with specified name and value

Link copied to clipboard
fun removeRawParam(paramName: String)
Link copied to clipboard

Connect to Perforce stream with specified name

Link copied to clipboard
open fun stringParameter(customName: String? = null): DelegateProvider<String>
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates this object and reports found errors to the provided consumer