-
Notifications
You must be signed in to change notification settings - Fork 566
Conversation
@@ -0,0 +1,172 @@ | |||
#!/usr/bin/env sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better reuse shared gradlew in ../../
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android Studio generates this wrapper while creating the project. I think it's better to not remove it because we have two separate builds in any case. The first one is the multiplatform library and is managed manually. The second one is the Android Studio build which compiles the Android app and is fully managed by Android Studio (including Gradle's version and its updates).
The Gradle guys also create a separate wrapper for each sample project in their samples (e.g. https://github.com/gradle/native-samples/tree/master/cpp/application)
@@ -0,0 +1,84 @@ | |||
@if "%DEBUG%" == "" @echo off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@olonho I can' remove these two gradle wrapper files. But I can't remove the Beside of that and I wanted to be as close as possible with the documentation. And there stands nothing to use the wrapper from the root dir in the android project. |
db2774d
to
580275b
Compare
I think yes, adding such a sample makes sense. But I didn't check this PR on my machine yet so let me take a closer look at it first :) @olonho What do you think about this MPP sample? |
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jre
dependency is actually deprecated since 1.2.0 and you should use jdk
:
http://kotlinlang.org/docs/reference/whatsnew12.html#kotlin-standard-library-artifacts-and-split-packages
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.1.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.1.2 is actually latest version
Hi @StefMa! I want to bring some improvements in the sample (in particular rewrite the framework building script as shown in #1583 and fix the remarks above). What is the best way to do it? May you give me access rights to push in this branch in you repo? Or it's better to create a separate branch in our repo and move your commits in it? |
Hi @ilmat192 I've checked that little checkbox in this PR. So normally you have already push rights to this PR :) See also this article and this one. Feel free to checkout this branch and push anything you like :) 👍 |
+ Switch to Gradle 4.7
Since 0.7 the Gradle plugin uses project properties instead of environment variables to manage debug/optimizations. This patch takes it into account.
@StefMa I've rebased the sample onto master and added some new changes. Please look at them and, if all is ok, I'll merge the PR. |
MULTIPLATFORM.md
Outdated
|
||
Kotlin/Native requires Gradle 4.7 or higher so you need to make sure that the AS project uses the correct | ||
Gradle version. To do this, open `androidApp/gradle/gradle-wrapper.properties` and check the `distributionUrl` | ||
property. Fix it if it's necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
Upgrade if necessary
sounds a little bit better.
But its just a minor. Keep it if you like :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
implementation 'com.android.support:appcompat-v7:27.1.1' | ||
implementation 'org.greeting:android:1.0' | ||
implementation project(':greeting:android') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted this sample to reflect 100% of the documentation.
If we use this the documentation and the sample is not the same anymore.
Either change the docu or revert this...
Update
Just seen that there is a big note in the documentation 🙃
Maybe we don't "note" it anymore but used it as a general rule?!
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME | |||
distributionPath=wrapper/dists | |||
zipStoreBase=GRADLE_USER_HOME | |||
zipStorePath=wrapper/dists | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you upgraded via the wrapper
task?
It's weird that the *jar haven't changed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just forgot about it. Thanks!
@@ -11,7 +11,7 @@ buildscript { | |||
// Specify all the plugins used as dependencies | |||
dependencies { | |||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.7-dev-1407" | |||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:${project.property('konan.plugin.version')}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the documenation with somehting like $kotlinNativeGradlePluginVersion
...
Then it isn't hardcoded 👍
@@ -1,4 +1,9 @@ | |||
enableFeaturePreview('GRADLE_METADATA') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that needed for the sample?
Then we have to documented that as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample in a separate repo uses KN 0.7 and there is no need to add this line for that version.
include ':greeting' | ||
include ':greeting:common' | ||
include ':greeting:android' | ||
include ':greeting:ios' | ||
|
||
includeBuild '../../shared' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to add a comment here that this is not part "of the sample" and only used for this sample...
Know what I mean? 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I see :)
The sample becomes a little bit complicated with all these composite builds.
May be it's better to move it in a separate repo?
We use composite build to allow a user to build all samples in the main repo with the compiler and the Gradle plugin built from sources right now. But in a separate repo we can use a fixed KN version and where will be no differences between the documentation and the sample itself. I can make a repo under JB organisation and move your changes into it. What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. The sample blows a little bit 🙃
Yes, I think it make sense to move it in a new repository.
The only thing we have to make sure is that the documentation and the new repo are always in sync.
We can also move the documentation into the new repository and link in this repo to the new repo?! 🤔
Having the documentation here but the implementation in a new repo is a little bit strange...
Anyway.
I would welcome to have a separate repository for it.
The rest can be discussed then 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the documentation here but the implementation in a new repo is a little bit strange
Having all docs in one place is more convenient though. But you're right too and I would rather move the MPP doc in the new repo. @olonho what do you think?
samples/multiplatform/.gitignore
Outdated
@@ -0,0 +1,6 @@ | |||
.iml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is not required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.2.31' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it 1.2.31
required? can we use latest 1.2.41
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// By default the project directory name is used as an artifact name thus the full dependency | ||
// description will be 'org.greeting:android:1.0' | ||
group = 'org.greeting' | ||
version = 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maven-style dependency is actually not used in this sample anymore, only project dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will use the maven-style dependency in a separate repo.
|
||
import XCTest | ||
import Greeting | ||
@testable import iosApp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,28 @@ | |||
apply plugin: 'com.android.application' | |||
apply plugin: 'kotlin-android' | |||
apply plugin: 'kotlin-android-extensions' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we don't have android app itself (only empty stub) is makes no sense to add extensions here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be useful if a user wants to write an application on basis of this sample.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AS will add this plugin automatically on creating new activity, but this is not a big deal anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removed this.
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId "org.konan.multiplatform" | ||
minSdkVersion 24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho sample should use either 15 or 21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
dependencies { | ||
// Set up compilation dependency on common Kotlin stdlib | ||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use implementation
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The project has been moved in a separate repo.
If I could I would approve that PR 👍 |
Thanks! The separate repo is here: https://github.com/JetBrains/kotlin-mpp-example. I've fixed all the remarks added to this PR there. If there are no objections from others, I'll merge this PR. |
Looks almost ok, but there are still some issues:
Add
to fix |
|
The MPP sample is implemented in a separate repo: https://github.com/JetBrains/kotlin-mpp-example
I've created a sample implementation from the Multiplatform doc.
Don't know if you are interested in it or not.
But I've just added it to the samples and refer it in the multiplatform doc.
Let me know if you want to use it (then I have to adjust the package names (guru.stefma to org.jetbrains) and stuff like that.
Otherwise feel free to just close it 😄