From 1c18eae18edfdd6e558cfa31b0774d13038691e9 Mon Sep 17 00:00:00 2001 From: yschimke Date: Thu, 3 Nov 2022 18:08:03 +0000 Subject: [PATCH] Disable publishing block when media3 included in another build. From https://github.com/androidx/media/pull/127/files PiperOrigin-RevId: 485921271 (cherry picked from commit 48aac9ba90344d960214c2d0364a68c0d74e109e) --- RELEASENOTES.md | 2 ++ publish.gradle | 74 +++++++++++++++++++++++++------------------------ settings.gradle | 2 ++ 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8924c6571d..a4a54914ff 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -30,6 +30,8 @@ Release notes ([#10684](https://github.com/google/ExoPlayer/issues/10684)). * Add `Player.getVideoSurfaceSize` that returns the size of the surface on which the video is rendered. +* Build: + * Avoid publishing block when included in another gradle build. * Downloads: * Fix potential infinite loop in `ProgressiveDownloader` caused by simultaneous download and playback with the same `PriorityTaskManager` diff --git a/publish.gradle b/publish.gradle index 2bb21b92bb..6b2b0fcd76 100644 --- a/publish.gradle +++ b/publish.gradle @@ -16,45 +16,47 @@ apply plugin: 'maven-publish' apply from: "$gradle.ext.androidxMediaSettingsDir/missing_aar_type_workaround.gradle" afterEvaluate { - publishing { - repositories { - maven { - url = findProperty('mavenRepo') ?: "${buildDir}/repo" + if (rootProject.name == "media3") { + publishing { + repositories { + maven { + url = findProperty('mavenRepo') ?: "${buildDir}/repo" + } } - } - publications { - release(MavenPublication) { - from components.release - artifact androidSourcesJar - groupId = 'androidx.media3' - artifactId = findProperty('releaseArtifactId') ?: '' - version = findProperty('releaseVersion') ?: '' - pom { - name = - findProperty('releaseName') - ?: '' - description = - findProperty('releaseDescription') - ?: findProperty('releaseName') - ?: '' - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' + publications { + release(MavenPublication) { + from components.release + artifact androidSourcesJar + groupId = 'androidx.media3' + artifactId = findProperty('releaseArtifactId') ?: '' + version = findProperty('releaseVersion') ?: '' + pom { + name = + findProperty('releaseName') + ?: '' + description = + findProperty('releaseDescription') + ?: findProperty('releaseName') + ?: '' + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } } - } - developers { - developer { - name = 'The Android Open Source Project' + developers { + developer { + name = 'The Android Open Source Project' + } + } + scm { + connection = 'scm:git:https://github.com/androidx/media.git' + url = 'https://github.com/androidx/media' + } + withXml { + addMissingAarTypeToXml(it) } - } - scm { - connection = 'scm:git:https://github.com/androidx/media.git' - url = 'https://github.com/androidx/media' - } - withXml { - addMissingAarTypeToXml(it) } } } diff --git a/settings.gradle b/settings.gradle index eaaf9cd9c5..716f405a9a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,6 +18,8 @@ if (gradle.ext.has('androidxMediaModulePrefix')) { modulePrefix += gradle.ext.androidxMediaModulePrefix } +rootProject.name = 'media3' + include modulePrefix + 'demo' project(modulePrefix + 'demo').projectDir = new File(rootDir, 'demos/main') include modulePrefix + 'demo-cast'