-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fixes #5666 #5670
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
base: next-major
Are you sure you want to change the base?
Fixes #5666 #5670
Changes from all commits
05b44d4
b713b25
27e6dce
795218c
3025608
5452b5c
dcf04c9
7b1bdca
92c5ffa
49c986a
0324e0c
ccdd337
98c3c39
57affd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ package io.realm.gradle | |
|
|
||
| import com.android.build.gradle.AppPlugin | ||
| import com.android.build.gradle.LibraryPlugin | ||
| import com.neenbedankt.gradle.androidapt.AndroidAptPlugin | ||
| import io.realm.transformer.RealmTransformer | ||
| import org.gradle.api.GradleException | ||
| import org.gradle.api.Plugin | ||
|
|
@@ -42,30 +41,17 @@ class Realm implements Plugin<Project> { | |
|
|
||
| def syncEnabledDefault = false | ||
| def dependencyConfigurationName = getDependencyConfigurationName(project) | ||
| def usesAptPlugin = project.plugins.findPlugin('com.neenbedankt.android-apt') != null | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I think we can remove support for this, we cannot do it in a patch release as it might be a breaking change, but if you direct this PR towards the branch
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (although technically AS 3.0 cannot run android-apt anymore, but maybe some legacy projects still use it with older version of IDE)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cmelchior I have changed the branch to next-major :) |
||
| def isKotlinProject = project.plugins.findPlugin('kotlin-android') != null | ||
| def useKotlinExtensionsDefault = isKotlinProject | ||
| def hasAnnotationProcessorConfiguration = project.getConfigurations().findByName('annotationProcessor') != null | ||
| // TODO add a parameter in 'realm' block if this should be specified by users | ||
| def preferAptOnKotlinProject = false | ||
|
|
||
|
|
||
| project.extensions.create('realm', RealmPluginExtension, project, syncEnabledDefault, useKotlinExtensionsDefault, dependencyConfigurationName) | ||
|
|
||
| if (shouldApplyAndroidAptPlugin(usesAptPlugin, isKotlinProject, | ||
| hasAnnotationProcessorConfiguration, preferAptOnKotlinProject)) { | ||
| project.plugins.apply(AndroidAptPlugin) | ||
| usesAptPlugin = true | ||
| } | ||
|
|
||
| project.android.registerTransform(new RealmTransformer(project)) | ||
|
|
||
| project.repositories.add(project.getRepositories().jcenter()) | ||
| project.dependencies.add(dependencyConfigurationName, "io.realm:realm-annotations:${Version.VERSION}") | ||
| if (usesAptPlugin) { | ||
| project.dependencies.add("apt", "io.realm:realm-annotations-processor:${Version.VERSION}") | ||
| project.dependencies.add("androidTestApt", "io.realm:realm-annotations-processor:${Version.VERSION}") | ||
| } else if (isKotlinProject && !preferAptOnKotlinProject) { | ||
| if (isKotlinProject) { | ||
| project.dependencies.add("kapt", "io.realm:realm-annotations-processor:${Version.VERSION}") | ||
| project.dependencies.add("kaptAndroidTest", "io.realm:realm-annotations-processor:${Version.VERSION}") | ||
| } else { | ||
|
|
@@ -99,19 +85,4 @@ class Realm implements Plugin<Project> { | |
| oldDependencyName | ||
| } | ||
| } | ||
|
|
||
| private static boolean shouldApplyAndroidAptPlugin(boolean usesAptPlugin, boolean isKotlinProject, | ||
| boolean hasAnnotationProcessorConfiguration, | ||
| boolean preferAptOnKotlinProject) { | ||
| if (usesAptPlugin) { | ||
| // for any projects that uses android-apt plugin already. No need to apply it twice. | ||
| return false | ||
| } | ||
| if (isKotlinProject) { | ||
| // for any Kotlin projects where user did not apply 'android-apt' plugin manually. | ||
| return preferAptOnKotlinProject && !hasAnnotationProcessorConfiguration | ||
| } | ||
| // for any Java Projects where user did not apply 'android-apt' plugin manually. | ||
| return !hasAnnotationProcessorConfiguration | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ android { | |
|
|
||
| dependencies { | ||
| implementation project(':realm-library') | ||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure what impact this has on downstream projects? |
||
| androidTestImplementation 'junit:junit:4.12' | ||
| androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
| androidTestImplementation 'com.android.support.test:rules:1.0.1' | ||
|
|
@@ -70,7 +70,8 @@ dependencies { | |
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| jcenter() | ||
| maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' } | ||
| } | ||
|
|
||
| // enable @ParametersAreNonnullByDefault annotation. See https://blog.jetbrains.com/kotlin/2017/09/kotlin-1-1-50-is-out/ | ||
|
|
||
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.
Where do these come from?
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.
Last time I saw
genit came from Eclipse things. 😮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.
@cmelchior @Zhuinden I am not sure from where It came, I have imported the whole project in IntelliJ Ultimate, and i guess the build generated the gen folder so I have added it in the .gitignore, to ignore then gen folder.