diff --git a/.github/workflows/compilation-check.yml b/.github/workflows/compilation-check.yml index 0a53f7a..1e01ef7 100644 --- a/.github/workflows/compilation-check.yml +++ b/.github/workflows/compilation-check.yml @@ -9,20 +9,27 @@ on: jobs: build: runs-on: macOS-latest - + env: + MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }} + MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }} + GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }} steps: - uses: actions/checkout@v1 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 + - name: Set up netrc + uses: extractions/netrc@v1 + with: + machine: api.mapbox.com + username: mapbox + password: ${{ secrets.MAPBOX_SECRET_TOKEN }} - name: Cocoapods install run: (cd sample/ios-app && pod install) - - name: Build K/N cache - run: ./gradlew :maps:runCommonizer - name: Check library run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64 - name: Install pods with kotlin run: cd sample/ios-app && pod install - name: build ios sample - run: cd sample/ios-app && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO \ No newline at end of file + run: cd sample/ios-app && set -o pipefail && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 04346f1..c294b2b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,17 +18,23 @@ jobs: SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }} - + MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }} + MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }} + GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }} steps: - uses: actions/checkout@v1 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 + - name: Set up netrc + uses: extractions/netrc@v1 + with: + machine: api.mapbox.com + username: mapbox + password: ${{ secrets.MAPBOX_SECRET_TOKEN }} - name: Cocoapods install run: (cd sample/ios-app && pod install) - - name: Build K/N cache - run: ./gradlew :maps:runCommonizer - name: Publish library run: ./gradlew publish release: @@ -44,6 +50,6 @@ jobs: with: commitish: ${{ github.ref }} tag_name: release/${{ github.event.inputs.version }} - release_name: Release ${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }} body: "Will be filled later" draft: true \ No newline at end of file diff --git a/README.md b/README.md index edf14ba..0b1aa90 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![moko-maps](https://user-images.githubusercontent.com/5010169/71351401-27c14d80-25a6-11ea-9183-17821f6d4212.png) -[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/maps) ](https://repo1.maven.org/maven2/dev/icerock/moko/maps) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-orange) +[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/maps) ](https://repo1.maven.org/maven2/dev/icerock/moko/maps) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko&name=maps) # Mobile Kotlin maps module This is a Kotlin Multiplatform library that provides controls of maps to common code. @@ -7,7 +7,6 @@ This is a Kotlin Multiplatform library that provides controls of maps to common ## Table of Contents - [Features](#features) - [Requirements](#requirements) -- [Versions](#versions) - [Installation](#installation) - [Usage](#usage) - [Samples](#samples) @@ -25,26 +24,6 @@ This is a Kotlin Multiplatform library that provides controls of maps to common - Android API 16+ - iOS version 9.0+ -## Versions -### Bintray -- kotlin 1.3.61 - - 0.1.0 - - 0.1.1 - - 0.2.0 - - 0.2.1 - - 0.3.0 - - 0.4.0-dev-1 -- kotlin 1.3.70 - - 0.4.0-dev-2 - - 0.4.0-dev-3 - - 0.4.0-dev-4 -- kotlin 1.4.10 - - 0.5.0 - - 0.5.1 -### mavenCentral -- kotlin 1.4.31 - - 0.5.2 - ## Installation root build.gradle ```groovy @@ -59,9 +38,9 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:maps:0.5.2") - commonMainApi("dev.icerock.moko:maps-google:0.5.2") - commonMainApi("dev.icerock.moko:maps-mapbox:0.5.2") + commonMainApi("dev.icerock.moko:maps:0.6.0") + commonMainApi("dev.icerock.moko:maps-google:0.6.0") + commonMainApi("dev.icerock.moko:maps-mapbox:0.6.0") } kotlin.targets @@ -191,7 +170,29 @@ class MarkerViewModel( ## Samples Please see more examples in the [sample directory](sample). -## Set Up Locally +## Set Up Locally +Before open project need to setup `gradle.properties` with tokens: +``` +# mapbox tokens by guide https://docs.mapbox.com/android/maps/guides/install/ +mapbox.secretToken=YOUR_SECRET_MAPBOX_KEY +mapbox.publicToken=YOUR_PUBLIC_MAPBOX_KEY + +# google maps api key by guide https://developers.google.com/maps/documentation/android-sdk/get-api-key +googleMaps.apiKey=YOUR_API_KEY +``` + +# ios info.plist setup with tokens: +``` +MGLMapboxAccessToken=YOUR_PUBLIC_MAPBOX_KEY +GoogleAPIkey=YOUR_API_KEY +``` +add the following entry to your `.netrc` file: +``` +machine api.mapbox.com +login mapbox +password YOUR_SECRET_MAPBOX_KEY +``` + - The [maps directory](maps) contains the base classes for all maps providers; - The [maps-google directory](maps-google) contains the Google Maps implementation; - The [maps-mapbox directory](maps-mapbox) contains the mapbox implementation; diff --git a/build.gradle.kts b/build.gradle.kts index acc76d7..b663b04 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,144 +1,34 @@ /* * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ - -import java.util.Base64 - -plugins { - plugin(Deps.Plugins.detekt) apply false -} +import org.gradle.api.internal.artifacts.DefaultModuleVersionSelector buildscript { repositories { mavenCentral() google() gradlePluginPortal() - - jcenter { - content { - includeGroup("org.jetbrains.trove4j") - } - } } dependencies { - plugin(Deps.Plugins.mokoResources) - plugin(Deps.Plugins.kotlinSerialization) + classpath(":maps-build-logic") + classpath("dev.icerock.moko:resources-generator:0.16.1") + classpath("org.jetbrains.kotlin:kotlin-serialization:1.5.20") } } allprojects { - repositories { - mavenCentral() - google() - - maven { url = uri("https://mapbox.bintray.com/mapbox") } - - jcenter { - content { - includeGroup("org.jetbrains.trove4j") - includeGroup("org.jetbrains.kotlinx") - } - } - } - - apply(plugin = Deps.Plugins.detekt.id) - - configure { - input.setFrom( - "src/commonMain/kotlin", - "src/androidMain/kotlin", - "src/iosMain/kotlin", - "src/iosX64Main/kotlin" - ) - } - - dependencies { - "detektPlugins"(Deps.Libs.Detekt.detektFormatting) - } - - plugins.withId(Deps.Plugins.androidLibrary.id) { - configure { - compileSdkVersion(Deps.Android.compileSdk) - - defaultConfig { - minSdkVersion(Deps.Android.minSdk) - targetSdkVersion(Deps.Android.targetSdk) - } - } - } - - plugins.withId(Deps.Plugins.mavenPublish.id) { + plugins.withId("org.gradle.maven-publish") { group = "dev.icerock.moko" - version = Deps.mokoMapsVersion - - val javadocJar by tasks.registering(Jar::class) { - archiveClassifier.set("javadoc") - } - - configure { - repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { - name = "OSSRH" - - credentials { - username = System.getenv("OSSRH_USER") - password = System.getenv("OSSRH_KEY") - } - } - - publications.withType { - // Stub javadoc.jar artifact - artifact(javadocJar.get()) - - // Provide artifacts information requited by Maven Central - pom { - name.set("MOKO maps") - description.set("Control your map from common code for mobile (android & ios) Kotlin Multiplatform development") - url.set("https://github.com/icerockdev/moko-maps") - licenses { - license { - url.set("https://github.com/icerockdev/moko-maps/blob/master/LICENSE.md") - } - } - - developers { - developer { - id.set("Alex009") - name.set("Aleksey Mikhailov") - email.set("aleksey.mikhailov@icerockdev.com") - } - developer { - id.set("prokopishin") - name.set("Nikita Prokopishin") - email.set("nprokopishin@icerockdev.com") - } - developer { - id.set("Dorofeev") - name.set("Andrey Dorofeev") - email.set("adorofeev@icerockdev.com") - } - } - - scm { - connection.set("scm:git:ssh://github.com/icerockdev/moko-maps.git") - developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-maps.git") - url.set("https://github.com/icerockdev/moko-maps") - } - } - } - - apply(plugin = Deps.Plugins.signing.id) - - configure { - val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") - val signingPassword: String? = System.getenv("SIGNING_PASSWORD") - val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> - String(Base64.getDecoder().decode(base64Key)) - } - if (signingKeyId != null) { - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - sign(publications) - } - } + version = libs.versions.mokoMapsVersion.get() + } + configurations.configureEach { + resolutionStrategy { + val coroutines: MinimalExternalModuleDependency = rootProject.libs.coroutines.get() + val forcedCoroutines: ModuleVersionSelector = DefaultModuleVersionSelector.newSelector( + coroutines.module, + coroutines.versionConstraint.requiredVersion + ) + force(forcedCoroutines) } } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index e856d25..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -plugins { - id("org.jetbrains.kotlin.jvm") version("1.4.31") -} - -repositories { - mavenCentral() - google() - - jcenter { - content { - includeGroup("org.jetbrains.trove4j") - } - } -} - -dependencies { - implementation("dev.icerock:mobile-multiplatform:0.9.1") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31") - implementation("com.android.tools.build:gradle:4.1.1") -} diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt deleted file mode 100755 index 47947a1..0000000 --- a/buildSrc/src/main/kotlin/Deps.kt +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - - -object Deps { - private const val kotlinVersion = "1.4.31" - - private const val lifecycleVersion = "2.2.0" - private const val androidAppCompatVersion = "1.1.0" - private const val espressoCoreVersion = "3.2.0" - private const val testRunnerVersion = "1.2.0" - private const val testExtJunitVersion = "1.1.1" - private const val playServicesLocationVersion = "18.0.0" - private const val playServicesMapsVersion = "17.0.0" - private const val googleMapsServicesVersion = "0.2.11" - private const val mapboxVersion = "9.2.1" - private const val mapboxNavigationVersion = "0.42.6" - private const val mapboxAnnotationVersion = "0.9.0" - private const val multidexVersion = "2.0.1" - - private const val kotlinxSerializationVersion = "1.1.0" - private const val coroutinesVersion = "1.4.2-native-mt" - private const val ktorClientVersion = "1.5.2" - - private const val detektVersion = "1.15.0" - - private const val mokoGraphicsVersion = "0.6.1" - private const val mokoParcelizeVersion = "0.6.1" - private const val mokoResourcesVersion = "0.15.1" - private const val mokoMvvmVersion = "0.9.2" - private const val mokoGeoVersion = "0.3.2" - private const val mokoPermissionsVersion = "0.8.0" - const val mokoMapsVersion = "0.5.2" - - object Android { - const val compileSdk = 28 - const val targetSdk = 28 - const val minSdk = 21 - } - - object Plugins { - val androidApplication = GradlePlugin(id = "com.android.application") - val androidLibrary = GradlePlugin(id = "com.android.library") - val kotlinMultiplatform = GradlePlugin( - id = "org.jetbrains.kotlin.multiplatform", - module = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - ) - val kotlinKapt = GradlePlugin(id = "kotlin-kapt") - val kotlinAndroid = GradlePlugin(id = "kotlin-android") - val kotlinAndroidExtensions = GradlePlugin(id = "kotlin-parcelize") - val kotlinSerialization = GradlePlugin( - id = "org.jetbrains.kotlin.plugin.serialization", - module = "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion" - ) - val mavenPublish = GradlePlugin(id = "org.gradle.maven-publish") - val signing = GradlePlugin(id = "signing") - - val mobileMultiplatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform") - val iosFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.ios-framework") - - val mokoResources = GradlePlugin( - id = "dev.icerock.mobile.multiplatform-resources", - module = "dev.icerock.moko:resources-generator:$mokoResourcesVersion" - ) - - val detekt = GradlePlugin( - id = "io.gitlab.arturbosch.detekt", - version = detektVersion - ) - } - - object Libs { - object Android { - const val appCompat = - "androidx.appcompat:appcompat:$androidAppCompatVersion" - const val lifecycle = - "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion" - const val playServicesLocation = - "com.google.android.gms:play-services-location:$playServicesLocationVersion" - const val playServicesMaps = - "com.google.android.gms:play-services-maps:$playServicesMapsVersion" - const val googleMapsServices = - "com.google.maps:google-maps-services:$googleMapsServicesVersion" - const val mapbox = - "com.mapbox.mapboxsdk:mapbox-android-sdk:$mapboxVersion" - const val mapboxNavigation = - "com.mapbox.mapboxsdk:mapbox-android-navigation:$mapboxNavigationVersion" - const val mapboxAnnotation = - "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:$mapboxAnnotationVersion" - const val multidex = - "androidx.multidex:multidex:$multidexVersion" - const val ktorClientOkHttp = - "io.ktor:ktor-client-okhttp:$ktorClientVersion" - - object Tests { - const val espressoCore = - "androidx.test.espresso:espresso-core:$espressoCoreVersion" - const val kotlinTestJUnit = - "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion" - const val testCore = - "androidx.test:core:1.3.0" - const val robolectric = - "org.robolectric:robolectric:4.3" - const val testRunner = - "androidx.test:runner:$testRunnerVersion" - const val testRules = - "androidx.test:rules:$testRunnerVersion" - const val testExtJunit = - "androidx.test.ext:junit:$testExtJunitVersion" - } - } - - object MultiPlatform { - const val kotlinSerialization = - "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion" - const val coroutines = - "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - const val ktorClient = - "io.ktor:ktor-client-core:$ktorClientVersion" - const val mokoResources = - "dev.icerock.moko:resources:$mokoResourcesVersion" - const val mokoParcelize = - "dev.icerock.moko:parcelize:$mokoParcelizeVersion" - const val mokoGraphics = - "dev.icerock.moko:graphics:$mokoGraphicsVersion" - const val mokoMvvm = - "dev.icerock.moko:mvvm:$mokoMvvmVersion" - const val mokoGeo = - "dev.icerock.moko:geo:$mokoGeoVersion" - val mokoPermissions = MultiPlatformLibrary( - common = "dev.icerock.moko:permissions:$mokoPermissionsVersion", - iosX64 = "dev.icerock.moko:permissions-iosx64:$mokoPermissionsVersion", - iosArm64 = "dev.icerock.moko:permissions-iosarm64:$mokoPermissionsVersion" - ) - val mokoMaps = MultiPlatformLibrary( - common = "dev.icerock.moko:maps:$mokoMapsVersion", - iosX64 = "dev.icerock.moko:maps-iosx64:$mokoMapsVersion", - iosArm64 = "dev.icerock.moko:maps-iosarm64:$mokoMapsVersion" - ) - val mokoMapsGoogle = MultiPlatformLibrary( - common = "dev.icerock.moko:maps-google:$mokoMapsVersion", - iosX64 = "dev.icerock.moko:maps-google-iosx64:$mokoMapsVersion", - iosArm64 = "dev.icerock.moko:maps-google-iosarm64:$mokoMapsVersion" - ) - val mokoMapsMapbox = MultiPlatformLibrary( - common = "dev.icerock.moko:maps-mapbox:$mokoMapsVersion", - iosX64 = "dev.icerock.moko:maps-mapbox-iosx64:$mokoMapsVersion", - iosArm64 = "dev.icerock.moko:maps-mapbox-iosarm64:$mokoMapsVersion" - ) - - object Tests { - const val kotlinTest = - "org.jetbrains.kotlin:kotlin-test-common:$kotlinVersion" - const val kotlinTestAnnotations = - "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlinVersion" - } - } - - object Ios { - const val ktorClientIos = - "io.ktor:ktor-client-ios:$ktorClientVersion" - } - - object Detekt { - const val detektFormatting = - "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion" - } - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..310b673 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,53 @@ +[versions] +kotlinVersion = "1.5.20" +lifecycleVersion = "2.2.0" +androidAppCompatVersion = "1.2.0" +espressoCoreVersion = "3.2.0" +testRunnerVersion = "1.2.0" +testExtJunitVersion = "1.1.1" +playServicesLocationVersion = "18.0.0" +playServicesMapsVersion = "17.0.0" +googleMapsServicesVersion = "0.2.11" +mapboxVersion = "9.6.1" +mapboxNavigationVersion = "1.5.1" +mapboxAnnotationVersion = "0.9.0" +mapboxServicesVersion = "5.8.0" +multidexVersion = "2.0.1" +kotlinxSerializationVersion = "1.2.1" +coroutinesVersion = "1.5.0-native-mt" +ktorClientVersion = "1.6.0" +mokoGraphicsVersion = "0.7.0" +mokoParcelizeVersion = "0.7.1" +mokoResourcesVersion = "0.16.1" +mokoMvvmVersion = "0.11.0" +mokoGeoVersion = "0.4.0" +mokoPermissionsVersion = "0.10.1" +mokoMapsVersion = "0.6.0" + +[libraries] +appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" } +lifecycle = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleVersion" } +playServicesLocation = { module = "com.google.android.gms:play-services-location", version.ref = "playServicesLocationVersion" } +playServicesMaps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMapsVersion" } +googleMapsServices = { module = "com.google.maps:google-maps-services", version.ref = "googleMapsServicesVersion" } +mapbox = { module = "com.mapbox.mapboxsdk:mapbox-android-sdk", version.ref = "mapboxVersion" } +mapboxNavigation = { module = "com.mapbox.navigation:core", version.ref = "mapboxNavigationVersion" } +mapboxAnnotation = { module = "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9", version.ref = "mapboxAnnotationVersion" } +mapboxServices = { module = "com.mapbox.mapboxsdk:mapbox-sdk-services", version.ref = "mapboxServicesVersion" } +multidex = { module = "androidx.multidex:multidex", version.ref = "multidexVersion" } +ktorClientOkHttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorClientVersion" } +kotlinSerialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationVersion" } +coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutinesVersion" } +ktorClient = { module = "io.ktor:ktor-client-core", version.ref = "ktorClientVersion" } +mokoResources = { module = "dev.icerock.moko:resources", version.ref = "mokoResourcesVersion" } +mokoParcelize = { module = "dev.icerock.moko:parcelize", version.ref = "mokoParcelizeVersion" } +mokoGraphics = { module = "dev.icerock.moko:graphics", version.ref = "mokoGraphicsVersion" } +mokoMvvm = { module = "dev.icerock.moko:mvvm", version.ref = "mokoMvvmVersion" } +mokoGeo = { module = "dev.icerock.moko:geo", version.ref = "mokoGeoVersion" } +mokoPermissions = { module = "dev.icerock.moko:permissions", version.ref = "mokoPermissionsVersion" } +mokoMaps = { module = "dev.icerock.moko:maps", version.ref = "mokoMapsVersion" } +mokoMapsGoogle = { module = "dev.icerock.moko:maps-google", version.ref = "mokoMapsVersion" } +mokoMapsMapbox = { module = "dev.icerock.moko:maps-mapbox", version.ref = "mokoMapsVersion" } +kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlinVersion" } +ktorClientIos = { module = "io.ktor:ktor-client-ios", version.ref = "ktorClientVersion" } + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d913..0f80bbf 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/maps-build-logic/build.gradle.kts b/maps-build-logic/build.gradle.kts new file mode 100644 index 0000000..84cbae3 --- /dev/null +++ b/maps-build-logic/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() + google() + + gradlePluginPortal() +} + +dependencies { + api("dev.icerock:mobile-multiplatform:0.12.0") + api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20") + api("com.android.tools.build:gradle:4.2.1") + api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0") +} diff --git a/maps-build-logic/src/main/kotlin/android-app-convention.gradle.kts b/maps-build-logic/src/main/kotlin/android-app-convention.gradle.kts new file mode 100644 index 0000000..2859874 --- /dev/null +++ b/maps-build-logic/src/main/kotlin/android-app-convention.gradle.kts @@ -0,0 +1,32 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("com.android.application") + id("android-base-convention") + id("kotlin-android") +} + +android { + dexOptions { + javaMaxHeapSize = "2g" + } + + buildTypes { + getByName("release") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + getByName("debug") { + isDebuggable = true + applicationIdSuffix = ".debug" + } + } + + packagingOptions { + exclude("META-INF/*.kotlin_module") + exclude("META-INF/AL2.0") + exclude("META-INF/LGPL2.1") + } +} diff --git a/maps-build-logic/src/main/kotlin/android-base-convention.gradle.kts b/maps-build-logic/src/main/kotlin/android-base-convention.gradle.kts new file mode 100644 index 0000000..bfd44d3 --- /dev/null +++ b/maps-build-logic/src/main/kotlin/android-base-convention.gradle.kts @@ -0,0 +1,14 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +import com.android.build.gradle.BaseExtension + +configure { + compileSdkVersion(30) + + defaultConfig { + minSdkVersion(21) + targetSdkVersion(30) + } +} diff --git a/maps-build-logic/src/main/kotlin/android-library-convention.gradle.kts b/maps-build-logic/src/main/kotlin/android-library-convention.gradle.kts new file mode 100644 index 0000000..c435401 --- /dev/null +++ b/maps-build-logic/src/main/kotlin/android-library-convention.gradle.kts @@ -0,0 +1,13 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("android-base-convention") +} + +android { + sourceSets.all { java.srcDir("src/$name/kotlin") } +} diff --git a/maps-build-logic/src/main/kotlin/android-publication-convention.gradle.kts b/maps-build-logic/src/main/kotlin/android-publication-convention.gradle.kts new file mode 100644 index 0000000..b4dae9e --- /dev/null +++ b/maps-build-logic/src/main/kotlin/android-publication-convention.gradle.kts @@ -0,0 +1,15 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("publication-convention") +} + +afterEvaluate { + publishing.publications { + create("release", MavenPublication::class.java) { + from(components.getByName("release")) + } + } +} diff --git a/maps-build-logic/src/main/kotlin/detekt-convention.gradle.kts b/maps-build-logic/src/main/kotlin/detekt-convention.gradle.kts new file mode 100644 index 0000000..68343a8 --- /dev/null +++ b/maps-build-logic/src/main/kotlin/detekt-convention.gradle.kts @@ -0,0 +1,15 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("io.gitlab.arturbosch.detekt") +} + +detekt { + input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin", "src/main/kotlin") +} + +dependencies { + "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0") +} diff --git a/maps-build-logic/src/main/kotlin/javadoc-stub-convention.gradle.kts b/maps-build-logic/src/main/kotlin/javadoc-stub-convention.gradle.kts new file mode 100644 index 0000000..a1a2691 --- /dev/null +++ b/maps-build-logic/src/main/kotlin/javadoc-stub-convention.gradle.kts @@ -0,0 +1,16 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("org.gradle.maven-publish") +} + +val javadocJar by tasks.registering(Jar::class) { + archiveClassifier.set("javadoc") +} + +publishing.publications.withType { + // Stub javadoc.jar artifact + artifact(javadocJar.get()) +} diff --git a/maps-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts b/maps-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts new file mode 100644 index 0000000..347106b --- /dev/null +++ b/maps-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts @@ -0,0 +1,18 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.multiplatform") + id("android-base-convention") + id("dev.icerock.mobile.multiplatform.android-manifest") +} + +kotlin { + ios() + android { + publishLibraryVariants("release", "debug") + } +} + diff --git a/maps-build-logic/src/main/kotlin/publication-convention.gradle.kts b/maps-build-logic/src/main/kotlin/publication-convention.gradle.kts new file mode 100644 index 0000000..46eeeca --- /dev/null +++ b/maps-build-logic/src/main/kotlin/publication-convention.gradle.kts @@ -0,0 +1,75 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +import java.util.Base64 + +plugins { + id("javadoc-stub-convention") + id("org.gradle.maven-publish") + id("signing") +} + +publishing { + repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + name = "OSSRH" + + credentials { + username = System.getenv("OSSRH_USER") + password = System.getenv("OSSRH_KEY") + } + } + + publications.withType { + // Provide artifacts information requited by Maven Central + pom { + name.set("MOKO maps") + description.set("Control your map from common code for mobile (android & ios) Kotlin Multiplatform development") + url.set("https://github.com/icerockdev/moko-maps") + licenses { + license { + name.set("Apache-2.0") + distribution.set("repo") + url.set("https://github.com/icerockdev/moko-maps/blob/master/LICENSE.md") + } + } + + developers { + developer { + id.set("Alex009") + name.set("Aleksey Mikhailov") + email.set("aleksey.mikhailov@icerockdev.com") + } + developer { + id.set("prokopishin") + name.set("Nikita Prokopishin") + email.set("nprokopishin@icerockdev.com") + } + developer { + id.set("Dorofeev") + name.set("Andrey Dorofeev") + email.set("adorofeev@icerockdev.com") + } + } + + scm { + connection.set("scm:git:ssh://github.com/icerockdev/moko-maps.git") + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-maps.git") + url.set("https://github.com/icerockdev/moko-maps") + } + } + } +} + + +signing { + val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> + String(Base64.getDecoder().decode(base64Key)) + } + if (signingKeyId != null) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) + } +} diff --git a/maps-google/build.gradle.kts b/maps-google/build.gradle.kts index f18506e..20583c1 100644 --- a/maps-google/build.gradle.kts +++ b/maps-google/build.gradle.kts @@ -3,32 +3,32 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.kotlinKapt) - plugin(Deps.Plugins.kotlinAndroidExtensions) - plugin(Deps.Plugins.kotlinSerialization) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mavenPublish) + id("multiplatform-library-convention") + id("dev.icerock.mobile.multiplatform.android-manifest") + id("publication-convention") + id("kotlin-parcelize") + id("kotlin-kapt") + id("kotlinx-serialization") + id("dev.icerock.mobile.multiplatform.cocoapods") } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.coroutines) - commonMainImplementation(Deps.Libs.MultiPlatform.ktorClient) - commonMainImplementation(Deps.Libs.MultiPlatform.kotlinSerialization) + commonMainImplementation(libs.coroutines) + commonMainImplementation(libs.ktorClient) + commonMainImplementation(libs.kotlinSerialization) - commonMainApi(project(":maps")) - commonMainApi(Deps.Libs.MultiPlatform.mokoGeo) - commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics) + commonMainApi(projects.maps) + commonMainApi(libs.mokoGeo) + commonMainApi(libs.mokoGraphics) - androidMainImplementation(Deps.Libs.Android.appCompat) - androidMainImplementation(Deps.Libs.Android.lifecycle) - androidMainImplementation(Deps.Libs.Android.playServicesLocation) - androidMainImplementation(Deps.Libs.Android.playServicesMaps) - androidMainImplementation(Deps.Libs.Android.googleMapsServices) - androidMainImplementation(Deps.Libs.Android.ktorClientOkHttp) + "androidMainImplementation"(libs.appCompat) + "androidMainImplementation"(libs.lifecycle) + "androidMainApi"(libs.playServicesLocation) + "androidMainApi"(libs.playServicesMaps) + "androidMainImplementation"(libs.googleMapsServices) + "androidMainImplementation"(libs.ktorClientOkHttp) - iosMainImplementation(Deps.Libs.Ios.ktorClientIos) + "iosMainImplementation"(libs.ktorClientIos) } cocoaPods { diff --git a/maps-mapbox/build.gradle.kts b/maps-mapbox/build.gradle.kts index 5b89874..92242b6 100644 --- a/maps-mapbox/build.gradle.kts +++ b/maps-mapbox/build.gradle.kts @@ -3,24 +3,25 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.kotlinAndroidExtensions) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mavenPublish) + id("multiplatform-library-convention") + id("dev.icerock.mobile.multiplatform.android-manifest") + id("publication-convention") + id("kotlin-parcelize") + id("dev.icerock.mobile.multiplatform.cocoapods") } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.coroutines) + commonMainImplementation(libs.coroutines) - commonMainApi(project(":maps")) + commonMainApi(projects.maps) - androidMainImplementation(Deps.Libs.Android.appCompat) - androidMainImplementation(Deps.Libs.Android.lifecycle) - androidMainImplementation(Deps.Libs.Android.playServicesLocation) - androidMainImplementation(Deps.Libs.Android.mapbox) - androidMainImplementation(Deps.Libs.Android.mapboxAnnotation) - androidMainImplementation(Deps.Libs.Android.mapboxNavigation) + "androidMainImplementation"(libs.appCompat) + "androidMainImplementation"(libs.lifecycle) + "androidMainImplementation"(libs.playServicesLocation) + "androidMainImplementation"(libs.mapboxAnnotation) + "androidMainImplementation"(libs.mapboxServices) + "androidMainApi"(libs.mapbox) + "androidMainApi"(libs.mapboxNavigation) } cocoaPods { diff --git a/maps/build.gradle.kts b/maps/build.gradle.kts index 69da000..3e12ebf 100644 --- a/maps/build.gradle.kts +++ b/maps/build.gradle.kts @@ -3,23 +3,20 @@ */ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.kotlinKapt) - plugin(Deps.Plugins.kotlinAndroidExtensions) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mavenPublish) + id("multiplatform-library-convention") + id("dev.icerock.mobile.multiplatform.android-manifest") + id("publication-convention") + id("kotlin-kapt") + id("kotlin-parcelize") } dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.coroutines) { - isForce = true - } + commonMainImplementation(libs.coroutines) - commonMainApi(Deps.Libs.MultiPlatform.mokoResources) - commonMainApi(Deps.Libs.MultiPlatform.mokoGeo) - commonMainApi(Deps.Libs.MultiPlatform.mokoGraphics) - commonMainApi(Deps.Libs.MultiPlatform.mokoParcelize) + commonMainApi(libs.mokoResources) + commonMainApi(libs.mokoGeo) + commonMainApi(libs.mokoGraphics) + commonMainApi(libs.mokoParcelize) - commonMainImplementation(Deps.Libs.MultiPlatform.mokoPermissions.common) + commonMainImplementation(libs.mokoPermissions) } diff --git a/sample/android-app/build.gradle.kts b/sample/android-app/build.gradle.kts index 5cdb04f..4241244 100644 --- a/sample/android-app/build.gradle.kts +++ b/sample/android-app/build.gradle.kts @@ -1,57 +1,37 @@ plugins { - plugin(Deps.Plugins.androidApplication) - plugin(Deps.Plugins.kotlinAndroid) - plugin(Deps.Plugins.kotlinKapt) + id("android-app-convention") + id("kotlin-android") + id("kotlin-kapt") } android { - compileSdkVersion(Deps.Android.compileSdk) - buildFeatures.dataBinding = true - dexOptions { - javaMaxHeapSize = "2g" - } - defaultConfig { - minSdkVersion(Deps.Android.minSdk) - targetSdkVersion(Deps.Android.targetSdk) - applicationId = "dev.icerock.moko.samples.maps" versionCode = 1 versionName = "0.1.0" - vectorDrawables.useSupportLibrary = true - multiDexEnabled = true - } - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - } - getByName("debug") { - isDebuggable = true - applicationIdSuffix = ".debug" - } - } + val googleMapsApiKey: String = (System.getenv("GOOGLE_MAPS_API_KEY") ?: extra["googleMaps.apiKey"] as? String).orEmpty() + val mapboxPublicToken: String = (System.getenv("MAPBOX_PUBLIC_TOKEN") ?: extra["mapbox.publicToken"] as? String).orEmpty() - packagingOptions { - exclude("META-INF/*.kotlin_module") + manifestPlaceholders["googleMapsApiKey"] = googleMapsApiKey + buildConfigField("String", "GOOGLE_MAPS_API_KEY", "\"$googleMapsApiKey\"") + buildConfigField("String", "MAPBOX_PUBLIC_TOKEN", "\"$mapboxPublicToken\"") } } dependencies { - implementation(Deps.Libs.Android.appCompat) - implementation(Deps.Libs.Android.playServicesLocation) - implementation(Deps.Libs.Android.playServicesMaps) - implementation(Deps.Libs.Android.googleMapsServices) - implementation(Deps.Libs.Android.mapbox) - implementation(Deps.Libs.Android.mapboxAnnotation) + implementation(libs.appCompat) + implementation(libs.playServicesLocation) + implementation(libs.playServicesMaps) + implementation(libs.googleMapsServices) + implementation(libs.mapbox) - implementation(Deps.Libs.Android.multidex) + implementation(libs.multidex) - implementation(project(":sample:mpp-library")) + implementation(projects.sample.mppLibrary) } diff --git a/sample/android-app/src/main/AndroidManifest.xml b/sample/android-app/src/main/AndroidManifest.xml index 7d1c132..ee7681f 100755 --- a/sample/android-app/src/main/AndroidManifest.xml +++ b/sample/android-app/src/main/AndroidManifest.xml @@ -22,7 +22,6 @@ - - + diff --git a/sample/android-app/src/main/java/com/icerockdev/app/GoogleMapsActivity.kt b/sample/android-app/src/main/java/com/icerockdev/app/GoogleMapsActivity.kt index 458ab18..0250d8c 100644 --- a/sample/android-app/src/main/java/com/icerockdev/app/GoogleMapsActivity.kt +++ b/sample/android-app/src/main/java/com/icerockdev/app/GoogleMapsActivity.kt @@ -27,8 +27,7 @@ class GoogleMapsActivity : MvvmActivity() { override val viewModelVariableId: Int = BR.viewModel override val viewModelClass: Class = MapboxViewModel::class.java - private val mapboxToken = "YOUR-ACCESS-TOKEN" + private val mapboxToken = BuildConfig.MAPBOX_PUBLIC_TOKEN override fun viewModelFactory(): ViewModelProvider.Factory { return createViewModelFactory { diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts deleted file mode 100644 index 33ed62b..0000000 --- a/sample/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. - */ - -subprojects { - configurations.all { - resolutionStrategy.dependencySubstitution { - listOf( - Deps.Libs.MultiPlatform.mokoMaps to ":maps", - Deps.Libs.MultiPlatform.mokoMapsGoogle to ":maps-google", - Deps.Libs.MultiPlatform.mokoMapsMapbox to ":maps-mapbox" - ).flatMap { (mpl, project) -> - listOfNotNull( - mpl.common, - mpl.iosX64, - mpl.iosArm64 - ).map { it to project } - }.forEach { (moduleSpec, projectSpec) -> - substitute(module(moduleSpec)) - .with(project(projectSpec)) - } - } - } -} diff --git a/sample/ios-app/Podfile b/sample/ios-app/Podfile index 6a48575..48da49c 100644 --- a/sample/ios-app/Podfile +++ b/sample/ios-app/Podfile @@ -12,9 +12,9 @@ platform :ios, '11.0' target 'TestProj' do # MultiPlatformLibrary pod 'MultiPlatformLibrary', :path => '../mpp-library' - pod 'Mapbox-iOS-SDK', '5.6.0' - pod 'MapboxNavigation', '0.40.0' - pod 'GoogleMaps', '3.7.0' + pod 'Mapbox-iOS-SDK', '6.3.0' + pod 'MapboxNavigation', '1.4.1' + pod 'GoogleMaps', '5.1.0' end # GoogleMaps is static library that already linked in moko-maps-google. Remove duplicated linking. diff --git a/sample/ios-app/TestProj.xcodeproj/project.pbxproj b/sample/ios-app/TestProj.xcodeproj/project.pbxproj index 6b320c3..e1d55ef 100644 --- a/sample/ios-app/TestProj.xcodeproj/project.pbxproj +++ b/sample/ios-app/TestProj.xcodeproj/project.pbxproj @@ -289,6 +289,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 4VU932NX78; INFOPLIST_FILE = src/Info.plist; + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.maps; PRODUCT_NAME = "moko-maps"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -307,6 +308,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 4VU932NX78; INFOPLIST_FILE = src/Info.plist; + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.maps; PRODUCT_NAME = "moko-maps"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/sample/ios-app/src/AppDelegate.swift b/sample/ios-app/src/AppDelegate.swift index be44ee7..4cbbb7c 100755 --- a/sample/ios-app/src/AppDelegate.swift +++ b/sample/ios-app/src/AppDelegate.swift @@ -12,8 +12,7 @@ class AppDelegate: NSObject, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - // TODO: Replace with your API Key from https://developers.google.com/maps/documentation/ios-sdk/ - GMSServices.provideAPIKey("YOUR-API-KEY") + GMSServices.provideAPIKey(Bundle.main.object(forInfoDictionaryKey: "GoogleAPIkey") as! String) // For Mapbox add key "MGLMapboxAccessToken" in Info.plist return true diff --git a/sample/ios-app/src/GoogleMapViewController.swift b/sample/ios-app/src/GoogleMapViewController.swift index f512b2e..96949b2 100644 --- a/sample/ios-app/src/GoogleMapViewController.swift +++ b/sample/ios-app/src/GoogleMapViewController.swift @@ -20,7 +20,7 @@ class GoogleMapViewController: UIViewController { permissionsController: PermissionsController(), googleMapController: GoogleMapController( mapView: mapView, - geoApiKey: "YOUR-API-KEY" + geoApiKey: Bundle.main.object(forInfoDictionaryKey: "GoogleAPIkey") as! String ) ) diff --git a/sample/ios-app/src/Info.plist b/sample/ios-app/src/Info.plist index 58bce56..fffcf9c 100755 --- a/sample/ios-app/src/Info.plist +++ b/sample/ios-app/src/Info.plist @@ -61,7 +61,9 @@ UIInterfaceOrientationPortraitUpsideDown MGLMapboxAccessToken - YOUR-ACCESS-TOKEN + YOUR_PUBLIC_MAPBOX_KEY + GoogleAPIkey + YOUR_API_KEY MGLMapboxMetricsEnabledSettingShownInApp diff --git a/sample/mpp-library/build.gradle.kts b/sample/mpp-library/build.gradle.kts index b7a10a7..2268b59 100644 --- a/sample/mpp-library/build.gradle.kts +++ b/sample/mpp-library/build.gradle.kts @@ -1,24 +1,29 @@ plugins { - plugin(Deps.Plugins.androidLibrary) - plugin(Deps.Plugins.kotlinMultiplatform) - plugin(Deps.Plugins.mobileMultiplatform) - plugin(Deps.Plugins.mokoResources) - plugin(Deps.Plugins.iosFramework) + id("com.android.library") + id("android-base-convention") + id("detekt-convention") + id("org.jetbrains.kotlin.multiplatform") + id("dev.icerock.mobile.multiplatform.android-manifest") + id("dev.icerock.mobile.multiplatform.ios-framework") + id("dev.icerock.mobile.multiplatform-resources") + id("dev.icerock.mobile.multiplatform.cocoapods") } -dependencies { - commonMainImplementation(Deps.Libs.MultiPlatform.coroutines) - - commonMainApi(Deps.Libs.MultiPlatform.mokoGeo) - commonMainApi(Deps.Libs.MultiPlatform.mokoMvvm) - commonMainApi(Deps.Libs.MultiPlatform.mokoPermissions.common) - commonMainApi(Deps.Libs.MultiPlatform.mokoMaps.common) - commonMainApi(Deps.Libs.MultiPlatform.mokoMapsGoogle.common) - commonMainApi(Deps.Libs.MultiPlatform.mokoMapsMapbox.common) +kotlin{ + android() + ios() +} - androidMainImplementation(Deps.Libs.Android.lifecycle) - androidMainImplementation(Deps.Libs.Android.playServicesLocation) - androidMainImplementation(Deps.Libs.Android.mapbox) +dependencies { + commonMainImplementation(libs.coroutines) + commonMainImplementation(libs.mokoResources) + commonMainApi(libs.mokoGeo) + commonMainApi(libs.mokoMvvm) + commonMainApi(libs.mokoPermissions) + commonMainApi(projects.maps) + commonMainApi(projects.mapsGoogle) + commonMainApi(projects.mapsMapbox) + "androidMainImplementation"(libs.lifecycle) } multiplatformResources { @@ -26,10 +31,10 @@ multiplatformResources { } framework { - export(Deps.Libs.MultiPlatform.mokoPermissions) - export(Deps.Libs.MultiPlatform.mokoMaps) - export(Deps.Libs.MultiPlatform.mokoMapsGoogle) - export(Deps.Libs.MultiPlatform.mokoMapsMapbox) + export(libs.mokoPermissions) + export(projects.maps) + export(projects.mapsGoogle) + export(projects.mapsMapbox) } cocoaPods { diff --git a/settings.gradle.kts b/settings.gradle.kts index ab14bd6..697b2c0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,6 +2,39 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ +enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +dependencyResolutionManagement { + repositories { + mavenCentral() + google() + + maven { + url = uri("https://api.mapbox.com/downloads/v2/releases/maven") + authentication { + create("basic", org.gradle.authentication.http.BasicAuthentication::class) + } + credentials { + // Do not change the username below. + // This should always be `mapbox` (not your username). + username = "mapbox" + // Use the secret token you stored in gradle.properties as the password + password = System.getenv("MAPBOX_SECRET_TOKEN") + ?: extra["mapbox.secretToken"] as? String + } + } + + jcenter { + content { + includeGroup("org.jetbrains.kotlinx") + } + } + } +} + +includeBuild("maps-build-logic") + include(":maps") include(":maps-google") include(":maps-mapbox")