Update instructions for GMaven releasing

Issue: #5246

#minor-release

PiperOrigin-RevId: 366041182
This commit is contained in:
andrewlewis 2021-03-31 16:40:28 +01:00 committed by Oliver Woodman
parent 056ef5c914
commit 86a0a405b6
5 changed files with 52 additions and 124 deletions

View File

@ -22,28 +22,16 @@ and extend, and can be updated through Play Store application updates.
## Using ExoPlayer ## ## Using ExoPlayer ##
ExoPlayer modules can be obtained from JCenter. It's also possible to clone the ExoPlayer modules can be obtained from [the Google Maven repository][]. It's
repository and depend on the modules locally. also possible to clone the repository and depend on the modules locally.
### From JCenter ### ### From the Google Maven repository
#### 1. Add repositories #### #### 1. Add ExoPlayer module dependencies ####
The easiest way to get started using ExoPlayer is to add it as a gradle The easiest way to get started using ExoPlayer is to add it as a gradle
dependency. You need to make sure you have the Google and JCenter repositories dependency in the `build.gradle` file of your app module. The following will add
included in the `build.gradle` file in the root of your project: a dependency to the full library:
```gradle
repositories {
google()
jcenter()
}
```
#### 2. Add ExoPlayer module dependencies ####
Next add a dependency in the `build.gradle` file of your app module. The
following will add a dependency to the full library:
```gradle ```gradle
implementation 'com.google.android.exoplayer:exoplayer:2.X.X' implementation 'com.google.android.exoplayer:exoplayer:2.X.X'
@ -51,6 +39,9 @@ implementation 'com.google.android.exoplayer:exoplayer:2.X.X'
where `2.X.X` is your preferred version. where `2.X.X` is your preferred version.
Note: old versions of ExoPlayer are available via JCenter. To use them, you need
to add `jcenter()` to your project's root build.gradle `repositories` block.
As an alternative to the full library, you can depend on only the library As an alternative to the full library, you can depend on only the library
modules that you actually need. For example the following will add dependencies modules that you actually need. For example the following will add dependencies
on the Core, DASH and UI library modules, as might be required for an app that on the Core, DASH and UI library modules, as might be required for an app that
@ -72,18 +63,19 @@ individually.
* `exoplayer-smoothstreaming`: Support for SmoothStreaming content. * `exoplayer-smoothstreaming`: Support for SmoothStreaming content.
* `exoplayer-ui`: UI components and resources for use with ExoPlayer. * `exoplayer-ui`: UI components and resources for use with ExoPlayer.
In addition to library modules, ExoPlayer has multiple extension modules that In addition to library modules, ExoPlayer has extension modules that depend on
depend on external libraries to provide additional functionality. Some external libraries to provide additional functionality. Some extensions are
extensions are available from JCenter, whereas others must be built manually. available from the Maven repository, whereas others must be built manually.
Browse the [extensions directory][] and their individual READMEs for details. Browse the [extensions directory][] and their individual READMEs for details.
More information on the library and extension modules that are available from More information on the library and extension modules that are available can be
JCenter can be found on [Bintray][]. found on the [Google Maven ExoPlayer page][].
[extensions directory]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/ [extensions directory]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/
[Bintray]: https://bintray.com/google/exoplayer [the Google Maven repository]: https://developer.android.com/studio/build/dependencies#google-maven
[Google Maven ExoPlayer page]: https://maven.google.com/web/index.html#com.google.android.exoplayer
#### 3. Turn on Java 8 support #### #### 2. Turn on Java 8 support ####
If not enabled already, you also need to turn on Java 8 support in all If not enabled already, you also need to turn on Java 8 support in all
`build.gradle` files depending on ExoPlayer, by adding the following to the `build.gradle` files depending on ExoPlayer, by adding the following to the

View File

@ -132,8 +132,8 @@
* Upgrade IMA SDK dependency to 3.22.3, fixing an issue with * Upgrade IMA SDK dependency to 3.22.3, fixing an issue with
`NullPointerExceptions` within `WebView` callbacks `NullPointerExceptions` within `WebView` callbacks
([#8447](https://github.com/google/ExoPlayer/issues/8447)). ([#8447](https://github.com/google/ExoPlayer/issues/8447)).
* Update instructions and publishing configuration for releasing to Google's
the IMA SDK. Maven repository instead of bintray/JCenter.
### 2.13.2 (2021-02-25) ### 2.13.2 (2021-02-25)

View File

@ -14,21 +14,15 @@
buildscript { buildscript {
repositories { repositories {
google() google()
jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.novoda:bintray-release:0.9.1'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.1' classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.1'
} }
} }
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter()
}
project.ext {
exoplayerPublishEnabled = false
} }
if (it.hasProperty('externalBuildDir')) { if (it.hasProperty('externalBuildDir')) {
if (!new File(externalBuildDir).isAbsolute()) { if (!new File(externalBuildDir).isAbsolute()) {

View File

@ -15,8 +15,8 @@ more external libraries as described below. These are licensed separately.
To use this extension you need to clone the ExoPlayer repository and depend on To use this extension you need to clone the ExoPlayer repository and depend on
its modules locally. Instructions for doing this can be found in ExoPlayer's its modules locally. Instructions for doing this can be found in ExoPlayer's
[top level README][]. The extension is not provided via JCenter (see [#2781][] [top level README][]. The extension is not provided via Google's Maven
for more information). repository (see [#2781][] for more information).
In addition, it's necessary to manually build the FFmpeg library, so that gradle In addition, it's necessary to manually build the FFmpeg library, so that gradle
can bundle the FFmpeg binaries in the APK: can bundle the FFmpeg binaries in the APK:

View File

@ -12,38 +12,8 @@
// 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.
if (project.ext.has("exoplayerPublishEnabled") apply plugin: 'maven-publish'
&& project.ext.exoplayerPublishEnabled) { afterEvaluate {
// For publishing to Bintray.
apply plugin: 'bintray-release'
publish {
artifactId = releaseArtifact
desc = releaseDescription
publishVersion = releaseVersion
repoName = getBintrayRepo()
userOrg = 'google'
groupId = 'com.google.android.exoplayer'
website = 'https://github.com/google/ExoPlayer'
}
gradle.taskGraph.whenReady { taskGraph ->
project.tasks
.findAll { task -> task.name.contains("generatePomFileFor") }
.forEach { task ->
task.doLast {
task.outputs.files
.filter { File file ->
file.path.contains("publications") \
&& file.name.matches("^pom-.+\\.xml\$")
}
.forEach { File file -> addLicense(file) }
}
}
}
} else {
// For publishing to a Maven repository.
apply plugin: 'maven-publish'
afterEvaluate {
publishing { publishing {
repositories { repositories {
maven { maven {
@ -80,36 +50,8 @@ if (project.ext.has("exoplayerPublishEnabled")
} }
} }
} }
}
tasks.withType(PublishToMavenRepository) { it.dependsOn lint, test }
}
def getBintrayRepo() {
boolean publicRepo = hasProperty('publicRepo') &&
property('publicRepo').toBoolean()
return publicRepo ? 'exoplayer' : 'exoplayer-test'
}
static void addLicense(File pom) {
def licenseNode = new Node(null, "license")
licenseNode.append(
new Node(null, "name", "The Apache Software License, Version 2.0"))
licenseNode.append(
new Node(null, "url", "http://www.apache.org/licenses/LICENSE-2.0.txt"))
licenseNode.append(new Node(null, "distribution", "repo"))
def licensesNode = new Node(null, "licenses")
licensesNode.append(licenseNode)
def xml = new XmlParser().parse(pom)
xml.append(licensesNode)
def writer = new PrintWriter(new FileWriter(pom))
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
def printer = new XmlNodePrinter(writer)
printer.preserveWhitespace = true
printer.print(xml)
writer.close()
} }
tasks.withType(PublishToMavenRepository) { it.dependsOn lint, test }
task androidSourcesJar(type: Jar) { task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources') archiveClassifier.set('sources')