Skip to content

Commit

Permalink
885 - Accessibility statement dependency is missing when using releas…
Browse files Browse the repository at this point in the history
…ed AARs (#886)
  • Loading branch information
florentmaitre authored Mar 18, 2024
1 parent dfc0edb commit dea1021
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 15 deletions.
43 changes: 43 additions & 0 deletions accessibility-statement/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Software Name: Orange Design System
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

import com.orange.ods.gradle.Dependencies

plugins {
id("library")
}

android {
namespace = "com.orange.accessibilitystatementlibrary"

buildFeatures {
viewBinding = true
dataBinding = true
}

sourceSets {
named("main") {
manifest.srcFile("../vendor/accessibility-statement-lib-android/AccessibilityStatementLibrary/src/main/AndroidManifest.xml")
java.srcDir("../vendor/accessibility-statement-lib-android/AccessibilityStatementLibrary/src/main/java")
res.srcDir("../vendor/accessibility-statement-lib-android/AccessibilityStatementLibrary/src/main/res")
}
}
}

dependencies {
api(Dependencies.constraintLayout)
implementation(Dependencies.coreKtx)
}

mavenCentralPublish {
artifactId = "accessibility-statement"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ object Dependencies {
const val composeUiTooling = "androidx.compose.ui:ui-tooling"
const val composeUiToolingPreview = "androidx.compose.ui:ui-tooling-preview"
const val composeUiViewBinding = "androidx.compose.ui:ui-viewbinding"
const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
const val constraintLayoutCompose = "androidx.constraintlayout:constraintlayout-compose:${Versions.constraintLayoutCompose}"
const val coreKtx = "androidx.core:core-ktx:${Versions.core}"
const val customViewPoolingContainer = "androidx.customview:customview-poolingcontainer:${Versions.customViewPoolingContainer}"
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/com/orange/ods/gradle/ProjectExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,9 @@ fun Project.gitHubApi(action: GitHubApi.() -> Unit) {
val token = Environment.getVariables("GITHUB_TOKEN").first()
GitHubApi(token, "Orange-OpenSource/ods-android").action()
}

val Project.artifactId: String
get() = "ods-$name"

val Project.isPublished: Boolean
get() = extensions.findByType(MavenCentralPublishPluginExtension::class.java)?.enabled == true
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ object Versions {

const val accompanist = "0.34.0"
const val activity = "1.8.2"
const val androidGradlePlugin = "8.2.2"
const val androidGradlePlugin = "8.3.0"
const val appCompat = "1.6.1"
const val browser = "1.8.0"
const val composeBom = "2024.02.02"
const val composeCompiler = "1.5.10"
const val coil = "2.6.0"
const val constraintLayout = "2.1.4"
const val constraintLayoutCompose = "1.0.1"
const val core = "1.12.0"
const val customViewPoolingContainer = "1.0.0"
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/maven-central-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.orange.ods.gradle.Environment
import com.orange.ods.gradle.MavenCentralPublishPluginExtension
import com.orange.ods.gradle.artifactId

plugins {
id("com.android.library")
Expand All @@ -35,7 +36,7 @@ afterEvaluate {
create<MavenPublication>(MavenCentralPublishPluginExtension.VARIANT) {
from(components["release"])
groupId = "com.orange.ods.android"
artifactId = pluginExtension?.artifactId ?: "ods-${project.name}"
artifactId = pluginExtension?.artifactId ?: project.artifactId
this.version = version

pom {
Expand Down
23 changes: 16 additions & 7 deletions buildSrc/src/main/kotlin/release.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
* Software description: Android library of reusable graphical components
*/

import com.orange.ods.gradle.artifactId
import com.orange.ods.gradle.execute
import com.orange.ods.gradle.findTypedProperty
import com.orange.ods.gradle.isPublished
import java.text.SimpleDateFormat
import java.util.Date

Expand Down Expand Up @@ -118,18 +120,25 @@ tasks.register<DefaultTask>("testSonatypeRepository") {
throw GradleException("Please set the \"sonatypeRepositoryId\" project property.")
}

// Add Sonatype Maven repository
// Add Sonatype Maven repository in root build.gradle.kts file
File("build.gradle.kts").replace("(\\s*)mavenCentral\\(\\)".toRegex()) { matchResult ->
val indent = matchResult.groupValues[1]
"${matchResult.value}${indent}maven(url = \"https://oss.sonatype.org/content/repositories/comorange-$sonatypeRepositoryId\")"
}

// Replace project dependencies with module dependencies in app
File("app/build.gradle.kts").replace("implementation\\(project\\(\":(.*)\"\\)\\)".toRegex()) { matchResult ->
"implementation(\"com.orange.ods.android:ods-${matchResult.groupValues[1]}:$version\")"
}
val publishedSubprojects = rootProject.subprojects.filter { it.isPublished }
val nonPublishedSubprojects = rootProject.subprojects.filter { !it.isPublished }
publishedSubprojects.forEach { publishedSubproject ->
// Remove published Android Studio modules from settings.gradle.kts
File("settings.gradle.kts").replace("include\\(\":${publishedSubproject.name}\"\\)(\\n)?".toRegex(), "")

// Remove all Android Studio modules except app
File("settings.gradle.kts").replace("(include\\(.*\\)(\\n)?)+".toRegex(), "include(\":app\")\n")
// Replace project dependencies with artifact dependencies in build.gradle.kts files of non published modules
nonPublishedSubprojects.forEach { nonPublishedSubproject ->
File("${nonPublishedSubproject.name}/build.gradle.kts").replace(
"implementation\\(project\\(\":${publishedSubproject.name}\"\\)\\)".toRegex(),
"implementation(\"com.orange.ods.android:${publishedSubproject.artifactId}:$version\")"
)
}
}
}
}
2 changes: 1 addition & 1 deletion module-about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
}

dependencies {
implementation(project(":accessibility-statement-lib-android"))
implementation(project(":accessibility-statement"))
implementation(project(":lib"))
implementation(Dependencies.appCompat)
implementation(Dependencies.browser)
Expand Down
9 changes: 4 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@

rootProject.name = "Orange Design System Android"

include(":accessibility-statement")
include(":app")
include(":composable-processor")
include(":lib")
include(":lib-xml")
include(":theme-orange")
include(":theme-innovation-cup")
include(":theme-contract")
include(":module-about")
include(":accessibility-statement-lib-android")
project(":accessibility-statement-lib-android").projectDir = File("vendor/accessibility-statement-lib-android/AccessibilityStatementLibrary")
include(":theme-contract")
include(":theme-innovation-cup")
include(":theme-orange")

0 comments on commit dea1021

Please sign in to comment.