-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to disable the built-in processor.
This allows us to change the default behavior of some annotations in case it the generated code doesn't provide the desired behavior.
- Loading branch information
Showing
7 changed files
with
124 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...m/amazon/lastmile/kotlin/inject/anvil/KotlinInjectExtensionSymbolProcessorProviderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@file:OptIn(ExperimentalCompilerApi::class) | ||
|
||
package com.amazon.lastmile.kotlin.inject.anvil | ||
|
||
import assertk.assertFailure | ||
import assertk.assertThat | ||
import assertk.assertions.isEqualTo | ||
import assertk.assertions.isInstanceOf | ||
import com.tschuchort.compiletesting.KotlinCompilation.ExitCode.OK | ||
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi | ||
import org.junit.jupiter.api.Test | ||
|
||
class KotlinInjectExtensionSymbolProcessorProviderTest { | ||
|
||
@Test | ||
fun `a processor can be disabled`() { | ||
Compilation() | ||
.configureKotlinInjectAnvilProcessor( | ||
processorOptions = mapOf( | ||
"com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesToProcessor" to | ||
"disabled", | ||
), | ||
) | ||
.compile( | ||
""" | ||
package com.amazon.test | ||
import com.amazon.lastmile.kotlin.inject.anvil.ContributesTo | ||
@ContributesTo | ||
@SingleInAppScope | ||
interface ComponentInterface | ||
""", | ||
) | ||
.run { | ||
assertThat(exitCode).isEqualTo(OK) | ||
|
||
// Throws the error because the generated component cannot be found. | ||
assertFailure { | ||
componentInterface.generatedComponent | ||
}.isInstanceOf<ClassNotFoundException>() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters