fun add()

in plugins/src/main/java/com/google/gradle/tasks/WarnAboutApiChangesTask.kt [55:86]


  fun add() {
    val diff = LinesChanged.fromFile(changesFile.asFile.get())

    val added = spoiler("APIs Added", diff.added.joinToString("\n\n") { it.trim() })
    val removed = spoiler("APIs Removed", diff.removed.joinToString("\n\n") { it.trim() })

    val message =
      when (diff.bump) {
        MAJOR ->
          """
                |You've removed things from the public API. This means your change will cause a
                |**major** version bump during release time. If you're okay with this, you can ignore
                |this message.
                | 
                |${removed.takeUnless { diff.removed.isEmpty() }.orEmpty()}
                |${added.takeUnless { diff.added.isEmpty() }.orEmpty()}
            """
            .trimMargin()
        MINOR ->
          """
                |You've added things to the public API. This means your change will cause a
                |**minor** version bump during release time. If you're okay with this, you can ignore
                |this message.
                | 
                |${added.takeUnless { diff.added.isEmpty() }.orEmpty()}
            """
            .trimMargin()
        else -> throw SkipTask("No public api changes found")
      }

    outputFile.asFile.get().writeText(message)
  }