Skip to content

Commit

Permalink
Fix GL-Native snapshots not resolving; refactor verify-docs job (#2878)
Browse files Browse the repository at this point in the history
* Fix GL-Native snapshots not resolving

* PR fixes

* Fix doc validation because of common not being part of gl-native
  • Loading branch information
kiryldz authored Dec 4, 2024
1 parent 7d89871 commit fef824a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

### MapboxCoreMaps,11.9.0-beta.1,Mapbox ToS,Mapbox,https://www.mapbox.com/
### MapboxCoreMaps,11.10.0-beta.1,Mapbox ToS,Mapbox,https://www.mapbox.com/

```
Mapbox Core Maps version 11.0
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ japicmp = "0.4.1"
# Dependencies

# GlNative and Common are used by the convention plugin
mapboxGlNative = "11.9.0-beta.1"
mapboxCommon = "24.9.0-beta.1"
mapboxGlNative = "11.10.0-SNAPSHOT-12-03--10-49.git-b51ed89"
mapboxCommon = "24.10.0-SNAPSHOT-12-03--10-49.git-b51ed89"

mapboxBase = "0.11.0"
mapboxGestures = "0.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ import org.gradle.api.Project
/**
* @param group The dependency group ID
* @param artifact The dependency artifact ID
* @param snapshotArtifact The dependency artifact ID to use if the version contains `-SNAPSHOT`
* @param supportsNdkVariant True if this dependency also publishes variants for different NDKs.
* The NDK will be suffixed to the artifact ID.
*/
internal abstract class BaseDependency(
open val group: String,
open val artifact: String,
open val snapshotArtifact: String = artifact,
open val supportsNdkVariant: Boolean = false,
) {
abstract fun resolveVersion(project: Project): String

fun add(project: Project, configuration: String) {
val version = resolveVersion(project)
var artifactId = if (version.contains("-SNAPSHOT")) {
snapshotArtifact
val artifactId = if (supportsNdkVariant) {
project.appendNdkIfNeeded(artifact)
} else {
artifact
}
if (supportsNdkVariant) {
artifactId = project.appendNdkIfNeeded(artifactId)
}
val coordinates = "${group}:$artifactId:$version"
project.dependencies.add(configuration, coordinates)
}
Expand All @@ -36,9 +31,8 @@ internal data class Dependency(
override val group: String,
override val artifact: String,
private val version: String,
override val snapshotArtifact: String = artifact,
override val supportsNdkVariant: Boolean = false,
) : BaseDependency(group, artifact, snapshotArtifact, supportsNdkVariant) {
) : BaseDependency(group, artifact, supportsNdkVariant) {
override fun resolveVersion(project: Project): String = version
}

Expand All @@ -51,9 +45,8 @@ internal data class VersionCatalogDependency(
override val artifact: String,
private val versionRef: String,
private val catalogName: String = "libs",
override val snapshotArtifact: String = artifact,
override val supportsNdkVariant: Boolean = false,
) : BaseDependency(group, artifact, snapshotArtifact, supportsNdkVariant) {
) : BaseDependency(group, artifact, supportsNdkVariant) {

override fun resolveVersion(project: Project): String =
project.getVersionCatalog(catalogName).findVersion(versionRef).get().toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ internal object MapboxDependencies {

internal val GlNative = VersionCatalogDependency(
group = "com.mapbox.maps",
// v11.9 snapshots or earlier should use `android-core-internal` as `artifact`.
artifact = "android-core",
versionRef = "mapboxGlNative",
snapshotArtifact = "android-core-internal",
supportsNdkVariant = true
)
}

0 comments on commit fef824a

Please sign in to comment.