From 067148057b690834acb794704385ca654070fa16 Mon Sep 17 00:00:00 2001 From: Pawel Pasterz Date: Fri, 25 Sep 2020 12:45:23 +0200 Subject: [PATCH] Remove gradle properties --- .../flank/gradle/FladlePluginDelegate.kt | 2 - .../gradle/integration/SanityRoboCheck.kt | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt b/buildSrc/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt index 173ffedc..87e3cfee 100644 --- a/buildSrc/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt +++ b/buildSrc/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt @@ -40,8 +40,6 @@ class FladlePluginDelegate { // Must be done afterEvaluate otherwise extension values will not be set. project.dependencies.add(FLADLE_CONFIG, "${base.flankCoordinates.get()}:${base.flankVersion.get()}") - if (project.hasProperty("sanityRobo")) base.sanityRobo.set(true) - // Only use automatic apk path detection for 'com.android.application' projects. project.pluginManager.withPlugin("com.android.application") { if (!base.debugApk.isPresent || !base.instrumentationApk.isPresent) { diff --git a/buildSrc/src/test/java/com/osacky/flank/gradle/integration/SanityRoboCheck.kt b/buildSrc/src/test/java/com/osacky/flank/gradle/integration/SanityRoboCheck.kt index 6de4c1b9..eff6e8c1 100644 --- a/buildSrc/src/test/java/com/osacky/flank/gradle/integration/SanityRoboCheck.kt +++ b/buildSrc/src/test/java/com/osacky/flank/gradle/integration/SanityRoboCheck.kt @@ -24,6 +24,58 @@ class SanityRoboCheck { |} | |fladle { + | sanityRobo = project.hasProperty('sanityRobo') + | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") + | debugApk = "foo.apk" + |} + """ + ) + + val result = gradleRun( + arguments = listOf("printYml", "-PsanityRobo"), + projectDir = testProjectRoot.root + ) + + assertThat(result.output).contains("SUCCESS") + assertThat(result.output).contains( + """ + |gcloud: + | app: foo.apk + | device: + | - model: NexusLowRes + | version: 28 + | + | use-orchestrator: false + | auto-google-login: false + | record-video: true + | performance-metrics: true + | timeout: 15m + | num-flaky-test-attempts: 0 + | + |flank: + | keep-file-path: false + | ignore-failed-tests: false + | disable-sharding: false + | smart-flank-disable-upload: false + | legacy-junit-result: false + | full-junit-result: false + | output-style: single + """.trimMargin() + ) + } + + @Test + fun checkSanityRoboRunWithProjectPropertySetAsExtensionProperty() { + makeGradleFile( + where = testProjectRoot, + buildScript = + """ + |plugins { + | id "com.osacky.fladle" + |} + | + |fladle { + | sanityRobo = true | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") | debugApk = "foo.apk" |} @@ -74,6 +126,7 @@ class SanityRoboCheck { |} | |fladle { + | sanityRobo = project.hasProperty('sanityRobo') | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") | debugApk = "foo.apk" | instrumentationApk = "test.apk" @@ -130,6 +183,7 @@ class SanityRoboCheck { |} | |fladle { + | sanityRobo = project.hasProperty('sanityRobo') | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") | debugApk = "foo.apk" | instrumentationApk = "test.apk" @@ -227,6 +281,7 @@ class SanityRoboCheck { |} | |fladle { + | sanityRobo = project.hasProperty('sanityRobo') | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") | debugApk = "foo.apk" | roboScript = "some/path/script.json" @@ -278,6 +333,7 @@ class SanityRoboCheck { |} | |fladle { + | sanityRobo = project.hasProperty('sanityRobo') | serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json") | debugApk = "foo.apk" | roboDirectives = [