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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Dependency Analysis Plugin Changelog

# Version 3.12.1
* [fix]: don't suggest non-existent Android unit test variant in advice.

# Version 3.12.0
* [feat]: exceptions are special. Exceptions get verified early by the JVM and so if a dependency is missing an
exception's type from the runtime classpath, that can cause failures in the consumer at runtime.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.parallel=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

VERSION=3.12.1-SNAPSHOT
VERSION=3.12.2-SNAPSHOT

# https://kotlinlang.org/docs/gradle-configure-project.html#dependency-on-the-standard-library
kotlin.stdlib.default.dependency=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.autonomousapps.kit.gradle.Dependency
import com.autonomousapps.kit.gradle.GradleProperties
import com.autonomousapps.kit.gradle.Plugin
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice
import com.autonomousapps.utils.DebugAware

Expand Down Expand Up @@ -67,6 +68,7 @@ abstract class AbstractVariantProject extends AbstractAndroidProject {
a.withBuildScript { bs ->
bs.plugins(appliedPlugins)
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies = dependencies
}
}.write()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.ProjectAdvice

Expand All @@ -30,15 +31,15 @@ final class AndroidTestSmokeProject extends AbstractAndroidProject {

private GradleProject build() {
return newAndroidGradleProjectBuilder(agpVersion)
.withAndroidSubproject('app') { subproject ->
subproject.sources = appSources()
subproject.styles = AndroidStyleRes.DEFAULT
subproject.colors = AndroidColorRes.DEFAULT

subproject.withBuildScript { buildScript ->
buildScript.plugins(androidApp())
buildScript.android = defaultAndroidAppBlock()
buildScript.dependencies(
.withAndroidSubproject('app') { app ->
app.sources = appSources()
app.styles = AndroidStyleRes.DEFAULT
app.colors = AndroidColorRes.DEFAULT
app.withBuildScript { bs ->
bs.plugins(androidApp())
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
kotlinStdLib('implementation'),
appcompat('implementation'),
junit('implementation'),
Expand All @@ -49,11 +50,11 @@ final class AndroidTestSmokeProject extends AbstractAndroidProject {
.withAndroidSubproject('benchmark') { test ->
test.sources = androidBenchmarkSources
test.manifest = null

test.withBuildScript { buildScript ->
buildScript.plugins(androidTest())
buildScript.android = defaultAndroidTestBlock(':app', true)
buildScript.dependencies(okHttp)
test.withBuildScript { bs ->
bs.plugins(androidTest())
bs.android = defaultAndroidTestBlock(':app', true)
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(okHttp)
}
}
.write()
Expand Down Expand Up @@ -85,9 +86,7 @@ final class AndroidTestSmokeProject extends AbstractAndroidProject {
class Lib {
val buffer = Buffer()
}'''.stripIndent()
)
.withPath('com.example', 'Lib')
.build()
).build()
]

Set<ProjectAdvice> actualBuildHealth() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.ProjectAdvice

Expand Down Expand Up @@ -43,6 +44,7 @@ final class AndroidThreeTenProject extends AbstractAndroidProject {
s.withBuildScript { bs ->
bs.plugins = androidApp(true)
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies = [
kotlinStdLib('implementation'),
appcompat('implementation'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.autonomousapps.kit.Source
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -32,6 +33,7 @@ final class ConstantsProject extends AbstractAndroidProject {
app.withBuildScript { bs ->
bs.plugins = androidApp()
bs.android = defaultAndroidAppBlock(true, 'com.example.app')
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
implementation(':lib'),
implementation(':lib2'),
Expand All @@ -49,6 +51,7 @@ final class ConstantsProject extends AbstractAndroidProject {
lib.withBuildScript { bs ->
bs.plugins(androidLib())
bs.android = defaultAndroidLibBlock(true, 'mutual.aid.lib')
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(kotlinStdLib('implementation'))
}
lib.sources = libSource
Expand All @@ -57,6 +60,7 @@ final class ConstantsProject extends AbstractAndroidProject {
lib.withBuildScript { bs ->
bs.plugins(androidLib())
bs.android = defaultAndroidLibBlock(true, 'mutual.aid.lib2')
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(kotlinStdLib('implementation'))
}
lib.sources = lib2Source
Expand All @@ -65,6 +69,7 @@ final class ConstantsProject extends AbstractAndroidProject {
lib.withBuildScript { bs ->
bs.plugins(androidLib())
bs.android = defaultAndroidLibBlock(true, 'mutual.aid.libstar')
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(kotlinStdLib('implementation'))
}
lib.sources = libstarSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.autonomousapps.kit.GradleProject
import com.autonomousapps.kit.Source
import com.autonomousapps.kit.SourceType
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.ProjectAdvice

Expand Down Expand Up @@ -39,6 +40,7 @@ final class DaggerProject extends AbstractAndroidProject {
s.sources = sources
s.withBuildScript { bs ->
bs.android = defaultAndroidLibBlock(true)
bs.kotlin = Kotlin.DEFAULT
bs.plugins(androidLib() + kapt())
bs.dependencies = [
javaxInject('api'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.autonomousapps.kit.Source
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -30,9 +31,8 @@ final class DataBindingProject extends AbstractAndroidProject {
app.withBuildScript { bs ->
bs.plugins = androidApp()
bs.android = defaultAndroidAppBlock(true, 'com.example.app')
bs.dependencies(
appcompat('implementation'),
)
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(appcompat('implementation'))
bs.withGroovy('android.buildFeatures.dataBinding true')
}
app.sources = appSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.autonomousapps.kit.SourceType
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -31,6 +32,7 @@ final class DataBindingWithExpressionsProject extends AbstractAndroidProject {
app.withBuildScript { bs ->
bs.plugins(androidApp(true))
bs.android = defaultAndroidAppBlock(true, 'com.example.app')
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(appcompat("implementation"))
bs.withGroovy('android.buildFeatures.dataBinding true')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package com.autonomousapps.android.projects
import com.autonomousapps.kit.GradleProject
import com.autonomousapps.kit.Source
import com.autonomousapps.kit.gradle.GradleProperties
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.GradleVariantIdentification
import com.autonomousapps.model.ProjectAdvice
Expand Down Expand Up @@ -43,6 +44,7 @@ final class DebugUsageProject extends AbstractAndroidProject {
p.withBuildScript { bs ->
bs.plugins = androidLib(true)
bs.android = defaultAndroidLibBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
kotlinStdLib,
junit('testImplementation'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.autonomousapps.android.projects

import com.autonomousapps.kit.GradleProject
import com.autonomousapps.kit.Source
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -30,6 +31,7 @@ final class HasJavaAndKotlinProject extends AbstractAndroidProject {
a.withBuildScript { bs ->
bs.plugins = androidLib(true)
bs.android = defaultAndroidLibBlock(true)
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
// Used by Kotlin class
commonsCollections('api'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.autonomousapps.kit.GradleProject
import com.autonomousapps.kit.Source
import com.autonomousapps.kit.SourceType
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -27,8 +28,9 @@ final class KmpAndroidProject extends AbstractAndroidProject {
app.manifest = AndroidManifest.simpleApp()
app.sources = sourcesConsumer
app.withBuildScript { bs ->
bs.android = defaultAndroidAppBlock()
bs.plugins = androidApp(true)
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies = [
// The artifact that is actually used is foundation-android
implementation('androidx.compose.foundation:foundation:1.6.0-alpha06')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import com.autonomousapps.kit.GradleProject
import com.autonomousapps.kit.Source
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.Dependency
import com.autonomousapps.kit.gradle.dependencies.Plugins
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.*
import static com.autonomousapps.kit.gradle.Dependency.debugImplementation
import static com.autonomousapps.kit.gradle.dependencies.Dependencies.appcompat
import static com.autonomousapps.kit.gradle.dependencies.Dependencies.kotlinStdLib

Expand All @@ -30,18 +30,18 @@ final class LeakCanaryProject extends AbstractAndroidProject {

private GradleProject build() {
return newAndroidGradleProjectBuilder(agpVersion)
.withAndroidSubproject('app') { subproject ->
subproject.sources = appSources()
subproject.styles = AndroidStyleRes.DEFAULT
subproject.colors = AndroidColorRes.DEFAULT

subproject.withBuildScript { buildScript ->
buildScript.plugins(androidApp())
buildScript.android = defaultAndroidAppBlock()
buildScript.dependencies(
.withAndroidSubproject('app') { app ->
app.sources = appSources()
app.styles = AndroidStyleRes.DEFAULT
app.colors = AndroidColorRes.DEFAULT
app.withBuildScript { bs ->
bs.plugins(androidApp())
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
kotlinStdLib('implementation'),
appcompat('implementation'),
new Dependency('debugImplementation', "com.squareup.leakcanary:leakcanary-android:$LEAK_CANARY_VERSION"),
debugImplementation("com.squareup.leakcanary:leakcanary-android:$LEAK_CANARY_VERSION"),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.autonomousapps.kit.SourceType
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand Down Expand Up @@ -38,6 +39,7 @@ final class ResProject extends AbstractAndroidProject {
app.withBuildScript { bs ->
bs.plugins(androidApp())
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(
project('implementation', ':lib'),
project('implementation', ':lib2'),
Expand All @@ -49,15 +51,15 @@ final class ResProject extends AbstractAndroidProject {
app.styles = AndroidStyleRes.DEFAULT
app.colors = AndroidColorRes.DEFAULT
app.withFile('src/main/res/layout/message_layout.xml', '''\
<?xml version="1.0" encoding="utf-8"?>
<com.example.app.MessageLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/message_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">

</com.example.app.MessageLayout>'''.stripIndent()
<?xml version="1.0" encoding="utf-8"?>
<com.example.app.MessageLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/message_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.example.app.MessageLayout>'''.stripIndent()
)
}
.withAndroidLibProject('lib') { lib ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidLayout
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.Dependency
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.Advice
import com.autonomousapps.model.ProjectAdvice

Expand All @@ -35,14 +36,15 @@ final class ServiceLoaderProject extends AbstractAndroidProject {
@SuppressWarnings('DuplicatedCode')
private GradleProject build() {
return newAndroidGradleProjectBuilder(agpVersion)
.withAndroidSubproject('app') { a ->
a.sources = sources
a.styles = AndroidStyleRes.DEFAULT
a.colors = AndroidColorRes.DEFAULT
a.layouts = layouts
a.withBuildScript { bs ->
.withAndroidSubproject('app') { app ->
app.sources = sources
app.styles = AndroidStyleRes.DEFAULT
app.colors = AndroidColorRes.DEFAULT
app.layouts = layouts
app.withBuildScript { bs ->
bs.plugins = androidApp(true)
bs.android = defaultAndroidAppBlock()
bs.kotlin = Kotlin.DEFAULT
bs.dependencies = dependencies
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.autonomousapps.kit.Source
import com.autonomousapps.kit.android.AndroidColorRes
import com.autonomousapps.kit.android.AndroidManifest
import com.autonomousapps.kit.android.AndroidStyleRes
import com.autonomousapps.kit.gradle.kotlin.Kotlin
import com.autonomousapps.model.ProjectAdvice

import static com.autonomousapps.AdviceHelper.actualProjectAdvice
Expand All @@ -30,9 +31,8 @@ final class ViewBindingProject extends AbstractAndroidProject {
app.withBuildScript { bs ->
bs.plugins = androidApp()
bs.android = defaultAndroidAppBlock(true, 'com.example.app')
bs.dependencies(
appcompat('implementation'),
)
bs.kotlin = Kotlin.DEFAULT
bs.dependencies(appcompat('implementation'))
bs.withGroovy('android.buildFeatures.viewBinding true')
}
app.sources = appSource
Expand Down