From 86a0a405b6b83bce99e5bd89e4b42d31f0ad0fea Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Wed, 31 Mar 2021 16:40:28 +0100 Subject: [PATCH] Update instructions for GMaven releasing Issue: #5246 #minor-release PiperOrigin-RevId: 366041182 --- README.md | 42 +++++-------- RELEASENOTES.md | 4 +- build.gradle | 6 -- extensions/ffmpeg/README.md | 4 +- publish.gradle | 120 ++++++++++-------------------------- 5 files changed, 52 insertions(+), 124 deletions(-) diff --git a/README.md b/README.md index ac4c41b0fe..73f57c92a1 100644 --- a/README.md +++ b/README.md @@ -22,28 +22,16 @@ and extend, and can be updated through Play Store application updates. ## Using ExoPlayer ## -ExoPlayer modules can be obtained from JCenter. It's also possible to clone the -repository and depend on the modules locally. +ExoPlayer modules can be obtained from [the Google Maven repository][]. It's +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 -dependency. You need to make sure you have the Google and JCenter repositories -included in the `build.gradle` file in the root of your project: - -```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: +dependency in the `build.gradle` file of your app module. The following will add +a dependency to the full library: ```gradle 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. +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 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 @@ -72,18 +63,19 @@ individually. * `exoplayer-smoothstreaming`: Support for SmoothStreaming content. * `exoplayer-ui`: UI components and resources for use with ExoPlayer. -In addition to library modules, ExoPlayer has multiple extension modules that -depend on external libraries to provide additional functionality. Some -extensions are available from JCenter, whereas others must be built manually. +In addition to library modules, ExoPlayer has extension modules that depend on +external libraries to provide additional functionality. Some extensions are +available from the Maven repository, whereas others must be built manually. Browse the [extensions directory][] and their individual READMEs for details. -More information on the library and extension modules that are available from -JCenter can be found on [Bintray][]. +More information on the library and extension modules that are available can be +found on the [Google Maven ExoPlayer page][]. [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 `build.gradle` files depending on ExoPlayer, by adding the following to the diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3224ce8d96..6d7c9ac409 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -132,8 +132,8 @@ * Upgrade IMA SDK dependency to 3.22.3, fixing an issue with `NullPointerExceptions` within `WebView` callbacks ([#8447](https://github.com/google/ExoPlayer/issues/8447)). - -the IMA SDK. +* Update instructions and publishing configuration for releasing to Google's + Maven repository instead of bintray/JCenter. ### 2.13.2 (2021-02-25) diff --git a/build.gradle b/build.gradle index 8c2186522a..5c5e643815 100644 --- a/build.gradle +++ b/build.gradle @@ -14,21 +14,15 @@ buildscript { repositories { google() - jcenter() } dependencies { 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' } } allprojects { repositories { google() - jcenter() - } - project.ext { - exoplayerPublishEnabled = false } if (it.hasProperty('externalBuildDir')) { if (!new File(externalBuildDir).isAbsolute()) { diff --git a/extensions/ffmpeg/README.md b/extensions/ffmpeg/README.md index da2fa40141..77dbc2588d 100644 --- a/extensions/ffmpeg/README.md +++ b/extensions/ffmpeg/README.md @@ -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 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][] -for more information). +[top level README][]. The extension is not provided via Google's Maven +repository (see [#2781][] for more information). In addition, it's necessary to manually build the FFmpeg library, so that gradle can bundle the FFmpeg binaries in the APK: diff --git a/publish.gradle b/publish.gradle index 802202b7c8..8ef54cf4e4 100644 --- a/publish.gradle +++ b/publish.gradle @@ -12,104 +12,46 @@ // See the License for the specific language governing permissions and // limitations under the License. -if (project.ext.has("exoplayerPublishEnabled") - && project.ext.exoplayerPublishEnabled) { - // 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 { - repositories { - maven { - url = findProperty('mavenRepo') ?: "${buildDir}/repo" - } +apply plugin: 'maven-publish' +afterEvaluate { + publishing { + repositories { + maven { + url = findProperty('mavenRepo') ?: "${buildDir}/repo" } - publications { - release(MavenPublication) { - from components.release - artifact androidSourcesJar - groupId = 'com.google.android.exoplayer' - artifactId = releaseArtifact - version releaseVersion - pom { - name = releaseArtifact - description = releaseDescription - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } + } + publications { + release(MavenPublication) { + from components.release + artifact androidSourcesJar + groupId = 'com.google.android.exoplayer' + artifactId = releaseArtifact + version releaseVersion + pom { + name = releaseArtifact + description = releaseDescription + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' } - developers { - developer { - name = 'The Android Open Source Project' - } - } - scm { - connection = 'scm:git:https://github.com/google/ExoPlayer.git' - url = 'https://github.com/google/ExoPlayer' + } + developers { + developer { + name = 'The Android Open Source Project' } } + scm { + connection = 'scm:git:https://github.com/google/ExoPlayer.git' + url = 'https://github.com/google/ExoPlayer' + } } } } } - 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("\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) { archiveClassifier.set('sources')