Skip to content

Commit

Permalink
Rename group ID
Browse files Browse the repository at this point in the history
Rename the group ID from `com.amazon.*` to `software.amazon.*` to meet the requirements of Amazon's open source policies.
  • Loading branch information
vRallev committed Sep 5, 2024
1 parent 7ef8176 commit adcf710
Show file tree
Hide file tree
Showing 46 changed files with 346 additions and 344 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ nor `RealAuthenticator` are referenced anywhere else.
The project comes with a KSP plugin and a runtime module:
```groovy
dependencies {
kspCommonMainMetadata "com.amazon.lastmile.kotlin.inject.anvil:compiler:$version"
commonMainImplementation "com.amazon.lastmile.kotlin.inject.anvil:runtime:$version"
kspCommonMainMetadata "software.amazon.lastmile.kotlin.inject.anvil:compiler:$version"
commonMainImplementation "software.amazon.lastmile.kotlin.inject.anvil:runtime:$version"
}
```
For details how to setup KSP itself for multiplatform projects see the
Expand Down Expand Up @@ -188,14 +188,14 @@ the built-in processors and create your own. A processor can be disabled through

```groovy
ksp {
arg("com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesBindingProcessor", "disabled")
arg("software.amazon.lastmile.kotlin.inject.anvil.processor.ContributesBindingProcessor", "disabled")
}
```

The key of the option must match the fully qualified name of the symbol processor and the value
must be `disabled`. All other values will keep the processor enabled. All built-in symbol
processors are part of
[this package](compiler/src/main/kotlin/com/amazon/lastmile/kotlin/inject/anvil/processor).
[this package](compiler/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/processor).

## Security

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.amazon.lastmile.kotlin.inject.anvil
package software.amazon.lastmile.kotlin.inject.anvil

import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.processing.SymbolProcessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil
package software.amazon.lastmile.kotlin.inject.anvil

import com.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import com.google.devtools.ksp.getDeclaredFunctions
import com.google.devtools.ksp.getVisibility
import com.google.devtools.ksp.processing.KSPLogger
Expand All @@ -16,6 +15,7 @@ import com.google.devtools.ksp.symbol.KSNode
import com.google.devtools.ksp.symbol.KSType
import com.google.devtools.ksp.symbol.Visibility
import me.tatarka.inject.annotations.Scope
import software.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import kotlin.reflect.KClass

@Suppress("TooManyFunctions")
Expand Down Expand Up @@ -139,7 +139,7 @@ internal interface ContextAware {
}

/**
* Return `com.amazon.Test` into `ComAmazonTest`.
* Return `software.amazon.Test` into `SoftwareAmazonTest`.
*/
val KSClassDeclaration.safeClassName: String
get() = requireQualifiedName()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.amazon.lastmile.kotlin.inject.anvil
package software.amazon.lastmile.kotlin.inject.anvil

import com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesBindingProcessor
import com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesSubcomponentFactoryProcessor
import com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesSubcomponentProcessor
import com.amazon.lastmile.kotlin.inject.anvil.processor.ContributesToProcessor
import com.amazon.lastmile.kotlin.inject.anvil.processor.MergeComponentProcessor
import com.amazon.lastmile.kotlin.inject.anvil.processor.extend.ContributingAnnotationProcessor
import com.google.auto.service.AutoService
import com.google.devtools.ksp.processing.SymbolProcessor
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.processing.SymbolProcessorProvider
import software.amazon.lastmile.kotlin.inject.anvil.processor.ContributesBindingProcessor
import software.amazon.lastmile.kotlin.inject.anvil.processor.ContributesSubcomponentFactoryProcessor
import software.amazon.lastmile.kotlin.inject.anvil.processor.ContributesSubcomponentProcessor
import software.amazon.lastmile.kotlin.inject.anvil.processor.ContributesToProcessor
import software.amazon.lastmile.kotlin.inject.anvil.processor.MergeComponentProcessor
import software.amazon.lastmile.kotlin.inject.anvil.processor.extend.ContributingAnnotationProcessor

/**
* Entry point for KSP to pick up our [SymbolProcessor].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.amazon.lastmile.kotlin.inject.anvil
package software.amazon.lastmile.kotlin.inject.anvil

import com.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.squareup.kotlinpoet.Annotatable
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.ksp.toClassName
import software.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import java.util.Locale

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil.processor
package software.amazon.lastmile.kotlin.inject.anvil.processor

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.ContributesBinding
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import com.amazon.lastmile.kotlin.inject.anvil.decapitalize
import com.google.devtools.ksp.processing.CodeGenerator
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
Expand All @@ -22,6 +17,11 @@ import com.squareup.kotlinpoet.ksp.addOriginatingKSFile
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo
import me.tatarka.inject.annotations.Provides
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.ContributesBinding
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import software.amazon.lastmile.kotlin.inject.anvil.decapitalize

/**
* Generates the code for [ContributesBinding].
Expand All @@ -30,7 +30,7 @@ import me.tatarka.inject.annotations.Provides
* the annotated type. To avoid name clashes the package name of the original interface is encoded
* in the interface name. E.g.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @Inject
* @SingleInAppScope
Expand All @@ -43,7 +43,7 @@ import me.tatarka.inject.annotations.Provides
*
* @SingleInAppScope
* @Origin(ComponentInterface::class)
* interface ComAmazonTestRealAuthenticator {
* interface SoftwareAmazonTestRealAuthenticator {
* @Provides fun provideRealAuthenticatorAuthenticator(
* realAuthenticator: RealAuthenticator
* ): Authenticator = realAuthenticator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil.processor
package software.amazon.lastmile.kotlin.inject.anvil.processor

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import com.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import com.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.isAnnotationPresent
import com.google.devtools.ksp.processing.CodeGenerator
Expand All @@ -21,6 +15,12 @@ import com.squareup.kotlinpoet.ksp.addOriginatingKSFile
import com.squareup.kotlinpoet.ksp.toAnnotationSpec
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import software.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent

/**
* Generates the code for [ContributesSubcomponent.Factory].
Expand All @@ -30,7 +30,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
* interface name. This is very similar to [ContributesTo] with the key differences that there
* are more strict checks and that [Subcomponent] is added as marker.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @ContributesSubcomponent
* @ChildScope
Expand All @@ -49,7 +49,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
* @ParentScope
* @Origin(Subcomponent.Factory::class)
* @Subcomponent
* interface ComAmazonTestSubcomponentFactory : Subcomponent.Factory
* interface SoftwareAmazonTestSubcomponentFactory : Subcomponent.Factory
* ```
*/
@OptIn(KspExperimental::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil.processor
package software.amazon.lastmile.kotlin.inject.anvil.processor

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.MergeComponent
import com.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import com.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.isAnnotationPresent
import com.google.devtools.ksp.processing.CodeGenerator
Expand All @@ -25,6 +19,12 @@ import com.squareup.kotlinpoet.ksp.toTypeName
import com.squareup.kotlinpoet.ksp.writeTo
import me.tatarka.inject.annotations.Component
import me.tatarka.inject.annotations.Provides
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.MergeComponent
import software.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import software.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent

/**
* Generates the code for [ContributesSubcomponent].
Expand All @@ -38,7 +38,7 @@ import me.tatarka.inject.annotations.Provides
* For each factory and contributed subcomponent it then will generate the final component and
* factory, e.g.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @ContributesSubcomponent
* @ChildScope
Expand All @@ -58,7 +58,7 @@ import me.tatarka.inject.annotations.Provides
* ```
* Will generate:
* ```
* package com.amazon.test
* package software.amazon.test
*
* @Component
* @MergeComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil.processor
package software.amazon.lastmile.kotlin.inject.anvil.processor

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import com.google.devtools.ksp.processing.CodeGenerator
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
Expand All @@ -17,6 +13,10 @@ import com.squareup.kotlinpoet.ksp.addOriginatingKSFile
import com.squareup.kotlinpoet.ksp.toAnnotationSpec
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation

/**
* Generates the code for [ContributesTo].
Expand All @@ -25,7 +25,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
* interface. To avoid name clashes the package name of the original interface is encoded in the
* interface name. E.g.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @ContributesTo
* @SingleInAppScope
Expand All @@ -37,7 +37,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
*
* @SingleInAppScope
* @Origin(ComponentInterface::class)
* interface ComAmazonTestComponentInterface : ComponentInterface
* interface SoftwareAmazonTestComponentInterface : ComponentInterface
* ```
*/
internal class ContributesToProcessor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
@file:OptIn(KspExperimental::class)

package com.amazon.lastmile.kotlin.inject.anvil.processor

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.ContributesBinding
import com.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import com.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.MergeComponent
import com.amazon.lastmile.kotlin.inject.anvil.extend.ContributingAnnotation
import com.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent
package software.amazon.lastmile.kotlin.inject.anvil.processor

import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.containingFile
import com.google.devtools.ksp.isAnnotationPresent
Expand All @@ -27,6 +19,14 @@ import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.ksp.toAnnotationSpec
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.ContributesBinding
import software.amazon.lastmile.kotlin.inject.anvil.ContributesSubcomponent
import software.amazon.lastmile.kotlin.inject.anvil.ContributesTo
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.MergeComponent
import software.amazon.lastmile.kotlin.inject.anvil.extend.ContributingAnnotation
import software.amazon.lastmile.kotlin.inject.anvil.internal.Subcomponent

/**
* Generates the code for [MergeComponent].
Expand All @@ -36,7 +36,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
* the same scope. The original kotlin-inject then can extend this generated interface in order
* for kotlin-inject to generate all necessary code. E.g.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @Component
* @MergeComponent
Expand All @@ -45,7 +45,7 @@ import com.squareup.kotlinpoet.ksp.writeTo
* ```
* Will generate:
* ```
* package com.amazon.test
* package software.amazon.test
*
* @SingleInAppScope
* interface TestComponentMerged : MergedSuperTypes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package com.amazon.lastmile.kotlin.inject.anvil.processor.extend
package software.amazon.lastmile.kotlin.inject.anvil.processor.extend

import com.amazon.lastmile.kotlin.inject.anvil.ContextAware
import com.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import com.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import com.amazon.lastmile.kotlin.inject.anvil.decapitalize
import com.amazon.lastmile.kotlin.inject.anvil.extend.ContributingAnnotation
import com.google.devtools.ksp.processing.CodeGenerator
import com.google.devtools.ksp.processing.KSPLogger
import com.google.devtools.ksp.processing.Resolver
Expand All @@ -20,6 +15,11 @@ import com.squareup.kotlinpoet.asClassName
import com.squareup.kotlinpoet.ksp.addOriginatingKSFile
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo
import software.amazon.lastmile.kotlin.inject.anvil.ContextAware
import software.amazon.lastmile.kotlin.inject.anvil.LOOKUP_PACKAGE
import software.amazon.lastmile.kotlin.inject.anvil.addOriginAnnotation
import software.amazon.lastmile.kotlin.inject.anvil.decapitalize
import software.amazon.lastmile.kotlin.inject.anvil.extend.ContributingAnnotation
import kotlin.reflect.KClass

/**
Expand All @@ -29,7 +29,7 @@ import kotlin.reflect.KClass
* class is generated. To avoid name clashes the package name of the original annotation
* class is encoded in the property name, e.g.
* ```
* package com.amazon.test
* package software.amazon.test
*
* @ContributingAnnotation
* annotation class ContributesRenderer
Expand All @@ -39,7 +39,7 @@ import kotlin.reflect.KClass
* package $LOOKUP_PACKAGE
*
* @Origin(ContributesRenderer::class)
* public val comAmazonTestContributesRenderer: KClass<ContributesRenderer>
* public val softwareAmazonTestContributesRenderer: KClass<ContributesRenderer>
* = ContributesRenderer::class
* ```
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@file:OptIn(ExperimentalCompilerApi::class)

package com.amazon.lastmile.kotlin.inject.anvil
package software.amazon.lastmile.kotlin.inject.anvil

import com.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import com.tschuchort.compiletesting.JvmCompilationResult
import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import software.amazon.lastmile.kotlin.inject.anvil.internal.Origin
import java.lang.reflect.Method
import java.lang.reflect.Modifier

internal val JvmCompilationResult.componentInterface: Class<*>
get() = classLoader.loadClass("com.amazon.test.ComponentInterface")
get() = classLoader.loadClass("software.amazon.test.ComponentInterface")

internal val Class<*>.inner: Class<*>
get() = classes.single { it.simpleName == "Inner" }
Expand All @@ -25,7 +25,7 @@ internal val Class<*>.generatedComponent: Class<*>
)

internal val JvmCompilationResult.contributesRenderer: Class<*>
get() = classLoader.loadClass("com.amazon.test.ContributesRenderer")
get() = classLoader.loadClass("software.amazon.test.ContributesRenderer")

internal fun <T : Any> Class<*>.newComponent(): T {
@Suppress("UNCHECKED_CAST")
Expand Down Expand Up @@ -61,7 +61,7 @@ internal val Class<*>.propertyAnnotations: Array<out Annotation>

@Language("kotlin")
internal val otherScopeSource = """
package com.amazon.test
package software.amazon.test
import me.tatarka.inject.annotations.Scope
Expand Down
Loading

0 comments on commit adcf710

Please sign in to comment.