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

Fix library dependency issues #3901

Merged
merged 6 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aws/sdk-adhoc-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ configure<software.amazon.smithy.gradle.SmithyExtension> {
outputDirectory = layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile
}

val checkedInSdkLockfile = rootProject.projectDir.resolve("aws/sdk/Cargo.lock")

dependencies {
implementation(project(":aws:sdk-codegen"))
implementation("software.amazon.smithy:smithy-aws-protocol-tests:$smithyVersion")
Expand Down Expand Up @@ -83,9 +85,10 @@ val allCodegenTests = listOf(
project.registerGenerateSmithyBuildTask(rootProject, pluginName, allCodegenTests)
project.registerGenerateCargoWorkspaceTask(rootProject, pluginName, allCodegenTests, workingDirUnderBuildDir)
project.registerGenerateCargoConfigTomlTask(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
project.registerCopyCheckedInCargoLockfileTask(checkedInSdkLockfile, layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)

tasks["smithyBuild"].dependsOn("generateSmithyBuild")
tasks["assemble"].finalizedBy("generateCargoWorkspace")
tasks["assemble"].dependsOn("generateCargoWorkspace").finalizedBy("copyCheckedInCargoLockfile")

project.registerModifyMtimeTask()
project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
Expand Down
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/CodegenTestCommon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import org.gradle.api.Project
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.Exec
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.register
Expand Down Expand Up @@ -295,6 +296,17 @@ fun Project.registerGenerateCargoConfigTomlTask(outputDir: File) {
}
}

fun Project.registerCopyCheckedInCargoLockfileTask(
lockfile: File,
destinationDir: File,
) {
this.tasks.register<Copy>("copyCheckedInCargoLockfile") {
description = "copy checked-in `Cargo.lock` to the destination directory"
from(lockfile)
into(destinationDir)
}
}

const val PREVIOUS_BUILD_HASHES_KEY = "previousBuildHashes"

fun Project.registerModifyMtimeTask() {
Expand Down
5 changes: 4 additions & 1 deletion codegen-client-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "o
val pluginName = "rust-client-codegen"
val workingDirUnderBuildDir = "smithyprojections/codegen-client-test/"

val checkedInSmithyRuntimeLockfile = rootProject.projectDir.resolve("rust-runtime/Cargo.lock")

dependencies {
implementation(project(":codegen-client"))
implementation("software.amazon.smithy:smithy-aws-protocol-tests:$smithyVersion")
Expand Down Expand Up @@ -124,11 +126,12 @@ val allCodegenTests = listOf(
project.registerGenerateSmithyBuildTask(rootProject, pluginName, allCodegenTests)
project.registerGenerateCargoWorkspaceTask(rootProject, pluginName, allCodegenTests, workingDirUnderBuildDir)
project.registerGenerateCargoConfigTomlTask(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
project.registerCopyCheckedInCargoLockfileTask(checkedInSmithyRuntimeLockfile, layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)

tasks["generateSmithyBuild"].inputs.property("smithy.runtime.mode", getSmithyRuntimeMode())

tasks["smithyBuild"].dependsOn("generateSmithyBuild")
tasks["assemble"].finalizedBy("generateCargoWorkspace")
tasks["assemble"].finalizedBy("generateCargoWorkspace", "copyCheckedInCargoLockfile")

project.registerModifyMtimeTask()
project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile)
Expand Down
15 changes: 15 additions & 0 deletions tools/ci-cdk/canary-runner/src/build_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ wit-bindgen = { version = "0.16.0", features = ["macros", "realloc"] }
wasmtime = { version = "17.0.1", features = ["component-model"] }
wasmtime-wasi = "17.0.1"
wasmtime-wasi-http = "17.0.1"

# TODO(MSRV): Version 1.4.0 uses `error_in_core` and is considered unstable library feature in our MSRV of 1.78.0.
# Remove this version constraint once we upgrade to a future MSRV that stabilizes `error_in_core`.
arbitrary = "=1.3.2"

"#;

lazy_static! {
Expand Down Expand Up @@ -599,6 +604,11 @@ wit-bindgen = { version = "0.16.0", features = ["macros", "realloc"] }
wasmtime = { version = "17.0.1", features = ["component-model"] }
wasmtime-wasi = "17.0.1"
wasmtime-wasi-http = "17.0.1"

# TODO(MSRV): Version 1.4.0 uses `error_in_core` and is considered unstable library feature in our MSRV of 1.78.0.
# Remove this version constraint once we upgrade to a future MSRV that stabilizes `error_in_core`.
arbitrary = "=1.3.2"

aws-config = { path = "some/sdk/path/aws-config", features = ["behavior-version-latest"] }
aws-sdk-s3 = { path = "some/sdk/path/s3" }
aws-sdk-ec2 = { path = "some/sdk/path/ec2" }
Expand Down Expand Up @@ -657,6 +667,11 @@ wit-bindgen = { version = "0.16.0", features = ["macros", "realloc"] }
wasmtime = { version = "17.0.1", features = ["component-model"] }
wasmtime-wasi = "17.0.1"
wasmtime-wasi-http = "17.0.1"

# TODO(MSRV): Version 1.4.0 uses `error_in_core` and is considered unstable library feature in our MSRV of 1.78.0.
# Remove this version constraint once we upgrade to a future MSRV that stabilizes `error_in_core`.
arbitrary = "=1.3.2"

aws-config = { version = "0.46.0", features = ["behavior-version-latest"] }
aws-sdk-s3 = { version = "0.20.0" }
aws-sdk-ec2 = { version = "0.19.0" }
Expand Down
3 changes: 3 additions & 0 deletions tools/ci-scripts/check-semver-hazards
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ runtime-versioner patch-runtime \
--sdk-path "$(pwd)/aws-sdk-rust" \
--smithy-rs-path "$(pwd)/smithy-rs"

echo -e "${C_YELLOW}# Copying the SDK lockfile to aws-sdk-rust...${C_RESET}"
cp "$(pwd)/smithy-rs/aws/sdk/Cargo.lock" "$(pwd)/aws-sdk-rust/"

echo -e "${C_YELLOW}# Testing SDK...${C_RESET}"
for sdk in aws-sdk-rust/sdk/*; do
if ls "$sdk/tests" | grep -v '^endpoint_tests\.rs$'; then
Expand Down
1 change: 0 additions & 1 deletion tools/ci-scripts/codegen-diff/semver-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def main(skip_generation=False):
elif get_cmd_status(f'git cat-file -e base:{sdk_directory}/{path}/Cargo.toml') != 0:
eprint(f'skipping {path} because it does not exist in base')
else:
get_cmd_output('cargo generate-lockfile', quiet=True)
(_, out, _) = get_cmd_output('cargo pkgid', cwd=path, quiet=True)
pkgid = parse_package_id(out)
(status, out, err) = get_cmd_output(f'cargo semver-checks check-release '
Expand Down
Loading