jberkel / android-plugin

An sbt plugin for Android development in Scala
https://groups.google.com/forum/#!forum/scala-on-android
Other
476 stars 113 forks source link

Collision when depending on an external sbt android project #117

Open charroch opened 12 years ago

charroch commented 12 years ago

Create 2 projects:

> g8 jberkel/android-app

Template for Android apps in Scala 

package [my.android.project]: com.novoda.main
name [My Android Project]: Main
main_activity [MainActivity]: 
scala_version [2.9.1]: 
api_level [10]: 
useProguard [true]: false

> g8 jberkel/android-app

Template for Android apps in Scala 

package [my.android.project]: com.novoda.lib
name [My Android Project]: Lib
main_activity [MainActivity]: 
scala_version [2.9.1]: 
api_level [10]: 
useProguard [true]: false

Change build.scala from main project to depend on lib:

lazy val main = Project (
  "Main",
  file("."),
   settings = General.fullAndroidSettings
) dependsOn (uri("file:///tmp/mylib"))

The above will yield a collision:

AttributeKey ID collisions detected for: 'apklib-dependencies' (sbt.Task[scala.collection.Seq[AndroidKeys$LibraryProject]], sbt.Task[scala.collection.Seq[AndroidKeys$LibraryProject]]), 'package-config' (sbt.Task[ApkConfig], sbt.Task[ApkConfig])

The above shows a design issue with the plugin itself where each keys are map to the Config Android. We would need to scope most settings to a per project key (ala 'android') and remove the constant mapping to the android Config scope as defined in the best practice document from sbt.

I ll try to get a pull request as soon as I have couple of hours to spare - or a hackaton as per the origin of this plugin.