diff --git a/annotations/.gitignore b/annotations/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/annotations/.gitignore @@ -0,0 +1 @@ +/build diff --git a/annotations/build.gradle.kts b/annotations/build.gradle.kts new file mode 100644 index 0000000000..0b85f37c56 --- /dev/null +++ b/annotations/build.gradle.kts @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +plugins { + id("com.android.library") + id("kotlin-android") +} + +apply(from = rootProject.file("configuration/checkstyle.gradle")) +apply(from = rootProject.file("configuration/publishing.gradle")) + +group = properties["POM_GROUP"].toString() + +android { + kotlinOptions { + moduleName = "com.amplifyframework.annotations" + } +} + +dependencies { + implementation(dependency.kotlin.stdlib) +} + +afterEvaluate { + // Disables this warning: + // warning: listOf(classfile) MethodParameters attribute + // introduced in version 52.0 class files is ignored in + // version 51.0 class files + // Root project has -Werror, so this warning + // would fail the build, otherwise. + tasks.withType().configureEach { + options.compilerArgs.add("-Xlint:-classfile") + } +} diff --git a/annotations/gradle.properties b/annotations/gradle.properties new file mode 100644 index 0000000000..13ed609b9e --- /dev/null +++ b/annotations/gradle.properties @@ -0,0 +1,4 @@ +POM_ARTIFACT_ID=annotations +POM_NAME=Amplify Framework for Android - Annotations +POM_DESCRIPTION=Amplify Framework for Android - Annotations for AWS Amplify Libraries +POM_PACKAGING=aar diff --git a/annotations/src/main/AndroidManifest.xml b/annotations/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..1f1387a5dc --- /dev/null +++ b/annotations/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/core/src/main/java/com/amplifyframework/core/InternalApiWarning.kt b/annotations/src/main/java/com/amplifyframework/annotations/InternalApiWarning.kt similarity index 91% rename from core/src/main/java/com/amplifyframework/core/InternalApiWarning.kt rename to annotations/src/main/java/com/amplifyframework/annotations/InternalApiWarning.kt index b9b359b726..7beb3eb99b 100644 --- a/core/src/main/java/com/amplifyframework/core/InternalApiWarning.kt +++ b/annotations/src/main/java/com/amplifyframework/annotations/InternalApiWarning.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package com.amplifyframework.core +package com.amplifyframework.annotations /** * API marked with this annotation is internal to Amplify, and it is not intended to be used outside. diff --git a/aws-core/src/main/java/com/amplifyframework/auth/AWSAuthSessionInternal.kt b/aws-core/src/main/java/com/amplifyframework/auth/AWSAuthSessionInternal.kt index f1569fe732..7b98a4c56c 100644 --- a/aws-core/src/main/java/com/amplifyframework/auth/AWSAuthSessionInternal.kt +++ b/aws-core/src/main/java/com/amplifyframework/auth/AWSAuthSessionInternal.kt @@ -14,8 +14,8 @@ */ package com.amplifyframework.auth +import com.amplifyframework.annotations.InternalApiWarning import com.amplifyframework.auth.result.AuthSessionResult -import com.amplifyframework.core.InternalApiWarning @InternalApiWarning open class AWSAuthSessionInternal( diff --git a/aws-core/src/main/java/com/amplifyframework/auth/AuthCredentialsProvider.kt b/aws-core/src/main/java/com/amplifyframework/auth/AuthCredentialsProvider.kt index 52cc8970d2..21657259b9 100644 --- a/aws-core/src/main/java/com/amplifyframework/auth/AuthCredentialsProvider.kt +++ b/aws-core/src/main/java/com/amplifyframework/auth/AuthCredentialsProvider.kt @@ -16,8 +16,8 @@ package com.amplifyframework.auth import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider +import com.amplifyframework.annotations.InternalApiWarning import com.amplifyframework.core.Consumer -import com.amplifyframework.core.InternalApiWarning @InternalApiWarning interface AuthCredentialsProvider : CredentialsProvider { diff --git a/aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/AWSS3StoragePlugin.java b/aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/AWSS3StoragePlugin.java index 0d66ca9ad1..789f9f1563 100644 --- a/aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/AWSS3StoragePlugin.java +++ b/aws-storage-s3/src/main/java/com/amplifyframework/storage/s3/AWSS3StoragePlugin.java @@ -20,10 +20,10 @@ import androidx.annotation.OptIn; import androidx.annotation.VisibleForTesting; +import com.amplifyframework.annotations.InternalApiWarning; import com.amplifyframework.auth.AuthCredentialsProvider; import com.amplifyframework.auth.CognitoCredentialsProvider; import com.amplifyframework.core.Consumer; -import com.amplifyframework.core.InternalApiWarning; import com.amplifyframework.core.NoOpConsumer; import com.amplifyframework.storage.StorageAccessLevel; import com.amplifyframework.storage.StorageException; diff --git a/build.gradle.kts b/build.gradle.kts index 169e948851..c45d5c307e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,7 +65,7 @@ tasks.register("clean").configure { } val optInAnnotations = listOf( - "com.amplifyframework.core.InternalApiWarning" + "com.amplifyframework.annotations.InternalApiWarning" ) subprojects { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 430e738142..769002b24c 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -30,6 +30,7 @@ android { } dependencies { + api(project(":annotations")) implementation(dependency.androidx.v4support) implementation(dependency.androidx.annotation) implementation(dependency.androidx.nav.fragment) diff --git a/settings.gradle.kts b/settings.gradle.kts index fe5ac09150..656a88f06c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -135,6 +135,7 @@ dependencyResolutionManagement { } } +include(":annotations") include(":core") include("aws-core")