Skip to content

Commit

Permalink
Fix formatting and compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
runningcode committed Oct 23, 2023
1 parent a8d41a6 commit 2ee6103
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 16 deletions.
6 changes: 6 additions & 0 deletions android-library-no-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ android {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

fulladleModuleConfig {
debugApk.set(rootProject.file("dummy_app.apk").path)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,15 @@ class FladlePluginDelegate {
classpath = project.fladleConfig
args =
if (project.hasProperty("dumpShards")) {
listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards")
listOf(
"firebase", "test", "android", "run", "-c",
writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards",
)
} else {
listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath)
listOf(
"firebase", "test", "android", "run", "-c",
writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath,
)
}
if (config.serviceAccountCredentials.isPresent) {
environment(mapOf("GOOGLE_APPLICATION_CREDENTIALS" to config.serviceAccountCredentials.get()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ fun configureModule(
// library modules do not produce an app apk and we'll use the one specified in fulladleModuleConfig block
// we need library modules to specify the app apk to test against, even if it's a dummy one
check(fulladleModuleExtension.debugApk.isPresent && fulladleModuleExtension.debugApk.orNull != null) {
"Library module ${project.path} did not specify a debug apk. Library modules do not generate a debug apk and one needs to be specified in the fulladleModuleConfig block\nThis is a required parameter in FTL which remains unused for library modules under test, and you can use a dummy apk here"
"Library module ${project.path} did not specify a debug apk. Library modules do not" +
"generate a debug apk and one needs to be specified in the fulladleModuleConfig block\n" +
"This is a required parameter in FTL which remains unused for library modules under test," +
"and you can use a dummy apk here"
}
flankGradleExtension.debugApk.set(rootProject.provider { fulladleModuleExtension.debugApk.get() })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ internal class YamlWriter {

if (base.projectId.orNull == null) {
check(base.serviceAccountCredentials.isPresent) {
"ServiceAccountCredentials in fladle extension not set. https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials"
"ServiceAccountCredentials in fladle extension not set." +
"https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials"
}
}
check(base.debugApk.isPresent) { "debugApk must be specified" }
if (!config.sanityRobo.get()) {
val result = config.instrumentationApk.isPresent.toInt() + config.roboScript.hasValue.toInt() + config.roboDirectives.isPresentAndNotEmpty.toInt()
val result =
config.instrumentationApk.isPresent.toInt() + config.roboScript.hasValue.toInt() +
config.roboDirectives.isPresentAndNotEmpty.toInt()

check(result == 1) {
val prefix =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class YamlWriterTest {
fail()
} catch (expected: IllegalStateException) {
assertEquals(
"ServiceAccountCredentials in fladle extension not set. https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials",
"ServiceAccountCredentials in fladle extension not set." +
"https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials",
expected.message,
)
}
Expand Down Expand Up @@ -178,7 +179,7 @@ class YamlWriterTest {
legacy-junit-result: false
full-junit-result: false
output-style: single
""".trimIndent() + '\n', // Dunno why this needs to be here to make the tests pass.
""".trimIndent() + '\n',
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class FlankGradlePluginIntegrationTest {
assertThat(
result.output,
).contains(
"ServiceAccountCredentials in fladle extension not set. https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials",
"ServiceAccountCredentials in fladle extension not set." +
"https://runningcode.github.io/fladle/configuration/#serviceaccountcredentials",
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,8 @@ class FulladlePluginIntegrationTest {

assertThat(result.output).contains("Task :configureFulladle FAILED")
assertThat(result.output).contains(
"Library module :android-library-project did not specify a debug apk. Library modules do not generate a debug apk and one needs to be specified in the fulladleModuleConfig block",
"Library module :android-library-project did not specify a debug apk. Library modules do not " +
"generate a debug apk and one needs to be specified in the fulladleModuleConfig block",
)
assertThat(result.output).contains(
"This is a required parameter in FTL which remains unused for library modules under test, and you can use a dummy apk here",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ private fun baseConfigMessage(option: String) = "Incorrect [base] configuration.
private fun additionalConfigMessage(
option: String,
name: String,
) =
"Incorrect [$name] configuration. [$option] can't be used together with sanityRobo. To configure sanityRobo, add clearPropertiesForSanityRobo() to the [$name] configuration"
) = "Incorrect [$name] configuration. [$option] can't be used together with sanityRobo." +
"To configure sanityRobo, add clearPropertiesForSanityRobo() to the [$name] configuration"

class SanityRoboTest {
@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder

private const val commonScriptPart = """
private const val COMMON_SCRIPT_PART = """
plugins {
id 'com.android.application'
id 'com.osacky.fladle'
Expand Down Expand Up @@ -44,7 +44,7 @@ class SanityWithAutoConfigureTest {
fun `test auto configuration with sanityRobo set (inner config)`() {
testProjectRoot.writeBuildDotGradle(
"""
$commonScriptPart
$COMMON_SCRIPT_PART
fladle {
serviceAccountCredentials = project.layout.projectDirectory.file("flank-gradle-service.json")
Expand Down Expand Up @@ -197,7 +197,7 @@ class SanityWithAutoConfigureTest {
fun `test auto configuration with sanityRobo set (base config)`() {
testProjectRoot.writeBuildDotGradle(
"""
$commonScriptPart
$COMMON_SCRIPT_PART
fladle {
sanityRobo = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class VariantTests {
assertThat(result.output).doesNotContain(":assembleVanillaRelease")
assertThat(result.output).doesNotContain(":assembleChocolate")

// See #60 https://github.com/runningcode/fladle/issues/60
/**
* See #60 https://github.com/runningcode/fladle/issues/60
testProjectRoot.writeEmptyServiceCredential()
val resultPrint = testProjectRoot.gradleRunner()
.withArguments("printYmlVanilla")
Expand Down
6 changes: 6 additions & 0 deletions sample-android-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ android {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

dependencies {
implementation(libs.appcompat)
implementation(libs.navigation.fragment.ktx)
Expand Down
8 changes: 7 additions & 1 deletion sample-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
namespace = "com.osacky.flank.gradle.sample"
namespace = "com.osacky.flank.gradle.sample.kotlin"
compileSdk = 33
defaultConfig {
applicationId = "com.osacky.flank.gradle.sample.kotlin"
Expand All @@ -21,6 +21,12 @@ android {
testOptions.execution = "ANDROIDX_TEST_ORCHESTRATOR"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

fladle {
flankVersion.set("23.10.0")
// Project Id is not needed if serviceAccountCredentials are set.
Expand Down
6 changes: 6 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ android {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

fladle {
async = true
flankVersion = "23.+"
Expand Down

0 comments on commit 2ee6103

Please sign in to comment.