All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jetbrains.pluginverifier.output.OutputOptions.kt Maven / Gradle / Ivy

Go to download

Command-line interface for JetBrains Plugin Verifier with set of high-level tasks for plugin and IDE validation

There is a newer version: 1.379
Show newest version
/*
 * Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 */

package com.jetbrains.pluginverifier.output

import com.jetbrains.plugin.structure.base.utils.replaceInvalidFileNameCharacters
import com.jetbrains.pluginverifier.PluginVerificationTarget
import com.jetbrains.pluginverifier.output.teamcity.TeamCityHistory
import com.jetbrains.pluginverifier.output.teamcity.TeamCityLog
import com.jetbrains.pluginverifier.output.teamcity.TeamCityResultPrinter
import java.nio.file.Path

data class OutputOptions(
  private val verificationReportsDirectory: Path,
  val teamCityLog: TeamCityLog?,
  val teamCityGroupType: TeamCityResultPrinter.GroupBy,
  val previousTcHistory: TeamCityHistory?,
  val outputFormats: List = DEFAULT_OUTPUT_FORMATS
) {

  fun getTargetReportDirectory(verificationTarget: PluginVerificationTarget): Path = when (verificationTarget) {
    is PluginVerificationTarget.IDE -> verificationReportsDirectory
      .resolve(verificationTarget.ideVersion.asString().replaceInvalidFileNameCharacters())

    is PluginVerificationTarget.Plugin -> verificationReportsDirectory
      .resolve("${verificationTarget.plugin.pluginId} ${verificationTarget.plugin.version}".replaceInvalidFileNameCharacters())
  }

  fun postProcessTeamCityTests(newTcHistory: TeamCityHistory) {
    if (teamCityLog != null) {
      newTcHistory.writeToFile(verificationReportsDirectory.resolve("tc-tests.json"))
      if (previousTcHistory != null) {
        newTcHistory.reportOldSkippedTestsSuccessful(previousTcHistory, teamCityLog)
      }
    }
  }

}

fun OutputOptions.usePlainOutput() = this.outputFormats.contains(OutputFormat.PLAIN)
fun OutputOptions.useHtml() = this.outputFormats.contains(OutputFormat.HTML)
fun OutputOptions.useMarkdown() = this.outputFormats.contains(OutputFormat.MARKDOWN)





© 2015 - 2024 Weber Informatics LLC | Privacy Policy