Skip to content

Commit

Permalink
Remove support for and use of Kotlin JS plugin (cashapp#1399)
Browse files Browse the repository at this point in the history
This plugin is going away in favor of using the multiplatform plugin.
  • Loading branch information
JakeWharton authored Aug 10, 2023
1 parent 93985ce commit 357b4de
Show file tree
Hide file tree
Showing 21 changed files with 8 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ private class RedwoodBuildExtensionImpl(private val project: Project) : RedwoodB
explicit = true
}
project.plugins.withId("org.jetbrains.kotlin.android", kotlinPluginHandler)
project.plugins.withId("org.jetbrains.kotlin.js", kotlinPluginHandler)
project.plugins.withId("org.jetbrains.kotlin.jvm", kotlinPluginHandler)
project.plugins.withId("org.jetbrains.kotlin.multiplatform", kotlinPluginHandler)
project.afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ import org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE
import org.gradle.api.tasks.TaskProvider
import org.gradle.language.base.plugins.LifecycleBasePlugin.CHECK_TASK_NAME
import org.gradle.language.base.plugins.LifecycleBasePlugin.VERIFICATION_GROUP
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.Companion.MAIN_COMPILATION_NAME
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.androidJvm
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.common
Expand Down Expand Up @@ -64,8 +62,6 @@ public class RedwoodLintPlugin : Plugin<Project> {
configureKotlinMultiplatformTargets(project, rootTask)
}
rootTask
} else if (project.plugins.hasPlugin("org.jetbrains.kotlin.js")) {
configureKotlinJsProject(project)
} else if (project.plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
configureKotlinJvmProject(project)
} else if (project.plugins.hasPlugin("org.jetbrains.kotlin.android")) {
Expand Down Expand Up @@ -158,15 +154,6 @@ private fun configureKotlinMultiplatformTargets(
}
}

private fun configureKotlinJsProject(
project: Project,
): TaskProvider<out Task> {
val kotlin = project.extensions.getByType(KotlinJsProjectExtension::class.java)
// Cast to supertype avoids deprecation on subtype of related mutable DSL API.
val target = (kotlin as KotlinSingleTargetExtension<*>).target
return createKotlinTargetRedwoodLintTask(project, target, baseTaskName)
}

private fun configureKotlinJvmProject(
project: Project,
): TaskProvider<out Task> {
Expand Down
24 changes: 0 additions & 24 deletions redwood-gradle-plugin/src/test/fixture/lint-js/build.gradle

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ class FixtureTest {
)
}

@Test fun lintJs() {
val fixtureDir = File("src/test/fixture/lint-js")
val result = fixtureGradleRunner(fixtureDir).build()
val lintTasks = result.tasks.map { it.path }.filter { it.startsWith(":redwoodLint") }
assertThat(lintTasks).containsExactly(
":redwoodLint",
)
}

@Test fun lintJvm() {
val fixtureDir = File("src/test/fixture/lint-jvm")
val result = fixtureGradleRunner(fixtureDir).build()
Expand Down
4 changes: 2 additions & 2 deletions redwood-layout-dom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'org.jetbrains.kotlin.js'
apply plugin: 'org.jetbrains.kotlin.multiplatform'

redwoodBuild {
publishing()
Expand All @@ -10,7 +10,7 @@ kotlin {
}

sourceSets {
main {
commonMain {
dependencies {
api projects.redwoodLayoutWidget
}
Expand Down
4 changes: 2 additions & 2 deletions redwood-lazylayout-dom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'org.jetbrains.kotlin.js'
apply plugin: 'org.jetbrains.kotlin.multiplatform'

redwoodBuild {
}
Expand All @@ -9,7 +9,7 @@ kotlin {
}

sourceSets {
main {
commonMain {
dependencies {
api projects.redwoodLazylayoutWidget
}
Expand Down
4 changes: 2 additions & 2 deletions samples/counter/browser/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'org.jetbrains.kotlin.js'
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'app.cash.redwood'

// The name of the final JS file to be referenced from HTML.
Expand All @@ -13,7 +13,7 @@ kotlin {
}

sourceSets {
main {
commonMain {
dependencies {
implementation projects.samples.counter.schema.widget
implementation projects.samples.counter.presenter
Expand Down
4 changes: 2 additions & 2 deletions samples/emoji-search/browser/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'org.jetbrains.kotlin.js'
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'app.cash.redwood'

// The name of the final JS file to be referenced from HTML.
Expand All @@ -13,7 +13,7 @@ kotlin {
}

sourceSets {
main {
commonMain {
dependencies {
implementation projects.samples.emojiSearch.schema.widget
implementation projects.samples.emojiSearch.presenter
Expand Down

0 comments on commit 357b4de

Please sign in to comment.