-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/kotlin-2.0
- Loading branch information
Showing
47 changed files
with
1,639 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree | ||
|
||
/* | ||
* Copyright (c) 2023 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
version = project.property("firebase-analytics.version") as String | ||
|
||
plugins { | ||
id("com.android.library") | ||
kotlin("native.cocoapods") | ||
kotlin("multiplatform") | ||
} | ||
|
||
android { | ||
val minSdkVersion: Int by project | ||
val compileSdkVersion: Int by project | ||
|
||
compileSdk = compileSdkVersion | ||
namespace = "dev.gitlive.firebase.analytics" | ||
|
||
defaultConfig { | ||
minSdk = minSdkVersion | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
testOptions { | ||
unitTests.apply { | ||
isIncludeAndroidResources = true | ||
} | ||
} | ||
packaging { | ||
resources.pickFirsts.add("META-INF/kotlinx-serialization-core.kotlin_module") | ||
resources.pickFirsts.add("META-INF/AL2.0") | ||
resources.pickFirsts.add("META-INF/LGPL2.1") | ||
} | ||
lint { | ||
abortOnError = false | ||
} | ||
} | ||
|
||
val supportIosTarget = project.property("skipIosTarget") != "true" | ||
|
||
kotlin { | ||
|
||
targets.configureEach { | ||
compilations.configureEach { | ||
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes" | ||
} | ||
} | ||
|
||
@Suppress("OPT_IN_USAGE") | ||
androidTarget { | ||
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test) | ||
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test) | ||
publishAllLibraryVariants() | ||
compilations.configureEach { | ||
kotlinOptions { | ||
jvmTarget = "11" | ||
} | ||
} | ||
} | ||
|
||
jvm { | ||
compilations.getByName("main") { | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
} | ||
compilations.getByName("test") { | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
} | ||
} | ||
|
||
if (supportIosTarget) { | ||
iosArm64() | ||
iosX64() | ||
iosSimulatorArm64() | ||
cocoapods { | ||
ios.deploymentTarget = "12.0" | ||
framework { | ||
baseName = "FirebaseAnalytics" | ||
} | ||
noPodspec() | ||
pod("FirebaseAnalytics") { | ||
version = "10.25.0" | ||
extraOpts += listOf("-compiler-option", "-fmodules") | ||
} | ||
} | ||
} | ||
|
||
js(IR) { | ||
useCommonJs() | ||
nodejs { | ||
testTask( | ||
Action { | ||
useKarma { | ||
useChromeHeadless() | ||
} | ||
} | ||
) | ||
} | ||
browser { | ||
testTask( | ||
Action { | ||
useKarma { | ||
useChromeHeadless() | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
||
sourceSets { | ||
all { | ||
languageSettings.apply { | ||
val apiVersion: String by project | ||
val languageVersion: String by project | ||
this.apiVersion = apiVersion | ||
this.languageVersion = languageVersion | ||
progressiveMode = true | ||
if (name.lowercase().contains("ios")) { | ||
optIn("kotlinx.cinterop.ExperimentalForeignApi") | ||
} | ||
} | ||
} | ||
|
||
getByName("commonMain") { | ||
dependencies { | ||
api(project(":firebase-app")) | ||
implementation(project(":firebase-common")) | ||
} | ||
} | ||
|
||
getByName("commonTest") { | ||
dependencies { | ||
implementation(project(":test-utils")) | ||
} | ||
} | ||
|
||
getByName("androidMain") { | ||
dependencies { | ||
api("com.google.firebase:firebase-analytics") | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (project.property("firebase-analytics.skipIosTests") == "true") { | ||
tasks.forEach { | ||
if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } | ||
} | ||
} | ||
|
||
if (project.property("firebase-analytics.skipJsTests") == "true") { | ||
tasks.forEach { | ||
if (it.name.contains("js", true) && it.name.contains("test", true)) { it.enabled = false } | ||
} | ||
} | ||
|
||
signing { | ||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign(publishing.publications) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Pod::Spec.new do |spec| | ||
spec.name = 'firebase_analytics' | ||
spec.version = '1.8.1' | ||
spec.homepage = '' | ||
spec.source = { :http=> ''} | ||
spec.authors = '' | ||
spec.license = '' | ||
spec.summary = '' | ||
spec.vendored_frameworks = 'build/cocoapods/framework/firebase_analytics.framework' | ||
spec.libraries = 'c++' | ||
|
||
|
||
|
||
spec.pod_target_xcconfig = { | ||
'KOTLIN_PROJECT_PATH' => ':firebase-analytics', | ||
'PRODUCT_MODULE_NAME' => 'firebase_analytics', | ||
} | ||
|
||
spec.script_phases = [ | ||
{ | ||
:name => 'Build firebase_analytics', | ||
:execution_position => :before_compile, | ||
:shell_path => '/bin/sh', | ||
:script => <<-SCRIPT | ||
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then | ||
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\"" | ||
exit 0 | ||
fi | ||
set -ev | ||
REPO_ROOT="$PODS_TARGET_SRCROOT" | ||
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \ | ||
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \ | ||
-Pkotlin.native.cocoapods.archs="$ARCHS" \ | ||
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION" | ||
SCRIPT | ||
} | ||
] | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@gitlive/firebase-analytics", | ||
"version": "1.12.0", | ||
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects", | ||
"main": "firebase-analytics.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/GitLiveApp/firebase-kotlin-sdk.git" | ||
}, | ||
"keywords": [ | ||
"kotlin", | ||
"multiplatform", | ||
"kotlin-js", | ||
"firebase" | ||
], | ||
"author": "dev.gitlive", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/GitLiveApp/firebase-kotlin-sdk/issues" | ||
}, | ||
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", | ||
"dependencies": { | ||
"@gitlive/firebase-app": "1.12.0", | ||
"firebase": "9.19.1", | ||
"kotlin": "1.6.10", | ||
"kotlinx-coroutines-core": "1.6.1-native-mt" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
firebase-analytics/src/androidInstrumentedTest/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<application android:usesCleartextTraffic="true" /> | ||
</manifest> |
15 changes: 15 additions & 0 deletions
15
...-analytics/src/androidInstrumentedTest/kotlin/dev/gitlive/firebase/analytics/analytics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
@file:JvmName("tests") | ||
package dev.gitlive.firebase.analytics | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
|
||
actual val emulatorHost: String = "10.0.2.2" | ||
|
||
actual val context: Any = InstrumentationRegistry.getInstrumentation().targetContext | ||
|
||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) | ||
actual annotation class IgnoreForAndroidUnitTest |
Oops, something went wrong.