Kotlin DSL Packages for DSL Development

Answered

Hello!

Currently, I am struggling with finding the names of properties in the objects of the Kotlin DSL.  For example, I want to turn on or off a feature for a particular step or vcs setting and I do not know the name of the property.  In this case, I typically turn off VCS Synchronized settings on TeamCity and use the User Interface to make my change.  I then tell it to commit the changes back to the repository where I can see the Kotlin equivalent.

This process is quite slow and cumbersome.  I would like to be able to discover what an object has to offer with the code completion you would typically get with an SDK.

Ultimately, I am looking for a software development package for the Kotlin DSL libraries.  I would like to see code completion for namespaces such as jetbrains.buildServer.configs.kotlin.v10.buildSteps.* and all of the other namespaces you will generally see in a Kotlin DSL script.

Is such a package available?  If not, where can I find the individual jar files?

 

Thanks!

0
8 comments

Hi Tanner,

We have a series of blog posts on how to use the Kotlin DSL. In particular, in part 2 linked below, you can see that the .jar file should be included in the project if you import it in IntelliJ IDEA. If not, the jar filename is listed in the blog post there as well, you can find the jar in your teamcity installation folder.

https://blog.jetbrains.com/teamcity/2016/12/kotlin-configuration-scripts-working-with-configuration-scripts/

0
Avatar
Permanently deleted user

Good Morning Denis,

 

Thanks for the quick response!  I was able to locate the configs-dsl-kotlin-10.0.0.jar file and it resolved some of my reference problems.  However, I appear to be missing a further subset of v10 classes that do not want to import?  TeamCity generated the namespace buildSteps.MSBuildStep with a lower case 'b' contrary to the upper case reference found in the configs-dsl-kotlin-10.0.0.jar reference.  These are the namespaces generated by TeamCity when I first enabled the synchronized VCS settings.

95% of my build script is MSBuild steps, and I can't seem to find the references for msBuild, script, exec steps or 3rd party build features.

Can you please provide further guidance where to find these jar files for references?

0
Avatar
Permanently deleted user

I have tried importing the .teamcity project using the pom.xml file. I work in an offline environment without a connection to the internet, so the Maven projects are unable to download from the Jetbrains website. This poses a large problem. Is there not an offline group of libraries available for download?

0

Hi Tanner,

as you can see here: https://confluence.jetbrains.com/display/TCD10/Kotlin+DSL#KotlinDSL-OpeningProjectinIDE, if you configure the pom.xml file to point at the teamcity server, the jar files will be retrieved automatically and set up as dependencies. You can safely remove the repository that points at the internet address to make sure it won't waste time checking that one.

1
Avatar
Permanently deleted user

Hi Denis,

Thank you for clarification.  I will mark the question as answered; however, I would still like to report my findings and make a suggestion for the type of disconnected development environment I work.

For starters I am only able to get the extended namespace dependencies such as buildSteps.MSBuildStep from the local TeamCity server that I am hosting.  This leaves all the dependencies that are needed from the "jetbrains-all" and "JetBrains" plugin repository unable to be received.

Could you open a ticket for TeamCity to consider shipping all dependencies with the server that is installed locally?  This would most definitely help ease the lives of people who work in offline environments.  Default functionality could still point to your web servers, but for the odd folks like myself who can't do that could simply point those other two repositories back to the local TeamCity server for the dependencies.

Would this be possible in future minor releases?

0

Hi Tanner,

What dependencies are you missing? All the dependencies for the DSL itself should be obtainable through the local server dependency, if some are missing we might need to verify that. The only dependencies on the project should be kotlin runtime and stdlib (which can often be provided automatically by the kotlin plugin in IntelliJ IDEA) and the config-dsl-kotlin-* which are provided by the local server.

The jar distribution is done this way so that external plugins can also provide DSL functionality without the need to ship additionally jar libraries in kotlin. Also if the plugins are updated on the server, the maven project should also get updated libraries automatically.

If after checking that you still consider appropriate to open a request to ship the dependencies manually, or generate them in a different way, please feel free to do so in https://youtrack.jetbrains.com/issues/TW, and please describe your situation as detailed as possible so that the request can be taken into account.

0
Avatar
Permanently deleted user

Hello Denis,

I am unable to resolve the dependencies for a few maven projects when the internet repositories are removed.  The only dependencies that are able to resolve from the local TeamCity server are the config-dsl-kotlin-* dependencies.

The maven dependencies that are not able to resolve in a disconnected environment are as follows:

Maven: org.jetbrains.kotlin:configs-dsl-kotlin:10.0.0

Maven: org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.3

Maven: org.jetbrains.kotlin:kotlin-runtime:1.0.3

Maven: org.jetbrains.kotlin:kotlin-stdlib:1.0.3

The pluginDependencies section in the pom.xml is also unable to resolve because it also default points to the internet.

 

To test this, take the following steps:

1.  Disconnect your computer from the network.

2.  Delete your local maven repository (or rename)

3.  Install TC 10.0.4 and configure with a basic setup.

4.  Download the initial project setup as Kotlin from the admin panel (the project is virtually blank with only dependencies)

5.  Try to import the pom.xml and see if it yields the same results as our discussion.

 

Thanks!

0

Hi Tanner,

just a follow up. I've created the request https://youtrack.jetbrains.com/issue/TW-48753 for including the libraries in the server distribution. Feel free to watch and vote to be informed of possible updates.

0

Please sign in to leave a comment.