Make it easier to use ExoPlayer modules in other projects II

With this change, it becomes possible to depend on ExoPlayer
locally in settings.gradle by doing:

gradle.ext.exoplayerRoot = 'path/to/exoplayer/root'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')

You can optionally add a prefix onto ExoPlayer's module names
by adding:

gradle.ext.exoplayerModulePrefix = 'prefix'

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160277967
This commit is contained in:
olly 2017-06-27 08:27:36 -07:00 committed by Oliver Woodman
parent 26b32f6078
commit 4a59c7cf40
20 changed files with 125 additions and 89 deletions

View File

@ -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.
ext {
project.ext {
// Important: ExoPlayer specifies a minSdkVersion of 9 because various
// components provided by the library may be of use on older devices.
// However, please note that the core media playback functionality provided
@ -25,4 +25,8 @@ ext {
dexmakerVersion = '1.2'
mockitoVersion = '1.9.5'
releaseVersion = 'r2.4.2'
modulePrefix = ':';
if (gradle.ext.has('exoplayerModulePrefix')) {
modulePrefix += gradle.ext.exoplayerModulePrefix
}
}

54
core_settings.gradle Normal file
View File

@ -0,0 +1,54 @@
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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 = gradle.ext.exoplayerRoot
def modulePrefix = ':'
if (gradle.ext.has('exoplayerModulePrefix')) {
modulePrefix += gradle.ext.exoplayerModulePrefix
}
include modulePrefix + 'library'
include modulePrefix + 'library-core'
include modulePrefix + 'library-dash'
include modulePrefix + 'library-hls'
include modulePrefix + 'library-smoothstreaming'
include modulePrefix + 'library-ui'
include modulePrefix + 'testutils'
include modulePrefix + 'extension-ffmpeg'
include modulePrefix + 'extension-flac'
include modulePrefix + 'extension-gvr'
include modulePrefix + 'extension-ima'
include modulePrefix + 'extension-okhttp'
include modulePrefix + 'extension-opus'
include modulePrefix + 'extension-vp9'
project(modulePrefix + 'library').projectDir = new File(rootDir, 'library/all')
project(modulePrefix + 'library-core').projectDir = new File(rootDir, 'library/core')
project(modulePrefix + 'library-dash').projectDir = new File(rootDir, 'library/dash')
project(modulePrefix + 'library-hls').projectDir = new File(rootDir, 'library/hls')
project(modulePrefix + 'library-smoothstreaming').projectDir = new File(rootDir, 'library/smoothstreaming')
project(modulePrefix + 'library-ui').projectDir = new File(rootDir, 'library/ui')
project(modulePrefix + 'testutils').projectDir = new File(rootDir, 'testutils')
project(modulePrefix + 'extension-ffmpeg').projectDir = new File(rootDir, 'extensions/ffmpeg')
project(modulePrefix + 'extension-flac').projectDir = new File(rootDir, 'extensions/flac')
project(modulePrefix + 'extension-gvr').projectDir = new File(rootDir, 'extensions/gvr')
project(modulePrefix + 'extension-ima').projectDir = new File(rootDir, 'extensions/ima')
project(modulePrefix + 'extension-okhttp').projectDir = new File(rootDir, 'extensions/okhttp')
project(modulePrefix + 'extension-opus').projectDir = new File(rootDir, 'extensions/opus')
project(modulePrefix + 'extension-vp9').projectDir = new File(rootDir, 'extensions/vp9')
if (gradle.ext.has('exoplayerIncludeCronetExtension')
&& gradle.ext.exoplayerIncludeCronetExtension) {
include modulePrefix + 'extension-cronet'
project(modulePrefix + 'extension-cronet').projectDir = new File(rootDir, 'extensions/cronet')
}

View File

@ -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.
apply from: '../version_constants.gradle'
apply from: '../constants.gradle'
apply plugin: 'com.android.application'
android {
@ -46,14 +46,14 @@ android {
}
dependencies {
compile project(':library-core')
compile project(':library-dash')
compile project(':library-hls')
compile project(':library-smoothstreaming')
compile project(':library-ui')
withExtensionsCompile project(path: ':extension-ffmpeg')
withExtensionsCompile project(path: ':extension-flac')
withExtensionsCompile project(path: ':extension-ima')
withExtensionsCompile project(path: ':extension-opus')
withExtensionsCompile project(path: ':extension-vp9')
compile project(modulePrefix + 'library-core')
compile project(modulePrefix + 'library-dash')
compile project(modulePrefix + 'library-hls')
compile project(modulePrefix + 'library-smoothstreaming')
compile project(modulePrefix + 'library-ui')
withExtensionsCompile project(path: modulePrefix + 'extension-ffmpeg')
withExtensionsCompile project(path: modulePrefix + 'extension-flac')
withExtensionsCompile project(path: modulePrefix + 'extension-ima')
withExtensionsCompile project(path: modulePrefix + 'extension-opus')
withExtensionsCompile project(path: modulePrefix + 'extension-vp9')
}

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -30,11 +30,11 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile files('libs/cronet_api.jar')
compile files('libs/cronet_impl_common_java.jar')
compile files('libs/cronet_impl_native_java.jar')
androidTestCompile project(':library')
androidTestCompile project(modulePrefix + 'library')
androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
androidTestCompile 'org.mockito:mockito-core:' + mockitoVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,7 +31,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
}
ext {

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,8 +31,8 @@ android {
}
dependencies {
compile project(':library-core')
androidTestCompile project(':testutils')
compile project(modulePrefix + 'library-core')
androidTestCompile project(modulePrefix + 'testutils')
}
ext {

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -25,7 +25,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.google.vr:sdk-audio:1.60.1'
}

View File

@ -1,4 +1,4 @@
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -13,7 +13,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.android.support:support-annotations:' + supportLibraryVersion
compile 'com.google.ads.interactivemedia.v3:interactivemedia:3.6.0'
compile 'com.google.android.gms:play-services-ads:10.2.4'
@ -28,7 +28,7 @@ dependencies {
// will become unnecessary when the support-v4 dependency in the chain above
// has been updated to 24.2.0 or later.
compile 'com.android.support:support-v4:' + supportLibraryVersion
androidTestCompile project(':library')
androidTestCompile project(modulePrefix + 'library')
androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
androidTestCompile 'org.mockito:mockito-core:' + mockitoVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -30,7 +30,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile('com.squareup.okhttp3:okhttp:3.6.0') {
exclude group: 'org.json'
}

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,7 +31,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
}
ext {

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,7 +31,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
}
ext {

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -25,11 +25,11 @@ android {
}
dependencies {
compile project(':library-core')
compile project(':library-dash')
compile project(':library-hls')
compile project(':library-smoothstreaming')
compile project(':library-ui')
compile project(modulePrefix + 'library-core')
compile project(modulePrefix + 'library-dash')
compile project(modulePrefix + 'library-hls')
compile project(modulePrefix + 'library-smoothstreaming')
compile project(modulePrefix + 'library-ui')
}
ext {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
apply plugin: 'com.android.library'
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
android {
compileSdkVersion project.ext.compileSdkVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,10 +31,10 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.android.support:support-annotations:' + supportLibraryVersion
compile 'com.android.support:support-core-utils:' + supportLibraryVersion
androidTestCompile project(':testutils')
androidTestCompile project(modulePrefix + 'testutils')
androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
androidTestCompile 'org.mockito:mockito-core:' + mockitoVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,7 +31,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.android.support:support-annotations:' + supportLibraryVersion
androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,9 +31,9 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.android.support:support-annotations:' + supportLibraryVersion
androidTestCompile project(':testutils')
androidTestCompile project(modulePrefix + 'testutils')
androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
androidTestCompile 'org.mockito:mockito-core:' + mockitoVersion

View File

@ -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.
apply from: '../../version_constants.gradle'
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -31,7 +31,7 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'com.android.support:support-annotations:' + supportLibraryVersion
}

View File

@ -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.
apply from: '../version_constants.gradle'
apply from: '../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -25,8 +25,8 @@ android {
}
dependencies {
androidTestCompile project(':library-core')
androidTestCompile project(':library-dash')
androidTestCompile project(':library-hls')
androidTestCompile project(':testutils')
androidTestCompile project(modulePrefix + 'library-core')
androidTestCompile project(modulePrefix + 'library-dash')
androidTestCompile project(modulePrefix + 'library-hls')
androidTestCompile project(modulePrefix + 'testutils')
}

View File

@ -11,38 +11,16 @@
// 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.
include ':library'
include ':library-core'
include ':library-dash'
include ':library-hls'
include ':library-smoothstreaming'
include ':library-ui'
include ':testutils'
include ':demo'
include ':playbacktests'
include ':extension-ffmpeg'
include ':extension-flac'
include ':extension-gvr'
include ':extension-ima'
include ':extension-okhttp'
include ':extension-opus'
include ':extension-vp9'
// Uncomment the following line to use the Cronet Extension.
// include ':extension-cronet'
gradle.ext.exoplayerRoot = settingsDir
project(':library').projectDir = new File(settingsDir, 'library/all')
project(':library-core').projectDir = new File(settingsDir, 'library/core')
project(':library-dash').projectDir = new File(settingsDir, 'library/dash')
project(':library-hls').projectDir = new File(settingsDir, 'library/hls')
project(':library-smoothstreaming').projectDir = new File(settingsDir, 'library/smoothstreaming')
project(':library-ui').projectDir = new File(settingsDir, 'library/ui')
project(':extension-ffmpeg').projectDir = new File(settingsDir, 'extensions/ffmpeg')
project(':extension-flac').projectDir = new File(settingsDir, 'extensions/flac')
project(':extension-gvr').projectDir = new File(settingsDir, 'extensions/gvr')
project(':extension-ima').projectDir = new File(settingsDir, 'extensions/ima')
project(':extension-okhttp').projectDir = new File(settingsDir, 'extensions/okhttp')
project(':extension-opus').projectDir = new File(settingsDir, 'extensions/opus')
project(':extension-vp9').projectDir = new File(settingsDir, 'extensions/vp9')
// Uncomment the following line to use the Cronet Extension.
// See extensions/cronet/README.md for details.
// project(':extension-cronet').projectDir = new File(settingsDir, 'extensions/cronet')
def modulePrefix = ':'
if (gradle.ext.has('exoplayerModulePrefix')) {
modulePrefix += gradle.ext.exoplayerModulePrefix
}
include modulePrefix + 'demo'
include modulePrefix + 'playbacktests'
project(modulePrefix + 'demo').projectDir = new File(rootDir, 'demo')
project(modulePrefix + 'playbacktests').projectDir = new File(rootDir, 'playbacktests')
apply from: 'core_settings.gradle'

View File

@ -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.
apply from: '../version_constants.gradle'
apply from: '../constants.gradle'
apply plugin: 'com.android.library'
android {
@ -25,6 +25,6 @@ android {
}
dependencies {
compile project(':library-core')
compile project(modulePrefix + 'library-core')
compile 'org.mockito:mockito-core:' + mockitoVersion
}