diff --git a/accessibility-statement/build.gradle.kts b/accessibility-statement/build.gradle.kts new file mode 100644 index 000000000..a5330fd72 --- /dev/null +++ b/accessibility-statement/build.gradle.kts @@ -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" +} diff --git a/buildSrc/src/main/kotlin/com/orange/ods/gradle/Dependencies.kt b/buildSrc/src/main/kotlin/com/orange/ods/gradle/Dependencies.kt index bcb3e99a3..e3f15ba7b 100644 --- a/buildSrc/src/main/kotlin/com/orange/ods/gradle/Dependencies.kt +++ b/buildSrc/src/main/kotlin/com/orange/ods/gradle/Dependencies.kt @@ -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}" diff --git a/buildSrc/src/main/kotlin/com/orange/ods/gradle/ProjectExt.kt b/buildSrc/src/main/kotlin/com/orange/ods/gradle/ProjectExt.kt index a9a4da711..deb9101f0 100644 --- a/buildSrc/src/main/kotlin/com/orange/ods/gradle/ProjectExt.kt +++ b/buildSrc/src/main/kotlin/com/orange/ods/gradle/ProjectExt.kt @@ -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 diff --git a/buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt b/buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt index 7fe2267b1..217e6c4c4 100644 --- a/buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt +++ b/buildSrc/src/main/kotlin/com/orange/ods/gradle/Versions.kt @@ -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" diff --git a/buildSrc/src/main/kotlin/maven-central-publish.gradle.kts b/buildSrc/src/main/kotlin/maven-central-publish.gradle.kts index 6d139fcbf..4bbb5f0cb 100644 --- a/buildSrc/src/main/kotlin/maven-central-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/maven-central-publish.gradle.kts @@ -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") @@ -35,7 +36,7 @@ afterEvaluate { create(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 { diff --git a/buildSrc/src/main/kotlin/release.gradle.kts b/buildSrc/src/main/kotlin/release.gradle.kts index 55b792505..dce263596 100644 --- a/buildSrc/src/main/kotlin/release.gradle.kts +++ b/buildSrc/src/main/kotlin/release.gradle.kts @@ -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 @@ -118,18 +120,25 @@ tasks.register("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\")" + ) + } + } } } diff --git a/module-about/build.gradle.kts b/module-about/build.gradle.kts index f9dbb9056..b5d3215d8 100644 --- a/module-about/build.gradle.kts +++ b/module-about/build.gradle.kts @@ -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) diff --git a/settings.gradle.kts b/settings.gradle.kts index 48baad2a3..084691748 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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")