diff --git a/.gitignore b/.gitignore index 7d38506f03..137d268e21 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ realm/realm-library/src/main/cpp/jni_include realm/realm-library/distribution # Cmake output realm/realm-library/.externalNativeBuild + +gen/ +out/ diff --git a/gradle-plugin/build.gradle b/realm-gradle-plugin/build.gradle similarity index 87% rename from gradle-plugin/build.gradle rename to realm-gradle-plugin/build.gradle index d9a9d8695e..9fd610174e 100644 --- a/gradle-plugin/build.gradle +++ b/realm-gradle-plugin/build.gradle @@ -47,13 +47,7 @@ dependencies { compile gradleApi() compile localGroovy() compile "io.realm:realm-transformer:${version}" - /*Note: the latest Android Gradle plugin has now built in support for annotation processors and warns and/or blocks android-apt, - see this https://bitbucket.org/hvisser/android-apt/wiki/Migration page on how to migrate - and this https://www.littlerobots.nl/blog/Whats-next-for-android-apt/ for more info. - */ - compile 'com.neenbedankt.gradle.plugins:android-apt:1.8' //TODO: https://www.littlerobots.nl/blog/Whats-next-for-android-apt/ - provided 'com.android.tools.build:gradle:3.1.0-alpha06' - + provided 'com.android.tools.build:gradle:3.1.0-alpha07' testCompile gradleTestKit() testCompile 'junit:junit:4.12' } @@ -124,7 +118,7 @@ publishing { accessKey project.hasProperty('s3AccessKey') ? s3AccessKey : 'noAccessKey' secretKey project.hasProperty('s3SecretKey') ? s3SecretKey : 'noSecretKey' } - if(project.version.endsWith('-SNAPSHOT')) { + if (project.version.endsWith('-SNAPSHOT')) { url "s3://realm-ci-artifacts/maven/snapshots/" } else { url "s3://realm-ci-artifacts/maven/releases/" @@ -163,7 +157,7 @@ artifactory { password = project.hasProperty('bintrayKey') ? bintrayKey : 'noKey' } defaults { - publications ('realmPublication') + publications('realmPublication') } } } diff --git a/gradle-plugin/gradle.properties b/realm-gradle-plugin/gradle.properties similarity index 100% rename from gradle-plugin/gradle.properties rename to realm-gradle-plugin/gradle.properties diff --git a/gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/realm-gradle-plugin/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from gradle-plugin/gradle/wrapper/gradle-wrapper.jar rename to realm-gradle-plugin/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/realm-gradle-plugin/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradle-plugin/gradle/wrapper/gradle-wrapper.properties rename to realm-gradle-plugin/gradle/wrapper/gradle-wrapper.properties diff --git a/gradle-plugin/gradlew b/realm-gradle-plugin/gradlew similarity index 100% rename from gradle-plugin/gradlew rename to realm-gradle-plugin/gradlew diff --git a/gradle-plugin/gradlew.bat b/realm-gradle-plugin/gradlew.bat similarity index 100% rename from gradle-plugin/gradlew.bat rename to realm-gradle-plugin/gradlew.bat diff --git a/gradle-plugin/settings.gradle b/realm-gradle-plugin/settings.gradle similarity index 100% rename from gradle-plugin/settings.gradle rename to realm-gradle-plugin/settings.gradle diff --git a/gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy b/realm-gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy similarity index 68% rename from gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy rename to realm-gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy index 6064b95cf9..2091ac00c8 100644 --- a/gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy +++ b/realm-gradle-plugin/src/main/groovy/io/realm/gradle/Realm.groovy @@ -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 { def syncEnabledDefault = false def dependencyConfigurationName = getDependencyConfigurationName(project) - def usesAptPlugin = project.plugins.findPlugin('com.neenbedankt.android-apt') != null 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 { 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 - } } diff --git a/gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy b/realm-gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy similarity index 97% rename from gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy rename to realm-gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy index fc343412dd..5d4462e260 100644 --- a/gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy +++ b/realm-gradle-plugin/src/main/groovy/io/realm/gradle/RealmPluginExtension.groovy @@ -20,8 +20,8 @@ import org.gradle.api.Project class RealmPluginExtension { private Project project - def boolean syncEnabled - def boolean kotlinExtensionsEnabled + boolean syncEnabled + boolean kotlinExtensionsEnabled private String dependencyConfigurationName RealmPluginExtension(Project project, boolean syncEnabledDefault, boolean useKotlinExtensionsDefault, String dependencyConfigurationName) { diff --git a/gradle-plugin/src/main/templates/Version.java b/realm-gradle-plugin/src/main/groovy/io/realm/gradle/Version.java similarity index 100% rename from gradle-plugin/src/main/templates/Version.java rename to realm-gradle-plugin/src/main/groovy/io/realm/gradle/Version.java diff --git a/gradle-plugin/src/main/resources/META-INF/gradle-plugins/realm-android.properties b/realm-gradle-plugin/src/main/resources/META-INF/gradle-plugins/realm-android.properties similarity index 100% rename from gradle-plugin/src/main/resources/META-INF/gradle-plugins/realm-android.properties rename to realm-gradle-plugin/src/main/resources/META-INF/gradle-plugins/realm-android.properties diff --git a/gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy b/realm-gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy similarity index 94% rename from gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy rename to realm-gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy index 2f9080ebd8..d10621cd2c 100644 --- a/gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy +++ b/realm-gradle-plugin/src/test/groovy/io/realm/gradle/PluginTest.groovy @@ -30,7 +30,6 @@ import org.junit.Before import org.junit.Test import static org.junit.Assert.assertEquals -import static org.junit.Assert.assertFalse import static org.junit.Assert.assertTrue import static org.junit.Assert.fail @@ -53,8 +52,7 @@ class PluginTest { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0-alpha03' - classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' + classpath 'com.android.tools.build:gradle:3.1.0-alpha07' classpath "io.realm:realm-gradle-plugin:${currentVersion}" } } @@ -71,7 +69,7 @@ class PluginTest { } @Test - public void pluginFailsWithoutAndroidPlugin() { + void pluginFailsWithoutAndroidPlugin() { project.buildscript { repositories { mavenLocal() @@ -79,7 +77,6 @@ class PluginTest { } dependencies { classpath 'com.android.tools.build:gradle:3.1.0-alpha03' - classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' classpath "io.realm:realm-gradle-plugin:${currentVersion}" } } diff --git a/realm/build.gradle b/realm/build.gradle index 82f7c806cf..03c1c96369 100644 --- a/realm/build.gradle +++ b/realm/build.gradle @@ -9,12 +9,12 @@ buildscript { mavenLocal() google() jcenter() - maven { url 'https://jitpack.io' } + maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' } maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0-alpha06' + classpath 'com.android.tools.build:gradle:3.1.0-alpha07' classpath 'de.undercouch:gradle-download-task:3.3.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' classpath 'com.novoda:gradle-android-command-plugin:1.7.1' @@ -42,6 +42,7 @@ allprojects { mavenLocal() google() jcenter() + maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' } } } diff --git a/realm/kotlin-extensions/build.gradle b/realm/kotlin-extensions/build.gradle index 3ba0e38c80..ff4795c576 100644 --- a/realm/kotlin-extensions/build.gradle +++ b/realm/kotlin-extensions/build.gradle @@ -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" 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/ diff --git a/realm/realm-library/build.gradle b/realm/realm-library/build.gradle index 86f675551b..6f79252363 100644 --- a/realm/realm-library/build.gradle +++ b/realm/realm-library/build.gradle @@ -183,8 +183,8 @@ import io.realm.transformer.RealmTransformer android.registerTransform(new RealmTransformer()) repositories { - maven { url "https://jitpack.io" } - mavenCentral() + jcenter() + maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' } } dependencies { @@ -207,11 +207,11 @@ dependencies { androidTestImplementation 'com.google.dexmaker:dexmaker:1.2' androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2' androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' - androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" androidTestImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" // specify error prone version to prevent sudden failure - errorprone 'com.google.errorprone:error_prone_core:2.1.2' + errorprone 'com.google.errorprone:error_prone_core:2.2.0' } task sourcesJar(type: Jar) {