[Gradle, Test] Make utility isTeamCityRun as top-level function
This commit is contained in:
committed by
Space Team
parent
0d2c68664d
commit
cd8843289b
-2
@@ -47,8 +47,6 @@ abstract class BaseGradleIT {
|
||||
open val defaultGradleVersion: GradleVersionRequired
|
||||
get() = GradleVersionRequired.None
|
||||
|
||||
val isTeamCityRun = System.getenv("TEAMCITY_VERSION") != null
|
||||
|
||||
@Before
|
||||
open fun setUp() {
|
||||
// Aapt2 from Android Gradle Plugin 3.2 and below does not handle long paths on Windows.
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.gradle.testbase
|
||||
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import org.jetbrains.kotlin.gradle.util.isTeamCityRun
|
||||
import org.jetbrains.kotlin.test.WithMuteInDatabase
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.Tag
|
||||
@@ -42,7 +43,7 @@ abstract class KGPBaseTest {
|
||||
|
||||
@AfterAll
|
||||
fun checkThatDefaultKonanHasNotBeenCreated() {
|
||||
if (System.getenv("TEAMCITY_VERSION") != null) {
|
||||
if (isTeamCityRun) {
|
||||
val userHomeDir = System.getProperty("user.home")
|
||||
assertDirectoryDoesNotExist(Paths.get("$userHomeDir/.konan"))
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.gradle.testbase
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult
|
||||
import org.jetbrains.kotlin.gradle.util.isTeamCityRun
|
||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import org.jetbrains.kotlin.test.util.convertLineSeparators
|
||||
import org.jetbrains.kotlin.test.util.trimTrailingWhitespacesAndAddNewlineAtEOF
|
||||
@@ -38,7 +39,7 @@ internal fun assertEqualsToFile(expectedFile: File, actualText: String) {
|
||||
val textSanitized: String = actualText.trim().convertLineSeparators().trimTrailingWhitespacesAndAddNewlineAtEOF()
|
||||
|
||||
if (!expectedFile.exists()) {
|
||||
if (KtUsefulTestCase.IS_UNDER_TEAMCITY) {
|
||||
if (isTeamCityRun) {
|
||||
fail("Expected data file $expectedFile did not exist")
|
||||
} else {
|
||||
expectedFile.writeText(textSanitized)
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.testbase
|
||||
|
||||
import org.jetbrains.kotlin.gradle.util.isTeamCityRun
|
||||
import org.junit.jupiter.api.condition.OS
|
||||
import org.junit.jupiter.api.extension.ConditionEvaluationResult
|
||||
import org.junit.jupiter.api.extension.ExecutionCondition
|
||||
@@ -42,7 +43,7 @@ internal class ExecutionOnOsCondition : ExecutionCondition {
|
||||
|
||||
private val logger = LoggerFactory.getLogger(ExecutionOnOsCondition::class.java)
|
||||
|
||||
private val isUnderTeamcity = System.getenv("TEAMCITY_VERSION") != null
|
||||
private val isUnderTeamcity = isTeamCityRun
|
||||
|
||||
private val enabledOnCurrentOs = "Enabled on operating system: ${System.getProperty("os.name")}"
|
||||
private val notSupportedOnCurrentOs = "Test is not supported on operating system: ${System.getProperty("os.name")}"
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.util
|
||||
|
||||
val isTeamCityRun = System.getenv("TEAMCITY_VERSION") != null
|
||||
Reference in New Issue
Block a user