How can I extract the organization for each of my Projects in my build?

8 views
Skip to first unread message

Kalman Bekesi

unread,
Aug 26, 2013, 5:03:21 AM8/26/13
to simple-b...@googlegroups.com
Hi, I'm trying to extract the organization and version for all my Projects in a plugin.

When I do the following for label == "version" it works. However when trying to get the organization for each Project it returns the name of the master project.
Any idea's how I can get the org for each project?

  val myKey = TaskKey[Unit]("myKey")
  val mySettings = Seq[Setting[_]](
    myKey <<= (loadedBuild, buildStructure, state) map {
      (level, structure, state) ⇒

        for {
          ref ← structure.allProjectRefs // ProjectRef
          project ← Project.getProject(ref, structure) // ResolvedProject
        } yield {
          project.settings foreach { setting ⇒
            val label = setting.key.key.label
            if (label == "organization") {
              val value = Project.extract(state).getOpt(SettingKey(setting.key.key))
              value match {
                case Some(a) ⇒ println(a) // Not working - just getting name of parent project
                case None    ⇒ "oh no"
              }
            }
          }
        }
Reply all
Reply to author
Forward
0 new messages