| import com.android.tools.internal.testing.DevicePool; |
| |
| apply plugin: 'java' |
| apply plugin: 'kotlin' |
| apply plugin: 'jacoco-tools-base' |
| |
| repositories { |
| maven { url = uri(rootProject.cloneArtifacts.repository) } |
| } |
| |
| dependencies { |
| testCompile project(':base:build-system:integration-test:framework') |
| testCompile project(':analytics-library:protos') |
| testCompile project(':apksig') |
| testCompile project(':base:builder') |
| testCompile project(':base:builder-model') |
| testCompile project(':base:gradle') |
| testCompile project(':base:instant-run:instant-run-client') |
| testCompile project(':base:sdk-common') |
| testCompile project(':base:testing-infrastructure:device-pool:device-provider') |
| testCompile project(':base:testutils') |
| testCompile project(':base:java-lib-model') |
| |
| testCompile libs.kotlin_stdlib |
| |
| testCompile gradleApi() |
| testCompile libs.apache_commons_io |
| testCompile libs.apache_commons_lang |
| testCompile libs.google_api_client |
| testCompile libs.google_storage_client |
| testCompile libs.groovy |
| testCompile libs.junit |
| testCompile libs.protobuf |
| testCompile libs.protobuf_util |
| testCompile libs.truth |
| |
| testCompile libs.mockito_core |
| |
| // Add dependency on plugin code. Exclude transitive dependencies to avoid conflict due to |
| // Groovy versions. |
| testCompile(project(':base:gradle-core')) { |
| transitive = false |
| } |
| testCompile(project(':base:gradle')) { |
| transitive = false |
| } |
| } |
| |
| configurations { |
| // google-api-client depends on guava-jdk5. |
| testCompile.exclude group: 'com.google.guava', module: 'guava-jdk5' |
| } |
| |
| def testEnvironment = |
| /* |
| * We keep the following properties: |
| * - starting with CUSTOM_ e.g. CUSTOM_ANDROID_HOME |
| * - DEBUG_INNER_TEST: to allow us to debug tests |
| * - starting with LC_ or LANG_, so the locale is set up correctly |
| * - BUILDBOT_: to get BuildBot specific information e.g. buildId used for performance tests |
| */ |
| System.getenv().findAll { entry -> |
| String key = entry.key |
| key.startsWith("CUSTOM_") || |
| key.startsWith("ACTD_") || // environment variables for uploading to Dana |
| key.startsWith("PERF_") || // environment variables for controlling perf tests |
| key == "USE_GRADLE_NIGHTLY" || |
| key == "BENCHMARK_EXPERIMENT" || |
| key == "DEBUG_INNER_TEST" || |
| // For NDK tests on Windows. See init.mk. |
| key == "OS" || |
| key == "PROCESSOR_ARCHITECTURE" || |
| key == "ProgramW6432" || |
| key == "ProgramFiles(x86)" || |
| key == "TMP" || |
| key == "TEMP" || |
| // For AccentCharacterAndProguardTest |
| key.startsWith("LC_") || |
| key.startsWith("LANG") || |
| key.startsWith("BUILDBOT_") |
| } |
| |
| testEnvironment << [ |
| TEST_TMPDIR: |
| System.env.TEST_TMPDIR != null |
| ? new File(System.env.TEST_TMPDIR) |
| : project.buildDir, // Use the same environment variable as Bazel for now. |
| CUSTOM_REPO: new File(rootProject.ext.androidHostOut, "repo").toString() |
| + File.pathSeparator |
| + rootProject.file("../prebuilts/tools/common/m2/repository/").toString(), |
| CUSTOM_IMPROVED_DEPENDENCY_RESOLUTION : "true" |
| ] |
| |
| File tempFile = new File(project.buildDir, 'tmp') |
| |
| task("createTestTempDirectory") { |
| doLast { tempFile.mkdirs() } |
| } |
| |
| test { |
| description = |
| "Runs the data binding gradle integration tests" |
| systemProperties['jar.path'] = jar.archivePath |
| systemProperties['java.io.tmpdir'] = tempFile.absolutePath |
| environment = testEnvironment |
| |
| // Always run the task, when requested. |
| outputs.upToDateWhen { false } |
| |
| maxParallelForks = Runtime.runtime.availableProcessors() / 4 |
| |
| testLogging { |
| events = ['FAILED', 'SKIPPED', 'STANDARD_ERROR'] |
| displayGranularity = 2 // Show test class and method. |
| exceptionFormat = 'full' |
| showCauses = true |
| } |
| dependsOn ':publishLocal' , createTestTempDirectory |
| } |