Skip to content

Commit

Permalink
Remove autovalue APIs
Browse files Browse the repository at this point in the history
We no longer use this
  • Loading branch information
ZacSweers committed Nov 18, 2023
1 parent 177bc00 commit 3584b4b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 123 deletions.
82 changes: 0 additions & 82 deletions slack-plugin/src/main/kotlin/slack/gradle/SlackExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.jetbrains.kotlin.gradle.plugin.KaptExtension
import slack.gradle.agp.PermissionAllowlistConfigurer
import slack.gradle.compose.configureComposeCompiler
import slack.gradle.dependencies.SlackDependencies
Expand Down Expand Up @@ -86,7 +85,6 @@ constructor(

var kaptRequired = false
var naptRequired = false
val avMoshiEnabled = featuresHandler.avExtensionMoshi.getOrElse(false)
val moshiCodegenEnabled = featuresHandler.moshiHandler.moshiCodegen.getOrElse(false)
val moshiSealedCodegenEnabled = featuresHandler.moshiHandler.sealedCodegen.getOrElse(false)
val allowKsp = slackProperties.allowKsp
Expand Down Expand Up @@ -236,27 +234,6 @@ constructor(
dependencies.add("compileOnly", "com.slack.circuit:circuit-codegen-annotations")
}

if (featuresHandler.autoValue.getOrElse(false)) {
markKaptNeeded("AutoValue")
dependencies.add("compileOnly", SlackDependencies.Auto.Value.annotations)
dependencies.add(aptConfiguration(), SlackDependencies.Auto.Value.autovalue)
if (avMoshiEnabled) {
dependencies.add("implementation", SlackDependencies.Auto.Value.Moshi.runtime)
dependencies.add(aptConfiguration(), SlackDependencies.Auto.Value.Moshi.extension)
}
if (featuresHandler.avExtensionParcel.getOrElse(false)) {
dependencies.add("implementation", SlackDependencies.Auto.Value.Parcel.adapter)
dependencies.add(aptConfiguration(), SlackDependencies.Auto.Value.Parcel.extension)
}
if (featuresHandler.avExtensionWith.getOrElse(false)) {
dependencies.add(aptConfiguration(), SlackDependencies.Auto.Value.with)
}
if (featuresHandler.avExtensionKotlin.getOrElse(false)) {
dependencies.add(aptConfiguration(), SlackDependencies.Auto.Value.kotlin)
configure<KaptExtension> { arguments { arg("avkSrc", project.file("src/main/java")) } }
}
}

if (featuresHandler.autoService.getOrElse(false)) {
if (allowKsp) {
markKspNeeded("AutoService")
Expand All @@ -269,12 +246,6 @@ constructor(
}
}

if (featuresHandler.incap.getOrElse(false)) {
markKaptNeeded("Incap")
dependencies.add("compileOnly", SlackDependencies.Incap.incap)
dependencies.add(aptConfiguration(), SlackDependencies.Incap.processor)
}

if (featuresHandler.redacted.getOrElse(false)) {
pluginManager.apply("dev.zacsweers.redacted")
}
Expand Down Expand Up @@ -363,19 +334,9 @@ constructor(
/** Enables AutoService on this project. */
internal abstract val autoService: Property<Boolean>

/** Enables InCap on this project. */
internal abstract val incap: Property<Boolean>

/** Enables redacted-compiler-plugin on this project. */
internal abstract val redacted: Property<Boolean>

// AutoValue
internal abstract val autoValue: Property<Boolean>
internal abstract val avExtensionMoshi: Property<Boolean>
internal abstract val avExtensionParcel: Property<Boolean>
internal abstract val avExtensionWith: Property<Boolean>
internal abstract val avExtensionKotlin: Property<Boolean>

// Moshi
internal val moshiHandler = objects.newInstance<MoshiHandler>()

Expand Down Expand Up @@ -460,44 +421,6 @@ constructor(
daggerHandler.runtimeOnly.setDisallowChanges(true)
}

/**
* Enables AutoValue for this project.
*
* @param moshi Enables auto-value-moshi
* @param parcel Enables auto-value-parcel
* @param with Enables auto-value-with
*/
@OptIn(DelicateSlackPluginApi::class)
public fun autoValue(
moshi: Boolean = false,
parcel: Boolean = false,
with: Boolean = false,
) {
autoValue(moshi, parcel, with, kotlin = false)
}

/**
* Enables AutoValue for this project.
*
* @param moshi Enables auto-value-moshi
* @param parcel Enables auto-value-parcel
* @param with Enables auto-value-with
* @param kotlin Enables auto-value-kotlin. THIS SHOULD ONLY BE TEMPORARY FOR MIGRATION PURPOSES!
*/
@DelicateSlackPluginApi
public fun autoValue(
moshi: Boolean = false,
parcel: Boolean = false,
with: Boolean = false,
kotlin: Boolean = false
) {
autoValue.setDisallowChanges(true)
avExtensionParcel.setDisallowChanges(parcel)
avExtensionMoshi.setDisallowChanges(moshi)
avExtensionWith.setDisallowChanges(with)
avExtensionKotlin.setDisallowChanges(kotlin)
}

/**
* Enables Moshi for this project.
*
Expand Down Expand Up @@ -525,11 +448,6 @@ constructor(
autoService.setDisallowChanges(true)
}

/** Enables InCap on this project. */
public fun incap() {
incap.setDisallowChanges(true)
}

/** Enables redacted-compiler-plugin on this project. */
public fun redacted() {
redacted.setDisallowChanges(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,42 +100,6 @@ internal object SlackDependencies : DependencySet() {
// Intentionally public as we use AutoService annotations only in some places
val annotations: Any by artifact("auto-service-annotations")
}

object Value : DependencyGroup("com.google.auto.value", "auto-value") {
// Intentionally public for custom AutoValue extensions to build against
val autovalue: Any by artifact("auto-value")
// Intentionally public as we use AutoValue annotations only in some places
val annotations: Any by artifact("auto-value-annotations")

val kotlin: Any by
artifact(
groupOverride = "com.slack.auto.value",
artifact = "auto-value-kotlin",
gradleProperty = "auto-value-kotlin"
)

// TODO Switch to using slack.features.autovalue in the build file.
val with: Any by
artifact(
groupOverride = "com.gabrielittner.auto.value",
artifact = "auto-value-with",
gradleProperty = "auto-value-with"
)

object Moshi : DependencyGroup("com.ryanharter.auto.value", "auto-value-moshi") {
// TODO Switch to using slack.features.autovalue in the build file.
val runtime: Any by artifact("auto-value-moshi-runtime")
// TODO Switch to using slack.features.autovalue in the build file.
val extension: Any by artifact("auto-value-moshi-extension")
}

object Parcel : DependencyGroup("com.ryanharter.auto.value", "auto-value-parcel") {
// Intentionally public as we host some custom adapters externally
val adapter: Any by artifact("auto-value-parcel-adapter")
// TODO Switch to using slack.features.autovalue in the build file.
val extension: Any by artifact("auto-value-parcel")
}
}
}

internal object Dagger : DependencyGroup("com.google.dagger") {
Expand All @@ -148,11 +112,6 @@ internal object SlackDependencies : DependencySet() {
internal val core: Any by artifact("error_prone_core")
}

object Incap : DependencyGroup("net.ltgt.gradle.incap") {
val incap: Any by artifact()
val processor: Any by artifact("incap-processor")
}

object Moshi : DependencyGroup("com.squareup.moshi") {
val adapters: Any by artifact("moshi-adapters")
val codeGen: Any by artifact("moshi-kotlin-codegen")
Expand Down

0 comments on commit 3584b4b

Please sign in to comment.