I've written a detector that errors when the legacy project dependency syntax is used in a Gradle build script, favoring the typesafe accessor syntax, i.e.,:
instead of
```
implementation project(":foo:bar")
```
use:
```
implementation projects.foo.bar
```
but I can't get the following test set up properly:
```
@Test
fun `legacy project path syntax detects error`() {
lint()
.files(
gradle(
"""
apply plugin: 'com.android.library'
dependencies {
implementation project(":foo:bar")
}
"""
).indented()
)
.issues(GradleProjectPathDetector.LEGACY_PROJECT_PATH_SYNTAX)
.run()
.expect("") // left blank, so that a test failure will inform what to paste here
.expectFixDiffs("") // ditto
}
```
I tried adding a settings.gradle to declare 2 modules and an empty foo/bar/build.gradle to appease the test run, but that didn't work.
I also stepped through
GradleModelMocker and its
associated test, but looks like there's either no support for this at the moment, or I'm just missing something.