Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for SDK token use in Gradle builds (#604) #621

Closed

Conversation

lduivenbode
Copy link

Updated build.gradle to reference gradle.properties, and to use MAPBOX_DOWNLOADS_TOKEN rather than SDK_REGISTRY_TOKEN. This makes it consistent with the Android installation instructions.

Also updated documentation to note this step as it's no longer iOS specific.

Updated build.gradle to reference gradle.properties, and to use MAPBOX_DOWNLOADS_TOKEN rather than SDK_REGISTRY_TOKEN. This makes it consistent with the Android installation instructions.

Also updated documentation to note this step as it's no longer iOS specific.
@@ -13,7 +13,7 @@ buildscript {
}

rootProject.allprojects {
def token = System.getenv('SDK_REGISTRY_TOKEN')
def token = project.property('MAPBOX_DOWNLOADS_TOKEN')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't return environment variables anymore, does it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set Gradle project properties using environment variables: https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks! But that doesn't necessarily make it easier to follow the Mapbox tutorial :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!! It's work in -> /snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/android/build.gradle (Ubuntu)

@luis901101
Copy link

According to the official mapbox documentation the way of getting the token key should be:
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""

This is a blocking issue for android, so please fix this PR and merge it as soon as posible.

@lduivenbode
Copy link
Author

According to the official mapbox documentation the way of getting the token key should be:
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""

This is a blocking issue for android, so please fix this PR and merge it as soon as posible.

Hi @luis901101 - can you clarify what needs to be "fixed"? I've only seen questions on this PR not comments. I was under the impression I'm still waiting for the maintainer to review it.

@kuhnroyal
Copy link

I am currently using this branch, but using ORG_GRADLE_PROJECT_MAPBOX_DOWNLOADS_TOKEN doesn't seem great. I ended up putting it in the local.properties.
I would suggest checking first via project.properties and then falling back to System.getenv('MAPBOX_DOWNLOADS_TOKEN').

@luis901101
Copy link

luis901101 commented May 20, 2021

According to the official mapbox documentation the way of getting the token key should be:
def token = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
This is a blocking issue for android, so please fix this PR and merge it as soon as posible.

Hi @luis901101 - can you clarify what needs to be "fixed"? I've only seen questions on this PR not comments. I was under the impression I'm still waiting for the maintainer to review it.

I mean, the documentation referenced by this plugin is the official documentation of mapbox where it's explained how the TOKEN should be set. In this documentation the token is named like MAPBOX_DOWNLOADS_TOKEN and it's located under $USER/.gradle/gradle.properties. So when a developer reads the documentation and sets the token as explained then the plugin doesn't build because of token SDK_REGISTRY_TOKEN not found. In fact in the currently published version v0.12.0 in pub.dev the only indication for token config is for iOS and none for Android... which makes it more difficult for devs to find out.
What I suggest to fix ASAP is the way of getting the token in build.gradle to match the official documentation. Or simply updating the README.md but this PR is not related to the README.

@botanegg
Copy link

It is can be like project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: System.getenv('MAPBOX_DOWNLOADS_TOKEN') to easy using both approach: editing $USER/.gradle/gradle.properties or using enviroment variables

@raphaelvigee
Copy link

Would be great to see this merged

@AAverin
Copy link
Contributor

AAverin commented Jul 17, 2021

I suggest to also write proper instructions in Readme on how project should be setup now.
Also, environment variable should be per-project configurable in case I have multiple projects with different mapbox accounts and tokens

Copy link
Contributor

@AAverin AAverin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't both iOS and Android, ideally, use the same project-specific property somehow?

@gabeschine
Copy link
Contributor

@AAverin I agree in principle, but this Flutter package should use whatever is documented in the MapBox SDK.

@felix-ht
Copy link
Collaborator

this was fixed with #721

@felix-ht felix-ht closed this Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.