def buildDoc()

in multiversion/src/main/scala/multiversion/outputs/ArtifactOutput.scala [187:219]


  def buildDoc(
      o: ArtifactOutput,
      index: ResolutionIndex,
      outputIndex: collection.Map[String, ArtifactOutput]
  ): Doc = {
    // This `ArtifactOutput` may belong to several `DependencyConfig`. We need to create a target
    // corresponding to each of these configurations, to reflect the different resolution contexts.
    val scalaImports = index.configsOf(o.dependency).map { config =>
      val depsRef = index.dependencies
        .getOrElse(config.id, Nil)
        .filterNot(_.repr == o.dependency.repr)
        .iterator
        .map(index.reconciledDependency(_).bazelLabel)
        .flatMap(outputIndex.get)
        .map("_" + _.label)
        .toSeq
        .distinct

      TargetOutput(
        kind = "scala_import",
        "name" -> Docs.literal(o.label + config.suffix),
        "jars" -> Docs.array(o.mavenLabel),
        "deps" -> Docs.array(depsRef: _*),
        "exports" -> Docs.array(depsRef: _*),
        "tags" -> Docs.array(tags(o.dependency): _*),
        "visibility" -> Docs.array("//visibility:public")
      ).toDoc
    }

    val genRuleAndImport = buildGenruleAndImportDoc(o)

    Doc.stack(scalaImports) / genRuleAndImport
  }