Skip to content

build config changes #151

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

Merged
merged 3 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
local.properties
/**/*.iml
*.iml
firebase-app/src/iosMain/c_interop/modules/
firebase-functions/src/iosMain/c_interop/modules/
firebase-auth/src/iosMain/c_interop/modules/
firebase-firestore/src/iosMain/c_interop/modules/
firebase-database/src/iosMain/c_interop/modules/
firebase-app/src/nativeInterop/cinterop/modules/
firebase-functions/src/nativeInterop/cinterop/modules/
firebase-auth/src/nativeInterop/cinterop/modules/
firebase-firestore/src/nativeInterop/cinterop/modules/
firebase-database/src/nativeInterop/cinterop/modules/
Firebase*.zip
/Firebase
/.DS_Store
*.log


/**/Cartfile.resolved
/**/c_interop/Carthage/
/**/nativeInterop/cinterop/Cartfile.resolved
/**/nativeInterop/cinterop/Carthage/
29 changes: 17 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import de.undercouch.gradle.tasks.download.Download
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
kotlin("multiplatform") version "1.4.21" apply false
id("de.undercouch.download").version("4.1.1")
id("base")
}

Expand All @@ -20,14 +19,22 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.1")
classpath("de.undercouch:gradle-download-task:4.1.1")
classpath("com.adarshr:gradle-test-logger-plugin:2.0.0")
}
}

val targetSdkVersion by extra(28)
val minSdkVersion by extra(16)

// TODO: Hierarchical project structures are not fully supported in IDEA, enable only for a regular built (https://youtrack.jetbrains.com/issue/KT-35011)
// add idea.active=true for local development
val _ideaActive = gradleLocalProperties(rootDir)["idea.active"] == "true"

//if (!_ideaActive) {
// ext["kotlin.mpp.enableGranularSourceSetsMetadata"] = "true"
// ext["kotlin.native.enableDependencyPropagation"] = "false"
//}

tasks {
val updateVersions by registering {
dependsOn(
Expand All @@ -43,6 +50,8 @@ tasks {

subprojects {

val ideaActive by extra(_ideaActive)

group = "dev.gitlive"

apply(plugin="com.adarshr.test-logger")
Expand All @@ -54,11 +63,9 @@ subprojects {
jcenter()
}


tasks.withType<Sign>().configureEach {
onlyIf { !project.gradle.startParameter.taskNames.contains("publishToMavenLocal") }
}


tasks {

Expand Down Expand Up @@ -155,7 +162,7 @@ subprojects {
executable = "carthage"
args(
it,
"--project-directory", "src/iosMain/c_interop",
"--project-directory", projectDir.resolve("src/nativeInterop/cinterop"),
"--platform", "iOS",
"--cache-builds"
)
Expand All @@ -170,8 +177,10 @@ subprojects {

create("carthageClean", Delete::class.java) {
group = "carthage"
delete(File("$projectDir/src/iosMain/c_interop/Carthage"))
delete(File("$projectDir/src/iosMain/c_interop/Cartfile.resolved"))
delete(
projectDir.resolve("src/nativeInterop/cinterop/Carthage"),
projectDir.resolve("src/nativeInterop/cinterop/Cartfile.resolved")
)
}
}

Expand Down Expand Up @@ -254,11 +263,7 @@ subprojects {
comments.set("A business-friendly OSS license")
}
}

}
}

}

}

61 changes: 42 additions & 19 deletions firebase-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

version = project.property("firebase-app.version") as String

plugins {
Expand Down Expand Up @@ -41,47 +44,67 @@ android {
}

kotlin {
js {
useCommonJs()
nodejs()
browser()
}

android {
publishLibraryVariants("release", "debug")
publishAllLibraryVariants()
}

val iosArm64 = iosArm64()
val iosX64 = iosX64("ios") {
fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = {
val nativeFrameworkPaths = listOf(
projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS")
)

binaries {
getTest("DEBUG").apply {
linkerOpts("-F$projectDir/src/iosMain/c_interop/Carthage/Build/iOS/")
linkerOpts(nativeFrameworkPaths.map { "-F$it" })
linkerOpts("-ObjC")
}
}

compilations.getByName("main") {
cinterops.create("FirebaseCore") {
compilerOpts(nativeFrameworkPaths.map { "-F$it" })
extraOpts("-verbose")
}
}
}

if (project.extra["ideaActive"] as Boolean) {
iosX64("ios", nativeTargetConfig())
} else {
ios(configure = nativeTargetConfig())
}

js {
useCommonJs()
nodejs()
browser()
}

sourceSets {
all {
languageSettings.apply {
apiVersion = "1.4"
languageVersion = "1.4"
progressiveMode = true
}
}

val commonMain by getting {
dependencies {
implementation(project(":firebase-common"))
}
}

val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-common:19.5.0")
}
}

configure(listOf(iosArm64, iosX64)) {
compilations.getByName("main") {
source(sourceSets.get("iosMain"))
val firebasecore by cinterops.creating {
packageName("cocoapods.FirebaseCore")
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseCore.def"))
compilerOpts("-F$projectDir/src/iosMain/c_interop/Carthage/Build/iOS/")
}
}
}
val iosMain by getting

val jsMain by getting
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language = Objective-C
package = cocoapods.FirebaseCore
modules = FirebaseCore
compilerOpts = -framework FirebaseCore
linkerOpts = -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseAnalytics -framework FIRAnalyticsConnector -framework GoogleAppMeasurement -framework FirebaseInstallations -framework GoogleDataTransport -framework GoogleUtilities -framework PromisesObjC -framework nanopb -framework StoreKit -lsqlite3
70 changes: 42 additions & 28 deletions firebase-auth/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

version = project.property("firebase-auth.version") as String

plugins {
Expand Down Expand Up @@ -65,34 +68,54 @@ android {
//}

kotlin {
js {
useCommonJs()
nodejs()
browser()
}

android {
publishLibraryVariants("release", "debug")
publishAllLibraryVariants()
}
val iosArm64 = iosArm64()
val iosX64 = iosX64("ios") {

fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = {
val nativeFrameworkPaths = listOf(
rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS"),
projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS")
)

binaries {
getTest("DEBUG").apply {
linkerOpts(
"-F${rootProject.projectDir}/firebase-app/src/iosMain/c_interop/Carthage/Build/iOS/",
"-F$projectDir/src/iosMain/c_interop/Carthage/Build/iOS/")
linkerOpts(nativeFrameworkPaths.map { "-F$it" })
linkerOpts("-ObjC")
}
}

compilations.getByName("main") {
cinterops.create("FirebaseAuth") {
compilerOpts(nativeFrameworkPaths.map { "-F$it" })
extraOpts("-verbose")
}
}
}

tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions.freeCompilerArgs += listOf(
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"
)
if (project.extra["ideaActive"] as Boolean) {
iosX64("ios", nativeTargetConfig())
} else {
ios(configure = nativeTargetConfig())
}

js {
useCommonJs()
nodejs()
browser()
}

sourceSets {
all {
languageSettings.apply {
apiVersion = "1.4"
languageVersion = "1.4"
progressiveMode = true
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}

val commonMain by getting {
dependencies {
api(project(":firebase-app"))
Expand All @@ -106,18 +129,9 @@ kotlin {
}
}

configure(listOf(iosArm64, iosX64)) {
compilations.getByName("main") {
source(sourceSets.get("iosMain"))
val firebaseAuth by cinterops.creating {
packageName("cocoapods.FirebaseAuth")
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseAuth.def"))
compilerOpts(
"-F$projectDir/src/iosMain/c_interop/Carthage/Build/iOS/"
)
}
}
}
val iosMain by getting

val jsMain by getting
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language = Objective-C
package = cocoapods.FirebaseAuth
modules = FirebaseAuth
compilerOpts = -framework FirebaseAuth
linkerOpts = -framework FirebaseAuth -framework GTMSessionFetcher
Loading