Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publish a BOM and a Version Catalog #1072

Merged
merged 2 commits into from
Oct 17, 2023
Merged

feat: publish a BOM and a Version Catalog #1072

merged 2 commits into from
Oct 17, 2023

Conversation

aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Oct 11, 2023

Issue #

closes #605
closes #805

upstream smithy-lang/smithy-kotlin#980

Description of changes

Publish a bill of materials and a version catalog.

This creates two new artifacts with the coordinates aws.sdk.kotlin:bom:<version> and aws.sdk.kotlin:version-catalog:<version>.

The BOM artifact can be used to align dependency versions of the SDK. The catalog declares all the artifacts and can be used to add and discover dependencies. They can be used together or separately.

Questions:

  1. A version catalog resolves - to . when consuming. e.g. aws-http becomes aws.http. This acts as a sort of namespace almost. I've grouped the runtime components with the prefix runtime- and services with service- for discoverability. This is entirely subjective though, we don't have to do anything here and could simply publish the catalog with the alias as the artifact name. The prefixes help with discoverability and match our package hierarchy IMHO though.
  2. Should we include smithy-kotlin dependencies in the version catalog? There are a number of optional dependencies that customers may want to pull in or features to enable. To do so requires they know about the smithy-kotlin artifacts. It may help discoverability to include them. Alternatively we can publish a separate catalog and BOM for smithy-kotlin.

Example usage of the version catalog in a consumer project:

// file: settings.gradle.kts

dependencyResolutionManagement {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    versionCatalogs {
        create("awskotlinsdk") {
            from("aws.sdk.kotlin:version-catalog:0.32.5-SNAPSHOT")
        }
    }
}
// file: build.gradle.kts

dependencies {
    implementation(awskotlinsdk.services.s3)
    implementation(awskotlinsdk.runtime.aws.http)
    ...
}

Example Artifacts:

This is with only s3 and sts service clients bootstrapped.

Built/published catalog:

#
# This file has been generated by Gradle and is intended to be consumed by Gradle
#
[metadata]
format.version = "1.1"

[libraries]
runtime-aws-config = {group = "aws.sdk.kotlin", name = "aws-config", version = "0.32.5-SNAPSHOT" }
runtime-aws-config-jvm = {group = "aws.sdk.kotlin", name = "aws-config-jvm", version = "0.32.5-SNAPSHOT" }
runtime-aws-core = {group = "aws.sdk.kotlin", name = "aws-core", version = "0.32.5-SNAPSHOT" }
runtime-aws-core-jvm = {group = "aws.sdk.kotlin", name = "aws-core-jvm", version = "0.32.5-SNAPSHOT" }
runtime-aws-endpoint = {group = "aws.sdk.kotlin", name = "aws-endpoint", version = "0.32.5-SNAPSHOT" }
runtime-aws-endpoint-jvm = {group = "aws.sdk.kotlin", name = "aws-endpoint-jvm", version = "0.32.5-SNAPSHOT" }
runtime-aws-http = {group = "aws.sdk.kotlin", name = "aws-http", version = "0.32.5-SNAPSHOT" }
runtime-aws-http-jvm = {group = "aws.sdk.kotlin", name = "aws-http-jvm", version = "0.32.5-SNAPSHOT" }
services-s3 = {group = "aws.sdk.kotlin", name = "s3", version = "0.32.5-SNAPSHOT" }
services-s3-jvm = {group = "aws.sdk.kotlin", name = "s3-jvm", version = "0.32.5-SNAPSHOT" }
services-sts = {group = "aws.sdk.kotlin", name = "sts", version = "0.32.5-SNAPSHOT" }
services-sts-jvm = {group = "aws.sdk.kotlin", name = "sts-jvm", version = "0.32.5-SNAPSHOT" }

Built/published BOM

{
  "formatVersion": "1.1",
  "component": {
    "group": "aws.sdk.kotlin",
    "module": "bom",
    "version": "0.32.5-SNAPSHOT",
    "attributes": {
      "org.gradle.status": "integration"
    }
  },
  "createdBy": {
    "gradle": {
      "version": "7.4.2"
    }
  },
  "variants": [
    {
      "name": "apiElements",
      "attributes": {
        "org.gradle.category": "platform",
        "org.gradle.usage": "java-api"
      },
      "dependencyConstraints": [
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-config-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-config",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-core-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-core",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-endpoint-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-endpoint",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-http-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-http",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "s3-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "s3",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "sts-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "sts",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        }
      ]
    },
    {
      "name": "runtimeElements",
      "attributes": {
        "org.gradle.category": "platform",
        "org.gradle.usage": "java-runtime"
      },
      "dependencyConstraints": [
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-config-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-config",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-core-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-core",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-endpoint-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-endpoint",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-http-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "aws-http",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "s3-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "s3",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "sts-jvm",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        },
        {
          "group": "aws.sdk.kotlin",
          "module": "sts",
          "version": {
            "requires": "0.32.5-SNAPSHOT"
          }
        }
      ]
    }
  ]
}

Additional Resources:

  • Here is the Gradle documentation on both.
  • This article gives a good overview of how a BOM is used in practice.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aajtodd aajtodd requested a review from a team as a code owner October 11, 2023 18:10
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@aajtodd aajtodd merged commit b5936d1 into main Oct 17, 2023
17 of 18 checks passed
@aajtodd aajtodd deleted the feat-bom branch October 17, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Provide a version catalog Provide a bill of materials (BOM)
3 participants