Skip to content

Commit

Permalink
Add kotlin-android, kapt plugins to the TestProjectGenerator.kt (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
sboishtyan authored Oct 1, 2020
1 parent 944ea7d commit e2addaa
Show file tree
Hide file tree
Showing 47 changed files with 569 additions and 390 deletions.
1 change: 0 additions & 1 deletion subprojects/gradle/artifactory-app-backup/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependencies {
implementation(project(":gradle:signer"))
implementation(project(":gradle:android"))
implementation(project(":gradle:upload-cd-build-result"))
implementation(Dependencies.gradle.androidPlugin)

testImplementation(project(":gradle:test-project"))
testImplementation(project(":gradle:artifactory-app-backup-test-fixtures"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.avito.android.plugin.artifactory

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.ciRun
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.http.Mock
import com.avito.test.http.MockDispatcher
import com.avito.test.http.MockWebServerFactory
Expand Down Expand Up @@ -31,6 +31,7 @@ internal class ArtifactoryAppBackupPluginTest {
TestProjectGenerator(
modules = listOf(
AndroidAppModule(
enableKotlinAndroidPlugin = false,
versionCode = "90",
versionName = "10",
name = moduleName,
Expand Down Expand Up @@ -109,6 +110,7 @@ internal class ArtifactoryAppBackupPluginTest {
TestProjectGenerator(
modules = listOf(
AndroidAppModule(
enableKotlinAndroidPlugin = false,
versionCode = "90",
versionName = "10",
name = moduleName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.bitbucket

import com.avito.test.gradle.KotlinModule
import com.avito.test.gradle.module.KotlinModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.commit
import com.avito.test.gradle.file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.avito.android.plugin.build_metrics

import com.avito.git.Git
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.TestResult
import com.avito.test.gradle.gradlew
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.utils.logging.CILogger
import com.google.common.truth.Truth.assertWithMessage
import org.junit.jupiter.api.BeforeEach
Expand All @@ -15,6 +15,9 @@ import org.junit.jupiter.api.TestFactory
import org.junit.jupiter.api.io.TempDir
import java.io.File

private const val rootAppName = "root"
private const val loggerPrefix = "[$rootAppName] statsd:"

class BuildMetricsPluginTest {

private lateinit var tempDir: File
Expand All @@ -26,6 +29,7 @@ class BuildMetricsPluginTest {
fun setup(@TempDir tempDir: File) {
this.tempDir = tempDir
TestProjectGenerator(
name = rootAppName,
plugins = listOf("com.avito.android.build-metrics"),
modules = listOf(
AndroidAppModule(name = "app")
Expand Down Expand Up @@ -162,5 +166,3 @@ class BuildMetricsPluginTest {
}

}

private const val loggerPrefix = "statsd:"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.avito.android.info

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.gradlew
import com.avito.test.gradle.module.AndroidAppModule
import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand All @@ -26,6 +26,7 @@ class BuildPropertiesPluginTest {
modules = listOf(
AndroidAppModule(
"app",
enableKotlinAndroidPlugin = false,
plugins = listOf("com.avito.android.build-properties"),
buildGradleExtra = """
buildProperties {
Expand All @@ -51,6 +52,7 @@ class BuildPropertiesPluginTest {
modules = listOf(
AndroidAppModule(
"app",
enableKotlinAndroidPlugin = false,
plugins = listOf("com.avito.android.build-properties"),
buildGradleExtra = """
buildInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avito.android.plugin.build_param_check

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.gradlew
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.avito.android.plugin.build_param_check.incremental_check

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.gradlew
import com.avito.test.gradle.module.AndroidAppModule
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.io.TempDir
import java.io.File

Expand Down Expand Up @@ -100,7 +99,6 @@ internal class IncrementalKaptTaskTest {
":checkIncrementalKapt",
"-ParchPersistenceVersion=2.2.4",
"-Pkapt.incremental.apt=true",
"-Djava.version=$javaVersion",
"-Djava.runtime.version=$javaVersion",
"-Djava.vendor=Avito",
expectFailure = expectFailure
Expand All @@ -124,7 +122,6 @@ internal class IncrementalKaptTaskTest {
AndroidAppModule(
name = "room-test",
plugins = listOfNotNull(
"kotlin-android",
"kotlin-kapt",
if (applyRoomPlugin) "com.avito.android.room-config" else null
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.ci

import com.avito.test.gradle.KotlinModule
import com.avito.test.gradle.module.KotlinModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.file
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.avito.android.plugin.artifactory.artifactoryPasswordParameterName
import com.avito.android.plugin.artifactory.artifactoryUserParameterName
import com.avito.cd.uploadCdBuildResultTaskName
import com.avito.ci.steps.verifyTaskName
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.file
import com.avito.upload_to_googleplay.deployTaskName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avito.ci

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.TestProjectGenerator
import java.io.File

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.ci.steps

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.file
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avito.ci.steps

import com.avito.plugin.tmsPluginId
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.ciRun
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.ci.steps

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.TestResult
import com.avito.test.gradle.ciRun
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.avito.cd.Providers
import com.avito.cd.uploadCdBuildResultTaskName
import com.avito.ci.runTask
import com.avito.git.Git
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.file
import com.avito.test.http.Mock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.ci.steps

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.file
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private fun provideLogger(project: Project, loggerName: String): CILogger {
)
}.logger
} else {
localBuildLogger(project.gradle.startParameter.logLevel < LogLevel.LIFECYCLE)
localBuildLogger(project.gradle.startParameter.logLevel < LogLevel.LIFECYCLE, loggerName)
}
}

Expand Down Expand Up @@ -96,17 +96,22 @@ private fun defaultCILogger(
)
}

private fun localBuildLogger(debug: Boolean): CILogger {
private fun localBuildLogger(
debug: Boolean,
name: String
): CILogger {

val gradleDebugLogger = if (debug) {
CILoggingHandlerImplementation(
formatter = AppendPrefixFormatter(name),
destination = StdoutDestination
)
} else {
NothingLoggingHandler
}

val stdoutHandler = CILoggingHandlerImplementation(
formatter = AppendPrefixFormatter(name),
destination = StdoutDestination
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.avito.android
import Visibility
import com.avito.android.CodeOwnershipValidationTest.Case.NegativeCase
import com.avito.android.CodeOwnershipValidationTest.Case.PositiveCase
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.ManualTempFolder
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avito.android

import com.avito.test.gradle.KotlinModule
import com.avito.test.gradle.PlatformModule
import com.avito.test.gradle.module.KotlinModule
import com.avito.test.gradle.module.PlatformModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.gradlew
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.avito.impact

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.Module
import com.avito.test.gradle.ParentGradleModule
import com.avito.test.gradle.PlatformModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.TestResult
import com.avito.test.gradle.commit
import com.avito.test.gradle.dir
import com.avito.test.gradle.file
import com.avito.test.gradle.git
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.module.Module
import com.avito.test.gradle.module.ParentGradleModule
import com.avito.test.gradle.module.PlatformModule
import com.avito.test.gradle.mutate
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled
Expand Down Expand Up @@ -134,7 +134,7 @@ class ImpactAnalysisTest {
)
with(projectDir) {
checkoutSourceBranch()
file("app/$KOTLIN_SOURCE_SET/SomeClass.kt").mutate()
file("app/$KOTLIN_SOURCE_SET/com/app/SomeClass.kt").mutate()
}
val result = detectChanges()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.avito.impact

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.TestResult
import com.avito.test.gradle.commit
Expand All @@ -10,6 +8,8 @@ import com.avito.test.gradle.file
import com.avito.test.gradle.git
import com.avito.test.gradle.kotlinClass
import com.avito.test.gradle.module
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.mutate
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -97,7 +97,7 @@ class SourceSetsImpactTest {
fun `change in the implementation main - detects changes in all tests and dependant projects`() {
with(projectDir) {
git("reset --hard")
file("feature/src/main/kotlin/SomeClass.kt").mutate()
file("feature/src/main/kotlin/com/feature/SomeClass.kt").mutate()
}
val result = detectChanges()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.avito.instrumentation.impact.util

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.KotlinModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.append
import com.avito.test.gradle.commit
import com.avito.test.gradle.dir
import com.avito.test.gradle.git
import com.avito.test.gradle.kotlinClass
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.module.KotlinModule
import java.io.File

const val projectToChange = "application"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.avito.instrumentation

import com.avito.instrumentation.configuration.InstrumentationPluginConfiguration.GradleInstrumentationPluginConfiguration.Data
import com.avito.report.model.RunId
import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.ciRun
import com.avito.test.gradle.file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.avito.instrumentation

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.TestResult
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.avito.instrumentation

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.Module
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.module.Module
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.ciRun
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avito.android

import com.avito.test.gradle.AndroidAppModule
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidAppModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.git
import com.avito.test.gradle.gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.avito.android.ModuleType.IMPLEMENTATION
import com.avito.android.ModuleType.TEST_LIB
import com.avito.android.ModuleTypesRules.Case.NegativeCase
import com.avito.android.ModuleTypesRules.Case.PositiveCase
import com.avito.test.gradle.AndroidLibModule
import com.avito.test.gradle.module.AndroidLibModule
import com.avito.test.gradle.ManualTempFolder
import com.avito.test.gradle.TestProjectGenerator
import com.avito.test.gradle.git
Expand Down
Loading

0 comments on commit e2addaa

Please sign in to comment.