From f0eb0fa8063ab92141cff37afe42b4c54e21eba9 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Wed, 2 Oct 2024 14:54:05 -0400 Subject: [PATCH] Misc foundry renames and documentation updates (#1005) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 33 +++ build.gradle.kts | 57 ----- config/git/hooks/pre-commit | 6 +- config/lint/lint.xml | 5 - docs/architecture.md | 18 +- docs/dependency-rake.md | 2 +- docs/dsl.md | 2 +- docs/formatters-and-analysis.md | 2 +- docs/index.md | 42 ++-- docs/utilities.md | 2 +- mkdocs.yml | 4 +- .../foundry-gradle-plugin/build.gradle.kts | 6 +- .../src/main/kotlin/Aliases.kt | 8 +- .../gradle/AndroidSourcesConfigurer.kt | 2 +- .../foundry/gradle/FoundryBasePlugin.kt | 4 +- .../kotlin/foundry/gradle/FoundryExtension.kt | 24 +- .../foundry/gradle/FoundryGradleUtil.kt | 25 +- .../foundry/gradle/FoundryProperties.kt | 235 +++++++++--------- .../foundry/gradle/FoundryRootPlugin.kt | 4 +- .../kotlin/foundry/gradle/FoundryTools.kt | 4 +- .../main/kotlin/foundry/gradle/GradleExt.kt | 26 +- .../main/kotlin/foundry/gradle/Platforms.kt | 82 ------ .../gradle/StandardProjectConfigurations.kt | 10 +- .../avoidance/ComputeAffectedProjectsTask.kt | 2 +- .../GenerateAndroidTestProjectPathsTask.kt | 2 +- .../avoidance/GenerateDependencyGraphTask.kt | 2 +- .../gradle/dependencyrake/DependencyRake.kt | 4 +- .../kotlin/foundry/gradle/lint/DetektTasks.kt | 2 +- .../kotlin/foundry/gradle/lint/LintTasks.kt | 2 +- .../foundry/gradle/stats/ModuleStats.kt | 10 +- .../gradle/tasks/AndroidTestApksTask.kt | 4 +- .../foundry/gradle/tasks/BootstrapTask.kt | 21 +- .../tasks/CheckDependencyVersionsTask.kt | 2 +- .../kotlin/foundry/gradle/tasks/FileTasks.kt | 4 +- .../gradle/tasks/InstallCommitHooksTask.kt | 2 +- .../gradle/tasks/PrintFossaDependencies.kt | 4 +- .../robolectric/UpdateRobolectricJarsTask.kt | 2 +- .../foundry/gradle/unittest/UnitTests.kt | 2 +- .../foundry/gradle/util/PropertyUtil.kt | 4 +- .../compose/projectgen/ProjectGenPresenter.kt | 2 + .../intellij/compose/projectgen/models.kt | 4 +- .../kotlin/foundry/cli/AppleSiliconCompat.kt | 2 +- .../gradle/GradleTestFixturesMigratorCli.kt | 24 +- 43 files changed, 308 insertions(+), 396 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09e47567b..43a1e9ba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,39 @@ Changelog **Unreleased** -------------- +### Project Restructuring + +We've restructured this project! Since its early days as a simple Gradle convention plugin it's expanded into IntelliJ plugins, CLIs, CI tooling, and more. To better capture this, we've renamed the project to *Foundry*, restructured its artifacts into a more cohesive setup, moved kotlin-cli-util into this repo, and will likely split out some more artifacts down the line. + +#### Migration Guide + +- Any **gradle properties** prefixed with `slack.` or `sgp.` have now moved to `foundry.`. `slack.gradle.` prefix have also removed the `gradle.` (i.e. `slack.gradle.foo` would now be `foundry.foo`). +- Package names have all aligned to `foundry.*`. In most cases it should be simple enough to replace `import com.slack.*` with `import foundry.*`. +- Gradle coordinates group have moved to the `com.slack.foundry` group name. + + | Old Artifact ID | New Artifact ID | + |---------------------|-----------------| + | sgp | gradle-plugin | + | sgp-agp-handler-api | agp-handler-api | + | sgp-common | foundry-common | + | sgp-tracing | tracing | + | skippy | skippy | + +- The former `kotlin-cli-util` APIs have moved to the `com.slack.foundry:cli` artifact. +- Platform-specific plugins now live under the `platforms/` directory. +- All other tools now live under the `tools/` directory. +- Most top-level `Slack`-prefixed APIs are now prefixed with `Foundry`. +- The primary gradle entry points are now `foundry {}`, but the previous `slack {}` entry points are left with deprecation `ReplaceWith` options. +- Gradle plugin IDs have migrated to `foundry.*` names. + + | Old | New | + |-------------------------------|--------------------------| + | `slack.gradle.root` | `foundry.root` | + | `slack.gradle.base` | `foundry.base` | + | `slack.gradle.apk-versioning` | `foundry.apk-versioning` | + +- Introduce new required `foundry.android.defaultNamespacePrefix` property for android projects. This is necessary for projects that don't define an `android.namespace` explicitly. + 0.19.6 ------ diff --git a/build.gradle.kts b/build.gradle.kts index 1ee6989ff..8d53ede3d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -131,69 +131,12 @@ allprojects { } } -/** - * These are magic shared versions that are used in both buildSrc's build file and - * SlackDependencies. These are copied as a source into the main source set and templated for - * replacement. - */ -data class KotlinBuildConfig(val kotlin: String) { - private val kotlinVersion by lazy { - val (major, minor, patch) = kotlin.substringBefore("-").split('.').map { it.toInt() } - KotlinVersion(major, minor, patch) - } - - // Left as a toe-hold for any future needs - private val extraArgs = arrayOf() - - /** - * See more information about these in - * - CommonCompilerArguments.kt - * - K2JVMCompilerArguments.kt - */ - val kotlinCompilerArgs: List = - listOf( - // Enhance not null annotated type parameter's types to definitely not null types (@NotNull T - // => T & Any) - "-Xenhance-type-parameter-types-to-def-not-null", - // Use fast implementation on Jar FS. This may speed up compilation time, but currently it's - // an experimental mode - // TODO toe-hold but we can't use it yet because it emits a warning that fails with -Werror - // https://youtrack.jetbrains.com/issue/KT-54928 - // "-Xuse-fast-jar-file-system", - // Support inferring type arguments based on only self upper bounds of the corresponding type - // parameters - "-Xself-upper-bound-inference", - ) + extraArgs - - /** - * See more information about these in - * - CommonCompilerArguments.kt - * - K2JVMCompilerArguments.kt - */ - val kotlinJvmCompilerArgs: List = - listOf( - "-Xjsr305=strict", - // Match JVM assertion behavior: - // https://publicobject.com/2019/11/18/kotlins-assert-is-not-like-javas-assert/ - "-Xassertions=jvm", - // Potentially useful for static analysis tools or annotation processors. - "-Xemit-jvm-type-annotations", - // Enable new jvm-default behavior - // https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/ - "-Xjvm-default=all", - "-Xtype-enhancement-improvements-strict-mode", - // https://kotlinlang.org/docs/whatsnew1520.html#support-for-jspecify-nullness-annotations - "-Xjspecify-annotations=strict", - ) -} - tasks.dokkaHtmlMultiModule { outputDirectory.set(rootDir.resolve("docs/api/0.x")) includes.from(project.layout.projectDirectory.file("README.md")) } val kotlinVersion = libs.versions.kotlin.get() -val kotlinBuildConfig = KotlinBuildConfig(kotlinVersion) val jvmTargetVersion = libs.versions.jvmTarget.map(JvmTarget::fromTarget) diff --git a/config/git/hooks/pre-commit b/config/git/hooks/pre-commit index df36c6c76..e7e2ae584 100755 --- a/config/git/hooks/pre-commit +++ b/config/git/hooks/pre-commit @@ -2,8 +2,8 @@ ######## FORMAT HOOK START ######## -if [[ "$SLACK_COMMIT_HOOK_OPT_OUT" == "true" ]]; then - echo 'Warning: Skipping pre-commit hook because SLACK_COMMIT_HOOK_OPT_OUT is true' +if [[ "$FOUNDRY_COMMIT_HOOK_OPT_OUT" == "true" ]]; then + echo 'Warning: Skipping pre-commit hook because FOUNDRY_COMMIT_HOOK_OPT_OUT is true' exit fi @@ -65,7 +65,7 @@ original_partially_staged_filenames=$(echo "$original_partially_staged_chksum" | #### Sort Dependencies section # Get a list of staged build.gradle.kts files -kts_files_list="$(git diff --cached --name-only --diff-filter=ACMR "-G.*" | grep -Ei "build\.gradle\.kts$" | grep -v -x -F "tooling/slack-platform/build.gradle.kts")" +kts_files_list="$(git diff --cached --name-only --diff-filter=ACMR "-G.*" | grep -Ei "build\.gradle\.kts$" )" if [[ ! -z ${kts_files_list} ]]; then # We have some build files! Join them to a string delimited on space. We'll pass these to sortDependencies kts_files_list="$(echo ${kts_files_list} | paste -sd " " -)" diff --git a/config/lint/lint.xml b/config/lint/lint.xml index 3d30dc727..dd1288340 100644 --- a/config/lint/lint.xml +++ b/config/lint/lint.xml @@ -19,11 +19,6 @@ - - - - - diff --git a/docs/architecture.md b/docs/architecture.md index d9df85446..255d51252 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,33 +1,33 @@ Architecture ============ -SGP consists of three Gradle plugins and some associated helper artifacts. +Foundry contains three Gradle plugins and some associated helper artifacts. -## `SlackRootPlugin` +## `FoundryRootPlugin` This is the root plugin that is applied to the root project of a multi-project build. ```kotlin plugins { - id("com.slack.gradle.root") + id("foundry.root") } ``` Its responsibilities include: -- Registering the `SlackTools` build service. +- Registering the `FoundryTools` build service. - Setting up global configuration (i.e. global lifecycle tasks, download tasks, etc). - Validating the JDK matches the expected JDK defined in `libs.versions.toml`. - Configure git (hooks, ignored revisions, etc). - (If running on macOS) Validating the build isn't running in Rosetta mode. -## `SlackBasePlugin` +## `FoundryBasePlugin` This is the base plugin that is applied to _all_ projects (including the root project). ```kotlin plugins { - id("com.slack.gradle.base") + id("foundry.base") } ``` @@ -45,7 +45,7 @@ Its responsibilities include: This class warrants special mention as it is responsible for the bulk of the configuration applied to projects SGP manages. -- Creates and exposes the [`slack` extension DSL](/dsl). +- Creates and exposes the [`foundry` extension DSL](/dsl). - Applies common configurations. - This largely just sets up the dependency sorter plugin. - Applies common JVM configurations. @@ -74,7 +74,7 @@ Java projects are fairly simple. Note that these are applied on all projects tha - Gradle toolchains are used to manage the JDK used for `JavaCompile` tasks in non-android projects to ensure consistency. - All `JavaCompile` tasks have `-parameters` added to `options.compilerArgs` for better static analysis and annotation processing support. - If opted-in, error-prone and nullaway are applied and set up with the project with common configurations (configured checks, ignoring build dirs, etc). - - SGP supports Error-Prone's auto-patching mode via enabling the `slack.epAutoPatch` property. + - Foundry supports Error-Prone's auto-patching mode via enabling the `foundry.epAutoPatch` property. ##### Android @@ -147,7 +147,7 @@ This also adds a `generateVersionProperties` task that is more or less only rele ## AGP Handlers -SGP is designed to work with multiple versions of AGP at a time, albeit only for forward compatibility and testing reasons. Generally SGP will only be tested against the latest stable version of AGP. To support multiple beta/canary versions of upcoming AGP versions, SGP has an API called `AgpHandler`, which is intended to be an AGP-agnostic common interface for configuring AGP projects across breaking API (source or binary) changes. When a new such change is introduced, we create an `AgpHandler{version}` artifact and implementation with that AGP version as its minimum. At runtime, SGP loads the relevant `AgpHandler` instance for the AGP version it is running against and relevant APIs use this instance via `SlackTools` to interact with them in a version-agnostic way. These aren't always needed so there may be times when there are no implementations needed for the current suite of AGP versions. +SGP is designed to work with multiple versions of AGP at a time, albeit only for forward compatibility and testing reasons. Generally SGP will only be tested against the latest stable version of AGP. To support multiple beta/canary versions of upcoming AGP versions, SGP has an API called `AgpHandler`, which is intended to be an AGP-agnostic common interface for configuring AGP projects across breaking API (source or binary) changes. When a new such change is introduced, we create an `AgpHandler{version}` artifact and implementation with that AGP version as its minimum. At runtime, SGP loads the relevant `AgpHandler` instance for the AGP version it is running against and relevant APIs use this instance via `FoundryTools` to interact with them in a version-agnostic way. These aren't always needed so there may be times when there are no implementations needed for the current suite of AGP versions. An example handler for AGP 8.0 looks like this. diff --git a/docs/dependency-rake.md b/docs/dependency-rake.md index 6572b364f..0f866ed42 100644 --- a/docs/dependency-rake.md +++ b/docs/dependency-rake.md @@ -41,7 +41,7 @@ The core implementation of DR lives in `DependencyRake.kt`. To run dependency rake in a project, use the below command ```bash -$ ./gradlew rakeDependencies -Pslack.gradle.config.enableAnalysisPlugin=true --no-configuration-cache +$ ./gradlew rakeDependencies -Pfoundry.config.enableAnalysisPlugin=true --no-configuration-cache ``` This will run all `rakeDependencies` tasks in the project. This task exists on all subprojects as well, but it diff --git a/docs/dsl.md b/docs/dsl.md index f21195703..41e3dbea7 100644 --- a/docs/dsl.md +++ b/docs/dsl.md @@ -10,7 +10,7 @@ Some examples of this include Dagger, Moshi code gen, Robolectric, and more. The primary entry point is the `slack` extension in the build file, which is backed by the `SlackExtension` interface. ```kotlin -slack { +foundry { features { dagger(...) moshi(...) diff --git a/docs/formatters-and-analysis.md b/docs/formatters-and-analysis.md index 5ac7b5327..751134e8f 100644 --- a/docs/formatters-and-analysis.md +++ b/docs/formatters-and-analysis.md @@ -27,7 +27,7 @@ The core set of analysis tools supported in SGP are: SGP ships with a standard set of git hooks (pre-commit, etc) that it can bootstrap in projects by running `./gradlew installCommitHooks`. These hooks rely on checking in relevant binaries for each formatter/checker, it's strongly recommended to use git-lfs for these. These files should be edited as needed to best serve the project they're running in. -SGP can configure these hooks in the project automatically during bootstrap if you add the `slack.git.hooksPath` gradle property and point it at the hooks directory that the above command output to, or wherever the host project opts to store them. +SGP can configure these hooks in the project automatically during bootstrap if you add the `foundry.git.hooksPath` gradle property and point it at the hooks directory that the above command output to, or wherever the host project opts to store them. Note that Detekt is not yet supported in git hooks as these require extra parameters for baselines. diff --git a/docs/index.md b/docs/index.md index 14758ae54..75ae823ae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,22 +1,18 @@ foundry =================== -This repository contains the core Gradle plugin and associated logic used for Slack's Android app. +This repository contains much of Slack's Android/Kotlin/JVM tooling for Gradle, IntelliJ, CLIs, and more. -This repo is effectively _read-only_ and does not publish artifacts to Maven Central. We [develop +This repo is effectively for Slack's own used but publishes to Maven Central. We [develop these in the open](https://slack.engineering/developing-in-the-open/) to knowledge-share with the community. -As such, our issue tracker is closed and we don't normally accept external PRs, but we welcome your -questions in the discussions section of the project! - -We may later publish some of these components. If you're interested in this, feel free to raise in -a discussions post or vote for existing suggestions. +As such, we don't normally accept external PRs, but we welcome your questions in the discussions section of the project! ## Highlights ### Common project configuration -The `slack.base` plugin offers common configuration for all projects implementing it, covering a +The `foundry.base` plugin offers common configuration for all projects implementing it, covering a wide spectrum of Android, Kotlin, and Java configurations. This includes a whole host of things! @@ -25,7 +21,7 @@ This includes a whole host of things! - Common Kotlin configuration (freeCompilerArgs, JVM target, etc). - Common Java configuration (toolchains, release versions, etc). - Common annotation processors. -- SlackExtension (see next section). +- `FoundryExtension` (see next section). - Formatting (via Spotless). - Platforms and BOM dependencies (see "Platform plugins" section below). - Common lint checks (both on Android and plain JVM projects). @@ -34,12 +30,12 @@ Full docs can be found in the [architecture](architecture) docs. ### Feature DSL -To ease use and configuration of common features in projects, we expose a `slack` DSL in projects +To ease use and configuration of common features in projects, we expose a `foundry` DSL in projects that allows for configuration of these in a semantically easy and boilerplate-free way. This is -controlled via `SlackExtension`. +controlled via `FoundryExtension`. ```kotlin -slack { +foundry { features { dagger() moshi(codegen = true) @@ -88,7 +84,7 @@ its advice to a project to automatically optimize it and _rake_ dependencies. As a part of our modularization efforts, we developed a scoring mechanism for modules that we could use as a measure of their "modularization". This includes a number of metrics and weighs them in a formula to compute a score. This includes LoC, language mixtures, and build graph centrality. This -logic is under the `slack.stats` package. +logic is under the `foundry.stats` package. ### Robolectric Jars Management @@ -166,25 +162,25 @@ There are a _ton_ of miscellaneous tools, utilities, and glue code for Gradle (a SGP expects there to be a `libs` version catalog. The following versions are required to be set the above catalog. -Their docs can be found in `SlackVersions.kt`. +Their docs can be found in `FoundryVersions.kt`. For Android projects, some extra definitions need to be defined - `libs.versions.toml` libraries - `google-coreLibraryDesugaring` - the core library desugaring libraries to use with L8. - `gradle.properties` properties - - `slack.compileSdkVersion` - - `slack.targetSdkVersion` - - `slack.minSdkVersion` + - `foundry.compileSdkVersion` + - `foundry.targetSdkVersion` + - `foundry.minSdkVersion` The following plugins are applied by default but can be disabled if you don't need them. -- Gradle's test retry – `slack.auto-apply.test-retry` - - By default, this uses the [Gradle test-retry plugin](https://github.com/gradle/test-retry-gradle-plugin), but can be configured to use the Gradle Enterprise plugin's implementation instead by setting the `slack.test.retry.pluginType` property to `GE`. -- Spotless – `slack.auto-apply.spotless` -- Detekt – `slack.auto-apply.detekt` -- NullAway – `slack.auto-apply.nullaway` -- Android Cache Fix – `slack.auto-apply.cache-fix` +- Gradle's test retry – `foundry.auto-apply.test-retry` + - By default, this uses the [Gradle test-retry plugin](https://github.com/gradle/test-retry-gradle-plugin), but can be configured to use the Gradle Enterprise plugin's implementation instead by setting the `foundry.test.retry.pluginType` property to `GE`. +- Spotless – `foundry.auto-apply.spotless` +- Detekt – `foundry.auto-apply.detekt` +- NullAway – `foundry.auto-apply.nullaway` +- Android Cache Fix – `foundry.auto-apply.cache-fix` ## Commit hooks diff --git a/docs/utilities.md b/docs/utilities.md index 2c81f450a..44f5d22b5 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -13,7 +13,7 @@ will just show stub files instead. To work mitigate this, we will _patch_ the SDK by putting a copy of the previous version's sources in the location of the new SDK. This allows most sources to still index properly during the beta period. Then, once the new sources are -available, the consuming repo needs only to update the `slack.latestCompileSdkWithSources` gradle property to that new +available, the consuming repo needs only to update the `foundry.latestCompileSdkWithSources` gradle property to that new SDK version and the patcher will clear out that copy and let AGP download the real ones. This runs automatically in the root plugin. diff --git a/mkdocs.yml b/mkdocs.yml index b185954ec..e2abf7b1c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,11 +5,11 @@ site_name: foundry repo_name: foundry repo_url: https://github.com/slackhq/foundry -site_description: "Gradle and IntelliJ build tooling used in Slack's Android repo" +site_description: "Gradle and IntelliJ build tooling used in Slack's Android projects" site_author: Slack remote_branch: gh-pages -copyright: 'Copyright © 2023 Slack Technologies, LLC' +copyright: 'Copyright © 2024 Slack Technologies, LLC' theme: name: 'material' diff --git a/platforms/gradle/foundry-gradle-plugin/build.gradle.kts b/platforms/gradle/foundry-gradle-plugin/build.gradle.kts index 29961d2ab..0c2435878 100644 --- a/platforms/gradle/foundry-gradle-plugin/build.gradle.kts +++ b/platforms/gradle/foundry-gradle-plugin/build.gradle.kts @@ -27,15 +27,15 @@ plugins { gradlePlugin { plugins.create("foundry-root") { - id = "foundry.gradle.root" + id = "foundry.root" implementationClass = "foundry.gradle.FoundryRootPlugin" } plugins.create("foundry-base") { - id = "foundry.gradle.base" + id = "foundry.base" implementationClass = "foundry.gradle.FoundryBasePlugin" } plugins.create("apkVersioning") { - id = "foundry.gradle.apk-versioning" + id = "foundry.apk-versioning" implementationClass = "foundry.gradle.ApkVersioningPlugin" } } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/Aliases.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/Aliases.kt index f112df396..40567b97f 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/Aliases.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/Aliases.kt @@ -15,8 +15,8 @@ */ import foundry.gradle.AndroidHandler import foundry.gradle.FoundryExtension -import foundry.gradle.SlackAndroidAppExtension -import foundry.gradle.SlackAndroidLibraryExtension +import foundry.gradle.FoundryAndroidAppExtension +import foundry.gradle.FoundryAndroidLibraryExtension import foundry.gradle.findByType import org.gradle.api.Action import org.gradle.api.Project @@ -67,7 +67,7 @@ public fun Project.slackAndroid(action: Action) { ReplaceWith("foundry { android { library(action) } }"), level = DeprecationLevel.WARNING, ) -public fun Project.slackAndroidLibrary(action: Action) { +public fun Project.slackAndroidLibrary(action: Action) { foundry { android { library(action) } } } @@ -76,6 +76,6 @@ public fun Project.slackAndroidLibrary(action: Action) { +public fun Project.slackAndroidApp(action: Action) { foundry { android { app(action) } } } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/AndroidSourcesConfigurer.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/AndroidSourcesConfigurer.kt index 22845562f..842221f8b 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/AndroidSourcesConfigurer.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/AndroidSourcesConfigurer.kt @@ -34,7 +34,7 @@ import org.gradle.api.logging.Logger */ internal object AndroidSourcesConfigurer { - internal const val MARKER_FILE_NAME = "slack_patched_marker" + internal const val MARKER_FILE_NAME = "foundry_patched_marker" fun patchSdkSources(requestedSdkVersion: Int, rootProject: Project, latest: Int) { val sdkDir = diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryBasePlugin.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryBasePlugin.kt index bf542d3d7..2d6dcac70 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryBasePlugin.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryBasePlugin.kt @@ -54,8 +54,8 @@ internal class FoundryBasePlugin @Inject constructor(private val buildFeatures: if (!target.isRootProject) { val versionCatalog = target.getVersionsCatalogOrNull() ?: error("SGP requires use of version catalogs!") - val slackTools = target.foundryTools() - StandardProjectConfigurations(foundryProperties, versionCatalog, slackTools).applyTo(target) + val foundryTools = target.foundryTools() + StandardProjectConfigurations(foundryProperties, versionCatalog, foundryTools).applyTo(target) // Configure Gradle's test-retry plugin for insights on build scans on CI only // Thinking here is that we don't want them to retry when iterating since failure diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryExtension.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryExtension.kt index e336fc583..aba211d7a 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryExtension.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryExtension.kt @@ -96,7 +96,7 @@ constructor( } internal fun applyTo(project: Project) { - val logVerbose = foundryProperties.slackExtensionVerbose + val logVerbose = foundryProperties.foundryExtensionVerbose // Dirty but necessary since the extension isn't configured yet when we call this project.afterEvaluate { featuresHandler.applyTo(project) @@ -622,7 +622,7 @@ constructor( if (testFixturesUseDagger.getOrElse(false) && !daggerHandler.enabled.getOrElse(false)) { error( "In order to enable test fixtures with dagger, you must also enable " + - "the `slack { features { dagger() } }` feature" + "the `foundry { features { dagger() } }` feature" ) } } @@ -765,7 +765,7 @@ public abstract class DaggerHandler @Inject constructor(objects: ObjectFactory) * they would be added to regular project dependencies. * * ``` - * slack { + * foundry { * features { * dagger(...) { * anvilGenerators(projects.libraries.foundation.anvil.injection.compiler) @@ -918,7 +918,7 @@ constructor( } else if (foundryProperties.composeEnableLiveLiterals) { project.logger.error( "Live literals are disabled and deprecated in AGP 8.7+. " + - "Please remove the `slack.compose.android.enableLiveLiterals` property." + "Please remove the `foundry.compose.android.enableLiveLiterals` property." ) } } @@ -1032,8 +1032,8 @@ constructor( public abstract class AndroidHandler @Inject constructor(objects: ObjectFactory, private val foundryProperties: FoundryProperties) { - internal val libraryHandler = objects.newInstance() - internal val appHandler = objects.newInstance() + internal val libraryHandler = objects.newInstance() + internal val appHandler = objects.newInstance() @Suppress("MemberVisibilityCanBePrivate") internal val featuresHandler = objects.newInstance() @@ -1056,11 +1056,11 @@ constructor(objects: ObjectFactory, private val foundryProperties: FoundryProper action.execute(featuresHandler) } - public fun library(action: Action) { + public fun library(action: Action) { action.execute(libraryHandler) } - public fun app(action: Action) { + public fun app(action: Action) { action.execute(appHandler) } @@ -1130,19 +1130,19 @@ public abstract class AndroidFeaturesHandler @Inject constructor() { public fun resources(prefix: String) { val libraryExtension = androidExtension as? LibraryExtension - ?: error("slack.android.features.resources() is only applicable in libraries!") + ?: error("foundry.android.features.resources() is only applicable in libraries!") libraryExtension.resourcePrefix = prefix libraryExtension.buildFeatures { androidResources = true } } } @FoundryExtensionMarker -public abstract class SlackAndroidLibraryExtension { +public abstract class FoundryAndroidLibraryExtension { // Left as a toe-hold for the future } @FoundryExtensionMarker -public abstract class SlackAndroidAppExtension { +public abstract class FoundryAndroidAppExtension { internal var allowlistAction: Action? = null /** @@ -1150,7 +1150,7 @@ public abstract class SlackAndroidAppExtension { * * Example: * ``` - * slack { + * foundry { * permissionAllowlist { * if (buildType.name == "release") { * setAllowlistFile(file('path/to/allowlist.txt')) diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryGradleUtil.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryGradleUtil.kt index 8fe9a3800..0e63e8077 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryGradleUtil.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryGradleUtil.kt @@ -26,6 +26,7 @@ import foundry.gradle.dependencies.DependencyGroup import foundry.gradle.util.gitExecProvider import foundry.gradle.util.mapToBoolean import java.io.File +import java.nio.file.Files import java.util.Locale import java.util.Optional import org.gradle.api.GradleException @@ -85,15 +86,25 @@ internal fun parseGitVersion(gitVersion: String?): VersionNumber { } internal fun robolectricJars(gradleUserHomeDir: File, createDirsIfMissing: Boolean = true): File { - val slackHome = - File(gradleUserHomeDir, "slack").apply { - if (createDirsIfMissing) { - if (!exists()) { - mkdir() - } + val foundryHome = File(gradleUserHomeDir, "foundry") + + // Migrate from existing slack + val slackHome = File(gradleUserHomeDir, "slack") + if (slackHome.exists()) { + println("Migrating slack home to foundry") + slackHome.copyRecursively(foundryHome, overwrite = true) + Files.deleteIfExists(slackHome.toPath()) + } + + foundryHome.apply { + if (createDirsIfMissing) { + if (!exists()) { + mkdir() } } - return File(slackHome, "robolectric-jars").apply { + } + + return File(foundryHome, "robolectric-jars").apply { if (createDirsIfMissing) { if (!exists()) { mkdir() diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryProperties.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryProperties.kt index 147b038d5..3d55db3b5 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryProperties.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryProperties.kt @@ -70,7 +70,11 @@ internal constructor( /** Indicates that this android library project has variants. Flag-only, value is ignored. */ public val libraryWithVariants: Boolean - get() = booleanProperty("slack.gradle.config.libraryWithVariants") + get() = booleanProperty("foundry.gradle.config.libraryWithVariants") + + /** Default namespace prefix for android proejcts if one isn't specified. */ + public val defaultNamespacePrefix: String + get() = stringProperty("foundry.android.defaultNamespacePrefix") /** * Indicates that the gradle versions plugin should allow unstable versions. By default unstable @@ -78,74 +82,74 @@ internal constructor( * is ignored. */ public val versionsPluginAllowUnstable: Boolean - get() = booleanProperty("slack.gradle.config.versionsPluginAllowUnstable") + get() = booleanProperty("foundry.gradle.config.versionsPluginAllowUnstable") /** Opt-out flag to skip the androidx dependency check. Should only be used for debugging. */ public val skipAndroidxCheck: Boolean - get() = booleanProperty("slack.gradle.skipAndroidXCheck") + get() = booleanProperty("foundry.gradle.skipAndroidXCheck") /** Version code used for debug APK outputs. */ public val debugVersionCode: Int - get() = intProperty("slack.gradle.debugVersionCode", 90009999) + get() = intProperty("foundry.gradle.debugVersionCode", 90009999) /** User string used for debug APK outputs. */ public val debugUserString: String - get() = stringProperty("slack.gradle.debugUserString", "debug") + get() = stringProperty("foundry.gradle.debugUserString", "debug") /** Opt-in flag to enable snapshots repos, used for the dependencies build shadow job. */ public val enableSnapshots: Boolean - get() = booleanProperty("slack.gradle.config.enableSnapshots") + get() = booleanProperty("foundry.gradle.config.enableSnapshots") /** Opt-in flag to enable mavenLocal repos, used for local testing. */ public val enableMavenLocal: Boolean - get() = booleanProperty("slack.gradle.config.enableMavenLocal") + get() = booleanProperty("foundry.gradle.config.enableMavenLocal") /** * Flag to indicate that this project should have no api dependencies, such as if it's solely an * annotation processor. */ public val rakeNoApi: Boolean - get() = booleanProperty("slack.gradle.config.rake.noapi") + get() = booleanProperty("foundry.gradle.config.rake.noapi") /** * Flag to enable the Gradle Dependency Analysis Plugin, which is disabled by default due to * https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/issues/204 */ public val enableAnalysisPlugin: Boolean - get() = booleanProperty("slack.gradle.config.enableAnalysisPlugin") + get() = booleanProperty("foundry.gradle.config.enableAnalysisPlugin") /** * Flag to indicate this project should be exempted from platforms, usually platform projects * themselves. */ public val noPlatform: Boolean - get() = booleanProperty("slack.gradle.config.noPlatform") + get() = booleanProperty("foundry.gradle.config.noPlatform") /** Property corresponding to the supported languages in GA builds */ public val supportedLanguages: String - get() = stringProperty("slack.supportedLanguages") + get() = stringProperty("foundry.supportedLanguages") /** Property corresponding to the supported languages in Internal builds */ public val supportedLanguagesInternal: String - get() = stringProperty("slack.supportedLanguagesInternal") + get() = stringProperty("foundry.supportedLanguagesInternal") /** Property corresponding to the supported languages in Beta builds */ public val supportedLanguagesBeta: String - get() = stringProperty("slack.supportedLanguagesBeta") + get() = stringProperty("foundry.supportedLanguagesBeta") /** * Property corresponding to the file path of a custom versions.json file for use with * dependencies shadow jobs. */ public val versionsJson: File? - get() = fileProperty("slack.versionsJson") + get() = fileProperty("foundry.versionsJson") /** * An alias name to a libs.versions.toml bundle for common Android Compose dependencies that * should be added to android projects with compose enabled */ public val defaultComposeAndroidBundleAlias: String? - get() = optionalStringProperty("slack.compose.android.defaultBundleAlias") + get() = optionalStringProperty("foundry.compose.android.defaultBundleAlias") /** * Enables live literals. Note that they are disabled by default due to @@ -153,7 +157,7 @@ internal constructor( * https://issuetracker.google.com/issues/274231394. */ public val composeEnableLiveLiterals: Boolean - get() = booleanProperty("slack.compose.android.enableLiveLiterals", false) + get() = booleanProperty("foundry.compose.android.enableLiveLiterals", false) /** * Common compose compiler options. @@ -164,14 +168,14 @@ internal constructor( public val composeCommonCompilerOptions: Provider> get() = resolver - .providerFor("sgp.compose.commonCompilerOptions") + .providerFor("foundry.compose.commonCompilerOptions") .map { value -> value.split(",").map { it.trim() } } .orElse(emptyList()) /** Relative path to a Compose stability configuration file from the _root_ project. */ public val composeStabilityConfigurationPath: Provider get() = - resolver.providerFor("sgp.compose.stabilityConfigurationPath").map { + resolver.providerFor("foundry.compose.stabilityConfigurationPath").map { project.rootProject.layout.projectDirectory.file(it) } @@ -183,7 +187,7 @@ internal constructor( */ public val composeUseIncludeInformationWorkaround: Boolean get() = - resolver.booleanValue("sgp.compose.useIncludeInformationWorkaround", defaultValue = true) + resolver.booleanValue("foundry.compose.useIncludeInformationWorkaround", defaultValue = true) /** * By default, Compose on android only enables source information in debug variants. This is a bit @@ -196,7 +200,7 @@ internal constructor( public val composeIncludeSourceInformationEverywhereByDefault: Boolean get() = resolver.booleanValue( - "sgp.compose.includeSourceInformationEverywhereByDefault", + "foundry.compose.includeSourceInformationEverywhereByDefault", defaultValue = true, ) @@ -210,7 +214,7 @@ internal constructor( * source sets), we swap the application id suffix at configuration time. */ public val usePrototypeAppId: Boolean - get() = presenceProperty("slack.usePrototypeAppId") + get() = presenceProperty("foundry.usePrototypeAppId") /** * Property corresponding to the SDK versions we test in Robolectric tests. Its value should be a @@ -218,19 +222,19 @@ internal constructor( */ public val robolectricTestSdks: List get() = - stringProperty("slack.robolectricTestSdks").splitToSequence(",").map { it.toInt() }.toList() + stringProperty("foundry.robolectricTestSdks").splitToSequence(",").map { it.toInt() }.toList() /** Property corresponding to the preinstrumented jars version (the `-i2` suffix in jars). */ public val robolectricIVersion: Int - get() = intProperty("slack.robolectricIVersion") + get() = intProperty("foundry.robolectricIVersion") /** Opt out for -Werror. */ public val allowWarnings: Provider - get() = resolver.booleanProvider("sgp.kotlin.allowWarnings", defaultValue = false) + get() = resolver.booleanProvider("foundry.kotlin.allowWarnings", defaultValue = false) /** Opt out for -Werror in tests. */ public val allowWarningsInTests: Provider - get() = resolver.booleanProvider("sgp.kotlin.allowWarningsInTests", defaultValue = false) + get() = resolver.booleanProvider("foundry.kotlin.allowWarningsInTests", defaultValue = false) /** * Anvil generator projects that should always be included when Anvil is enabled. @@ -238,7 +242,7 @@ internal constructor( * This should be semicolon-delimited Gradle project paths. */ public val anvilGeneratorProjects: String? - get() = optionalStringProperty("slack.anvil.generatorProjects") + get() = optionalStringProperty("foundry.anvil.generatorProjects") /** * Anvil runtime projects that should always be included when Anvil is enabled. @@ -246,22 +250,22 @@ internal constructor( * This should be semicolon-delimited Gradle project paths. */ public val anvilRuntimeProjects: String? - get() = optionalStringProperty("slack.anvil.runtimeProjects") + get() = optionalStringProperty("foundry.anvil.runtimeProjects") /** Flag to enable use of the Anvil KSP fork. https://github.com/ZacSweers/anvil */ public val anvilUseKspFork: Boolean - get() = booleanProperty("sgp.anvil.useKspFork", defaultValue = false) + get() = booleanProperty("foundry.anvil.useKspFork", defaultValue = false) /** Log Slack extension configuration state verbosely. */ - public val slackExtensionVerbose: Boolean - get() = booleanProperty("slack.extension.verbose") + public val foundryExtensionVerbose: Boolean + get() = booleanProperty("foundry.extension.verbose") /** * Flag for Error-Prone auto-patching. Enable when running an auto-patch of EP, such as when it's * being introduced to a new module or upgrading EP itself. */ public val errorProneAutoPatch: Boolean - get() = booleanProperty("slack.epAutoPatch") + get() = booleanProperty("foundry.epAutoPatch") /** * Error-Prone checks that should be considered errors. @@ -271,14 +275,14 @@ internal constructor( * Example: "AnnotationMirrorToString:AutoValueSubclassLeaked" */ public val errorProneCheckNamesAsErrors: String? - get() = optionalStringProperty("slack.epCheckNamesAsErrors") + get() = optionalStringProperty("foundry.epCheckNamesAsErrors") /** * Flag for Nullaway baselining. When enabled along with [errorProneAutoPatch], existing * nullability issues will be baselined with a `castToNonNull` call to wrap it. */ public val nullawayBaseline: Boolean - get() = booleanProperty("slack.nullaway.baseline") + get() = booleanProperty("foundry.nullaway.baseline") /** * Ndk version to use for android projects. @@ -286,18 +290,18 @@ internal constructor( * Latest versions can be found at https://developer.android.com/ndk/downloads */ public val ndkVersion: String? - get() = optionalStringProperty("slack.ndkVersion") + get() = optionalStringProperty("foundry.ndkVersion") /** * Enables verbose logging in miscellaneous places of SGP. This is intended to be a less noisy * alternative to running gradle with `--info` or `--debug`. */ public val verboseLogging: Boolean - get() = resolver.booleanValue("sgp.logging.verbose") + get() = resolver.booleanValue("foundry.logging.verbose") /** Flag to enable verbose logging in unit tests. */ public val testVerboseLogging: Boolean - get() = booleanProperty("slack.test.verboseLogging") || verboseLogging + get() = booleanProperty("foundry.test.verboseLogging") || verboseLogging /** * Flag to enable kapt in tests. By default these are disabled due to this undesirable (but @@ -307,37 +311,37 @@ internal constructor( * See https://youtrack.jetbrains.com/issue/KT-29481#focus=Comments-27-4651462.0-0 */ public val enableKaptInTests: Boolean - get() = booleanProperty("slack.enabled-kapt-in-tests") + get() = booleanProperty("foundry.enabled-kapt-in-tests") /** Flag to enable errors only in lint checks. */ public val lintErrorsOnly: Boolean - get() = booleanProperty("slack.lint.errors-only") + get() = booleanProperty("foundry.lint.errors-only") /** File name to use for a project's lint baseline. */ public val lintBaselineFileName: String? - get() = optionalStringProperty("slack.lint.baseline-file-name", blankIsNull = true) + get() = optionalStringProperty("foundry.lint.baseline-file-name", blankIsNull = true) /** Flag to control whether or not lint checks test sources. */ public val lintCheckTestSources: Boolean - get() = booleanProperty("sgp.lint.checkTestSources", true) + get() = booleanProperty("foundry.lint.checkTestSources", true) /** Flag to control whether or not lint checks ignores test sources. */ public val lintIgnoreTestSources: Boolean - get() = booleanProperty("sgp.lint.ignoreTestSources", false) + get() = booleanProperty("foundry.lint.ignoreTestSources", false) /** * Flag to control which agp version should be used for lint. Optional. Value should be a version * key in `libs.versions.toml`, */ public val lintVersionOverride: String? - get() = optionalStringProperty("sgp.lint.agpVersion") + get() = optionalStringProperty("foundry.lint.agpVersion") /** * Flag to indicate whether this project is a test library (such as test utils, test fixtures, * etc). */ public val isTestLibrary: Boolean - get() = booleanProperty("sgp.isTestLibrary", false) || project.name == "test-fixtures" + get() = booleanProperty("foundry.isTestLibrary", false) || project.name == "test-fixtures" /** * At the time of writing, AGP does not support running lint on `com.android.test` projects. This @@ -346,15 +350,15 @@ internal constructor( * https://issuetracker.google.com/issues/208765813 */ public val enableLintInAndroidTestProjects: Boolean - get() = booleanProperty("sgp.lint.enableOnAndroidTestProjects", false) + get() = booleanProperty("foundry.lint.enableOnAndroidTestProjects", false) /** Flag to enable/disable KSP. */ public val allowKsp: Boolean - get() = booleanProperty("slack.allow-ksp") + get() = booleanProperty("foundry.allow-ksp") /** Flag to enable/disable Moshi-IR. */ public val allowMoshiIr: Boolean - get() = booleanProperty("slack.allow-moshi-ir") + get() = booleanProperty("foundry.allow-moshi-ir") /** Flag to enable/disable moshi proguard rule gen. */ public val moshixGenerateProguardRules: Boolean @@ -362,15 +366,15 @@ internal constructor( /** Flag to connect SqlDelight sources to KSP. */ public val kspConnectSqlDelight: Boolean - get() = booleanProperty("sgp.ksp.connect.sqldelight") + get() = booleanProperty("foundry.ksp.connect.sqldelight") /** Flag to connect ViewBinding sources to KSP. */ public val kspConnectViewBinding: Boolean - get() = booleanProperty("sgp.ksp.connect.viewbinding") + get() = booleanProperty("foundry.ksp.connect.viewbinding") /** Variants that should be disabled in a given subproject. */ public val disabledVariants: String? - get() = optionalStringProperty("slack.disabledVariants") + get() = optionalStringProperty("foundry.disabledVariants") /** * The Slack-specific kotlin.daemon.jvmargs computed by bootstrap. @@ -388,15 +392,15 @@ internal constructor( * the unit test task for a single build variant (e.g. "testReleaseUnitTest"). */ public val ciUnitTestEnabled: Boolean - get() = booleanProperty("slack.ci-unit-test.enable", defaultValue = true) + get() = booleanProperty("foundry.ci-unit-test.enable", defaultValue = true) /** CI unit test variant (Android only). Defaults to `release`. */ public val ciUnitTestVariant: String - get() = stringProperty("slack.ci-unit-test.variant", "release") + get() = stringProperty("foundry.ci-unit-test.variant", "release") /** If enabled, applies the kotlinx-kover plugin to projects using ciUnitTest. */ public val ciUnitTestEnableKover: Boolean - get() = booleanProperty("slack.ci-unit-test.enableKover", false) + get() = booleanProperty("foundry.ci-unit-test.enableKover", false) /** * Parallelism multiplier to use for unit tests. This should be a float value that is multiplied @@ -404,17 +408,17 @@ internal constructor( */ public val unitTestParallelismMultiplier: Float get() { - val rawValue = stringProperty("slack.unit-test.parallelismMultiplier", "0.5") + val rawValue = stringProperty("foundry.unit-test.parallelismMultiplier", "0.5") val floatValue = rawValue.toFloatOrNull() require(floatValue != null && floatValue > 0) { - "Invalid value for slack.unit-test.parallelismMultiplier: '$rawValue'" + "Invalid value for foundry.unit-test.parallelismMultiplier: '$rawValue'" } return floatValue } /** Controls how often to fork the JVM in unit tests. Default is 1000. */ public val unitTestForkEvery: Long - get() = intProperty("slack.unit-test.forkEvery", 1000).toLong() + get() = intProperty("foundry.unit-test.forkEvery", 1000).toLong() /** * Flag to enable ciLint on a project. Default is true. @@ -423,14 +427,14 @@ internal constructor( * all the lint tasks in the project. */ public val ciLintEnabled: Boolean - get() = booleanProperty("slack.ci-lint.enable", defaultValue = true) + get() = booleanProperty("foundry.ci-lint.enable", defaultValue = true) /** * Comma-separated list of CI lint variants to run (Android only). Default when unspecified will * lint all variants. */ public val ciLintVariants: String? - get() = optionalStringProperty("slack.ci-lint.variants") + get() = optionalStringProperty("foundry.ci-lint.variants") /** Flag for enabling test orchestrator. */ public val useOrchestrator: Boolean @@ -443,17 +447,17 @@ internal constructor( * Should be `:path:to:robolectric-core` format */ public val robolectricCoreProject: String? - get() = optionalStringProperty("slack.location.robolectric-core") + get() = optionalStringProperty("foundry.location.robolectric-core") /** * Gradle path to a platform project to be referenced by other projects. * - * Should be `:path:to:slack-platform` format + * Should be `:path:to:foundry-platform` format * * @see Platforms */ public val platformProjectPath: String? - get() = optionalStringProperty("slack.location.slack-platform") + get() = optionalStringProperty("foundry.location.foundry-platform") /** * Opt-in path for commit hooks in the consuming repo that should be automatically installed @@ -462,7 +466,7 @@ internal constructor( * Corresponds to git's `core.hooksPath`. */ public val gitHooksFile: File? - get() = fileProperty("slack.git.hooksPath") + get() = fileProperty("foundry.git.hooksPath") /** * Opt-in path for a pre-commit hook in the consuming repo that should be automatically installed @@ -471,39 +475,39 @@ internal constructor( * Corresponds to git's `blame.ignoreRevsFile`. */ public val gitIgnoreRevsFile: File? - get() = fileProperty("slack.git.ignoreRevsFile") + get() = fileProperty("foundry.git.ignoreRevsFile") /** * Optional file location for an `affected_projects.txt` file that contains a list of projects * affected in this build. */ public val affectedProjects: File? - get() = fileProperty("slack.avoidance.affectedProjectsFile") + get() = fileProperty("foundry.avoidance.affectedProjectsFile") /* Controls for Java/JVM/JDK versions uses in compilations and execution of tests. */ /** Flag to enable strict JDK mode, forcing some things like JAVA_HOME. */ public val strictJdk: Boolean - get() = booleanProperty("slackToolchainsStrict", defaultValue = true) + get() = booleanProperty("foundryToolchainsStrict", defaultValue = true) /** Android cache fix plugin. */ - public val enableAndroidCacheFix: Boolean = booleanProperty("slack.plugins.android-cache-fix") + public val enableAndroidCacheFix: Boolean = booleanProperty("foundry.plugins.android-cache-fix") /** * Optional override for buildToolsVersion in Android projects. Sometimes temporarily necessary to * pick up new fixes. */ public val buildToolsVersionOverride: String? = - optionalStringProperty("sgp.android.buildToolsVersionOverride") + optionalStringProperty("foundry.android.buildToolsVersionOverride") /** * Performance optimization to relocate the entire project build directory to a location outside * the IDE's view. This prevents the IDE from tracking these files and improves IDE performance. */ - public val relocateBuildDir: Boolean = betaFeature("sgp.perf.relocateBuildDir") + public val relocateBuildDir: Boolean = betaFeature("foundry.perf.relocateBuildDir") /** Opt-in for beta SGP features. */ - public val enableBetaFeatures: Boolean = booleanProperty("sgp.beta", defaultValue = false) + public val enableBetaFeatures: Boolean = booleanProperty("foundry.beta", defaultValue = false) /** * Shorthand helper for checking features that are in beta or falling back to their specific flag. @@ -514,22 +518,22 @@ internal constructor( /* Controls for auto-applied plugins. */ public val autoApplyTestRetry: Boolean - get() = booleanProperty("slack.auto-apply.test-retry", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.test-retry", defaultValue = true) public val autoApplySpotless: Boolean - get() = booleanProperty("slack.auto-apply.spotless", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.spotless", defaultValue = true) public val autoApplyDetekt: Boolean - get() = booleanProperty("slack.auto-apply.detekt", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.detekt", defaultValue = true) public val autoApplyNullaway: Boolean - get() = booleanProperty("slack.auto-apply.nullaway", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.nullaway", defaultValue = true) public val autoApplyCacheFix: Boolean - get() = booleanProperty("slack.auto-apply.cache-fix", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.cache-fix", defaultValue = true) public val autoApplySortDependencies: Boolean - get() = booleanProperty("slack.auto-apply.sort-dependencies", defaultValue = true) + get() = booleanProperty("foundry.auto-apply.sort-dependencies", defaultValue = true) /* Test retry controls. */ public enum class TestRetryPluginType { @@ -539,50 +543,50 @@ internal constructor( public val testRetryPluginType: TestRetryPluginType get() = - stringProperty("slack.test.retry.pluginType", TestRetryPluginType.RETRY_PLUGIN.name) + stringProperty("foundry.test.retry.pluginType", TestRetryPluginType.RETRY_PLUGIN.name) .let(TestRetryPluginType::valueOf) public val testRetryFailOnPassedAfterRetry: Provider get() = - resolver.booleanProvider("slack.test.retry.failOnPassedAfterRetry", defaultValue = false) + resolver.booleanProvider("foundry.test.retry.failOnPassedAfterRetry", defaultValue = false) public val testRetryMaxFailures: Provider - get() = resolver.intProvider("slack.test.retry.maxFailures", defaultValue = 20) + get() = resolver.intProvider("foundry.test.retry.maxFailures", defaultValue = 20) public val testRetryMaxRetries: Provider - get() = resolver.intProvider("slack.test.retry.maxRetries", defaultValue = 1) + get() = resolver.intProvider("foundry.test.retry.maxRetries", defaultValue = 1) /* Detekt configs. */ /** Detekt config files, evaluated from rootProject.file(...). */ public val detektConfigs: List? - get() = optionalStringProperty("slack.detekt.configs")?.split(",") + get() = optionalStringProperty("foundry.detekt.configs")?.split(",") /** Detekt baseline file, evaluated from project.layout.projectDirectory.file(...). */ public val detektBaselineFileName: String? - get() = optionalStringProperty("slack.detekt.baseline-file-name", blankIsNull = true) + get() = optionalStringProperty("foundry.detekt.baseline-file-name", blankIsNull = true) /** Enables full detekt mode (with type resolution). Off by default due to performance issues. */ public val enableFullDetekt: Boolean - get() = booleanProperty("slack.detekt.full") + get() = booleanProperty("foundry.detekt.full") /** Comma-separated set of projects to ignore in sorting dependencies. */ public val sortDependenciesIgnore: String? - get() = optionalStringProperty("slack.sortDependencies.ignore") + get() = optionalStringProperty("foundry.sortDependencies.ignore") /** Enables verbose debug logging across the plugin. */ public val debug: Boolean - get() = booleanProperty("slack.debug", defaultValue = false) + get() = booleanProperty("foundry.debug", defaultValue = false) /** A comma-separated list of configurations to use in affected project detection. */ public val affectedProjectConfigurations: String? - get() = optionalStringProperty("slack.avoidance.affected-project-configurations") + get() = optionalStringProperty("foundry.avoidance.affected-project-configurations") /** * Flag to, when true, makes [affectedProjectConfigurations] build upon the defaults rather than * replace them. */ public val buildUponDefaultAffectedProjectConfigurations: Boolean - get() = booleanProperty("slack.avoidance.build-upon-default-affected-project-configurations") + get() = booleanProperty("foundry.avoidance.build-upon-default-affected-project-configurations") /** * Global control for enabling stricter validation of projects, such as ensuring Kotlin projects @@ -593,30 +597,31 @@ internal constructor( * Granular controls should depend on this check + include their own opt-out check as-needed. */ public val strictMode: Boolean - get() = booleanProperty("slack.strict", defaultValue = false) + get() = booleanProperty("foundry.strict", defaultValue = false) /** Specific toggle for validating manifests in androidTest sources. */ public val strictValidateAndroidTestManifest: Boolean - get() = booleanProperty("slack.strict.validateAndroidTestManifests", defaultValue = true) + get() = booleanProperty("foundry.strict.validateAndroidTestManifests", defaultValue = true) /** * Always enables resources in android unit tests. Only present for benchmarking purposes and * should otherwise be off. */ public val alwaysEnableResourcesInTests: Boolean - get() = booleanProperty("slack.gradle.config.test.alwaysEnableResources", defaultValue = false) + get() = + booleanProperty("foundry.gradle.config.test.alwaysEnableResources", defaultValue = false) /** Global toggle to enable bugsnag. Note this still respects variant filters. */ public val bugsnagEnabled: Provider - get() = resolver.booleanProvider("slack.gradle.config.bugsnag.enabled") + get() = resolver.booleanProvider("foundry.gradle.config.bugsnag.enabled") /** Branch pattern for git branches Bugsnag should be enabled on. */ public val bugsnagEnabledBranchPattern: Provider - get() = resolver.optionalStringProvider("slack.gradle.config.bugsnag.enabledBranchPattern") + get() = resolver.optionalStringProvider("foundry.gradle.config.bugsnag.enabledBranchPattern") /** Global boolean that controls whether mod score is enabled on this project. */ public val modScoreGlobalEnabled: Boolean - get() = resolver.booleanValue("slack.gradle.config.modscore.enabled") + get() = resolver.booleanValue("foundry.gradle.config.modscore.enabled") /** * Per-project boolean that allows for excluding this project from mod score. @@ -624,11 +629,11 @@ internal constructor( * Note this should only be applied to projects that cannot be depended on. */ public val modScoreIgnore: Boolean - get() = resolver.booleanValue("slack.gradle.config.modscore.ignore") + get() = resolver.booleanValue("foundry.gradle.config.modscore.ignore") /** Experimental flag to enable logging thermal throttling on macOS devices. */ public val logThermals: Boolean - get() = resolver.booleanValue("slack.log-thermals", defaultValue = false) + get() = resolver.booleanValue("foundry.log-thermals", defaultValue = false) /** * Enables eager configuration of [SgpArtifact] publishing in subprojects. This is behind a flag @@ -637,14 +642,14 @@ internal constructor( * @see StandardProjectConfigurations.setUpSubprojectArtifactPublishing */ public val eagerlyConfigureArtifactPublishing: Boolean - get() = resolver.booleanValue("sgp.artifacts.configure-eagerly", defaultValue = false) + get() = resolver.booleanValue("foundry.artifacts.configure-eagerly", defaultValue = false) /** * Force-disables Anvil regardless of `SlackExtension.dagger()` settings, useful for K2 testing * where Anvil is unsupported. */ public val disableAnvilForK2Testing: Boolean - get() = resolver.booleanValue("sgp.anvil.forceDisable", defaultValue = false) + get() = resolver.booleanValue("foundry.anvil.forceDisable", defaultValue = false) /** * Defines the [AnvilMode] to use with this compilation. See the docs on that class for more @@ -652,21 +657,21 @@ internal constructor( */ public val anvilMode: AnvilMode get() = - resolver.stringValue("sgp.anvil.mode", defaultValue = AnvilMode.K1_EMBEDDED.name).let { + resolver.stringValue("foundry.anvil.mode", defaultValue = AnvilMode.K1_EMBEDDED.name).let { AnvilMode.valueOf(it.uppercase(Locale.US)) } /** Overrides the kotlin language version if present. */ public val kaptLanguageVersion: Provider get() = - resolver.optionalStringProvider("sgp.kapt.languageVersion").map { + resolver.optionalStringProvider("foundry.kapt.languageVersion").map { KotlinVersion.fromVersion(it) } /** Defines a required vendor for JDK toolchains. */ public val jvmVendor: Provider get() = - resolver.optionalStringProvider("sgp.config.jvmVendor").map { + resolver.optionalStringProvider("foundry.config.jvmVendor").map { if (jvmVendorOptOut) { sneakyNull() } else { @@ -676,14 +681,14 @@ internal constructor( /** Flag to disable JVM vendor setting locally. */ public val jvmVendorOptOut: Boolean - get() = booleanProperty("sgp.config.jvmVendor.optOut", defaultValue = false) + get() = booleanProperty("foundry.config.jvmVendor.optOut", defaultValue = false) /** * Option to force a specific kotlin language version. By default defers to the KGP default the * build is running with. */ public val kotlinLanguageVersionOverride: Provider - get() = resolver.optionalStringProvider("sgp.kotlin.languageVersionOverride") + get() = resolver.optionalStringProvider("foundry.kotlin.languageVersionOverride") /** * Free compiler arguments to pass to Kotlin's `freeCompilerArgs` property in all compilations. @@ -692,7 +697,7 @@ internal constructor( public val kotlinFreeArgs: Provider> get() = resolver - .optionalStringProvider("sgp.kotlin.freeArgs") + .optionalStringProvider("foundry.kotlin.freeArgs") .map { it.split(',') } // Super important to default if absent due to // https://docs.gradle.org/8.7/release-notes.html#build-authoring-improvements @@ -705,7 +710,7 @@ internal constructor( public val kotlinJvmFreeArgs: Provider> get() = resolver - .optionalStringProvider("sgp.kotlin.jvmFreeArgs") + .optionalStringProvider("foundry.kotlin.jvmFreeArgs") .map { it.split(',') } // Super important to default if absent due to // https://docs.gradle.org/8.7/release-notes.html#build-authoring-improvements @@ -715,7 +720,7 @@ internal constructor( public val kotlinOptIn: Provider> get() = resolver - .optionalStringProvider("sgp.kotlin.optIns") + .optionalStringProvider("foundry.kotlin.optIns") .map { it.split(',') } // Super important to default if absent due to // https://docs.gradle.org/8.7/release-notes.html#build-authoring-improvements @@ -723,12 +728,12 @@ internal constructor( /** Default for Kotlin's `progressive` mode. Defaults to enabled. */ public val kotlinProgressive: Provider - get() = resolver.booleanProvider("sgp.kotlin.progressive", defaultValue = true) + get() = resolver.booleanProvider("foundry.kotlin.progressive", defaultValue = true) internal fun requireAndroidSdkProperties(): AndroidSdkProperties { - val compileSdk = compileSdkVersion ?: error("slack.compileSdkVersion not set") - val minSdk = minSdkVersion?.toInt() ?: error("slack.minSdkVersion not set") - val targetSdk = targetSdkVersion?.toInt() ?: error("slack.targetSdkVersion not set") + val compileSdk = compileSdkVersion ?: error("foundry.compileSdkVersion not set") + val minSdk = minSdkVersion?.toInt() ?: error("foundry.minSdkVersion not set") + val targetSdk = targetSdkVersion?.toInt() ?: error("foundry.targetSdkVersion not set") return AndroidSdkProperties(compileSdk, minSdk, targetSdk) } @@ -739,16 +744,16 @@ internal constructor( ) public val compileSdkVersion: String? - get() = optionalStringProperty("slack.compileSdkVersion") + get() = optionalStringProperty("foundry.compileSdkVersion") public fun latestCompileSdkWithSources(defaultValue: Int): Int = - intProperty("slack.latestCompileSdkWithSources", defaultValue = defaultValue) + intProperty("foundry.latestCompileSdkWithSources", defaultValue = defaultValue) private val minSdkVersion: String? - get() = optionalStringProperty("slack.minSdkVersion") + get() = optionalStringProperty("foundry.minSdkVersion") private val targetSdkVersion: String? - get() = optionalStringProperty("slack.targetSdkVersion") + get() = optionalStringProperty("foundry.targetSdkVersion") public companion object { /** @@ -757,17 +762,17 @@ internal constructor( * We don't just blanket use `kotlin.daemon.jvmargs` alone because we don't want to pollute * other projects. */ - public const val KOTLIN_DAEMON_ARGS_KEY: String = "slack.kotlin.daemon.jvmargs" + public const val KOTLIN_DAEMON_ARGS_KEY: String = "foundry.kotlin.daemon.jvmargs" /** Minimum xmx value for the Gradle daemon. Value is an integer and unit is gigabytes. */ // Key-only because it's used in a task init without a project instance - public const val MIN_GRADLE_XMX: String = "slack.bootstrap.minGradleXmx" + public const val MIN_GRADLE_XMX: String = "foundry.bootstrap.minGradleXmx" /** Minimum xms value for the Gradle daemon. Value is an integer and unit is gigabytes. */ // Key-only because it's used in a task init without a project instance - public const val MIN_GRADLE_XMS: String = "slack.bootstrap.minGradleXms" + public const val MIN_GRADLE_XMS: String = "foundry.bootstrap.minGradleXms" - private const val CACHED_PROVIDER_EXT_NAME = "slack.properties.provider" + private const val CACHED_PROVIDER_EXT_NAME = "foundry.properties.provider" public operator fun invoke( project: Project, diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryRootPlugin.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryRootPlugin.kt index 7c1929c3a..adfbfa97b 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryRootPlugin.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryRootPlugin.kt @@ -166,7 +166,7 @@ internal class FoundryRootPlugin @Inject constructor(private val buildFeatures: } project.configureGit(foundryProperties) } - project.configureSlackRootBuildscript( + project.configureFoundryRootBuildscript( foundryProperties.versions.jdk.asProvider(project.providers), foundryProperties.jvmVendor.map(JvmVendorSpec::matching).orNull, ) @@ -469,7 +469,7 @@ internal class FoundryRootPlugin @Inject constructor(private val buildFeatures: } } -private fun Project.configureSlackRootBuildscript( +private fun Project.configureFoundryRootBuildscript( jdkProvider: Provider, jvmVendor: JvmVendorSpec?, ) { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryTools.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryTools.kt index 762021d6d..77a0da05f 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryTools.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/FoundryTools.kt @@ -90,7 +90,7 @@ public abstract class FoundryTools : BuildService, AutoCloseable { private val avoidedTasks = Sets.newConcurrentHashSet() init { - debugLog("SlackTools created") + debugLog("FoundryTools created") // Thermals logging var canLogThermals = parameters.logThermals.get() @@ -98,7 +98,7 @@ public abstract class FoundryTools : BuildService, AutoCloseable { if (AppleSiliconCompat.Arch.get() != AppleSiliconCompat.Arch.ARM64) { logger.warn( "Thermals logging is enabled but configuration cache is enabled and this is not an " + - "Apple Silicon machine. Thermals logging will be disabled. Please set 'slack.log-thermals' " + + "Apple Silicon machine. Thermals logging will be disabled. Please set 'foundry.log-thermals' " + "to false in your home gradle.properties." ) canLogThermals = false diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/GradleExt.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/GradleExt.kt index c95b5489f..3cb1fb77e 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/GradleExt.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/GradleExt.kt @@ -46,19 +46,19 @@ import org.gradle.internal.service.ServiceRegistry * A set of utility functions that check and cache project information stored in extensions. */ -private const val IS_ANDROID = "slack.project.ext.isAndroid" -private const val IS_ANDROID_APPLICATION = "slack.project.ext.isAndroidApplication" -private const val IS_ANDROID_LIBRARY = "slack.project.ext.isAndroidLibrary" -private const val IS_ANDROID_TEST = "slack.project.ext.isAndroidTest" -private const val IS_USING_KAPT = "slack.project.ext.isUsingKapt" -private const val IS_USING_KSP = "slack.project.ext.isUsingKsp" -private const val IS_USING_MOSHI_IR = "slack.project.ext.isUsingMoshiIr" -private const val IS_KOTLIN = "slack.project.ext.isKotlin" -private const val IS_KOTLIN_ANDROID = "slack.project.ext.isKotlinAndroid" -private const val IS_KOTLIN_JVM = "slack.project.ext.isKotlinJvm" -private const val IS_KOTLIN_MULTIPLATFORM = "slack.project.ext.isKotlinMultiplatform" -private const val IS_JAVA_LIBRARY = "slack.project.ext.isJavaLibrary" -private const val IS_JAVA = "slack.project.ext.isJava" +private const val IS_ANDROID = "foundry.project.ext.isAndroid" +private const val IS_ANDROID_APPLICATION = "foundry.project.ext.isAndroidApplication" +private const val IS_ANDROID_LIBRARY = "foundry.project.ext.isAndroidLibrary" +private const val IS_ANDROID_TEST = "foundry.project.ext.isAndroidTest" +private const val IS_USING_KAPT = "foundry.project.ext.isUsingKapt" +private const val IS_USING_KSP = "foundry.project.ext.isUsingKsp" +private const val IS_USING_MOSHI_IR = "foundry.project.ext.isUsingMoshiIr" +private const val IS_KOTLIN = "foundry.project.ext.isKotlin" +private const val IS_KOTLIN_ANDROID = "foundry.project.ext.isKotlinAndroid" +private const val IS_KOTLIN_JVM = "foundry.project.ext.isKotlinJvm" +private const val IS_KOTLIN_MULTIPLATFORM = "foundry.project.ext.isKotlinMultiplatform" +private const val IS_JAVA_LIBRARY = "foundry.project.ext.isJavaLibrary" +private const val IS_JAVA = "foundry.project.ext.isJava" internal val Project.isRootProject: Boolean get() = rootProject === this diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/Platforms.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/Platforms.kt index e7a3ee21d..52830bb75 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/Platforms.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/Platforms.kt @@ -19,7 +19,6 @@ import com.squareup.moshi.JsonClass import com.squareup.moshi.adapter import foundry.gradle.dependencies.DependencyCollection import foundry.gradle.dependencies.DependencyDef -import foundry.gradle.dependencies.boms import foundry.gradle.dependencies.flattenedPlatformCoordinates import foundry.gradle.dependencies.identifierMap import foundry.gradle.util.JsonTools @@ -69,87 +68,6 @@ public object Platforms { "com.google.testing.compile:compile-testing", ) - /** Generates a `libs.versions.toml` representation of this [dependencyCollection]. */ - public fun generateLibsToml( - targetFile: File, - catalogName: String, - providers: ProviderFactory, - dependencyCollection: DependencyCollection, - logger: Logger, - ) { - logger.lifecycle("Generating $catalogName.toml") - if (targetFile.exists()) { - targetFile.delete() - } - targetFile.createNewFile() - - val identifierMap = dependencyCollection.identifierMap() - - targetFile.bufferedWriter().use { writer -> - val versionsToLibs = - dependencyCollection - .flattenedPlatformCoordinates() - .groupBy { it.gradleProperty } - .mapKeys { it.key.removePrefix("slack.dependencies.") } - - writer.append("[versions]") - writer.appendLine() - versionsToLibs.keys.sorted().forEach { - writer.append( - "${tomlKey(it)} = \"${providers.gradleProperty("slack.dependencies.$it").get()}\"" - ) - writer.appendLine() - } - writer.appendLine() - writer.append("[libraries]") - writer.appendLine() - versionsToLibs - .flatMap { (key, deps) -> - deps.map { dep -> - val libPath = tomlLibIdentifier(identifierMap, dep.identifier) - val versionRef = - if (dep.isBomManaged) { - "" - } else { - ", version.ref = \"${tomlKey(key)}\"" - } - "$libPath = { module = \"${dep.identifier}\"$versionRef }" - } - } - // Add `-bom` deps to libraries - .plus( - dependencyCollection.boms().map { group -> - val def = group.toBomDependencyDef() - val tomlKey = tomlKey(def.gradleProperty) - val libPath = "$tomlKey-bom" - "$libPath = { module = \"${def.identifier}\", version.ref = \"$tomlKey\" }" - } - ) - .sorted() - .forEach { lib -> - writer.append(lib) - writer.appendLine() - } - writer.appendLine() - - // Generate possible bundles. Note that we should check these manually and delete/adjust any - // as needed. - writer.append("[bundles]") - writer.appendLine() - for ((key, deps) in versionsToLibs.toSortedMap()) { - // bundles only make sense when there's multiple - if (deps.size < 2) continue - val bundleKeys = - deps.joinToString(", ") { dep -> - "\"${tomlLibIdentifier(identifierMap, dep.identifier)}\"" - } - writer.append("${tomlKey(key)} = [ $bundleKeys ]") - writer.appendLine() - } - } - logger.lifecycle("Wrote toml to $targetFile") - } - private fun tomlLibIdentifier(identifierMap: Map, identifier: String) = tomlLibForPath(identifierMap.getValue(identifier)) diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/StandardProjectConfigurations.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/StandardProjectConfigurations.kt index 1bd6d0382..a3bf7e3cf 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/StandardProjectConfigurations.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/StandardProjectConfigurations.kt @@ -68,7 +68,7 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.jvm.toolchain.JavaToolchainService import org.gradle.language.base.plugins.LifecycleBasePlugin -private const val LOG = "SlackPlugin:" +private const val LOG = "Foundry:" private const val FIVE_MINUTES_MS = 300_000L private fun Logger.logWithTag(message: String) { @@ -97,7 +97,7 @@ internal class StandardProjectConfigurations( val foundryProperties = FoundryProperties(project) val foundryExtension = project.extensions.create( - "slack", + "foundry", FoundryExtension::class.java, globalProperties, foundryProperties, @@ -169,7 +169,7 @@ internal class StandardProjectConfigurations( if (platformProjectPath == null) { if (foundryProperties.strictMode) { logger.warn( - "slack.location.slack-platform is not set. Consider creating one to ensure consistent dependency versions across projects!" + "foundry.location.foundry-platform is not set. Consider creating one to ensure consistent dependency versions across projects!" ) } } else if (!foundryProperties.noPlatform && path != platformProjectPath) { @@ -376,6 +376,7 @@ internal class StandardProjectConfigurations( } options.errorprone.nullaway { severity.setDisallowChanges(nullAwaySeverity) + // TODO make this configurable annotatedPackages.add("slack") checkOptionalEmptiness.setDisallowChanges(true) if (autoPatchEnabled && nullawayBaseline) { @@ -383,6 +384,7 @@ internal class StandardProjectConfigurations( autoFixSuppressionComment.setDisallowChanges( "Nullability issue auto-patched by NullAway." ) + // TODO make this configurable castToNonNullMethod.setDisallowChanges("slack.commons.JavaPreconditions.castToNotNull") } } @@ -813,7 +815,7 @@ internal class StandardProjectConfigurations( finalizeDsl { libraryExtension -> if (libraryExtension.namespace == null) { libraryExtension.namespace = - "slack" + + foundryProperties.defaultNamespacePrefix + projectPath .asSequence() .mapNotNull { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/ComputeAffectedProjectsTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/ComputeAffectedProjectsTask.kt index 65384c866..abf7b2c49 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/ComputeAffectedProjectsTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/ComputeAffectedProjectsTask.kt @@ -106,7 +106,7 @@ public abstract class ComputeAffectedProjectsTask : DefaultTask() { @get:Internal internal abstract val rootDir: DirectoryProperty init { - group = "slack" + group = "foundry" description = "Computes affected projects and writes output files to an output directory." } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateAndroidTestProjectPathsTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateAndroidTestProjectPathsTask.kt index d292d73bf..76da6c462 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateAndroidTestProjectPathsTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateAndroidTestProjectPathsTask.kt @@ -65,7 +65,7 @@ internal abstract class GenerateAndroidTestProjectPathsTask : DefaultTask() { return rootProject.tasks.register(NAME) { androidTestProjectInputs.from(androidTestApksResolver.artifactView()) outputFile.setDisallowChanges( - rootProject.layout.buildDirectory.file("slack/androidTestProjectPaths/paths.txt") + rootProject.layout.buildDirectory.file("foundry/androidTestProjectPaths/paths.txt") ) } } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateDependencyGraphTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateDependencyGraphTask.kt index 57ede52c5..962cf20d3 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateDependencyGraphTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/avoidance/GenerateDependencyGraphTask.kt @@ -87,7 +87,7 @@ internal abstract class GenerateDependencyGraphTask : DefaultTask() { return rootProject.tasks.register(NAME) { dependencyGraph.setDisallowChanges(rootProject.provider { lazyGraph }) outputFile.setDisallowChanges( - rootProject.layout.buildDirectory.file("slack/dependencyGraph/serializedGraph.bin") + rootProject.layout.buildDirectory.file("foundry/dependencyGraph/serializedGraph.bin") ) } } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt index 6801cd078..532029aec 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/dependencyrake/DependencyRake.kt @@ -87,7 +87,7 @@ constructor(objects: ObjectFactory, providers: ProviderFactory) : AbstractPostPr .setProperty(AnalysisMode::class.java) .convention( providers - .gradleProperty("slack.dependencyrake.modes") + .gradleProperty("foundry.dependencyrake.modes") .map { it.splitToSequence(",").map(AnalysisMode::valueOf).toSet() } .orElse( setOf( @@ -105,7 +105,7 @@ constructor(objects: ObjectFactory, providers: ProviderFactory) : AbstractPostPr objects .property() .convention( - providers.gradleProperty("slack.dependencyrake.dryRun").mapToBoolean().orElse(false) + providers.gradleProperty("foundry.dependencyrake.dryRun").mapToBoolean().orElse(false) ) @get:Input abstract val noApi: Property diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/DetektTasks.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/DetektTasks.kt index d7c906aab..aa620480f 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/DetektTasks.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/DetektTasks.kt @@ -42,7 +42,7 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin internal object DetektTasks { private const val GLOBAL_CI_DETEKT_TASK_NAME = "globalCiDetekt" private const val CI_DETEKT_TASK_NAME = "ciDetekt" - private const val LOG = "SlackDetekt:" + private const val LOG = "FoundryDetekt:" fun configureRootProject(project: Project, foundryProperties: FoundryProperties) { // Add detekt download task diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/LintTasks.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/LintTasks.kt index 5dbb6b293..41c34d37c 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/LintTasks.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/lint/LintTasks.kt @@ -59,7 +59,7 @@ import org.jetbrains.kotlin.tooling.core.withClosure internal object LintTasks { private const val GLOBAL_CI_LINT_TASK_NAME = "globalCiLint" private const val CI_LINT_TASK_NAME = "ciLint" - private const val LOG = "SlackLints:" + private const val LOG = "FoundryLints:" private fun Project.log(message: String) { logger.debug("$LOG $message") diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt index b9a349157..4b0a0a05d 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt @@ -95,7 +95,7 @@ public object ModuleStatsTasks { ) statsFiles.from(resolver.artifactView()) outputFile.setDisallowChanges( - rootProject.layout.buildDirectory.file("reports/slack/moduleStats.json") + rootProject.layout.buildDirectory.file("reports/foundry/moduleStats.json") ) this.includeGenerated.setDisallowChanges(includeGenerated) } @@ -125,7 +125,7 @@ public object ModuleStatsTasks { project.tasks.register("loc") { srcsDir.setDisallowChanges(project.layout.projectDirectory.dir("src/$mainSrcDir")) outputFile.setDisallowChanges( - project.layout.buildDirectory.file("reports/slack/loc.json") + project.layout.buildDirectory.file("reports/foundry/loc.json") ) } } @@ -146,7 +146,7 @@ public object ModuleStatsTasks { } this.includeGenerated.setDisallowChanges(includeGenerated) outputFile.setDisallowChanges( - project.layout.buildDirectory.file("reports/slack/moduleStats.json") + project.layout.buildDirectory.file("reports/foundry/moduleStats.json") ) } @@ -303,7 +303,7 @@ public abstract class ModuleStatsAggregatorTask : DefaultTask() { @get:OutputFile public abstract val outputFile: RegularFileProperty init { - group = "slack" + group = "foundry" } @TaskAction @@ -398,7 +398,7 @@ internal abstract class ModuleStatsCollectorTask @Inject constructor(objects: Ob @get:OutputFile abstract val outputFile: RegularFileProperty init { - group = "slack" + group = "foundry" } @TaskAction diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt index 26c0615d8..a09f2e8a0 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/AndroidTestApksTask.kt @@ -49,7 +49,7 @@ public abstract class AndroidTestApksTask : DefaultTask() { @get:OutputFile public abstract val outputFile: RegularFileProperty init { - group = "slack" + group = "foundry" } @OptIn(ExperimentalPathApi::class) @@ -74,7 +74,7 @@ public abstract class AndroidTestApksTask : DefaultTask() { return project.tasks.register(NAME) { androidTestApkDirs.from(resolver.artifactView()) outputFile.setDisallowChanges( - project.layout.buildDirectory.file("slack/androidTestAggregator/aggregatedTestApks.txt") + project.layout.buildDirectory.file("foundry/androidTestAggregator/aggregatedTestApks.txt") ) } } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BootstrapTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BootstrapTask.kt index da3c68fe8..5f98d0a31 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BootstrapTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/BootstrapTask.kt @@ -209,6 +209,7 @@ constructor(objects: ObjectFactory, providers: ProviderFactory) : DefaultTask() if (launcher.isPresent) { diagnosticsOutput.appendLine("Initializing JDK") + // TODO make this message configurable diagnosticsOutput.appendLine( """ JDK config: @@ -264,17 +265,19 @@ constructor(objects: ObjectFactory, providers: ProviderFactory) : DefaultTask() } val mode = propertiesMode.get() - val regionMarkerPrefix = "# Begin: Slack bootstrap-generated properties" - val regionMarkerSuffix = "# End: Slack bootstrap-generated properties" + val oldRegionMarkerPrefix = "# Begin: Slack bootstrap-generated properties" + val oldRegionMarkerSuffix = "# End: Slack bootstrap-generated properties" + val newRegionMarkerPrefix = "# Begin: Foundry bootstrap-generated properties" + val newRegionMarkerSuffix = "# End: Foundry bootstrap-generated properties" val prefix = """ - $regionMarkerPrefix + $newRegionMarkerPrefix # Note that these properties will prevent you from using other projects on JDK 8 # These are appended to the end of the file to override any previous declarations of the same # keys, but you should consider removing those keys if you have any. """ .trimIndent() - val suffix = "\n$regionMarkerSuffix" + val suffix = "\n$newRegionMarkerSuffix" val propsString = properties.entries.joinToString("\n", prefix = "\n$prefix\n", postfix = suffix) { (key, value) -> @@ -287,12 +290,16 @@ constructor(objects: ObjectFactory, providers: ProviderFactory) : DefaultTask() if (mode == APPEND) { diagnosticsOutput.appendLine("Appending properties to $propsFile") val propsFileLines = ArrayList(propsFile.readLines()) - val existingIndex = propsFileLines.indexOf(regionMarkerPrefix) + val existingIndex = + propsFileLines.indexOf(newRegionMarkerPrefix).takeUnless { it == -1 } + ?: propsFileLines.indexOf(oldRegionMarkerPrefix) if (existingIndex != -1) { diagnosticsOutput.appendLine("Removing existing region first") - val endIndex = propsFileLines.indexOf(regionMarkerSuffix) + val endIndex = + propsFileLines.indexOf(newRegionMarkerSuffix).takeUnless { it == -1 } + ?: propsFileLines.indexOf(oldRegionMarkerSuffix) check(endIndex != -1) { - "Could not find region suffix for properties, please delete the Slack properties below '$regionMarkerPrefix' and rerun." + "Could not find region suffix for properties, please delete the Slack properties below '$newRegionMarkerPrefix' and rerun." } propsFileLines.subList(existingIndex - 1, endIndex + 1).clear() } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/CheckDependencyVersionsTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/CheckDependencyVersionsTask.kt index 3bfcf04e6..42a05a8f8 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/CheckDependencyVersionsTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/CheckDependencyVersionsTask.kt @@ -93,7 +93,7 @@ public abstract class CheckDependencyVersionsTask : BaseDependencyCheckTask() { configureIdentifiersToVersions(configuration) outputFile.setDisallowChanges( project.layout.buildDirectory.file( - "reports/slack/dependencyVersionsIssues/$name/issues.txt" + "reports/foundry/dependencyVersionsIssues/$name/issues.txt" ) ) val catalog = project.getVersionsCatalog() diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/FileTasks.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/FileTasks.kt index 6c1193d9f..6a2336008 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/FileTasks.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/FileTasks.kt @@ -53,7 +53,7 @@ internal abstract class SimpleFileProducerTask : DefaultTask() { description: String, outputFilePath: String = "artifactMetadata/$name/produced.txt", input: String = "${project.path}:$name", - group: String = "slack", + group: String = "foundry", action: Action = Action {}, ): TaskProvider { return project.tasks.registerOrConfigure(name) { @@ -96,7 +96,7 @@ internal abstract class SimpleFilesConsumerTask : DefaultTask() { description: String, inputFiles: Provider>, outputFilePath: String = "artifactMetadata/$name/resolved.txt", - group: String = "slack", + group: String = "foundry", action: Action = Action {}, ): TaskProvider { return project.tasks.registerOrConfigure(name) { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/InstallCommitHooksTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/InstallCommitHooksTask.kt index 17472cd67..ae5e29c46 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/InstallCommitHooksTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/InstallCommitHooksTask.kt @@ -46,7 +46,7 @@ constructor(layout: ProjectLayout, objects: ObjectFactory) : DefaultTask() { objects.directoryProperty().convention(layout.projectDirectory.dir("config/git/hooks")) init { - group = "slack" + group = "foundry" description = "Installs basic git hook files for formatting to a given output directory." } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/PrintFossaDependencies.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/PrintFossaDependencies.kt index e70dfd96e..11199c8d0 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/PrintFossaDependencies.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/PrintFossaDependencies.kt @@ -46,7 +46,7 @@ public abstract class PrintFossaDependencies : BaseDependencyCheckTask() { @get:OutputFile public abstract val outputFile: RegularFileProperty init { - group = "slack" + group = "foundry" } override fun handleDependencies(identifiersToVersions: Map) { @@ -71,7 +71,7 @@ public abstract class PrintFossaDependencies : BaseDependencyCheckTask() { "print${name.capitalizeUS()}FossaDependencies" ) { outputFile.setDisallowChanges( - project.layout.buildDirectory.file("reports/slack/fossa/$name.txt") + project.layout.buildDirectory.file("reports/foundry/fossa/$name.txt") ) configureIdentifiersToVersions(configuration) } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/robolectric/UpdateRobolectricJarsTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/robolectric/UpdateRobolectricJarsTask.kt index 45fbb8e47..415f4f1a4 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/robolectric/UpdateRobolectricJarsTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/tasks/robolectric/UpdateRobolectricJarsTask.kt @@ -53,7 +53,7 @@ internal abstract class UpdateRobolectricJarsTask : DefaultTask(), BootstrapTask @get:Internal abstract val outputDir: DirectoryProperty init { - group = "slack" + group = "foundry" description = "Downloads the Robolectric android-all jars." } diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/unittest/UnitTests.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/unittest/UnitTests.kt index 44857ea87..fb0e2f737 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/unittest/UnitTests.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/unittest/UnitTests.kt @@ -60,7 +60,7 @@ internal object UnitTests { private const val GLOBAL_CI_UNIT_TEST_TASK_NAME = "globalCiUnitTest" private const val CI_UNIT_TEST_TASK_NAME = "ciUnitTest" private const val COMPILE_CI_UNIT_TEST_NAME = "compileCiUnitTest" - private const val LOG = "SlackUnitTests:" + private const val LOG = "FoundryUnitTests:" private fun maxForks(foundryProperties: FoundryProperties): Int { val multiplier = foundryProperties.unitTestParallelismMultiplier diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/util/PropertyUtil.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/util/PropertyUtil.kt index 76144e804..6d94964cb 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/util/PropertyUtil.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/util/PropertyUtil.kt @@ -109,7 +109,7 @@ internal fun Project.createPropertiesProvider(filePath: String): Provider { return localPropertiesProvider( key, - "slack.properties.provider.local-properties", + "foundry.properties.provider.local-properties", "local.properties", ) } @@ -120,7 +120,7 @@ internal fun Project.localProperty(key: String): Provider { internal fun Project.localGradleProperty(key: String): Provider { return localPropertiesProvider( key, - "slack.properties.provider.local-gradle-properties", + "foundry.properties.provider.local-gradle-properties", "gradle.properties", ) } diff --git a/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/ProjectGenPresenter.kt b/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/ProjectGenPresenter.kt index 0d28a92c5..d5e8de089 100644 --- a/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/ProjectGenPresenter.kt +++ b/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/ProjectGenPresenter.kt @@ -42,6 +42,7 @@ internal class ProjectGenPresenter( TextElement( "", "Package Name", + // TODO make the prefix configurable description = "The project package name (must start with 'slack.') This is used for both source packages and android.namespace.", prefixTransformation = "slack.", @@ -178,6 +179,7 @@ internal class ProjectGenPresenter( return generate( rootDir = File(rootDir), path = ":${path.value}", + // TODO make this configurable packageName = "slack.${packageName.value}", android = android.isChecked, androidFeatures = diff --git a/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/models.kt b/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/models.kt index 1c04caf1a..3de1bd428 100644 --- a/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/models.kt +++ b/platforms/intellij/compose/src/jvmMain/kotlin/foundry/intellij/compose/projectgen/models.kt @@ -69,7 +69,7 @@ internal data class BuildFile(val dependencies: List) { FileSpec.scriptBuilder("build.gradle").apply { // Plugins block beginControlFlow("plugins") - addStatement("alias(libs.plugins.slack.base)") + addStatement("alias(libs.plugins.foundry.base)") // TODO do we ever need to ensure no dupes? features.filterIsInstance().forEach { it.writeToPlugins(this) } endControlFlow() @@ -93,7 +93,7 @@ internal data class BuildFile(val dependencies: List) { val slackAndroidFeatures = features.filterIsInstance() if (slackFeatures.isNotEmpty() || slackAndroidFeatures.isNotEmpty()) { addStatement("") - beginControlFlow("slack") + beginControlFlow("foundry") if (slackFeatures.isNotEmpty()) { beginControlFlow("features") for (feature in slackFeatures) { diff --git a/tools/cli/src/main/kotlin/foundry/cli/AppleSiliconCompat.kt b/tools/cli/src/main/kotlin/foundry/cli/AppleSiliconCompat.kt index 9152c4399..fe545b8d1 100644 --- a/tools/cli/src/main/kotlin/foundry/cli/AppleSiliconCompat.kt +++ b/tools/cli/src/main/kotlin/foundry/cli/AppleSiliconCompat.kt @@ -35,7 +35,7 @@ public object AppleSiliconCompat { */ @Suppress("ReturnCount") public fun validate(errorMessage: () -> String) { - if (System.getenv("SLACK_SKIP_APPLE_SILICON_CHECK")?.toBoolean() == true) { + if (System.getenv("FOUNDRY_SKIP_APPLE_SILICON_CHECK")?.toBoolean() == true) { // Toe-hold to skip this check if anything goes wrong. return } diff --git a/tools/cli/src/main/kotlin/foundry/cli/gradle/GradleTestFixturesMigratorCli.kt b/tools/cli/src/main/kotlin/foundry/cli/gradle/GradleTestFixturesMigratorCli.kt index 254ebc54c..03f3c2f56 100644 --- a/tools/cli/src/main/kotlin/foundry/cli/gradle/GradleTestFixturesMigratorCli.kt +++ b/tools/cli/src/main/kotlin/foundry/cli/gradle/GradleTestFixturesMigratorCli.kt @@ -81,7 +81,7 @@ public class GradleTestFixturesMigratorCli : CliktCommand() { private val dryRun by dryRunOption() - private val useSgpDsl by option("--use-sgp").flag() + private val useFoundryDsl by option("--use-foundry").flag() private val targets by argument( @@ -178,7 +178,7 @@ public class GradleTestFixturesMigratorCli : CliktCommand() { var locMoved = 0L var dependenciesMoved = 0L for (migration in migratableProjects) { - if (useSgpDsl) { + if (useFoundryDsl) { migration.validate() } migration.enableInBuildFile() @@ -340,7 +340,7 @@ public class GradleTestFixturesMigratorCli : CliktCommand() { private fun TestFixtureTarget.enableInBuildFile() { val lines = hostProject.buildFile.readLines().toMutableList() - if (useSgpDsl) { + if (useFoundryDsl) { if ("enableTestFixtures()" in hostProject.buildFile.readText()) { // already enabled, return return @@ -349,21 +349,21 @@ public class GradleTestFixturesMigratorCli : CliktCommand() { val featuresBlock = lines.indexOfFirst { it.contains("features {") && !it.contains("android {") } if (featuresBlock == -1) { - // No features block. Check for `slack {` - val slackBlock = lines.indexOfFirst { it.contains("slack {") } - if (slackBlock == -1) { + // No features block. Check for `foundry {` + val foundryBlock = lines.indexOfFirst { it.contains("foundry {") } + if (foundryBlock == -1) { // No DSL at all, add one val endOfPluginsBlock = lines.indexOfFirst { it == "}" } check(endOfPluginsBlock != -1) { "No plugins block found in ${hostProject.gradlePath}" } - lines.add(endOfPluginsBlock + 1, "slack { features { enableTestFixtures() } }") + lines.add(endOfPluginsBlock + 1, "foundry { features { enableTestFixtures() } }") } else { - if (!lines[slackBlock].endsWith("{")) { + if (!lines[foundryBlock].endsWith("{")) { // There's other stuff on the line, split there and insert in between - val (first, rest) = lines[slackBlock].split("slack {") - lines[slackBlock] = "${first}slack {" - lines.addAll(slackBlock + 1, listOf("features { enableTestFixtures() }", rest)) + val (first, rest) = lines[foundryBlock].split("foundry {") + lines[foundryBlock] = "${first}foundry {" + lines.addAll(foundryBlock + 1, listOf("features { enableTestFixtures() }", rest)) } else { - lines.add(slackBlock + 1, "features { enableTestFixtures() }") + lines.add(foundryBlock + 1, "features { enableTestFixtures() }") } } } else {