From bd38c28bb87a286d8e7befa1cd9841032a711416 Mon Sep 17 00:00:00 2001 From: ibaker Date: Wed, 8 Sep 2021 16:26:38 +0100 Subject: [PATCH] Fix a bug in core_settings.gradle with relative paths I think this has been broken since https://github.com/google/ExoPlayer/commit/617267bfcf20c500fb4a3cfdff7104e4d88261a7 (which was trying to fix the same problem). This change initializes `rootDir` to always be the current project (i.e. ExoPlayer) directory. From the [Gradle docs](https://docs.gradle.org/current/userguide/working_with_files.html#sec:single_file_paths): > What happens in the case of multi-project builds? The file() method > will always turn relative paths into paths that are relative to the > current project directory, which may be a child project. We can also then remove exoplayerRoot completely and simplify the local dependency instructions. * #minor-release * #exofixit * Issue: #9403 PiperOrigin-RevId: 395478121 --- README.md | 3 +-- RELEASENOTES.md | 3 +++ core_settings.gradle | 2 +- settings.gradle | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d3c8c5e44c..3933f0bc18 100644 --- a/README.md +++ b/README.md @@ -115,9 +115,8 @@ Next, add the following to your project's `settings.gradle` file, replacing `path/to/exoplayer` with the path to your local copy: ```gradle -gradle.ext.exoplayerRoot = 'path/to/exoplayer' gradle.ext.exoplayerModulePrefix = 'exoplayer-' -apply from: file("$gradle.ext.exoplayerRoot/core_settings.gradle") +apply from: file("path/to/exoplayer/core_settings.gradle") ``` You should now see the ExoPlayer modules appear as part of your project. You can diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 16fe885297..d700482627 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -17,6 +17,9 @@ * Fix `NullPointerException` being thrown from `CacheDataSource` when reading a fully cached resource with `DataSpec.position` equal to the resource length. + * Fix a bug when [depending on ExoPlayer locally](README.md#locally) with + a relative path + ([#9403](https://github.com/google/ExoPlayer/issues/9403)). * Extractors: * Support TS packets without PTS flag ([#9294](https://github.com/google/ExoPlayer/issues/9294)). diff --git a/core_settings.gradle b/core_settings.gradle index 7fc3a4c3e2..06a4327aa7 100644 --- a/core_settings.gradle +++ b/core_settings.gradle @@ -11,7 +11,7 @@ // 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. -def rootDir = file(gradle.ext.exoplayerRoot) +def rootDir = file(".") if (!gradle.ext.has('exoplayerSettingsDir')) { gradle.ext.exoplayerSettingsDir = rootDir.getCanonicalPath() } diff --git a/settings.gradle b/settings.gradle index ee651f1908..c73ad7a1e0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,7 +11,6 @@ // 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. -gradle.ext.exoplayerRoot = rootDir gradle.ext.exoplayerModulePrefix = '' def modulePrefix = ':'