Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ class BuildHealthSubject private constructor(
.containsExactlyEntriesIn(expected.associate { it.projectPath to it.dependencyAdvice })
}

fun containsExactlyDependencyAdviceIn(expected: Map<String, Set<Advice>>): Ordered {
if (actual == null) failWithActual(simpleFact("build health was null"))
return assertThat(actual)
.comparingElementsUsing(DEPENDENCY_EQUIVALENCE)
.containsExactlyElementsIn(pairs(expected))
}

fun isEquivalentIgnoringModuleAdviceAndWarnings(expected: Iterable<ProjectAdvice>) {
if (actual == null) failWithActual(simpleFact("build health was null"))
assertThat(actual)
Expand All @@ -90,16 +83,6 @@ class BuildHealthSubject private constructor(
.containsExactlyElementsIn(expected.map { it.projectPath to it.shouldFail })
}

fun containsExactlyModuleAdviceIn(expected: Iterable<ProjectAdvice>): Ordered {
if (actual == null) failWithActual(simpleFact("build health was null"))
assertThat(actual)
.comparingElementsUsing(SHOULD_FAIL_EQUIVALENCE)
.containsExactlyElementsIn(expected.map { it.projectPath to it.shouldFail })
return assertThat(actual)
.comparingElementsUsing(MODULE_EQUIVALENCE)
.containsExactlyElementsIn(pairs(expected) { it.moduleAdvice })
}

fun containsExactlyModuleAdviceIn(expected: Map<String, Set<ModuleAdvice>>): Ordered {
if (actual == null) failWithActual(simpleFact("build health was null"))
return assertThat(actual)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ class AppModule(
override val variant = "debug"

init {
val agpVersion = "\${com.android.builder.model.Version.ANDROID_GRADLE_PLUGIN_VERSION}"

withBuildFile("""
|${plugins()}
|
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ interface ProjectDirProvider {
.dependencyAdvice
}

fun removeAdviceFor(spec: ModuleSpec): Set<String> {
return removeAdviceFor(spec.name)
}

fun removeAdviceFor(moduleName: String): Set<String> {
return adviceFor(moduleName).asSequence()
.filter { it.isRemove() }
.map { it.coordinates.identifier }
.toSortedSet()
}

fun buildHealthFor(spec: ModuleSpec): Set<ProjectAdvice> = buildHealthFor(spec.name)

fun buildHealthFor(moduleName: String): Set<ProjectAdvice> {
return buildHealthForV2(moduleName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.autonomousapps.fixtures
import com.autonomousapps.kit.AbstractGradleProject
import com.autonomousapps.kit.gradle.dependencies.Plugins
import java.io.File
import java.util.UUID
import java.util.*

// Very similar to what is in AbstractProject
private fun newSlug() = buildString {
Expand Down Expand Up @@ -43,18 +43,17 @@ class RootSpec @JvmOverloads constructor(
override val name: String = ":"

companion object {
// For use from Groovy
@JvmStatic @JvmOverloads fun defaultRootSpec(librarySpecs: List<LibrarySpec>? = null) = RootSpec(librarySpecs)

@JvmStatic fun defaultGradleProperties() = """
@JvmStatic
fun defaultGradleProperties() = """
# Necessary for AGP 3.6+
android.useAndroidX=true

# Try to prevent OOMs (Metaspace) in test daemons spawned by testkit tests
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1024m
""".trimIndent()

@JvmStatic fun defaultSettingsScript(agpVersion: String?, librarySpecs: List<LibrarySpec>?) = """
@JvmStatic
fun defaultSettingsScript(agpVersion: String?, librarySpecs: List<LibrarySpec>?) = """
pluginManagement {
repositories {
maven { url = '${System.getProperty("com.autonomousapps.plugin-under-test.repo")}' }
Expand All @@ -69,7 +68,8 @@ class RootSpec @JvmOverloads constructor(
${librarySpecs?.map { it.name }?.joinToString("\n") { "include(':$it')" } ?: ""}
""".trimIndent()

@JvmStatic fun defaultBuildScript(
@JvmStatic
fun defaultBuildScript(
agpVersion: String?,
extensionSpec: String,
) = """
Expand All @@ -95,18 +95,5 @@ class RootSpec @JvmOverloads constructor(
}
$extensionSpec
""".trimIndent()

@JvmStatic
fun kotlinGradlePlugin(librarySpecs: List<LibrarySpec>?): String {
val anyKotlin = librarySpecs?.any {
it.type == LibraryType.KOTLIN_ANDROID_LIB || it.type == LibraryType.KOTLIN_JVM_LIB
} ?: false

return if (anyKotlin) {
"""classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Plugins.KOTLIN_VERSION}""""
} else {
""
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,11 @@ package com.autonomousapps.fixtures

import com.autonomousapps.kit.gradle.dependencies.Plugins.KOTLIN_VERSION

const val KOTLIN_STDLIB_ID = "org.jetbrains.kotlin:kotlin-stdlib"
val KOTLIN_STDLIB = "$KOTLIN_STDLIB_ID:${KOTLIN_VERSION}"
const val KOTLIN_STDLIB_JDK7_ID = "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
val KOTLIN_STDLIB_JDK7 = "$KOTLIN_STDLIB_JDK7_ID:${KOTLIN_VERSION}"
const val COMMONS_IO_ID = "commons-io:commons-io"
const val COMMONS_IO = "$COMMONS_IO_ID:2.6"
const val COMMONS_TEXT_ID = "org.apache.commons:commons-text"
const val COMMONS_TEXT = "$COMMONS_TEXT_ID:1.8"
const val COMMONS_COLLECTIONS_ID = "org.apache.commons:commons-collections4"
const val COMMONS_COLLECTIONS = "$COMMONS_COLLECTIONS_ID:4.4"
const val COMMONS_LANG3_ID = "org.apache.commons:commons-lang3"
const val COMMONS_LANG3 = "$COMMONS_LANG3_ID:3.9"
const val JETBRAINS_ANNOTATIONS_ID = "org.jetbrains:annotations"
const val JETBRAINS_ANNOTATIONS = "$JETBRAINS_ANNOTATIONS_ID:13.0"

const val APPCOMPAT_ID = "androidx.appcompat:appcompat"
const val APPCOMPAT = "$APPCOMPAT_ID:1.1.0"

// This is also brought in transitively by APPCOMPAT
const val ANDROIDX_ANNOTATIONS_ID = "androidx.annotation:annotation"
const val ANDROIDX_ANNOTATIONS = "$ANDROIDX_ANNOTATIONS_ID:1.1.0"
const val CORE_ID = "androidx.core:core"
const val CORE = "$CORE_ID:1.1.0"
const val CORE_KTX_ID = "androidx.core:core-ktx"
const val CORE_KTX = "$CORE_KTX_ID:1.1.0"
const val CONSTRAINT_LAYOUT_ID = "androidx.constraintlayout:constraintlayout"
Expand All @@ -39,14 +21,7 @@ const val NAV_FRAGMENT_KTX_ID = "androidx.navigation:navigation-fragment-ktx"
const val NAV_FRAGMENT_KTX = "$NAV_FRAGMENT_KTX_ID:2.9.7"
const val NAV_UI_KTX_ID = "androidx.navigation:navigation-ui-ktx"
const val NAV_UI_KTX = "$NAV_UI_KTX_ID:2.9.7"

// Annotation Processors
const val TP_COMPILER_ID = "com.github.stephanenicolas.toothpick:toothpick-compiler"
const val TP_COMPILER = "$TP_COMPILER_ID:3.1.0"

private val DEPENDENCIES_KOTLIN_STDLIB_JDK7 = listOf("implementation" to KOTLIN_STDLIB_JDK7)
val DEPENDENCIES_KOTLIN_STDLIB = listOf("implementation" to KOTLIN_STDLIB)

val DEFAULT_APP_DEPENDENCIES = DEPENDENCIES_KOTLIN_STDLIB_JDK7 + listOf(
"implementation" to APPCOMPAT,
"implementation" to CORE_KTX,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ object Dependencies {
return provider.kotlinStdLib(configuration)
}

@JvmStatic
fun kotlinStdlibJdk8(configuration: String): Dependency {
return provider.kotlinStdlibJdk8(configuration)
}

@JvmStatic
fun kotlinStdlibJdk7(configuration: String): Dependency {
return provider.kotlinStdlibJdk7(configuration)
}

@JvmStatic
fun kotlinTestJunit(configuration: String): Dependency {
return provider.kotlinTestJunit(configuration)
Expand Down Expand Up @@ -91,21 +81,6 @@ object Dependencies {
return provider.kotestAssertions(configuration)
}

@JvmStatic
fun moshi(configuration: String): Dependency {
return provider.moshi(configuration)
}

@JvmStatic
fun moshiKotlin(configuration: String): Dependency {
return provider.moshiKotlin(configuration)
}

@JvmStatic
fun moshiAdapters(configuration: String): Dependency {
return provider.moshiAdapters(configuration)
}

@JvmStatic
fun okio(configuration: String): Dependency {
return provider.okio(configuration)
Expand Down Expand Up @@ -136,11 +111,6 @@ object Dependencies {
return provider.androidxAnnotations(configuration)
}

@JvmStatic
fun composeMultiplatformRuntime(configuration: String): Dependency {
return provider.composeMultiplatformRuntime(configuration)
}

@JvmStatic
fun composeMultiplatformFoundation(configuration: String): Dependency {
return provider.composeMultiplatformFoundation(configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ class DependencyProvider(

private val pluginUnderTestVersion = AbstractGradleProject.PLUGIN_UNDER_TEST_VERSION

/*
* Common configurations. TODO(tsr): add later.
*/

/*
* Frequently-used dependencies.
*/

fun dagp(configurationName: String): Dependency {
return Dependency(
configurationName,
Expand All @@ -38,14 +30,6 @@ class DependencyProvider(
return Dependency(configuration, "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
}

fun kotlinStdlibJdk8(configuration: String): Dependency {
return Dependency(configuration, "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
}

fun kotlinStdlibJdk7(configuration: String): Dependency {
return Dependency(configuration, "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
}

fun kotlinTestJunit(configuration: String): Dependency {
return Dependency(configuration, "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
}
Expand Down Expand Up @@ -86,18 +70,6 @@ class DependencyProvider(
return Dependency(configuration, "io.kotest:kotest-assertions-core:4.6.0")
}

fun moshi(configuration: String): Dependency {
return Dependency(configuration, "com.squareup.moshi:moshi:1.14.0")
}

fun moshiKotlin(configuration: String): Dependency {
return Dependency(configuration, "com.squareup.moshi:moshi-kotlin:1.14.0")
}

fun moshiAdapters(configuration: String): Dependency {
return Dependency(configuration, "com.squareup.moshi:moshi-adapters:1.14.0")
}

fun okio(configuration: String): Dependency {
return Dependency(configuration, "com.squareup.okio:okio:2.6.0")
}
Expand All @@ -122,10 +94,6 @@ class DependencyProvider(
return Dependency(configuration, "androidx.annotation:annotation:1.9.1")
}

fun composeMultiplatformRuntime(configuration: String): Dependency {
return Dependency(configuration, "org.jetbrains.compose.runtime:runtime:1.0.1")
}

fun composeMultiplatformFoundation(configuration: String): Dependency {
return Dependency(configuration, "org.jetbrains.compose.foundation:foundation:1.0.1")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ object Plugins {
kotlinVersion = KOTLIN_VERSION
)

@JvmStatic val buildHealthId: String = provider.buildHealthId
@JvmStatic val buildHealth: Plugin = provider.buildHealth

@JvmStatic val dagpId: String = provider.dagpId
@JvmStatic val dependencyAnalysis: Plugin = provider.dependencyAnalysis
@JvmStatic val dependencyAnalysisNoVersion: Plugin = provider.dependencyAnalysisNoVersion

@JvmStatic val androidAppId: String = provider.androidAppId
@JvmStatic val legacyKaptId: String = provider.androidLegacyKaptId
@JvmStatic val androidApp: Plugin = provider.androidAppNoVersion
@JvmStatic val androidLib: Plugin = provider.androidLibNoVersion
Expand All @@ -32,10 +30,8 @@ object Plugins {

@JvmStatic val kotlinJvm: Plugin = provider.kotlinJvm
@JvmStatic val kotlinJvmNoApply: Plugin = provider.kotlinJvmNoApply
@JvmStatic val kotlinAndroid: Plugin = provider.kotlinAndroid
@JvmStatic val kotlinAndroidNoVersion: Plugin = provider.kotlinAndroidNoVersion
@JvmStatic val kotlinJvmNoVersion: Plugin = provider.kotlinJvmNoVersion
@JvmStatic val kotlinMultiplatformNoApply: Plugin = provider.kotlinMultiplatformNoApply
@JvmStatic val kotlinMultiplatformNoVersion: Plugin = provider.kotlinMultiplatformNoVersion
@JvmStatic val kotlinKaptNoVersion: Plugin = provider.kotlinKaptNoVersion

Expand Down