pfn / kotlin-plugin

Build kotlin code using sbt
MIT License
136 stars 35 forks source link

Source files getting compiled multiple times #7

Closed matthewtsmith closed 8 years ago

matthewtsmith commented 8 years ago

I am using this plugin as part of a Play! Framework project. My source root is app. My application contains 53 Kotlin source files. When my application compiles it seems that everything gets compiled twice. Upon starting a build I see the following message: [info] Compiling 106 Kotlin sources Followed by: [warn] Duplicate source root: /Users/matthew/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt

For every kotlin source in my project. Once the compilation completes, it then starts over and compiles everything again.

I tried changing the kotlinSource to app in the build.sbt. When I do that it then outputs Compiling 159 Kotlin sources.

Prior to adding the plugin and using pure Java I did not have this problem. Here is my full output of a single build. Notice about half way through everything seems to start over:

[info] Compiling 106 Kotlin sources [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/VersionValidationAction.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/ConfigurationController.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Attachment.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Configurations.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataCollections.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataSets.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Lists.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Login.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Registration.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Router.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Users.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Configurations.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Portal.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DatabaseExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DateTimeExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/JsonExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/RequestExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Activity.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Application.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/AuthenticationInfo.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Branding.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Button.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Configuration.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ConfigurationVersion.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Connector.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CoreResponseCode.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CustomAttribute.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataElement.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataSet.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Email.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ExternalUserInfo.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Feature.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/FeatureGroup.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/GlobalSetting.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Installation.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ListConfig.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Location.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Menu.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MenuItem.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileSession.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileUser.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Page.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/PasswordRuleSet.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Status.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ApplicationLoader.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ConnectionContext.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Constants.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Devices.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/DiskStorage.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Filters.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/JacksonRawValueModule.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/LoggingFilter.kt [warn] Parameter 'featureID' is never used [warn] Parameter 'featureID' is never used [warn] Parameter 'featureID' is never used [warn] Parameter 'groupID' is never used [warn] Variable 'appAPIKey' is never used [warn] Variable 'bodyJSON' is never used [warn] Parameter 'userID' is never used [warn] Parameter 'version' is never used [warn] Parameter 'menuID' is never used [warn] Parameter 'menuID' is never used [warn] Parameter 'menuID' is never used [warn] Unchecked cast: kotlin.Any! to T [warn] Unchecked cast: kotlin.Any! to T [warn] Variable 'result' is never used [warn] Parameter 'context' is never used [warn] Elvis operator (?:) always returns the left operand of non-nullable type ??? [info] Compiling 1 Scala source to /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/target/scala-2.11/classes... Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js. [info] Compiling 106 Kotlin sources [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/VersionValidationAction.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/ConfigurationController.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Attachment.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Configurations.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataCollections.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataSets.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Lists.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Login.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Registration.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Router.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Users.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Configurations.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Portal.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DatabaseExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DateTimeExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/JsonExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/RequestExtensions.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Activity.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Application.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/AuthenticationInfo.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Branding.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Button.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Configuration.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ConfigurationVersion.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Connector.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CoreResponseCode.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CustomAttribute.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataElement.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataSet.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Email.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ExternalUserInfo.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Feature.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/FeatureGroup.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/GlobalSetting.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Installation.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ListConfig.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Location.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Menu.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MenuItem.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileSession.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileUser.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Page.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/PasswordRuleSet.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Status.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ApplicationLoader.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ConnectionContext.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Constants.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Devices.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/DiskStorage.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Filters.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/JacksonRawValueModule.kt [warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/LoggingFilter.kt [warn] Parameter 'featureID' is never used [warn] Parameter 'featureID' is never used [warn] Parameter 'featureID' is never used [warn] Parameter 'groupID' is never used [warn] Variable 'appAPIKey' is never used [warn] Variable 'bodyJSON' is never used [warn] Parameter 'userID' is never used [warn] Parameter 'version' is never used [warn] Parameter 'menuID' is never used [warn] Parameter 'menuID' is never used [warn] Parameter 'menuID' is never used [warn] Unchecked cast: kotlin.Any! to T [warn] Unchecked cast: kotlin.Any! to T [warn] Variable 'result' is never used [warn] Parameter 'context' is never used [warn] Elvis operator (?:) always returns the left operand of non-nullable type ??? [info] Compiling 1 Scala source to /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/target/scala-2.11/classes... [warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configuration file instead. [info] application - Creating Pool for datasource 'default'

pfn commented 8 years ago

can you reproduce this in and/or provide a minimal test case? there's no reason this should occur, unless play! does something weird.

matthewtsmith commented 8 years ago

Here is a sample project using the Play starter project: https://dl.dropboxusercontent.com/u/1451028/kotlin-play-sample.zip

I converted one source file to Kotlin. Just like in my project, it says its compiling two files. It then recompiles a second time before running.

Another interesting note, it seems that if I remove the 1 Kotlin source file the project does not compile twice. As soon as I add a Kotlin source file back into the project it begins noting the duplicate source root and compiling twice.

pfn commented 8 years ago

I can't compile the starter project

[warn]  module not found: com.typesafe.sbtrc#client-2-11;0.3.1
[warn] ==== local: tried
[warn]   C:\Users\pfnguyen\.ivy2\local\com.typesafe.sbtrc\client-2-11\0.3.1\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/typesafe/sbtrc/client-2-11/0.3.1/client-2-11-0.3.1.pom
[info] Resolving com.typesafe.sbtrc#actor-client-2-11;0.3.1 ...
[warn]  module not found: com.typesafe.sbtrc#actor-client-2-11;0.3.1
[warn] ==== local: tried
[warn]   C:\Users\pfnguyen\.ivy2\local\com.typesafe.sbtrc\actor-client-2-11\0.3.1\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/typesafe/sbtrc/actor-client-2-11/0.3.1/actor-client-2-11-0.3.1.pom
[info] Resolving net.contentobjects.jnotify#jnotify;0.94-play-1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.sbtrc#client-2-11;0.3.1: not found
[warn]  :: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]          com.typesafe.sbtrc:client-2-11:0.3.1
[warn]            +- com.typesafe.play:fork-run-protocol_2.11:2.5.1 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
[warn]            +- com.typesafe.play:fork-run_2.11:2.5.1 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
[warn]            +- play-java:play-java_2.11:1.0-SNAPSHOT
[warn]          com.typesafe.sbtrc:actor-client-2-11:0.3.1
[warn]            +- com.typesafe.play:fork-run_2.11:2.5.1 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
[warn]            +- play-java:play-java_2.11:1.0-SNAPSHOT

the build fails to update before even compiling.