Ensure rootProject.name is only set from settings.gradle

I moved this assignment in 0888dfbd05
in order to provide a single source-of-truth for `publish.gradle`,
but as pointed out in Issue: androidx/media#416 this breaks apps that are depending
on our project locally using the instructions we publish. Instead we can
remove the `rootProject.name` check from `publish.gradle`, and check an
explicit boolean value instead to indicate if the root project is 'ours'
(with this boolean only set from `settings.gradle`, so it doesn't get
picked up by apps depending on us locally).

#minor-release

PiperOrigin-RevId: 534459085
This commit is contained in:
ibaker 2023-05-23 17:55:48 +01:00 committed by tonihei
parent 4f0a256cc9
commit 9a79571284
3 changed files with 3 additions and 4 deletions

View File

@ -21,8 +21,6 @@ if (gradle.ext.has('androidxMediaModulePrefix')) {
modulePrefix += gradle.ext.androidxMediaModulePrefix
}
rootProject.name = gradle.ext.androidxMediaProjectName
include modulePrefix + 'lib-common'
project(modulePrefix + 'lib-common').projectDir = new File(rootDir, 'libraries/common')

View File

@ -16,7 +16,7 @@ apply plugin: 'maven-publish'
apply from: "$gradle.ext.androidxMediaSettingsDir/missing_aar_type_workaround.gradle"
afterEvaluate {
if (rootProject.name == gradle.ext.androidxMediaProjectName) {
if (gradle.ext.has('rootProjectIsAndroidXMedia3') && gradle.ext.rootProjectIsAndroidXMedia3) {
publishing {
repositories {
maven {

View File

@ -18,7 +18,8 @@ if (gradle.ext.has('androidxMediaModulePrefix')) {
modulePrefix += gradle.ext.androidxMediaModulePrefix
}
gradle.ext.androidxMediaProjectName = 'androidx.media3'
rootProject.name = 'androidx.media3'
gradle.ext.rootProjectIsAndroidXMedia3 = true
include modulePrefix + 'demo'
project(modulePrefix + 'demo').projectDir = new File(rootDir, 'demos/main')