Skip to content

Commit 4127802

Browse files
Update Kotlin & Gradle versions
1 parent 6d8c9fc commit 4127802

File tree

7 files changed

+50
-89
lines changed

7 files changed

+50
-89
lines changed

androidApp/build.gradle.kts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ version = "1.0-SNAPSHOT"
99
repositories {
1010
gradlePluginPortal()
1111
google()
12-
jcenter()
1312
mavenCentral()
1413
}
1514
dependencies {
1615
implementation(project(":shared"))
17-
implementation("com.google.android.material:material:1.2.0")
18-
implementation("androidx.appcompat:appcompat:1.2.0")
19-
implementation("androidx.constraintlayout:constraintlayout:1.1.3")
16+
implementation("com.google.android.material:material:1.4.0")
17+
implementation("androidx.appcompat:appcompat:1.3.0")
18+
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
2019
}
2120
android {
22-
compileSdkVersion(29)
21+
compileSdkVersion(30)
2322
defaultConfig {
2423
applicationId = "com.jetbrains.androidApp"
2524
minSdkVersion(24)
26-
targetSdkVersion(29)
25+
targetSdkVersion(30)
2726
versionCode = 1
2827
versionName = "1.0"
2928
}

build.gradle.kts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
buildscript {
22
repositories {
33
gradlePluginPortal()
4-
jcenter()
54
google()
65
mavenCentral()
76
}
87
dependencies {
9-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
10-
classpath("com.android.tools.build:gradle:4.0.1")
8+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
9+
classpath("com.android.tools.build:gradle:7.0.0-beta05")
1110
}
1211
}
13-
group = "com.jetbrains"
14-
version = "1.0-SNAPSHOT"
1512

16-
repositories {
17-
mavenCentral()
13+
allprojects {
14+
repositories {
15+
google()
16+
mavenCentral()
17+
}
1818
}
19+
20+
tasks.register("clean", Delete::class) {
21+
delete(rootProject.buildDir)
22+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

iosApp/iosApp.xcodeproj/project.pbxproj

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
7555FF8B242A565B00829871 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7555FF89242A565B00829871 /* LaunchScreen.storyboard */; };
1616
7555FF96242A565B00829871 /* iosAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF95242A565B00829871 /* iosAppTests.swift */; };
1717
7555FFA1242A565B00829871 /* iosAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FFA0242A565B00829871 /* iosAppUITests.swift */; };
18-
7555FFB2242A642300829871 /* shared.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7555FFB1242A642300829871 /* shared.framework */; };
19-
7555FFB3242A642300829871 /* shared.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7555FFB1242A642300829871 /* shared.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2018
/* End PBXBuildFile section */
2119

2220
/* Begin PBXContainerItemProxy section */
@@ -36,20 +34,6 @@
3634
};
3735
/* End PBXContainerItemProxy section */
3836

39-
/* Begin PBXCopyFilesBuildPhase section */
40-
7555FFB4242A642300829871 /* Embed Frameworks */ = {
41-
isa = PBXCopyFilesBuildPhase;
42-
buildActionMask = 2147483647;
43-
dstPath = "";
44-
dstSubfolderSpec = 10;
45-
files = (
46-
7555FFB3242A642300829871 /* shared.framework in Embed Frameworks */,
47-
);
48-
name = "Embed Frameworks";
49-
runOnlyForDeploymentPostprocessing = 0;
50-
};
51-
/* End PBXCopyFilesBuildPhase section */
52-
5337
/* Begin PBXFileReference section */
5438
7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
5539
7555FF7E242A565900829871 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -65,15 +49,13 @@
6549
7555FF9C242A565B00829871 /* iosAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iosAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6650
7555FFA0242A565B00829871 /* iosAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosAppUITests.swift; sourceTree = "<group>"; };
6751
7555FFA2242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
68-
7555FFB1242A642300829871 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../shared/build/xcode-frameworks/shared.framework"; sourceTree = "<group>"; };
6952
/* End PBXFileReference section */
7053

7154
/* Begin PBXFrameworksBuildPhase section */
7255
7555FF78242A565900829871 /* Frameworks */ = {
7356
isa = PBXFrameworksBuildPhase;
7457
buildActionMask = 2147483647;
7558
files = (
76-
7555FFB2242A642300829871 /* shared.framework in Frameworks */,
7759
);
7860
runOnlyForDeploymentPostprocessing = 0;
7961
};
@@ -158,7 +140,6 @@
158140
7555FFB0242A642200829871 /* Frameworks */ = {
159141
isa = PBXGroup;
160142
children = (
161-
7555FFB1242A642300829871 /* shared.framework */,
162143
);
163144
name = Frameworks;
164145
sourceTree = "<group>";
@@ -170,11 +151,10 @@
170151
isa = PBXNativeTarget;
171152
buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
172153
buildPhases = (
173-
7555FFB5242A651A00829871 /* ShellScript */,
154+
7555FFB5242A651A00829871 /* Run Script */,
174155
7555FF77242A565900829871 /* Sources */,
175156
7555FF78242A565900829871 /* Frameworks */,
176157
7555FF79242A565900829871 /* Resources */,
177-
7555FFB4242A642300829871 /* Embed Frameworks */,
178158
);
179159
buildRules = (
180160
);
@@ -292,7 +272,7 @@
292272
/* End PBXResourcesBuildPhase section */
293273

294274
/* Begin PBXShellScriptBuildPhase section */
295-
7555FFB5242A651A00829871 /* ShellScript */ = {
275+
7555FFB5242A651A00829871 /* Run Script */ = {
296276
isa = PBXShellScriptBuildPhase;
297277
buildActionMask = 2147483647;
298278
files = (
@@ -301,13 +281,14 @@
301281
);
302282
inputPaths = (
303283
);
284+
name = "Run Script";
304285
outputFileListPaths = (
305286
);
306287
outputPaths = (
307288
);
308289
runOnlyForDeploymentPostprocessing = 0;
309290
shellPath = /bin/sh;
310-
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}\n";
291+
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
311292
};
312293
/* End PBXShellScriptBuildPhase section */
313294

@@ -486,12 +467,17 @@
486467
CODE_SIGN_STYLE = Automatic;
487468
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
488469
ENABLE_PREVIEWS = YES;
489-
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks";
470+
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
490471
INFOPLIST_FILE = iosApp/Info.plist;
491472
LD_RUNPATH_SEARCH_PATHS = (
492473
"$(inherited)",
493474
"@executable_path/Frameworks",
494475
);
476+
OTHER_LDFLAGS = (
477+
"$(inherited)",
478+
"-framework",
479+
shared,
480+
);
495481
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
496482
PRODUCT_NAME = "$(TARGET_NAME)";
497483
SWIFT_VERSION = 5.0;
@@ -506,12 +492,17 @@
506492
CODE_SIGN_STYLE = Automatic;
507493
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
508494
ENABLE_PREVIEWS = YES;
509-
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks";
495+
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
510496
INFOPLIST_FILE = iosApp/Info.plist;
511497
LD_RUNPATH_SEARCH_PATHS = (
512498
"$(inherited)",
513499
"@executable_path/Frameworks",
514500
);
501+
OTHER_LDFLAGS = (
502+
"$(inherited)",
503+
"-framework",
504+
shared,
505+
);
515506
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
516507
PRODUCT_NAME = "$(TARGET_NAME)";
517508
SWIFT_VERSION = 5.0;
28 KB
Binary file not shown.

settings.gradle.kts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
pluginManagement {
22
repositories {
3-
gradlePluginPortal()
43
google()
5-
jcenter()
4+
gradlePluginPortal()
65
mavenCentral()
76
}
8-
resolutionStrategy {
9-
eachPlugin {
10-
if (requested.id.namespace == "com.android" || requested.id.name == "kotlin-android-extensions") {
11-
useModule("com.android.tools.build:gradle:4.0.1")
12-
}
13-
}
14-
}
157
}
16-
rootProject.name = "KmmSample"
178

9+
rootProject.name = "KmmSample"
1810

1911
include(":androidApp")
2012
include(":shared")

shared/build.gradle.kts

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
33
plugins {
44
kotlin("multiplatform")
55
id("com.android.library")
6-
id("kotlin-android-extensions")
76
}
8-
group = "com.jetbrains"
9-
version = "1.0-SNAPSHOT"
107

11-
repositories {
12-
gradlePluginPortal()
13-
google()
14-
jcenter()
15-
mavenCentral()
16-
}
178
kotlin {
189
android()
19-
ios {
10+
11+
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
12+
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
13+
::iosArm64
14+
else
15+
::iosX64
16+
17+
iosTarget("ios") {
2018
binaries {
2119
framework {
2220
baseName = "shared"
@@ -31,46 +29,23 @@ kotlin {
3129
implementation(kotlin("test-annotations-common"))
3230
}
3331
}
34-
val androidMain by getting {
35-
dependencies {
36-
implementation("com.google.android.material:material:1.2.0")
37-
}
38-
}
32+
val androidMain by getting
3933
val androidTest by getting {
4034
dependencies {
4135
implementation(kotlin("test-junit"))
42-
implementation("junit:junit:4.12")
36+
implementation("junit:junit:4.13.2")
4337
}
4438
}
4539
val iosMain by getting
4640
val iosTest by getting
4741
}
4842
}
43+
4944
android {
50-
compileSdkVersion(29)
45+
compileSdkVersion(30)
5146
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
5247
defaultConfig {
53-
minSdkVersion(24)
54-
targetSdkVersion(29)
55-
versionCode = 1
56-
versionName = "1.0"
57-
}
58-
buildTypes {
59-
getByName("release") {
60-
isMinifyEnabled = false
61-
}
48+
minSdkVersion(21)
49+
targetSdkVersion(30)
6250
}
63-
}
64-
val packForXcode by tasks.creating(Sync::class) {
65-
group = "build"
66-
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
67-
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
68-
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
69-
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
70-
inputs.property("mode", mode)
71-
dependsOn(framework.linkTask)
72-
val targetDir = File(buildDir, "xcode-frameworks")
73-
from({ framework.outputDirectory })
74-
into(targetDir)
75-
}
76-
tasks.getByName("build").dependsOn(packForXcode)
51+
}

0 commit comments

Comments
 (0)