# Is this the correct way to run a full build of kotlin/libraries?

**URL:** <https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241>\
**Category:** Uncategorized\
**Created:** [March 17, 2012, 10:10pm UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241 "2012-03-17T22:10:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![frasolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frasolo/32/10364_2.png) [@frasolo](https://discuss.kotlinlang.org/u/frasolo)\
**Post date:** [March 17, 2012, 10:10pm UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/1 "2012-03-17T22:10:38Z")

</div>

I have already done the following:

1. forked [https://github.com/JetBrains/kotlin](https://github.com/JetBrains/kotlin)
2. cloned my fork and from there:
  1. git fetch upstream
  2. git merge upstream/master
  3. ant -f update\_dependencies.xml (if needed) 
  4. ant dist (same as ant -f build.xml or even just ant from what I could see)
  5. cd libraries && mvn [-PlocalKotlin] clean package

If so, are steps 3 to 5 run by the Kotlin [Compiler and Plugin](http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt345&tab=buildTypeStatusDiv) build configuration? If not, why?

One of the reasons I ask is because I noticed that the version of the IDEA snapshot in update\_dependencies.xml had recently been upgraded from 116 to 118 whilst the [IDEA CE build](http://teamcity.jetbrains.com/project.html?projectId=project66) itself had not been successful for a while and therefore the last successful build remained stuck at version 116. Yet, none of the [Kotlin builds](http://teamcity.jetbrains.com/project.html?projectId=project67) picked up this problem. Step 3 failed on the command line as expected.

Secondly, after locally downgrading the version back to 116, I got several compilation failures for **stdlib** on the command line (step 5) due to methods not being implemented or (Jet) classes/methods not being found after repeated attempts over the past 24 hours (see the attached mvn\_libraries.log). Again, none of the [Kotlin builds](http://teamcity.jetbrains.com/project.html?projectId=project67) picks up these problems.

This made me wonder whether I had correctly followed the instructions from [this thread](https://discuss.kotlinlang.org/t/getting-a-dev-environment-setup-for-working-on-kotlin-libraries/1257) and from the [Getting Started](http://confluence.jetbrains.net/display/Kotlin/Getting+Started) guide, and arguably more importantly, it made me wish for an ideally new build configuration that faithfully mirrors the steps that existing _and_ aspiring committers should be executing on the command line before eventually pushing back to [https://github.com/JetBrains/kotlin](https://github.com/JetBrains/kotlin). This configuration would have picked up both of the above issues.

How does that sound, folks?

  
  
 [ant\_dist.log.zip](https://discuss.kotlinlang.org/uploads/short-url/tzskxYv7HXFPRvsF5VW7rZ2GV19.zip) (1.69 KB)  
  
 [mvn\_libraries.log.zip](https://discuss.kotlinlang.org/uploads/short-url/lYw1b4kTiMetEsFYRvbV3MRDWc3.zip) (3.38 KB)  
  
 [ant\_update\_dependencies.log.zip](https://discuss.kotlinlang.org/uploads/short-url/hGurigLIcIoDqTiOcE7Viu6DSf7.zip) (636 Bytes)

---

<div class="post-metadata">

**Author:** ![jstrachan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstrachan/32/1559_2.png) [@jstrachan](https://discuss.kotlinlang.org/u/jstrachan)\
**Post date:** [March 19, 2012, 9:52am UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/2 "2012-03-19T09:52:07Z")

</div>

I don't know much about the teamcity builds am afraid; so can't really help figure out why the builds didn't barf when the 118 build wasn't available.

Certainly your summary matches my understanding of the current build & CI stuff. Currently the update\_dependencies step is a little flaky - its hard to know exactly when you need to perform this step locally. I’ve had times when I did an update locally then couldn’t build anything as I got a newer version of IDEA which didn’t work yet.

Personally I’d prefer for these dependencies to be checked into source control then we’re all on the same page & when a new IDEA build is needed/required someone or some CI build checks them into source control. Then contributors don’t need to guess when they need to run the ant -f update\_dependencies.xml script.

Those compile errors from the mvn build certainly look bad :). Seems like the tests are not seeing any of the extension methods defined in the standard library which looks pretty fatal to me; a sure sign something’s screwy.

Am just running a test locally to see how it works for me - if 118 is indeed borked we should just rollback the update\_dependencies.xml to use 116 until it works. Not sure what to do about the TeamCity builds though as I don’t really grok what they’re doing 🙂

---

<div class="post-metadata">

**Author:** ![jstrachan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstrachan/32/1559_2.png) [@jstrachan](https://discuss.kotlinlang.org/u/jstrachan)\
**Post date:** [March 19, 2012, 12:24pm UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/3 "2012-03-19T12:24:58Z")

</div>

Just grabbed a clean checkout, ran

```kotlin
    ant -f update_dependencies.xml 
    ant dist
    cd libraries
    mvn install
```

and it worked fine for me here.

There was a slight gremlin earlier BTW with an incorrect repository URL; but it seems to be working fine for me here.

I wonder if the 118 build has worked or updated in the meantime or something? Maybe the working build on the 18th fixed your issue?

Going forward, checking in the IDEA dependencies would really help us avoid this issue. I guess its mostly the intellij-core.jar we use right?

---

<div class="post-metadata">

**Author:** ![frasolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frasolo/32/10364_2.png) [@frasolo](https://discuss.kotlinlang.org/u/frasolo)\
**Post date:** [March 20, 2012, 10:03pm UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/4 "2012-03-20T22:03:17Z")

</div>

Well, I've just given it another go, using mvn install in step 5 this time, with no joy, even after zapping my .m2 repository and .ivy2 cache. See the attached command line outputs once again.

I noticed the new [Libraries - Maven Build](http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt364) configuration successfully executes the following steps in sequence:

1. ant -f TeamCityBuild.xml pre\_build

2. ant -f TeamCityBuild.xml zip
3. mvn package -PlocalKotlin 

I’ve tried these too, without success. I’m beginning to think that there is something broken in my setup, so I’ll try all of the above on another machine next.

I cannot help but notice the many ways of building **kotlin/libraries** and I wonder whether anyone had a particular objection to consolidating build strategies across environments (CI, local) to make it clear and simple for contributers and maintainers alike. Thoughts anyone?

  
  
 [ant\_dist.log.zip](https://discuss.kotlinlang.org/uploads/short-url/iZAMrwlfYSpT1xCxrRHbf9fzjdZ.zip) (1.71 KB)  
  
 [ant\_update\_dependencies.log.zip](https://discuss.kotlinlang.org/uploads/short-url/eJrfvfVMQtD8dZuCAyYELG5bNCH.zip) (659 Bytes)  
  
 [mvn\_install.log.zip](https://discuss.kotlinlang.org/uploads/short-url/wYG0wO2eeemBXely4KA3PFmJCIP.zip) (13.5 KB)

---

<div class="post-metadata">

**Author:** ![jstrachan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstrachan/32/1559_2.png) [@jstrachan](https://discuss.kotlinlang.org/u/jstrachan)\
**Post date:** [March 20, 2012, 11:07pm UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/5 "2012-03-20T23:07:14Z")

</div>

What happens if you try:

```kotlin
cd libraries
mvn install
```

This will then use the released maven plugin and use its kotlin runtime - so not depend on any ant build at all in the root directory?

The build of kotlin/libraries is actually a regular maven project; there’s no magic or special stuff required (unless you use the localKotlin profile to reuse the Ant build - but only do that if you really want to - for example if you’re making local changes to the standard library.

---

<div class="post-metadata">

**Author:** ![frasolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frasolo/32/10364_2.png) [@frasolo](https://discuss.kotlinlang.org/u/frasolo)\
**Post date:** [March 21, 2012, 1:51am UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/6 "2012-03-21T01:51:10Z")

</div>

I've finally figured out what the problem was: it was my local addition of a test case under kotlin/libraries/stdlib/test which had a package declaration beginning with kotlin as in:

package **kotlin**.subpackage

...

This somehow resulted in all these odd compilation errors. Renaming the package to:

package **test**.subpackage

…

fixed the issue once and for all.

We might want to highlight this restriction of not being able to mirror the package structure of production code in tests for stdlib classes.

---

<div class="post-metadata">

**Author:** ![jstrachan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstrachan/32/1559_2.png) [@jstrachan](https://discuss.kotlinlang.org/u/jstrachan)\
**Post date:** [March 21, 2012, 8:08am UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/7 "2012-03-21T08:08:28Z")

</div>

Ah I've hit that bug quite a bit before [http://youtrack.jetbrains.com/issue/KT-1381](http://youtrack.jetbrains.com/issue/KT-1381)

Yes, its painful. Seems that every compile generates a namespace.class which its very easy to hide other namespace.class files generated in other libraries - for example breaking the standard library if you create a class in the kotlin package.

Developers are used to creating test cases in the same package; which doesn’t work right now if that package has top level functions/methods or extension methods.

---

<div class="post-metadata">

**Author:** ![frasolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frasolo/32/10364_2.png) [@frasolo](https://discuss.kotlinlang.org/u/frasolo)\
**Post date:** [March 21, 2012, 8:32am UTC](https://discuss.kotlinlang.org/t/is-this-the-correct-way-to-run-a-full-build-of-kotlin-libraries/1241/8 "2012-03-21T08:32:55Z")

</div>

Thanks James! I've added a link to this thread to illustrate this bug.
