Move upstream components to common
Common houses DataSource as an interface for reading data, but most of the concrete implementations are in ExoPlayer. This means that in practice, if an app wants to use a module that reads using DataSource (e.g. extractor), they may be forced to depend on ExoPlayer as well to get a concrete implementation (e.g. FileDataSource). This change moves the DataSource implementations into common to resolve this. PiperOrigin-RevId: 403222081
This commit is contained in:
parent
b2bf9f4d0f
commit
6ef82e4423
@ -13,7 +13,21 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
|
apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
|
||||||
|
|
||||||
android.buildTypes.debug.testCoverageEnabled true
|
android {
|
||||||
|
defaultConfig {
|
||||||
|
multiDexEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
testCoverageEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
androidTest.assets.srcDir '../../testdata/src/test/assets/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api ('com.google.guava:guava:' + guavaVersion) {
|
api ('com.google.guava:guava:' + guavaVersion) {
|
||||||
@ -31,6 +45,12 @@ dependencies {
|
|||||||
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
|
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
|
||||||
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
|
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
|
||||||
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
|
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
|
||||||
|
androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion
|
||||||
|
androidTestImplementation 'com.linkedin.dexmaker:dexmaker:' + dexmakerVersion
|
||||||
|
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:' + dexmakerVersion
|
||||||
|
androidTestImplementation(project(modulePrefix + 'testutils')) {
|
||||||
|
exclude module: modulePrefix.substring(1) + 'library-core'
|
||||||
|
}
|
||||||
testImplementation 'org.mockito:mockito-core:' + mockitoVersion
|
testImplementation 'org.mockito:mockito-core:' + mockitoVersion
|
||||||
testImplementation 'androidx.test:core:' + androidxTestCoreVersion
|
testImplementation 'androidx.test:core:' + androidxTestCoreVersion
|
||||||
testImplementation 'androidx.test.ext:junit:' + androidxTestJUnitVersion
|
testImplementation 'androidx.test.ext:junit:' + androidxTestJUnitVersion
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
# Proguard rules specific to the common module.
|
# Proguard rules specific to the common module.
|
||||||
|
|
||||||
|
# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening.
|
||||||
|
-keepclassmembers class com.google.android.exoplayer2.upstream.RawResourceDataSource {
|
||||||
|
public static android.net.Uri buildRawResourceUri(int);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Constructors accessed via reflection in DefaultDataSource
|
||||||
|
-dontnote com.google.android.exoplayer2.ext.rtmp.RtmpDataSource
|
||||||
|
-keepclassmembers class com.google.android.exoplayer2.ext.rtmp.RtmpDataSource {
|
||||||
|
<init>();
|
||||||
|
}
|
||||||
|
|
||||||
# Don't warn about checkerframework and Kotlin annotations
|
# Don't warn about checkerframework and Kotlin annotations
|
||||||
-dontwarn org.checkerframework.**
|
-dontwarn org.checkerframework.**
|
||||||
-dontwarn kotlin.annotations.jvm.**
|
-dontwarn kotlin.annotations.jvm.**
|
||||||
|
35
library/common/src/androidTest/AndroidManifest.xml
Normal file
35
library/common/src/androidTest/AndroidManifest.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2016 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.google.android.exoplayer2.common.test">
|
||||||
|
|
||||||
|
<uses-sdk/>
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="false"
|
||||||
|
tools:ignore="MissingApplicationIcon,HardcodedDebugMode">
|
||||||
|
<provider
|
||||||
|
android:authorities="com.google.android.exoplayer2.testutil.AssetContentProvider"
|
||||||
|
android:name="com.google.android.exoplayer2.testutil.AssetContentProvider"/>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:targetPackage="com.google.android.exoplayer2.common.test"
|
||||||
|
android:name="androidx.test.runner.AndroidJUnitRunner"/>
|
||||||
|
|
||||||
|
</manifest>
|
@ -19,7 +19,7 @@ import android.content.res.Resources;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import com.google.android.exoplayer2.core.test.R;
|
import com.google.android.exoplayer2.common.test.R;
|
||||||
import com.google.android.exoplayer2.testutil.DataSourceContractTest;
|
import com.google.android.exoplayer2.testutil.DataSourceContractTest;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
@ -1,10 +1,5 @@
|
|||||||
# Proguard rules specific to the core module.
|
# Proguard rules specific to the core module.
|
||||||
|
|
||||||
# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening.
|
|
||||||
-keepclassmembers class com.google.android.exoplayer2.upstream.RawResourceDataSource {
|
|
||||||
public static android.net.Uri buildRawResourceUri(int);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Constructors accessed via reflection in DefaultRenderersFactory
|
# Constructors accessed via reflection in DefaultRenderersFactory
|
||||||
-dontnote com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer
|
-dontnote com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer
|
||||||
-keepclassmembers class com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer {
|
-keepclassmembers class com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer {
|
||||||
@ -31,12 +26,6 @@
|
|||||||
<init>(android.os.Handler, com.google.android.exoplayer2.audio.AudioRendererEventListener, com.google.android.exoplayer2.audio.AudioSink);
|
<init>(android.os.Handler, com.google.android.exoplayer2.audio.AudioRendererEventListener, com.google.android.exoplayer2.audio.AudioSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Constructors accessed via reflection in DefaultDataSource
|
|
||||||
-dontnote com.google.android.exoplayer2.ext.rtmp.RtmpDataSource
|
|
||||||
-keepclassmembers class com.google.android.exoplayer2.ext.rtmp.RtmpDataSource {
|
|
||||||
<init>();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Constructors accessed via reflection in DefaultDownloaderFactory
|
# Constructors accessed via reflection in DefaultDownloaderFactory
|
||||||
-dontnote com.google.android.exoplayer2.source.dash.offline.DashDownloader
|
-dontnote com.google.android.exoplayer2.source.dash.offline.DashDownloader
|
||||||
-keepclassmembers class com.google.android.exoplayer2.source.dash.offline.DashDownloader {
|
-keepclassmembers class com.google.android.exoplayer2.source.dash.offline.DashDownloader {
|
||||||
|
@ -25,11 +25,7 @@
|
|||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
tools:ignore="MissingApplicationIcon,HardcodedDebugMode"
|
tools:ignore="MissingApplicationIcon,HardcodedDebugMode"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true"/>
|
||||||
<provider
|
|
||||||
android:authorities="com.google.android.exoplayer2.testutil.AssetContentProvider"
|
|
||||||
android:name="com.google.android.exoplayer2.testutil.AssetContentProvider"/>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
<instrumentation
|
<instrumentation
|
||||||
android:targetPackage="com.google.android.exoplayer2.core.test"
|
android:targetPackage="com.google.android.exoplayer2.core.test"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user