Unverified Commit 5c937957 authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Make runtime versioner ignore any additional flags (#3520)

## Motivation and Context
This is the first of two PRs to remove the concept of stable/unstable
versions from the release process. This PR will cause a full docker
rebuild, so I'm splitting it out to merge first to make iterating on the
second PR easier.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent 0694727e
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -29,11 +29,6 @@ pub fn patch(args: PatchRuntime) -> Result<()> {
        bail!("aws-sdk-rust has a dirty working tree. Aborting.");
    }

    step(
        "Patching smithy-rs/gradle.properties with given crate version numbers",
        || patch_gradle_properties(&smithy_rs, &args),
    )?;

    // Use aws:sdk:assemble to generate both the smithy-rs runtime and AWS SDK
    // runtime crates with the correct version numbers.
    step("Generating an AWS SDK", || {
@@ -96,31 +91,6 @@ pub fn patch_with(args: PatchRuntimeWith) -> Result<()> {
    Ok(())
}

fn patch_gradle_properties(smithy_rs: &Repo, args: &PatchRuntime) -> Result<()> {
    let props_path = smithy_rs.root.join("gradle.properties");
    let props =
        fs::read_to_string(&props_path).context("failed to read smithy-rs/gradle.properties")?;
    let mut new_props = String::with_capacity(props.len());
    for line in props.lines() {
        if line.starts_with("smithy.rs.runtime.crate.stable.version=") {
            new_props.push_str(&format!(
                "smithy.rs.runtime.crate.stable.version={}",
                args.stable_crate_version
            ));
        } else if line.starts_with("smithy.rs.runtime.crate.unstable.version=") {
            new_props.push_str(&format!(
                "smithy.rs.runtime.crate.unstable.version={}",
                args.unstable_crate_version
            ));
        } else {
            new_props.push_str(line);
        }
        new_props.push('\n');
    }
    fs::write(&props_path, new_props).context("failed to write smithy-rs/gradle.properties")?;
    Ok(())
}

fn apply_version_only_dependencies(aws_sdk_rust: &Repo) -> Result<()> {
    aws_sdk_rust
        .cmd(
+6 −2
Original line number Diff line number Diff line
@@ -59,11 +59,15 @@ pub struct PatchRuntime {
    #[arg(long)]
    previous_release_tag: Option<String>,
    /// Version number for stable crates.
    ///
    /// Deprecated: this argument is ignored
    #[arg(long)]
    stable_crate_version: String,
    stable_crate_version: Option<String>,
    /// Version number for unstable crates.
    ///
    /// Deprecated: this argument is ignored
    #[arg(long)]
    unstable_crate_version: String,
    unstable_crate_version: Option<String>,
}

#[derive(clap::Args, Clone)]
+3 −10
Original line number Diff line number Diff line
@@ -10,14 +10,9 @@
C_YELLOW='\033[1;33m'
C_RESET='\033[0m'

if [ "$#" -ne 2 ]; then
  echo "Usage: check-semver-hazards <stable-crate-version> <unstable-crate-version>"
  exit 1
if [ "$#" -ne 0 ]; then
  echo "Unexpected arguments ignored"
fi
STABLE_CRATE_VERSION="$1"
UNSTABLE_CRATE_VERSION="$2"
echo "Stable crate version: ${STABLE_CRATE_VERSION}"
echo "Unstable crate version: ${UNSTABLE_CRATE_VERSION}"

# Need to allow warnings since there may be deprecations that the old SDK uses
unset RUSTFLAGS
@@ -27,9 +22,7 @@ set -eux
echo -e "${C_YELLOW}# Patching SDK...${C_RESET}"
runtime-versioner patch-runtime \
  --sdk-path "$(pwd)/aws-sdk-rust" \
  --smithy-rs-path "$(pwd)/smithy-rs" \
  --stable-crate-version "${STABLE_CRATE_VERSION}" \
  --unstable-crate-version "${UNSTABLE_CRATE_VERSION}"
  --smithy-rs-path "$(pwd)/smithy-rs"

# Testing just a small subset of the full SDK to check for semver hazards
echo -e "${C_YELLOW}# Testing SDK...${C_RESET}"