From 0fa8e9d403650c6ad5b02043119f6ecde14db5be Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Tue, 11 Jul 2023 17:51:15 +0200 Subject: [PATCH] remove a bunch of workarounds --- build-logic/src/main/kotlin/Node.kt | 5 ----- build-logic/src/main/kotlin/Publishing.kt | 7 ------- build.gradle.kts | 6 ++++-- gradle.properties | 6 ------ gradle/libraries.toml | 6 +++--- libraries/apollo-annotations/build.gradle.kts | 14 ++++++++++---- libraries/apollo-compiler/build.gradle.kts | 3 +++ tests/enums/src/main/graphql/schema.graphqls | 2 +- tests/gradle.properties | 8 -------- tests/idling-resource/build.gradle.kts | 3 +-- tests/java-nullability/build.gradle.kts | 2 ++ tests/settings.gradle.kts | 5 +---- 12 files changed, 25 insertions(+), 42 deletions(-) diff --git a/build-logic/src/main/kotlin/Node.kt b/build-logic/src/main/kotlin/Node.kt index 00a3ef1108f..8ea46f0e389 100644 --- a/build-logic/src/main/kotlin/Node.kt +++ b/build-logic/src/main/kotlin/Node.kt @@ -23,9 +23,4 @@ fun Project.configureNode() { lockFileDirectory = projectDir.resolve("kotlin-js-store-${project.getKotlinPluginVersion().substringBeforeLast(".")}") } } - - // See https://youtrack.jetbrains.com/issue/KT-49774/KJS-Gradle-Errors-during-NPM-dependencies-resolution-in-parallel-build-lead-to-unfriendly-error-messages-like-Projects-must-be#focus=Comments-27-6271456.0-0 - rootProject.plugins.withType(NodeJsRootPlugin::class.java) { - project.extensions.getByType(NodeJsRootExtension::class.java).nodeVersion = "16.17.0" - } } diff --git a/build-logic/src/main/kotlin/Publishing.kt b/build-logic/src/main/kotlin/Publishing.kt index 80074772e11..abf27626183 100644 --- a/build-logic/src/main/kotlin/Publishing.kt +++ b/build-logic/src/main/kotlin/Publishing.kt @@ -298,13 +298,6 @@ private fun Project.setDefaultPomFields(mavenPublication: MavenPublication) { private fun Project.createJavaSourcesTask(): TaskProvider { return tasks.register("javaSourcesJar", Jar::class.java) { - /** - * Add a dependency on the compileKotlin task to make sure the generated sources like - * antlr or SQLDelight get included - * See also https://youtrack.jetbrains.com/issue/KT-47936 - */ - dependsOn("compileKotlin") - archiveClassifier.set("sources") val sourceSets = project.extensions.getByType(JavaPluginExtension::class.java).sourceSets from(sourceSets.getByName("main").allSource) diff --git a/build.gradle.kts b/build.gradle.kts index 39abdb23193..b3697e181f9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import JapiCmp.configureJapiCmp +import java.util.Locale plugins { id("apollo.library") apply false @@ -107,7 +108,7 @@ tasks.named("dokkaHtmlMultiModule").configure { tasks.named("dependencyUpdates").configure { (this as com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask) rejectVersionIf { - listOf("alpha", "beta", "rc").any { candidate.version.toLowerCase().contains(it) } + listOf("alpha", "beta", "rc").any { candidate.version.lowercase().contains(it) } } } @@ -147,8 +148,9 @@ configure { } tasks.register("rmbuild") { + val root = file(".") doLast { - file(".").walk().onEnter { + root.walk().onEnter { if (it.isDirectory && it.name == "build") { println("deleting: $it") it.deleteRecursively() diff --git a/gradle.properties b/gradle.properties index dc2523310d6..ec604561d98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,9 +27,3 @@ org.gradle.caching=true # org.gradle.configuration-cache=true org.gradle.parallel=true - -# See https://kotlinlang.org/docs/whatsnew-eap.html#preview-of-gradle-composite-builds-support-in-kotlin-multiplatform -kotlin.mpp.import.enableKgpDependencyResolution=true - -# See https://youtrack.jetbrains.com/issue/KT-55995/Add-ability-to-perform-precise-compilation-task-outputs-backup -kotlin.compiler.preciseCompilationResultsBackup=true diff --git a/gradle/libraries.toml b/gradle/libraries.toml index 2f43c55dd60..b889ea0bdd2 100644 --- a/gradle/libraries.toml +++ b/gradle/libraries.toml @@ -42,8 +42,7 @@ truth = "1.1.3" [libraries] android-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "android-plugin" } android-plugin-min = { group = "com.android.tools.build", name = "gradle", version.ref = "android-plugin-min" } -android-support-annotations = { group = "com.android.support", name = "support-annotations", version = "28.0.0" } -android-test-runner = { group = "com.android.support.test", name = "runner", version = "1.0.2" } +android-test-runner = { group = "androidx.test", name = "runner", version = "1.5.2" } androidx-annotation = { group = "androidx.annotation", name = "annotation", version = "1.6.0" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version = "1.1.0" } androidx-espresso-idlingresource = { group = "androidx.test.espresso", name = "espresso-idling-resource", version = "3.5.1" } @@ -113,7 +112,8 @@ kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", kotlin-plugin-min = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-min" } kotlin-plugin-max = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-max" } kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # the Kotlin plugin resolves the version -kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin-stdlib" } +kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common", version.ref = "kotlin-stdlib" } +kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin-stdlib" } kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-stdlib" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # the Kotlin plugin resolves the version kotlin-test-annotations-common = { group = "org.jetbrains.kotlin", name = "kotlin-test-annotations-common" } # the Kotlin plugin resolves the version diff --git a/libraries/apollo-annotations/build.gradle.kts b/libraries/apollo-annotations/build.gradle.kts index 3fc0f0d7f82..51572b82d6d 100644 --- a/libraries/apollo-annotations/build.gradle.kts +++ b/libraries/apollo-annotations/build.gradle.kts @@ -10,16 +10,22 @@ apolloLibrary { kotlin { sourceSets { + /** + * Because apollo-annotation is pulled as an API dependency in in all other modules we configure the + * Kotlin stdlib dependency here. See https://youtrack.jetbrains.com/issue/KT-53471 + */ findByName("commonMain")?.apply { dependencies { - api(libs.kotlin.stdlib) - api(libs.jetbrains.annotations) + api(libs.kotlin.stdlib.common) + } + } + findByName("jvmMain")?.apply { + dependencies { + api(libs.kotlin.stdlib.jvm) } } - findByName("jsMain")?.apply { dependencies { - // See https://youtrack.jetbrains.com/issue/KT-53471 api(libs.kotlin.stdlib.js) } } diff --git a/libraries/apollo-compiler/build.gradle.kts b/libraries/apollo-compiler/build.gradle.kts index 79d367cb103..b0c5cf5837f 100644 --- a/libraries/apollo-compiler/build.gradle.kts +++ b/libraries/apollo-compiler/build.gradle.kts @@ -32,6 +32,9 @@ dependencies { testImplementation(libs.androidx.annotation) { because("Used in the Java generated code") } + testImplementation(libs.jetbrains.annotations) { + because("Used in the Java generated code") + } } abstract class GeneratePluginVersion : DefaultTask() { diff --git a/tests/enums/src/main/graphql/schema.graphqls b/tests/enums/src/main/graphql/schema.graphqls index 3372f4a30ad..730f4534e2c 100644 --- a/tests/enums/src/main/graphql/schema.graphqls +++ b/tests/enums/src/main/graphql/schema.graphqls @@ -44,7 +44,7 @@ enum Gravity { type, } -# See https://youtrack.jetbrains.com/issue/KT-52315 +# See https://youtrack.jetbrains.com/issue/KT-52315 for why this test enum Foo { header, footer, diff --git a/tests/gradle.properties b/tests/gradle.properties index 20034c57dda..ef0c874a68a 100644 --- a/tests/gradle.properties +++ b/tests/gradle.properties @@ -2,7 +2,6 @@ xcodeproj=samples/multiplatform/kmp-ios-app/kmp-ios-app.xcodeproj android.useAndroidX=true - # Keep in sync with other projects # Give more memory to the Gradle daemon org.gradle.jvmargs=-Xmx8g @@ -13,11 +12,4 @@ org.gradle.caching=true # Enable the configuration cache # org.gradle.configuration-cache=true -kotlin.mpp.androidSourceSetLayoutVersion1.nowarn=true org.gradle.parallel=true - -# See https://kotlinlang.org/docs/whatsnew-eap.html#preview-of-gradle-composite-builds-support-in-kotlin-multiplatform -kotlin.mpp.import.enableKgpDependencyResolution=true - -# See https://youtrack.jetbrains.com/issue/KT-55995/Add-ability-to-perform-precise-compilation-task-outputs-backup -kotlin.compiler.preciseCompilationResultsBackup=true diff --git a/tests/idling-resource/build.gradle.kts b/tests/idling-resource/build.gradle.kts index e3e43beeea8..119dd362a4f 100644 --- a/tests/idling-resource/build.gradle.kts +++ b/tests/idling-resource/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { implementation(libs.androidx.espresso.idlingresource) implementation(libs.apollo.idlingresource) testImplementation(libs.apollo.mockserver) - testImplementation(libs.android.support.annotations) + testImplementation(libs.androidx.annotation) testImplementation(libs.android.test.runner) } @@ -19,7 +19,6 @@ android { defaultConfig { minSdk = libs.versions.android.sdkversion.min.get().toInt() - targetSdk = libs.versions.android.sdkversion.target.get().toInt() } } diff --git a/tests/java-nullability/build.gradle.kts b/tests/java-nullability/build.gradle.kts index 4beeff8f3eb..c25828b40c9 100644 --- a/tests/java-nullability/build.gradle.kts +++ b/tests/java-nullability/build.gradle.kts @@ -8,6 +8,8 @@ dependencies { implementation(libs.apollo.api.java) implementation(libs.guava.jre) implementation(libs.androidx.annotation) + implementation(libs.jetbrains.annotations) + testImplementation(libs.junit) } diff --git a/tests/settings.gradle.kts b/tests/settings.gradle.kts index 383ea4714cd..34e8c12cabc 100644 --- a/tests/settings.gradle.kts +++ b/tests/settings.gradle.kts @@ -23,10 +23,7 @@ rootProject.projectDir include(project) } -includeBuild("../") { - // See https://youtrack.jetbrains.com/issue/KT-56536 - name = "apollo-kotlin" -} +includeBuild("../") dependencyResolutionManagement { versionCatalogs {