Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Adding Bintray Gradle plugin for artifact publishing #13999

Conversation

langsmith
Copy link
Contributor

Because of recent artifact publishing issues with Sonatype and CircleCI, this pr adds https://github.com/bintray/gradle-bintray-plugin so that we can publish Maps SDK for Android artifacts to Bintray. We can pass them on to Maven Central once in Bintray.

cc @mapbox/maps-android

@langsmith langsmith added build Android Mapbox Maps SDK for Android in progress labels Feb 27, 2019
@langsmith langsmith self-assigned this Feb 27, 2019
@langsmith
Copy link
Contributor Author

This pr is still a work in progress, but I think things are close to being done. I opened the pr for visibility

@langsmith langsmith force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from cf18912 to bd9d501 Compare February 28, 2019 18:36
@langsmith
Copy link
Contributor Author

Progress! After lots of tweaking, bintrayUpload finally successfully created https://bintray.com/mapbox/mapbox/mapbox-android-sdk . Not sure why https://bintray.com/mapbox/mapbox/mapbox-android-sdk#files is empty but at least we've moved forward on this. Yes, the 0.0.0 version can be deleted 😄

File issue seems to be related to the POM file setup:

screen shot 2019-03-04 at 6 05 35 pm

@langsmith
Copy link
Contributor Author

Seems that the error mentioned above is one that many others have seen

bintray/gradle-bintray-plugin#88

bintray/gradle-bintray-plugin#81

@langsmith langsmith force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from a0ab0d7 to e3696c9 Compare March 5, 2019 22:11
@langsmith
Copy link
Contributor Author

MapboxGLAndroidSDK seems to be used by the Gradle Bintray plugin and set as the artifactId, rather than the artifactId value of mapbox-android-sdk which I set at https://github.com/mapbox/mapbox-gl-native/pull/13999/files#diff-e8814550c6b8959b69ba7bdabdd97566R25

Despite that, latest commit was able to create the aar and pom files and their signed .asc version.

screen shot 2019-03-05 at 5 26 03 pm

The POM file goes to https://bintray.com/mapbox/mapbox/mapbox-android-sdk, however it's incomplete 😕 The POM generated by this branch is still missing some fields that the POM found at https://search.maven.org/artifact/com.mapbox.mapboxsdk/mapbox-android-sdk/7.2.0/aar has . Each dependency in the Bintray POM is missing the scope and exclusion fields, and I've yet to figure out why. The Bintray POM is also missing opening fields such as url, description, and developers. I set that info in gradle-bintray.gradle, so I'm not sure why it's not carrying over. Remedy is in this comment/thread?: novoda/bintray-release#19 (comment) ?

Bintray POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mapbox.mapboxsdk</groupId>
  <artifactId>MapboxGLAndroidSDK</artifactId>
  <version>7.3.0-SNAPSHOT</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.mapbox.mapboxsdk</groupId>
      <artifactId>mapbox-sdk-turf</artifactId>
      <version>4.3.0</version>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>appcompat-v7</artifactId>
      <version>27.1.1</version>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-annotations</artifactId>
      <version>27.1.1</version>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-fragment</artifactId>
      <version>27.1.1</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>3.12.0</version>
    </dependency>
    <dependency>
      <groupId>com.getkeepsafe.relinker</groupId>
      <artifactId>relinker</artifactId>
      <version>1.3.1</version>
    </dependency>
    <dependency>
      <groupId>com.mapbox.mapboxsdk</groupId>
      <artifactId>mapbox-android-telemetry</artifactId>
      <version>4.2.0</version>
    </dependency>
    <dependency>
      <groupId>com.mapbox.mapboxsdk</groupId>
      <artifactId>mapbox-sdk-geojson</artifactId>
      <version>4.3.0</version>
    </dependency>
    <dependency>
      <groupId>com.mapbox.mapboxsdk</groupId>
      <artifactId>mapbox-android-gestures</artifactId>
      <version>0.4.0</version>
    </dependency>
  </dependencies>
</project>

----Instructions if you'd like to try yourself------

Switch to this branch, cd to this repo's root folder on the command line, and then run make apackage to create the artifact files. Add BINTRAY_USER, BINTRAY_KEY, and GPG passphrase and their respective values to your gradle.properties file (e.g. BINTRAY_KEY=key). Another option is to just hardcode them (but don't commit/push them to Github!!!) in the user and key fields at the top of the bintray {} section of the gradle-bintray.gradle file (e.g. key = "key"). You can set passphrase in the gpg section at the bottom of the gradle-bintray.gradle file. Once the artifact creation process is done and you've set the bintray user/key, run make run-android-upload-to-bintray on the command line. You should see something similar to:

screen shot 2019-03-05 at 3 37 28 pm

Still need to figure out:

  1. why the POM isn't being filled out with all of the various information, which I set in the gradle-bintray.gradle file
  2. finishing figuring out how to upload the files that are part of a Maps SDK release (javadoc.jar, sources.jar, etc.) https://search.maven.org/artifact/com.mapbox.mapboxsdk/mapbox-android-sdk/7.2.0/aar

screen shot 2019-03-05 at 3 54 44 pm

  1. why MapboxGLAndroidSDK is being filled into the POM file as artifactId. Related to 400 Response but Successful Upload bintray/gradle-bintray-plugin#81 (comment)?

@langsmith langsmith force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from debb1f0 to af8f2c6 Compare March 6, 2019 01:56
@LukasPaczos LukasPaczos force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch 3 times, most recently from 8b3190f to e1a5873 Compare March 6, 2019 16:29
@LukasPaczos
Copy link
Contributor

Thanks for kicking this off @langsmith!

I've made some changes to resolve the Still need to figure out points. Key takeaways are:

  • maven-publish plugin doesn't fill out POM files automatically, to tackle this, I've used this Gradle plugin which reduces the boilerplate of including the deps manually, however, the additional info like names and URLs still had to be added manually.
  • Javadocs are generated as they were before and included in the artifact.
  • Because of the improved POM file generation, we are actually going to ship dependencies with correct scopes (runtime/compile) and prevent leaks.

@LukasPaczos LukasPaczos force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from c4f33a2 to 7a09e80 Compare March 7, 2019 14:41
@LukasPaczos
Copy link
Contributor

Since we are still waiting for the jCenter account to be opened in order to server SNAPSHOTs, 7a09e80 disables those builds for now, so that we can ship the alpha build without delaying further.

@LukasPaczos LukasPaczos force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from 7a09e80 to 6d58eb8 Compare March 7, 2019 15:00
@LukasPaczos LukasPaczos force-pushed the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch from 6d58eb8 to d660419 Compare March 7, 2019 15:48
@LukasPaczos LukasPaczos merged commit b4e315e into master Mar 7, 2019
@LukasPaczos LukasPaczos deleted the adding-bintray-gradle-file-for-android-7.2.0-alpha.2-dispersal branch March 7, 2019 17:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants