Skip to content

Commit 4f595f0

Browse files
authored
Fixed some warnings and enabled allWarningsAsErrors again (#6306)
* Fixed some warnings and enabled allWarningsAsErrors again * remove debug * Fix warning after rebase * restore mockserver license until next release * fix another warning * fix persisted query manifest test
1 parent b446f42 commit 4f595f0

File tree

39 files changed

+81
-104
lines changed

39 files changed

+81
-104
lines changed

build-logic/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
23
import org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension
34
import org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin
@@ -38,9 +39,9 @@ dependencies {
3839
implementation(libs.androidx.lint.gradle.plugin)
3940
implementation(libs.kotlin.plugin.compose)
4041

41-
// We want the KSP plugin to use the version from the classpath and not force a newer version
42-
// of the Gradle plugin
4342
implementation(libs.kotlin.plugin)
43+
implementation(libs.kotlin.plugin.annotations)
44+
4445
runtimeOnly(libs.ksp)
4546
// XXX: This is only needed for tests. We could have different build logic for different
4647
// builds but this seems just overkill for now
@@ -64,7 +65,7 @@ tasks.withType<JavaCompile>().configureEach {
6465
options.release.set(17)
6566
}
6667
tasks.withType(KotlinJvmCompile::class.java).configureEach {
67-
kotlinOptions.jvmTarget = "17"
68+
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
6869
}
6970

7071
gradlePlugin {

build-logic/src/main/kotlin/CompilerOptions.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,7 @@ fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptio
149149
}
150150

151151
kotlinExtensionOrNull?.coreLibrariesVersion = "${kotlinCompilerOptions.version.version}.0"
152-
/**
153-
* Required because of:
154-
*
155-
* > Task :apollo-runtime:compileKotlinWasmJs
156-
* w: duplicate library name: kotlin
157-
*
158-
* (maybe https://youtrack.jetbrains.com/issue/KT-51110?)
159-
*/
160-
allWarningsAsErrors(false)
152+
allWarningsAsErrors(true)
161153
}
162154

163155
fun setTestToolchain(project: Project, test: Test, javaVersion: Int) {

build-logic/src/main/kotlin/Mpp.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import org.gradle.api.Action
33
import org.gradle.api.Project
44
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
5+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
56
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
67
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
7-
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
88
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
99

1010
internal val allAppleTargets = setOf(
@@ -74,6 +74,12 @@ fun Project.configureMpp(
7474
}
7575
}
7676
}
77+
if (withWasm) {
78+
@OptIn(ExperimentalWasmDsl::class)
79+
wasmJs {
80+
nodejs()
81+
}
82+
}
7783

7884
if (enableLinux && withLinux) {
7985
linuxX64("linux")
@@ -102,15 +108,6 @@ fun Project.configureMpp(
102108
}
103109
}
104110
}
105-
if (withWasm) {
106-
@OptIn(ExperimentalWasmDsl::class)
107-
wasmJs {
108-
/**
109-
* See https://youtrack.jetbrains.com/issue/KT-63014
110-
*/
111-
nodejs()
112-
}
113-
}
114111

115112
configureSourceSetGraph()
116113
}

build-logic/src/main/kotlin/Node.kt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,29 @@ import org.gradle.api.Project
22
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
33
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
44
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
5+
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
56
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
67
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
78

89
fun Project.configureNode() {
9-
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask::class.java).configureEach {
10+
check(this == rootProject) {
11+
"Must only be called in root project"
12+
}
13+
plugins.withType(NodeJsRootPlugin::class.java).configureEach {
14+
extensions.getByType(NodeJsRootExtension::class.java).apply {
15+
// /**
16+
// * See https://youtrack.jetbrains.com/issue/KT-63014
17+
// */
18+
// version = "21.0.0-v8-canary202309143a48826a08"
19+
// downloadBaseUrl = "https://nodejs.org/download/v8-canary"
20+
}
21+
22+
tasks.withType(KotlinNpmInstallTask::class.java).configureEach {
23+
args.add("--ignore-engines")
24+
}
25+
}
26+
27+
tasks.withType(KotlinNpmInstallTask::class.java).configureEach {
1028
args.addAll(
1129
listOf(
1230
"--network-concurrency",

build-logic/src/main/kotlin/api.kt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,29 +124,7 @@ fun Project.apolloTest(
124124
}
125125

126126
fun Project.apolloRoot(ciBuild: TaskProvider<Task>) {
127-
configureWasmCompatibleNode()
127+
configureNode()
128128
rootSetup(ciBuild)
129129
}
130130

131-
/**
132-
* See https://youtrack.jetbrains.com/issue/KT-63014
133-
*/
134-
private fun Project.configureWasmCompatibleNode() {
135-
check(this == rootProject) {
136-
"Must only be called in root project"
137-
}
138-
plugins.withType(NodeJsRootPlugin::class.java).configureEach {
139-
extensions.getByType(NodeJsRootExtension::class.java).apply {
140-
version = "21.0.0-v8-canary202309143a48826a08"
141-
downloadBaseUrl = "https://nodejs.org/download/v8-canary"
142-
}
143-
144-
tasks.withType(KotlinNpmInstallTask::class.java).configureEach {
145-
args.add("--ignore-engines")
146-
}
147-
}
148-
}
149-
150-
fun Project.apolloTestRoot() {
151-
configureWasmCompatibleNode()
152-
}

build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ tasks.register("ciPublishSnapshot") {
4242
}
4343
}
4444

45-
4645
tasks.register("ciPublishRelease") {
4746
description = "Publishes all artifacts to OSSRH and the Gradle Plugin Portal"
4847

@@ -117,7 +116,6 @@ tasks.named("dependencyUpdates").configure {
117116
}
118117
}
119118

120-
rootProject.configureNode()
121119
rootProject.configureJapiCmp()
122120

123121
configure<kotlinx.validation.ApiValidationExtension> {

gradle/libraries.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ kotlinx-serialization-runtime = "1.6.2"
3636
ksp = "2.1.0-1.0.29"
3737
ktor = "3.0.0"
3838
moshix = "0.14.1"
39-
node-fetch = "2.6.7"
39+
node-fetch = "2.7.0"
4040
okio = "3.9.0"
4141
okhttp = "4.12.0"
4242
rx-java2 = "2.2.21"
@@ -121,6 +121,7 @@ kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", versio
121121
graphql-java = "com.graphql-java:graphql-java:20.4"
122122
# The main kotlin version for build-logic and Gradle tests
123123
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin" }
124+
kotlin-plugin-annotations = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-annotations", version.ref = "kotlin-plugin"}
124125
kotlin-plugin-compose = { group = "org.jetbrains.kotlin", name = "compose-compiler-gradle-plugin", version.ref = "kotlin-plugin" }
125126
# For Gradle integration tests to make sure we stay compatible with 1.5.0
126127
kotlin-plugin-min = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-min" }

kotlin-js-store-2.1/yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ node-fetch@2.6.7:
363363
dependencies:
364364
whatwg-url "^5.0.0"
365365

366+
node-fetch@2.7.0:
367+
version "2.7.0"
368+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
369+
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
370+
dependencies:
371+
whatwg-url "^5.0.0"
372+
366373
normalize-path@^3.0.0, normalize-path@~3.0.0:
367374
version "3.0.0"
368375
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo/compiler/entrypoints.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class EntryPoints {
157157
}
158158
}
159159

160+
@Suppress("DEPRECATION")
160161
internal fun ApolloCompilerPlugin.toOperationOutputGenerator(): OperationOutputGenerator {
161162
return object : OperationOutputGenerator {
162163
override fun generate(operationDescriptorList: Collection<OperationDescriptor>): OperationOutput {

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo/compiler/CodegenTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package com.apollographql.apollo.compiler
24

35
import com.apollographql.apollo.annotations.ApolloExperimental
@@ -253,7 +255,7 @@ class CodegenTest {
253255
"mutation_create_review", "simple_fragment", "data_builders" -> true
254256
else -> false
255257
}
256-
@Suppress("DEPRECATION") val operationIdGenerator = when (folder.name) {
258+
val operationIdGenerator = when (folder.name) {
257259
"operation_id_generator" -> object : OperationIdGenerator {
258260
override fun apply(operationDocument: String, operationName: String): String {
259261
return "hash"
@@ -279,10 +281,8 @@ class CodegenTest {
279281

280282
val graphqlFiles = setOf(File(folder, "TestOperation.graphql"))
281283

282-
@Suppress("DEPRECATION")
283284
val operationOutputGenerator = OperationOutputGenerator.Default(operationIdGenerator)
284285

285-
@Suppress("DEPRECATION")
286286
val targetLanguage = if (generateKotlinModels) {
287287
if (folder.name == "enum_field") KOTLIN_1_9 else KOTLIN_1_5
288288
} else {

0 commit comments

Comments
 (0)