Unverified Commit d5750d48 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Include non-service-specific examples in the generated workspace (#957)

* Include non-service-specific examples in the generated workspace

* Update changelog

* Fix missing dependency for compilation

* Fix typo in Kinesis example
parent b9d5923a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -196,6 +196,9 @@ jobs:
      uses: actions/setup-java@v1
      with:
        java-version: ${{ env.java_version }}
    # The telephone-game example depends on ALSA, so we need this library to compile it
    - name: Install libasound2-dev
      run: sudo apt-get install -y libasound2-dev
    - name: Generate and check all services
      run: ./gradlew -Paws.fullsdk=true :aws:sdk:cargoCheck
    - name: Generate a name for the SDK
+12 −0
Original line number Diff line number Diff line
@@ -10,3 +10,15 @@
# references = ["smithy-rs#920"]
# meta = { "breaking" = false, "tada" = false, "bug" = false }
# author = "rcoh"

[[aws-sdk-rust]]
message = "Include non-service-specific examples in the root Cargo workspace so that they can build"
references = ["smithy-rs#957"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "jdisanti"

[[smithy-rs]]
message = "Include non-service-specific examples in the generated root Cargo workspace"
references = ["smithy-rs#957"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "jdisanti"
+13 −1
Original line number Diff line number Diff line
@@ -284,7 +284,19 @@ fun generateCargoWorkspace(services: List<AwsService>): String {
    val generatedModules = services.map { it.module }.toSet()
    val examples = projectDir.resolve("examples")
        .listFiles { file -> !file.name.startsWith(".") }.orEmpty().toList()
        .filter { generatedModules.contains(it.name) }
        .filter { file ->
            val cargoToml = File(file, "Cargo.toml")
            if (cargoToml.exists()) {
                val usedModules = cargoToml.readLines()
                    .map { line -> line.substringBefore('=').trim() }
                    .filter { line -> line.startsWith("aws-sdk-") }
                    .map { line -> line.substringAfter("aws-sdk-") }
                    .toSet()
                generatedModules.containsAll(usedModules)
            } else {
                false
            }
        }
        .map { "examples/${it.name}" }

    val modules = (
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ edition = "2018"

[dependencies]
aws-config = { path = "../../build/aws-sdk/sdk/aws-config" }
autoscalingplans = { package = "aws-sdk-autoscalingplans", path = "../../build/aws-sdk/sdk/autoscalingplans" }
aws-sdk-autoscalingplans = { path = "../../build/aws-sdk/sdk/autoscalingplans" }
aws-types = { path = "../../build/aws-sdk/sdk/aws-types" }
tokio = { version = "1", features = ["full"] }
structopt = { version = "0.3", default-features = false }
+2 −2
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@
 * SPDX-License-Identifier: Apache-2.0.
 */

use autoscalingplans::{Client, Error, Region};
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_autoscalingplans::{Client, Error, Region};
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
@@ -39,7 +39,7 @@ async fn main() -> Result<(), Error> {
    if verbose {
        println!(
            "Auto Scaling Plans client version: {}",
            autoscalingplans::PKG_VERSION
            aws_sdk_autoscalingplans::PKG_VERSION
        );
        println!(
            "Region:                            {:?}",
Loading