Fix a bug in core_settings.gradle with relative paths

I think this has been broken since 617267bfcf (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
This commit is contained in:
ibaker 2021-09-08 16:26:38 +01:00 committed by Ian Baker
parent 837667dea1
commit bd38c28bb8
4 changed files with 5 additions and 4 deletions

View File

@ -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: `path/to/exoplayer` with the path to your local copy:
```gradle ```gradle
gradle.ext.exoplayerRoot = 'path/to/exoplayer'
gradle.ext.exoplayerModulePrefix = '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 You should now see the ExoPlayer modules appear as part of your project. You can

View File

@ -17,6 +17,9 @@
* Fix `NullPointerException` being thrown from `CacheDataSource` when * Fix `NullPointerException` being thrown from `CacheDataSource` when
reading a fully cached resource with `DataSpec.position` equal to the reading a fully cached resource with `DataSpec.position` equal to the
resource length. 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: * Extractors:
* Support TS packets without PTS flag * Support TS packets without PTS flag
([#9294](https://github.com/google/ExoPlayer/issues/9294)). ([#9294](https://github.com/google/ExoPlayer/issues/9294)).

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
def rootDir = file(gradle.ext.exoplayerRoot) def rootDir = file(".")
if (!gradle.ext.has('exoplayerSettingsDir')) { if (!gradle.ext.has('exoplayerSettingsDir')) {
gradle.ext.exoplayerSettingsDir = rootDir.getCanonicalPath() gradle.ext.exoplayerSettingsDir = rootDir.getCanonicalPath()
} }

View File

@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
gradle.ext.exoplayerRoot = rootDir
gradle.ext.exoplayerModulePrefix = '' gradle.ext.exoplayerModulePrefix = ''
def modulePrefix = ':' def modulePrefix = ':'