diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57f73846e..85cedbeff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,12 +49,6 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - # Limit the size of the cache entry. - # These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly. - gradle-home-cache-excludes: | - caches/jars-9 - caches/transforms-3 - - name: Build and run tests id: gradle timeout-minutes: 10 diff --git a/CHANGELOG.md b/CHANGELOG.md index 13900ca61..33dc80e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog **Unreleased** -------------- +- Add a `foundry.android.test.compressWithLegacyPackaging` flag to compress androidTest APKs with legacy packaging. - Support emulator.wtf for `androidTest()`. This feature is gated by the `foundry.emulatorwtf.enable` feature flag. 0.22.6 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cb75ef36c..bd75057f5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ nullawayGradle = "2.1.0" okhttp = "5.0.0-alpha.12" okio = "3.9.1" retrofit = "2.11.0" -roborazzi = "1.32.2" +roborazzi = "1.36.0" slack-lint = "0.8.2" sortDependencies = "0.13" spotless = "7.0.0.BETA4" 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 0978028b9..9b831edd3 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 @@ -473,6 +473,26 @@ internal constructor( public val useOrchestrator: Provider get() = resolver.booleanProvider("foundry.android.test.orchestrator", false) + /** + * Flag for compressing androidTest APks with legacy packaging. + * + * See: + * - https://issuetracker.google.com/issues/259832799 + * - https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/DexPackagingOptions#useLegacyPackaging:kotlin.Boolean + */ + public val compressAndroidTestApksWithLegacyPackaging: Provider + get() = resolver.booleanProvider("foundry.android.test.compressWithLegacyPackaging", false) + + /** + * Flag for minifying androidTest APks with R8. This just tree shakes. + * + * See: + * - https://issuetracker.google.com/issues/259832799 + * - https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/DexPackagingOptions#useLegacyPackaging:kotlin.Boolean + */ + public val minifyAndroidTestApks: Provider + get() = resolver.booleanProvider("foundry.android.test.minifyEnabled", false) + /** * Location for robolectric-core to be referenced by app. Temporary till we have a better solution * for "always add these" type of deps. 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 fde5a7f86..51d123790 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 @@ -510,8 +510,15 @@ internal class StandardProjectConfigurations( if (isAndroidTestEnabled) { if (!excluded && isAffectedProject) { // Aggregate test apks. In Fladle we aggregate test APKs, in emulator.wtf we aggregate - // to their - // root project dep + // to their root project dep + if (isLibraryVariant) { + val libraryVariant = variant as LibraryVariant + libraryVariant.androidTest?.apply { + packaging.dex.useLegacyPackaging.set( + foundryProperties.compressAndroidTestApksWithLegacyPackaging + ) + } + } if ( foundryProperties.enableEmulatorWtfForAndroidTest && pluginManager.hasPlugin("wtf.emulator.gradle") @@ -536,14 +543,11 @@ internal class StandardProjectConfigurations( ) .publishWith(skippyAndroidTestProjectPublisher) if (isLibraryVariant) { - (variant as LibraryVariant) - .androidTest - ?.artifacts - ?.get(SingleArtifact.APK) - ?.let { apkArtifactsDir -> - // Wire this up to the aggregator. No need for an intermediate task here. - androidTestApksPublisher.publishDirs(apkArtifactsDir) - } + val libraryVariant = variant as LibraryVariant + libraryVariant.androidTest?.apply { + // Wire this up to the aggregator. No need for an intermediate task here. + androidTestApksPublisher.publishDirs(artifacts.get(SingleArtifact.APK)) + } } } } else { diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ModuleTopographyTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ModuleTopographyTask.kt index 84614be5a..4304f0410 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ModuleTopographyTask.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ModuleTopographyTask.kt @@ -15,36 +15,18 @@ */ package foundry.gradle.topography -import com.github.ajalt.mordant.markdown.Markdown -import com.github.ajalt.mordant.rendering.AnsiLevel -import com.github.ajalt.mordant.terminal.Terminal -import foundry.cli.walkEachFile -import foundry.common.json.JsonTools import foundry.gradle.FoundryExtension import foundry.gradle.FoundryProperties import foundry.gradle.artifacts.FoundryArtifact -import foundry.gradle.artifacts.Publisher import foundry.gradle.artifacts.Resolver -import foundry.gradle.avoidance.SkippyArtifacts -import foundry.gradle.capitalizeUS import foundry.gradle.properties.setDisallowChanges import foundry.gradle.register import foundry.gradle.serviceOf -import foundry.gradle.tasks.SimpleFileProducerTask import foundry.gradle.tasks.SimpleFilesConsumerTask import foundry.gradle.tasks.mustRunAfterSourceGeneratingTasks -import foundry.gradle.tasks.publish -import foundry.gradle.util.toJson -import java.nio.file.Path -import kotlin.io.path.ExperimentalPathApi -import kotlin.io.path.extension -import kotlin.io.path.readText -import kotlin.io.path.useLines -import kotlin.io.path.writeText import kotlin.jvm.optionals.getOrNull import org.gradle.api.DefaultTask import org.gradle.api.Project -import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.RegularFileProperty import org.gradle.api.internal.plugins.PluginRegistry import org.gradle.api.provider.MapProperty @@ -53,17 +35,10 @@ import org.gradle.api.provider.Provider import org.gradle.api.provider.SetProperty import org.gradle.api.tasks.CacheableTask import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.PathSensitive -import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskProvider -import org.gradle.api.tasks.options.Option -import org.gradle.language.base.plugins.LifecycleBasePlugin -import org.gradle.work.DisableCachingByDefault private fun MapProperty.put(feature: ModuleFeature, provider: Provider) { put(feature.name, provider.orElse(false)) @@ -182,232 +157,3 @@ public abstract class ModuleTopographyTask : DefaultTask() { topography.writeJsonTo(topographyOutputFile, prettyPrint = true) } } - -@DisableCachingByDefault -public abstract class ValidateModuleTopographyTask : DefaultTask() { - @get:InputFile - @get:PathSensitive(PathSensitivity.NONE) - @get:Optional - public abstract val featuresConfigFile: RegularFileProperty - - @get:InputFile - @get:PathSensitive(PathSensitivity.NONE) - public abstract val topographyJson: RegularFileProperty - - @get:Optional - @get:Option(option = "auto-fix", description = "Enables auto-fixing build files") - @get:Input - public abstract val autoFix: Property - - @get:Internal public abstract val projectDirProperty: DirectoryProperty - - @get:OutputFile public abstract val modifiedBuildFile: RegularFileProperty - @get:OutputFile public abstract val featuresToRemoveOutputFile: RegularFileProperty - - init { - group = "foundry" - @Suppress("LeakingThis") - notCompatibleWithConfigurationCache("This task modified build files in place") - @Suppress("LeakingThis") doNotTrackState("This task modified build files in place") - } - - @OptIn(ExperimentalPathApi::class) - @TaskAction - public fun validate() { - val topography = ModuleTopography.from(topographyJson) - val loadedFeatures = - featuresConfigFile.asFile - .map { ModuleFeaturesConfig.load(it.toPath()) } - .getOrElse(ModuleFeaturesConfig.DEFAULT) - .loadFeatures() - val features = buildSet { - addAll(topography.features.map { featureKey -> loadedFeatures.getValue(featureKey) }) - // Include plugin-specific features to the check here - addAll(loadedFeatures.filterValues { it.matchingPlugin in topography.plugins }.values) - } - val featuresToRemove = mutableSetOf() - - val projectDir = projectDirProperty.asFile.get().toPath() - val srcsDir = projectDir.resolve("src") - - val buildFile = projectDir.resolve("build.gradle.kts") - var buildFileText = buildFile.readText() - val initialBuildFileHash = buildFileText.hashCode() - - for (feature in features) { - val initialRemoveSize = featuresToRemove.size - feature.matchingSourcesDir?.let { matchingSrcsDir -> - if (projectDir.resolve(matchingSrcsDir).walkEachFile().none()) { - featuresToRemove += feature - } - } - - feature.generatedSourcesDir?.let { generatedSrcsDir -> - if (projectDir.resolve(generatedSrcsDir).walkEachFile().none()) { - featuresToRemove += feature - } - } - - if (feature.matchingText.isNotEmpty()) { - if (!feature.hasMatchingTextIn(srcsDir)) { - featuresToRemove += feature - } - } - - val isRemoving = featuresToRemove.size != initialRemoveSize - if (isRemoving) { - feature.removalPatterns?.let { removalPatterns -> - for (removalRegex in removalPatterns) { - buildFileText = buildFileText.replace(removalRegex, "").removeEmptyBraces() - } - } - } - } - - JsonTools.toJson>( - featuresToRemoveOutputFile, - featuresToRemove.toSortedSet(compareBy { it.name }), - ) - - val hasBuildFileChanges = initialBuildFileHash != buildFileText.hashCode() - val shouldAutoFix = autoFix.getOrElse(false) - if (hasBuildFileChanges) { - if (shouldAutoFix) { - buildFile.writeText(buildFileText) - } else { - modifiedBuildFile.asFile.get().writeText(buildFileText) - } - } - - val allAutoFixed = featuresToRemove.all { !it.removalPatterns.isNullOrEmpty() } - if (featuresToRemove.isNotEmpty()) { - val message = buildString { - appendLine( - "**Validation failed! The following features appear to be unused and can be removed.**" - ) - appendLine() - var first = true - featuresToRemove.forEach { - if (first) { - first = false - } else { - appendLine() - appendLine() - } - appendLine("- **${it.name}:** ${it.explanation}") - appendLine() - appendLine(" - **Advice:** ${it.advice}") - } - appendLine() - appendLine("Full list written to ${featuresToRemoveOutputFile.asFile.get().absolutePath}") - } - val t = Terminal(AnsiLevel.TRUECOLOR, interactive = true) - val md = Markdown(message) - t.println(md, stderr = true) - if (shouldAutoFix) { - if (allAutoFixed) { - logger.lifecycle("All issues auto-fixed") - } else { - throw AssertionError("Not all issues could be fixed automatically") - } - } else { - throw AssertionError() - } - } - } - - @OptIn(ExperimentalPathApi::class) - private fun ModuleFeature.hasMatchingTextIn(srcsDir: Path): Boolean { - logger.debug("Checking for $name annotation usages in sources") - return srcsDir - .walkEachFile() - .run { - if (matchingTextFileExtensions.isNotEmpty()) { - filter { it.extension in matchingTextFileExtensions } - } else { - this - } - } - .any { file -> - file.useLines { lines -> - for (line in lines) { - if (matchingText.any { it in line }) { - return@any true - } - } - } - false - } - } - - internal companion object { - private const val LOG = "[ValidateModuleTopography]" - private const val NAME = "validateModuleTopography" - private val CI_NAME = "ci${NAME.capitalizeUS()}" - internal val GLOBAL_CI_NAME = "global${CI_NAME.capitalizeUS()}" - - fun register( - project: Project, - topographyTask: TaskProvider, - foundryProperties: FoundryProperties, - affectedProjects: Set?, - ) { - val publisher = - if (affectedProjects == null || project.path in affectedProjects) { - Publisher.interProjectPublisher(project, FoundryArtifact.SKIPPY_VALIDATE_TOPOGRAPHY) - } else { - val log = "$LOG Skipping ${project.path}:$CI_NAME because it is not affected." - if (foundryProperties.debug) { - project.logger.lifecycle(log) - } else { - project.logger.debug(log) - } - SkippyArtifacts.publishSkippedTask(project, NAME) - null - } - - val validateModuleTopographyTask = - project.tasks.register(NAME) { - topographyJson.set(topographyTask.flatMap { it.topographyOutputFile }) - featuresConfigFile.convention(foundryProperties.topographyFeaturesConfig) - projectDirProperty.set(project.layout.projectDirectory) - autoFix.convention(foundryProperties.topographyAutoFix) - featuresToRemoveOutputFile.setDisallowChanges( - project.layout.buildDirectory.file("foundry/topography/validate/featuresToRemove.json") - ) - modifiedBuildFile.setDisallowChanges( - project.layout.buildDirectory.file( - "foundry/topography/validate/modified-build.gradle.kts" - ) - ) - } - val ciValidateModuleTopographyTask = - SimpleFileProducerTask.registerOrConfigure( - project, - CI_NAME, - description = "Lifecycle task to run $NAME for ${project.path}.", - group = LifecycleBasePlugin.VERIFICATION_GROUP, - ) { - dependsOn(validateModuleTopographyTask) - } - publisher?.publish(ciValidateModuleTopographyTask) - } - } -} - -//// Usage -// var code = "foundry { features { compose() } }" -// code = code.replace(Regex("\\bcompose\\(\\)"), "") // remove compose() -// code = removeEmptyBraces(code) // recursively remove empty braces -// -// println(code) // Should print "" -// TODO write tests for this -private val EMPTY_DSL_BLOCK = "(\\w*)\\s*\\{\\s*\\}".toRegex() - -internal fun String.removeEmptyBraces(): String { - var result = this - while (EMPTY_DSL_BLOCK.containsMatchIn(result)) { - result = EMPTY_DSL_BLOCK.replace(result, "") - } - return result -} diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ValidateModuleTopographyTask.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ValidateModuleTopographyTask.kt new file mode 100644 index 000000000..7b2161439 --- /dev/null +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/topography/ValidateModuleTopographyTask.kt @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2024 Slack Technologies, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package foundry.gradle.topography + +import com.github.ajalt.mordant.markdown.Markdown +import com.github.ajalt.mordant.rendering.AnsiLevel +import com.github.ajalt.mordant.terminal.Terminal +import foundry.cli.walkEachFile +import foundry.common.json.JsonTools +import foundry.gradle.FoundryProperties +import foundry.gradle.artifacts.FoundryArtifact +import foundry.gradle.artifacts.Publisher +import foundry.gradle.avoidance.SkippyArtifacts +import foundry.gradle.capitalizeUS +import foundry.gradle.properties.setDisallowChanges +import foundry.gradle.register +import foundry.gradle.tasks.SimpleFileProducerTask +import foundry.gradle.tasks.publish +import foundry.gradle.util.toJson +import java.nio.file.Path +import kotlin.io.path.ExperimentalPathApi +import kotlin.io.path.extension +import kotlin.io.path.readText +import kotlin.io.path.useLines +import kotlin.io.path.writeText +import org.gradle.api.DefaultTask +import org.gradle.api.Project +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.file.RegularFileProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.TaskProvider +import org.gradle.api.tasks.options.Option +import org.gradle.language.base.plugins.LifecycleBasePlugin +import org.gradle.work.DisableCachingByDefault + +@DisableCachingByDefault +public abstract class ValidateModuleTopographyTask : DefaultTask() { + @get:InputFile + @get:PathSensitive(PathSensitivity.NONE) + @get:Optional + public abstract val featuresConfigFile: RegularFileProperty + + @get:InputFile + @get:PathSensitive(PathSensitivity.NONE) + public abstract val topographyJson: RegularFileProperty + + @get:Optional + @get:Option(option = "auto-fix", description = "Enables auto-fixing build files") + @get:Input + public abstract val autoFix: Property + + @get:Internal public abstract val projectDirProperty: DirectoryProperty + + @get:OutputFile public abstract val modifiedBuildFile: RegularFileProperty + @get:OutputFile public abstract val featuresToRemoveOutputFile: RegularFileProperty + + init { + group = "foundry" + @Suppress("LeakingThis") + notCompatibleWithConfigurationCache("This task modified build files in place") + @Suppress("LeakingThis") doNotTrackState("This task modified build files in place") + } + + @OptIn(ExperimentalPathApi::class) + @TaskAction + public fun validate() { + val topography = ModuleTopography.from(topographyJson) + val loadedFeatures = + featuresConfigFile.asFile + .map { ModuleFeaturesConfig.load(it.toPath()) } + .getOrElse(ModuleFeaturesConfig.DEFAULT) + .loadFeatures() + val features = buildSet { + addAll(topography.features.map { featureKey -> loadedFeatures.getValue(featureKey) }) + // Include plugin-specific features to the check here + addAll(loadedFeatures.filterValues { it.matchingPlugin in topography.plugins }.values) + } + val featuresToRemove = mutableSetOf() + + val projectDir = projectDirProperty.asFile.get().toPath() + val srcsDir = projectDir.resolve("src") + + val buildFile = projectDir.resolve("build.gradle.kts") + var buildFileText = buildFile.readText() + val initialBuildFileHash = buildFileText.hashCode() + + for (feature in features) { + val initialRemoveSize = featuresToRemove.size + feature.matchingSourcesDir?.let { matchingSrcsDir -> + if (projectDir.resolve(matchingSrcsDir).walkEachFile().none()) { + featuresToRemove += feature + } + } + + feature.generatedSourcesDir?.let { generatedSrcsDir -> + if (projectDir.resolve(generatedSrcsDir).walkEachFile().none()) { + featuresToRemove += feature + } + } + + if (feature.matchingText.isNotEmpty()) { + if (!feature.hasMatchingTextIn(srcsDir)) { + featuresToRemove += feature + } + } + + val isRemoving = featuresToRemove.size != initialRemoveSize + if (isRemoving) { + feature.removalPatterns?.let { removalPatterns -> + for (removalRegex in removalPatterns) { + buildFileText = buildFileText.replace(removalRegex, "").removeEmptyBraces() + } + } + } + } + + JsonTools.toJson>( + featuresToRemoveOutputFile, + featuresToRemove.toSortedSet(compareBy { it.name }), + ) + + val hasBuildFileChanges = initialBuildFileHash != buildFileText.hashCode() + val shouldAutoFix = autoFix.getOrElse(false) + if (hasBuildFileChanges) { + if (shouldAutoFix) { + buildFile.writeText(buildFileText) + } else { + modifiedBuildFile.asFile.get().writeText(buildFileText) + } + } + + val allAutoFixed = featuresToRemove.all { !it.removalPatterns.isNullOrEmpty() } + if (featuresToRemove.isNotEmpty()) { + val message = buildString { + appendLine( + "**Validation failed! The following features appear to be unused and can be removed.**" + ) + appendLine() + var first = true + featuresToRemove.forEach { + if (first) { + first = false + } else { + appendLine() + appendLine() + } + appendLine("- **${it.name}:** ${it.explanation}") + appendLine() + appendLine(" - **Advice:** ${it.advice}") + } + appendLine() + appendLine("Full list written to ${featuresToRemoveOutputFile.asFile.get().absolutePath}") + } + val t = Terminal(AnsiLevel.TRUECOLOR, interactive = true) + val md = Markdown(message) + t.println(md, stderr = true) + if (shouldAutoFix) { + if (allAutoFixed) { + logger.lifecycle("All issues auto-fixed") + } else { + throw AssertionError("Not all issues could be fixed automatically") + } + } else { + throw AssertionError() + } + } + } + + @OptIn(ExperimentalPathApi::class) + private fun ModuleFeature.hasMatchingTextIn(srcsDir: Path): Boolean { + logger.debug("Checking for $name annotation usages in sources") + return srcsDir + .walkEachFile() + .run { + if (matchingTextFileExtensions.isNotEmpty()) { + filter { it.extension in matchingTextFileExtensions } + } else { + this + } + } + .any { file -> + file.useLines { lines -> + for (line in lines) { + if (matchingText.any { it in line }) { + return@any true + } + } + } + false + } + } + + internal companion object { + private const val LOG = "[ValidateModuleTopography]" + private const val NAME = "validateModuleTopography" + private val CI_NAME = "ci${NAME.capitalizeUS()}" + internal val GLOBAL_CI_NAME = "global${CI_NAME.capitalizeUS()}" + + fun register( + project: Project, + topographyTask: TaskProvider, + foundryProperties: FoundryProperties, + affectedProjects: Set?, + ) { + val publisher = + if (affectedProjects == null || project.path in affectedProjects) { + Publisher.Companion.interProjectPublisher( + project, + FoundryArtifact.SKIPPY_VALIDATE_TOPOGRAPHY, + ) + } else { + val log = "$LOG Skipping ${project.path}:$CI_NAME because it is not affected." + if (foundryProperties.debug) { + project.logger.lifecycle(log) + } else { + project.logger.debug(log) + } + SkippyArtifacts.publishSkippedTask(project, NAME) + null + } + + val validateModuleTopographyTask = + project.tasks.register(NAME) { + topographyJson.set(topographyTask.flatMap { it.topographyOutputFile }) + featuresConfigFile.convention(foundryProperties.topographyFeaturesConfig) + projectDirProperty.set(project.layout.projectDirectory) + autoFix.convention(foundryProperties.topographyAutoFix) + featuresToRemoveOutputFile.setDisallowChanges( + project.layout.buildDirectory.file("foundry/topography/validate/featuresToRemove.json") + ) + modifiedBuildFile.setDisallowChanges( + project.layout.buildDirectory.file( + "foundry/topography/validate/modified-build.gradle.kts" + ) + ) + } + val ciValidateModuleTopographyTask = + SimpleFileProducerTask.Companion.registerOrConfigure( + project, + CI_NAME, + description = "Lifecycle task to run $NAME for ${project.path}.", + group = LifecycleBasePlugin.VERIFICATION_GROUP, + ) { + dependsOn(validateModuleTopographyTask) + } + publisher?.publish(ciValidateModuleTopographyTask) + } + } +} + +//// Usage +// var code = "foundry { features { compose() } }" +// code = code.replace(Regex("\\bcompose\\(\\)"), "") // remove compose() +// code = removeEmptyBraces(code) // recursively remove empty braces +// +// println(code) // Should print "" +// TODO write tests for this +private val EMPTY_DSL_BLOCK = "(\\w*)\\s*\\{\\s*\\}".toRegex() + +internal fun String.removeEmptyBraces(): String { + var result = this + while (EMPTY_DSL_BLOCK.containsMatchIn(result)) { + result = EMPTY_DSL_BLOCK.replace(result, "") + } + return result +} diff --git a/tools/cli/api/cli.api b/tools/cli/api/cli.api index 9bd8e9e7b..e0ff043e8 100644 --- a/tools/cli/api/cli.api +++ b/tools/cli/api/cli.api @@ -450,23 +450,23 @@ public final class foundry/cli/buildkite/BlockedState$Companion { public final class foundry/cli/buildkite/Build { public static final field Companion Lfoundry/cli/buildkite/Build$Companion; public fun ()V - public fun (Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Lkotlinx/serialization/json/JsonObject; + public final fun component3 ()Ljava/util/Map; public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ljava/lang/String; public final fun component6 ()Lkotlinx/serialization/json/JsonObject; public final fun component7 ()Ljava/lang/String; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Lfoundry/cli/buildkite/BuildType; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;)Lfoundry/cli/buildkite/Build; - public static synthetic fun copy$default (Lfoundry/cli/buildkite/Build;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;ILjava/lang/Object;)Lfoundry/cli/buildkite/Build; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;)Lfoundry/cli/buildkite/Build; + public static synthetic fun copy$default (Lfoundry/cli/buildkite/Build;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/BuildType;ILjava/lang/Object;)Lfoundry/cli/buildkite/Build; public fun equals (Ljava/lang/Object;)Z public final fun getBranch ()Ljava/lang/String; public final fun getCommit ()Ljava/lang/String; - public final fun getEnv ()Lkotlinx/serialization/json/JsonObject; + public final fun getEnv ()Ljava/util/Map; public final fun getLabel ()Ljava/lang/String; public final fun getMessage ()Ljava/lang/String; public final fun getMetaData ()Lkotlinx/serialization/json/JsonObject; @@ -1997,8 +1997,8 @@ public final class foundry/cli/buildkite/MultiChannelMessage$Companion { public final class foundry/cli/buildkite/NestedBlockStepClass : foundry/cli/buildkite/Keyable { public static final field Companion Lfoundry/cli/buildkite/NestedBlockStepClass$Companion; public fun ()V - public fun (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lkotlinx/serialization/json/JsonObject;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;)V - public synthetic fun (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lkotlinx/serialization/json/JsonObject;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;IILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Ljava/util/Map;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;)V + public synthetic fun (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Ljava/util/Map;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;IILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/Boolean; public final fun component10 ()Ljava/lang/String; public final fun component11 ()Ljava/lang/String; @@ -2015,7 +2015,7 @@ public final class foundry/cli/buildkite/NestedBlockStepClass : foundry/cli/buil public final fun component21 ()Ljava/lang/Long; public final fun component22 ()Ljava/lang/String; public final fun component23 ()Lfoundry/cli/buildkite/ConcurrencyMethod; - public final fun component24 ()Lkotlinx/serialization/json/JsonObject; + public final fun component24 ()Ljava/util/Map; public final fun component25 ()Lfoundry/cli/buildkite/MatrixUnion; public final fun component26 ()Ljava/util/List; public final fun component27 ()Ljava/lang/Long; @@ -2042,8 +2042,8 @@ public final class foundry/cli/buildkite/NestedBlockStepClass : foundry/cli/buil public final fun component7 ()Ljava/lang/String; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/lang/String; - public final fun copy (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lkotlinx/serialization/json/JsonObject;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;)Lfoundry/cli/buildkite/NestedBlockStepClass; - public static synthetic fun copy$default (Lfoundry/cli/buildkite/NestedBlockStepClass;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lkotlinx/serialization/json/JsonObject;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;IILjava/lang/Object;)Lfoundry/cli/buildkite/NestedBlockStepClass; + public final fun copy (Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Ljava/util/Map;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;)Lfoundry/cli/buildkite/NestedBlockStepClass; + public static synthetic fun copy$default (Lfoundry/cli/buildkite/NestedBlockStepClass;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Block;Lfoundry/cli/buildkite/BlockedState;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/DependsOn;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/NestedBlockStepType;Lfoundry/cli/buildkite/Input;Lfoundry/cli/buildkite/Agents;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Commands;Lfoundry/cli/buildkite/Commands;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Ljava/util/Map;Lfoundry/cli/buildkite/MatrixUnion;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptStep;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Wait;Lfoundry/cli/buildkite/Wait;Ljava/lang/Boolean;Lfoundry/cli/buildkite/Build;Lfoundry/cli/buildkite/Trigger;Ljava/lang/String;Ljava/util/List;IILjava/lang/Object;)Lfoundry/cli/buildkite/NestedBlockStepClass; public fun equals (Ljava/lang/Object;)Z public final fun getAgents ()Lfoundry/cli/buildkite/Agents; public final fun getAllowDependencyFailure ()Ljava/lang/Boolean; @@ -2061,7 +2061,7 @@ public final class foundry/cli/buildkite/NestedBlockStepClass : foundry/cli/buil public final fun getConcurrencyMethod ()Lfoundry/cli/buildkite/ConcurrencyMethod; public final fun getContinueOnFailure ()Ljava/lang/Boolean; public final fun getDependsOn ()Lfoundry/cli/buildkite/DependsOn; - public final fun getEnv ()Lkotlinx/serialization/json/JsonObject; + public final fun getEnv ()Ljava/util/Map; public final fun getFields ()Ljava/util/List; public final fun getGroup ()Ljava/lang/String; public final fun getId ()Ljava/lang/String; @@ -2234,17 +2234,17 @@ public final class foundry/cli/buildkite/Option$Companion { public final class foundry/cli/buildkite/Pipeline { public static final field Companion Lfoundry/cli/buildkite/Pipeline$Companion; - public fun (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Lkotlinx/serialization/json/JsonObject;Ljava/util/List;)V - public synthetic fun (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Lkotlinx/serialization/json/JsonObject;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Ljava/util/Map;Ljava/util/List;)V + public synthetic fun (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Ljava/util/Map;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/util/List; public final fun component2 ()Lfoundry/cli/buildkite/Agents; - public final fun component3 ()Lkotlinx/serialization/json/JsonObject; + public final fun component3 ()Ljava/util/Map; public final fun component4 ()Ljava/util/List; - public final fun copy (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Lkotlinx/serialization/json/JsonObject;Ljava/util/List;)Lfoundry/cli/buildkite/Pipeline; - public static synthetic fun copy$default (Lfoundry/cli/buildkite/Pipeline;Ljava/util/List;Lfoundry/cli/buildkite/Agents;Lkotlinx/serialization/json/JsonObject;Ljava/util/List;ILjava/lang/Object;)Lfoundry/cli/buildkite/Pipeline; + public final fun copy (Ljava/util/List;Lfoundry/cli/buildkite/Agents;Ljava/util/Map;Ljava/util/List;)Lfoundry/cli/buildkite/Pipeline; + public static synthetic fun copy$default (Lfoundry/cli/buildkite/Pipeline;Ljava/util/List;Lfoundry/cli/buildkite/Agents;Ljava/util/Map;Ljava/util/List;ILjava/lang/Object;)Lfoundry/cli/buildkite/Pipeline; public fun equals (Ljava/lang/Object;)Z public final fun getAgents ()Lfoundry/cli/buildkite/Agents; - public final fun getEnv ()Lkotlinx/serialization/json/JsonObject; + public final fun getEnv ()Ljava/util/Map; public final fun getNotify ()Ljava/util/List; public final fun getSteps ()Ljava/util/List; public fun hashCode ()I @@ -2440,12 +2440,12 @@ public final class foundry/cli/buildkite/Retry$Companion { public final class foundry/cli/buildkite/ScriptStep : foundry/cli/buildkite/Keyable { public static final field Companion Lfoundry/cli/buildkite/ScriptStep$Companion; public fun ()V - public fun (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;)V - public synthetic fun (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;)V + public synthetic fun (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Lfoundry/cli/buildkite/Agents; public final fun component10 ()Lfoundry/cli/buildkite/ConcurrencyMethod; public final fun component11 ()Lfoundry/cli/buildkite/DependsOn; - public final fun component12 ()Lkotlinx/serialization/json/JsonObject; + public final fun component12 ()Ljava/util/Map; public final fun component13 ()Ljava/lang/String; public final fun component14 ()Ljava/lang/String; public final fun component15 ()Ljava/lang/String; @@ -2471,8 +2471,8 @@ public final class foundry/cli/buildkite/ScriptStep : foundry/cli/buildkite/Keya public final fun component7 ()Lfoundry/cli/buildkite/SimpleStringValue; public final fun component8 ()Ljava/lang/Long; public final fun component9 ()Ljava/lang/String; - public final fun copy (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;)Lfoundry/cli/buildkite/ScriptStep; - public static synthetic fun copy$default (Lfoundry/cli/buildkite/ScriptStep;Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;ILjava/lang/Object;)Lfoundry/cli/buildkite/ScriptStep; + public final fun copy (Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;)Lfoundry/cli/buildkite/ScriptStep; + public static synthetic fun copy$default (Lfoundry/cli/buildkite/ScriptStep;Lfoundry/cli/buildkite/Agents;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Boolean;Lfoundry/cli/buildkite/SimpleStringValue;Lfoundry/cli/buildkite/SimpleStringValue;Ljava/lang/Long;Ljava/lang/String;Lfoundry/cli/buildkite/ConcurrencyMethod;Lfoundry/cli/buildkite/DependsOn;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lfoundry/cli/buildkite/MatrixUnion;Ljava/lang/String;Ljava/util/List;Ljava/lang/Long;Lfoundry/cli/buildkite/Plugins;Ljava/lang/Long;Lfoundry/cli/buildkite/Retry;Lfoundry/cli/buildkite/Signature;Lfoundry/cli/buildkite/Skip;Lfoundry/cli/buildkite/SoftFail;Ljava/lang/Long;Lfoundry/cli/buildkite/ScriptType;ILjava/lang/Object;)Lfoundry/cli/buildkite/ScriptStep; public fun equals (Ljava/lang/Object;)Z public final fun getAgents ()Lfoundry/cli/buildkite/Agents; public final fun getAllowDependencyFailure ()Ljava/lang/Boolean; @@ -2486,7 +2486,7 @@ public final class foundry/cli/buildkite/ScriptStep : foundry/cli/buildkite/Keya public final fun getConcurrencyGroup ()Ljava/lang/String; public final fun getConcurrencyMethod ()Lfoundry/cli/buildkite/ConcurrencyMethod; public final fun getDependsOn ()Lfoundry/cli/buildkite/DependsOn; - public final fun getEnv ()Lkotlinx/serialization/json/JsonObject; + public final fun getEnv ()Ljava/util/Map; public final fun getId ()Ljava/lang/String; public final fun getIdentifier ()Ljava/lang/String; public fun getKey ()Ljava/lang/String; diff --git a/tools/cli/src/main/kotlin/foundry/cli/buildkite/BuildkiteDataBindings.kt b/tools/cli/src/main/kotlin/foundry/cli/buildkite/BuildkiteDataBindings.kt index 70ffde314..6063257c4 100644 --- a/tools/cli/src/main/kotlin/foundry/cli/buildkite/BuildkiteDataBindings.kt +++ b/tools/cli/src/main/kotlin/foundry/cli/buildkite/BuildkiteDataBindings.kt @@ -76,7 +76,7 @@ public data class Pipeline( /** A list of steps */ val steps: List, val agents: Agents? = null, - val env: JsonObject? = null, + val env: Map? = null, val notify: List? = null, ) @@ -296,7 +296,7 @@ public data class NestedBlockStepClass( * attribute, you must also define concurrency_group and concurrency. */ @SerialName("concurrency_method") val concurrencyMethod: ConcurrencyMethod? = null, - val env: JsonObject? = null, + val env: Map? = null, val matrix: MatrixUnion? = null, /** Array of notification options for this step */ @@ -525,7 +525,7 @@ public data class Build( /** The commit hash for the build */ val commit: String? = null, - val env: JsonObject? = null, + val env: Map? = null, val label: String? = null, /** The message for the build (supports emoji) */ @@ -601,7 +601,7 @@ public data class ScriptStep( */ @SerialName("concurrency_method") val concurrencyMethod: ConcurrencyMethod? = null, @SerialName("depends_on") val dependsOn: DependsOn? = null, - val env: JsonObject? = null, + val env: Map? = null, val id: String? = null, val identifier: String? = null, @SerialName("if") val commandStepIf: String? = null,