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
240 changes: 90 additions & 150 deletions authenticator/api/authenticator.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.core.text.HtmlCompat
import androidx.core.text.HtmlCompat.FROM_HTML_MODE_COMPACT
import androidx.core.text.toHtml

/**
* Reads an HTML string from resources and turns it into an [AnnotatedString]
Expand Down Expand Up @@ -63,7 +64,7 @@ private fun Context.getText(
vararg formatArgs: Any
): CharSequence {
val resource = SpannedString(getText(id))
val html = HtmlCompat.toHtml(resource, HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE)
val html = resource.toHtml()
val string = String.format(html, *formatArgs)
return HtmlCompat.fromHtml(string, FROM_HTML_MODE_COMPACT)
}
Expand Down
4 changes: 4 additions & 0 deletions build-logic/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ dependencies {

gradlePlugin {
plugins {
register("androidApplication") {
id = "amplify.android.application"
implementationClass = "AndroidApplicationConventionPlugin"
}
register("androidLibrary") {
id = "amplify.android.library"
implementationClass = "AndroidLibraryConventionPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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.
*/

import com.amplify.ui.configureAndroid
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension

/**
* This convention plugin configures an Android library module
*/
class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target.pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.plugin.compose")
apply("org.jetbrains.kotlin.android")
}

with(target) {
extensions.configure<ApplicationExtension> {
target.configureAndroid(this)
defaultConfig {
targetSdk = 34
versionCode = 1
versionName = "1"
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}

tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.apply {
add("-Xlint:all")
add("-Werror")
}
}

tasks.withType<Test>().configureEach {
minHeapSize = "128m"
maxHeapSize = "4g"
}

configure<KotlinProjectExtension> {
jvmToolchain(17)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
* permissions and limitations under the License.
*/

import com.amplify.ui.configureAndroid
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/**
* This convention plugin configures an Android library module
Expand All @@ -34,6 +32,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target.pluginManager) {
apply("com.android.library")
apply("org.jetbrains.kotlin.plugin.compose")
apply("org.jetbrains.kotlin.android")
apply("amplify.android.ktlint")
}
Expand All @@ -43,7 +42,10 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
with(target) {
group = POM_GROUP
extensions.configure<LibraryExtension> {
configureAndroid(this)
target.configureAndroid(this)
defaultConfig {
consumerProguardFiles += rootProject.file("configuration/consumer-rules.pro")
}
}

tasks.withType<JavaCompile>().configureEach {
Expand All @@ -63,61 +65,4 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
}
}
}

private fun Project.configureAndroid(extension: LibraryExtension) {
val sdkVersionName = findProperty("VERSION_NAME") ?: rootProject.findProperty("VERSION_NAME")

if (hasProperty("signingKeyId")) {
println("Getting signing info from protected source.")
extra["signing.keyId"] = findProperty("signingKeyId")
extra["signing.password"] = findProperty("signingPassword")
extra["signing.inMemoryKey"] = findProperty("signingInMemoryKey")
}

extension.apply {
compileSdk = 35

buildFeatures {
buildConfig = true
}

defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments += "clearPackageData" to "true"
consumerProguardFiles += rootProject.file("configuration/consumer-rules.pro")

testOptions {
animationsDisabled = true
unitTests {
isIncludeAndroidResources = true
}
}

buildConfigField("String", "VERSION_NAME", "\"$sdkVersionName\"")
}

lint {
warningsAsErrors = true
abortOnError = true
enable += listOf("UnusedResources")
disable += listOf("GradleDependency", "NewerVersionAvailable", "AndroidGradlePluginVersion")
}

// Needed when running integration tests. The oauth2 library uses relies on two
// dependencies (Apache's httpcore and httpclient), both of which include
// META-INF/DEPENDENCIES. Tried a couple other options to no avail.
packaging {
resources.excludes += setOf("META-INF/DEPENDENCIES", "META-INF/LICENSE*")
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ComponentConventionPlugin : Plugin<Project> {
pluginManager.apply("amplify.android.screenshots")

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + amplifyInternalMarkers.map { "-opt-in=$it" }
compilerOptions {
freeCompilerArgs.addAll(amplifyInternalMarkers.map { "-opt-in=$it" })
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.plugins.signing.SigningExtension
Expand Down Expand Up @@ -128,6 +129,12 @@ class PublishingConventionPlugin : Plugin<Project> {
}

configure<SigningExtension> {
if (hasProperty("signingKeyId")) {
println("Getting signing info from protected source.")
extra["signing.keyId"] = findProperty("signingKeyId")
extra["signing.password"] = findProperty("signingPassword")
extra["signing.inMemoryKey"] = findProperty("signingInMemoryKey")
}
isRequired = isReleaseBuild && gradle.taskGraph.hasTask("publish")
if (hasProperty("signing.inMemoryKey")) {
val signingKey = findProperty("signing.inMemoryKey").toString().replace("\\n", "\n")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.
*/
package com.amplify.ui

import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project

internal fun Project.configureAndroid(extension: CommonExtension<*, *, *, *, *, *>) {
val sdkVersionName = findProperty("VERSION_NAME") ?: rootProject.findProperty("VERSION_NAME")

extension.apply {
compileSdk = 35

buildFeatures {
buildConfig = true
}

defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments += "clearPackageData" to "true"

testOptions {
animationsDisabled = true
unitTests {
isIncludeAndroidResources = true
}
}

buildConfigField("String", "VERSION_NAME", "\"$sdkVersionName\"")
}

lint {
warningsAsErrors = true
abortOnError = true
enable += listOf("UnusedResources")
disable += listOf("GradleDependency", "NewerVersionAvailable", "AndroidGradlePluginVersion")
}

// Needed when running integration tests. The oauth2 library uses relies on two
// dependencies (Apache's httpcore and httpclient), both of which include
// META-INF/DEPENDENCIES. Tried a couple other options to no avail.
packaging {
resources.excludes += setOf("META-INF/DEPENDENCIES", "META-INF/LICENSE*")
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}
}
}
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.binary.compatibility) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.kover)
Expand All @@ -20,7 +21,7 @@ plugins {
}

tasks.register<Delete>("clean").configure {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}

kover {
Expand Down
11 changes: 6 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[versions]
accompanist = "0.28.0"
agp = "8.7.2"
amplify = "2.29.0"
agp = "8.11.1"
amplify = "2.29.2"
appcompat = "1.6.1"
androidx-core = "1.9.0"
androidx-junit = "1.1.4"
androidx-activity = "1.6.1"
androidx-navigation = "2.5.3"
binary-compatibility = "0.14.0"
binary-compatibility = "0.18.1"
cameraX = "1.4.2"
compose-bom = "2025.06.01"
coroutines = "1.7.3"
desugar = "1.2.0"
desugar = "2.1.5"
futures = "1.1.0"
junit = "4.13.2"
kotest = "5.7.1"
kotlin = "1.9.10"
kotlin = "2.2.0"
kover = "0.9.1"
ktlint = "11.0.0"
licensee = "1.7.0"
Expand Down Expand Up @@ -113,6 +113,7 @@ test = [
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
binary-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading