1
1
import de.undercouch.gradle.tasks.download.Download
2
+ import org.apache.tools.ant.taskdefs.condition.Os
2
3
3
4
plugins {
4
5
kotlin(" multiplatform" ) version " 1.3.70" apply false
@@ -24,51 +25,69 @@ val minSdkVersion by extra(14)
24
25
25
26
tasks {
26
27
val downloadFirebaseZipFile by creating(Download ::class ) {
28
+ onlyIfModified(true )
27
29
src(" https://github.com/firebase/firebase-ios-sdk/releases/download/6.17.0/Firebase-6.17.0.zip" )
28
- dest(File (rootDir , " Firebase-6.17.0.zip" ))
30
+ dest(File (" $buildDir " , " Firebase-6.17.0.zip" ))
29
31
overwrite(true )
32
+
30
33
}
31
34
32
35
val unzipFirebase by creating(Copy ::class ) {
33
36
dependsOn(downloadFirebaseZipFile)
34
37
from(zipTree(downloadFirebaseZipFile.dest))
35
- into(rootDir)
38
+ into(" $buildDir " )
39
+ outputs.upToDateWhen { File (" $buildDir " ).exists() }
36
40
}
37
41
38
- val copyIOSFirebaseAuth by creating(Copy ::class ){
42
+ val copyIOSFirebaseAuthFramework by creating(Copy ::class ){
43
+ doFirst {
44
+ project.delete(files(" $rootDir /firebase-auth/src/iosMain/c_interop/modules/" ))
45
+ }
39
46
dependsOn(unzipFirebase)
40
- from(" $rootDir /Firebase/FirebaseAuth/FirebaseAuth.framework" )
47
+ from(" $rootDir /$buildDir / Firebase/FirebaseAuth/FirebaseAuth.framework" )
41
48
into(" $rootDir /firebase-auth/src/iosMain/c_interop/modules/FirebaseAuth.framework" )
42
49
}
43
50
44
- val copyIOSFirebaseDatabase by creating(Copy ::class ){
45
- dependsOn(copyIOSFirebaseAuth)
46
- from(" $rootDir /Firebase/FirebaseDatabase/FirebaseDatabase.framework" )
51
+ val copyIOSFirebaseDatabaseFramework by creating(Copy ::class ){
52
+ doFirst {
53
+ project.delete(files(" $rootDir /firebase-database/src/iosMain/c_interop/modules/" ))
54
+ }
55
+ dependsOn(unzipFirebase)
56
+ from(" $rootDir /$buildDir /Firebase/FirebaseDatabase/FirebaseDatabase.framework" )
47
57
into(" $rootDir /firebase-database/src/iosMain/c_interop/modules/FirebaseDatabase.framework" )
48
58
}
49
59
50
- val copyIOSFirebaseFirestore by creating(Copy ::class ){
51
- dependsOn(copyIOSFirebaseDatabase)
52
- from(" $rootDir /Firebase/FirebaseFirestore/FirebaseFirestore.framework" )
53
- into(" $rootDir /firebase-database/src/iosMain/c_interop/modules/FirebaseFirestore.framework" )
60
+ val copyIOSFirebaseFirestoreFramework by creating(Copy ::class ){
61
+ doFirst {
62
+ project.delete(files(" $rootDir /firebase-firestore/src/iosMain/c_interop/modules/" ))
63
+ }
64
+ dependsOn(unzipFirebase)
65
+ from(" $rootDir /$buildDir /Firebase/FirebaseFirestore/FirebaseFirestore.framework" )
66
+ into(" $rootDir /firebase-firestore/src/iosMain/c_interop/modules/FirebaseFirestore.framework" )
54
67
}
55
68
56
- val copyIOSFirebaseFunctions by creating(Copy ::class ){
57
- dependsOn(copyIOSFirebaseFirestore)
58
- from(" $rootDir /Firebase/FirebaseFunctions/FirebaseFunctions.framework" )
59
- into(" $rootDir /firebase-database/src/iosMain/c_interop/modules/FirebaseFunctions.framework" )
69
+ val copyIOSFirebaseFunctionsFramework by creating(Copy ::class ){
70
+ doFirst {
71
+ project.delete(files(" $rootDir /firebase-functions/src/iosMain/c_interop/modules/" ))
72
+ }
73
+ dependsOn(unzipFirebase)
74
+ from(" $rootDir /$buildDir /Firebase/FirebaseFunctions/FirebaseFunctions.framework" )
75
+ into(" $rootDir /firebase-functions/src/iosMain/c_interop/modules/FirebaseFunctions.framework" )
60
76
}
61
77
62
- val copyAllIOSFirebaseFrameworks by creating(Copy ::class ){
63
- dependsOn(copyIOSFirebaseFunctions)
64
- from(" $rootDir /Firebase/FirebaseAnalytics/FirebaseCore.framework" )
78
+ val copyIOSFirebaseAppFramework by creating(Copy ::class ){
79
+
80
+ doFirst {
81
+ project.delete(files(" $rootDir /firebase-app/src/iosMain/c_interop/modules/" ))
82
+ }
83
+
84
+ dependsOn(unzipFirebase)
85
+ from(" $rootDir /$buildDir /Firebase/FirebaseAnalytics/FirebaseCore.framework" )
65
86
into(" $rootDir /firebase-app/src/iosMain/c_interop/modules/FirebaseCore.framework" )
66
87
}
67
88
68
89
}
69
90
70
-
71
-
72
91
subprojects {
73
92
74
93
@@ -121,24 +140,14 @@ subprojects {
121
140
122
141
123
142
val publishToNpm by creating(Exec ::class ) {
124
-
125
- if (! File (rootDir, " Firebase" ).exists()) {
126
- dependsOn(
127
- rootProject.tasks.named(" copyAllIOSFirebaseFrameworks" ).get(),
128
- copyPackageJson,
129
- copyJS,
130
- copySourceMap,
131
- copyReadMe
132
- )
133
- } else {
134
- dependsOn(
135
- copyPackageJson,
136
- copyJS,
137
- copySourceMap,
138
- copyReadMe
139
- )
140
143
141
- }
144
+ dependsOn(
145
+ copyPackageJson,
146
+ copyJS,
147
+ copySourceMap,
148
+ copyReadMe
149
+ )
150
+
142
151
workingDir(" $buildDir /node_module" )
143
152
// commandLine("npm", "publish")
144
153
commandLine(" ls" )
@@ -158,7 +167,7 @@ subprojects {
158
167
if (! File (" $buildDir /node_module" ).exists()) {
159
168
mkdir(" $buildDir /node_module" )
160
169
}
161
-
170
+
162
171
dependencies {
163
172
" commonMainImplementation" (kotlin(" stdlib-common" ))
164
173
" commonMainImplementation" (" org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.4" )
0 commit comments