How to rename Kotlin DSL objects?

I have a build configuration that needs to have a massive reshuffling. Until now I could get by with keeping my class/object names in Kotlin intact, but it's getting hard to maintain with the Kotlin type being called something entirely different than the build type it represents. How can I rename my classes but also keep build history?

3 comments

Hi Laszlo,

 

each object has an UUID. As long as UUIDs are kept, TeamCity will ensure that they are bound to the same objects, so you don't need to keep names of the objects, just the UUIDs.

0

Where can I see those UUIDs? The generated XML contains <build-type ... uuid="" ...>.

0

For already existing items, that's the UUID you are looking for. They should be added to the items when generating nonportable Kotlin DSL, but if they are already in Kotlin DSL format and they don't have it you won't get them directly. For newly created projects or configurations, you can simply generate one. If you are using the portable DSL, remember to add the prefix.

 

If you are using 2018.2 or newer, you can click on "View DSL" in the sidebar to see the DSL of any given part of a project, including the UUIDs if you disable the "portable" icon on the top right.

 

More info to the UUIDs and prefixes here: https://confluence.jetbrains.com/display/TCD18/Kotlin+DSL#KotlinDSL-WhyportableDSLrequiresthesameprefixforallIDs?

0

Please sign in to leave a comment.