Skip to content
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
2 changes: 1 addition & 1 deletion csharp/CloudFront-S3-WAF/src/src.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion csharp/api-cors-lambda-crud-dynamodb/cdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "dotnet run -p src/ApiCorsLambdaCrudDynamodb/ApiCorsLambdaCrudDynamodb.csproj",
"app": "dotnet run --project src/ApiCorsLambdaCrudDynamodb/ApiCorsLambdaCrudDynamodb.csproj",
"watch": {
"include": [
"**"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>apigateway_cognito_lambda_dynamodb</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
2 changes: 1 addition & 1 deletion csharp/application-load-balancer/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet run -p src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj"
"app": "dotnet run --project src/ApplicationLoadBalancer/ApplicationLoadBalancer.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/appsync-graphql-dynamodb/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet run -p src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj"
"app": "dotnet run --project src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodb.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"profile": "",
"region": "",
"configuration": "Release",
"framework": "net6.0",
"framework": "net8.0",
"function-runtime": "dotnetcore3.1",
"function-memory-size": 256,
"function-timeout": 30,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion csharp/capitalize-string/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet publish -c Release CapitalizeStringHandler/src/CapitalizeStringHandler; dotnet run -p src/CapitalizeString"
"app": "dotnet publish -c Release CapitalizeStringHandler/src/CapitalizeStringHandler; dotnet run --project src/CapitalizeString"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal CapitalizeStringStack(Construct scope, string id, IStackProps props = n
Function fn = new Function(this, "capitalizestring", new FunctionProps
{
Runtime = Runtime.DOTNET_8,
Code = Code.FromAsset("./CapitalizeStringHandler/src/CapitalizeStringHandler/bin/Release/net6.0/publish"),
Code = Code.FromAsset("./CapitalizeStringHandler/src/CapitalizeStringHandler/bin/Release/net8.0/publish"),
Handler = "CapitalizeStringHandler::CapitalizeStringHandler.Function::FunctionHandler"
});
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/classic-load-balancer/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet run -p src/ClassicLoadBalancer/ClassicLoadBalancer.csproj"
"app": "dotnet run --project src/ClassicLoadBalancer/ClassicLoadBalancer.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RollForward>Major</RollForward>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/ec2-instance/src/Ec2Instance/Ec2Instance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet run -p src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj"
"app": "dotnet run --project src/ElasticbeanstalkBgPipeline/ElasticbeanstalkBgPipeline.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"context": {
"platform": "arn:aws:elasticbeanstalk:us-east-1::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux"
},
"app": "dotnet run -p src/ElasticbeanstalkEnvironment"
"app": "dotnet run --project src/ElasticbeanstalkEnvironment"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/eventbridge-firehose-s3-cdk/src/src.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion csharp/lambda-cron/cdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "dotnet run -p src/LambdaCron/LambdaCron.csproj",
"app": "dotnet run --project src/LambdaCron/LambdaCron.csproj",
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
"@aws-cdk/core:enableStackNameDuplicates": "true",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/lambda-cron/src/LambdaCron/LambdaCron.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/my-widget-service/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet src/MyWidgetService/bin/Debug/net6.0/MyWidgetService.dll"
"app": "dotnet src/MyWidgetService/bin/Debug/net8.0/MyWidgetService.dll"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/random-writer/src/RandomWriter/RandomWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/static-site/cdk.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"domain": "mystaticsite.com",
"subdomain": "www"
},
"app": "dotnet run -p src/StaticSite/StaticSite.csproj"
"app": "dotnet run --project src/StaticSite/StaticSite.csproj"
}
2 changes: 1 addition & 1 deletion csharp/static-site/src/StaticSite/StaticSite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion csharp/stepfunctions-job-poller/cdk.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"app": "dotnet run -p src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj"
"app": "dotnet run --project src/StepfunctionsJobPoller/StepfunctionsJobPoller.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<!-- Roll forward to future major versions of the netcoreapp as needed -->
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion go/httpapi-lambda/httpapi-lambda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestHttpapiLambdaStack(t *testing.T) {
stack := NewHttpapiLambdaStack(app, "MyStack", nil)

// THEN
template := assertions.Template_FromStack(stack)
template := assertions.Template_FromStack(stack, nil)

template.HasResourceProperties(jsii.String("AWS::ApiGatewayV2::Api"), map[string]interface{}{})

Expand Down
4 changes: 4 additions & 0 deletions scripts/build-toolkit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
package-lock.json
*.js.map
113 changes: 113 additions & 0 deletions scripts/build-toolkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# build-toolkit

TypeScript build runner for all CDK example projects using the [@aws-cdk/toolkit-lib](https://www.npmjs.com/package/@aws-cdk/toolkit-lib) for programmatic synthesis. Replaces the bash-based `build-*.sh` scripts with structured output and message capture.

## Supported Languages

- **TypeScript** - npm/yarn install → tsc build → jest test → synth
- **Python** - pip install in venv → synth (venv cleaned up after)
- **Java** - mvn compile → mvn test → synth
- **Go** - go build → go test → synth
- **C#/.NET** - dotnet build → synth

## What it does

For each CDK project discovered under the target directory:

1. Detects the language from project markers (package.json, requirements.txt, pom.xml, go.mod, *.csproj)
2. Runs the language-appropriate build pipeline
3. Runs programmatic `cdk synth` via `@aws-cdk/toolkit-lib` with a custom `IIoHost` that captures all warnings, deprecations, and errors
4. Projects with a `DO_NOT_AUTOTEST` file are skipped

## Usage

```bash
cd scripts/build-toolkit
npm install

# Build ALL languages from repo root
npx tsx src/index.ts ../..

# Build only one language
npx tsx src/index.ts ../.. --language typescript
npx tsx src/index.ts ../.. --language python

# With JSON report and custom concurrency
npx tsx src/index.ts ../.. --concurrency 4 --output /tmp/build-report.json

# Or point at a specific language directory
npx tsx src/index.ts ../../typescript
```

## CLI Options

| Option | Description | Default |
|--------|-------------|---------|
| `<dir>` | Root directory to scan for CDK projects (required) | - |
| `--language <lang>` | Filter to one language: typescript, python, java, go, csharp | _(all)_ |
| `--concurrency N` | Max parallel builds | `os.cpus().length / 2` |
| `--output <path>` | Write JSON report to file | _(none, console only)_ |

## Output

### Console

Live progress with emoji status per project as they complete:

```
Found 240 projects (230 buildable, 10 skipped)
Languages: typescript: 88, python: 78, java: 31, go: 25, csharp: 18
Concurrency: 8

⏭️ typescript/static-site (DO_NOT_AUTOTEST)
✅ python/lambda-cron
✅ typescript/lambda-cron
✅ go/lambda-cron
✅ typescript/ecs/cluster (1 warning)
❌ java/broken-project (build failed)

==============================
BUILD SUMMARY
==============================
Total: 240 (✅ 225 succeeded, ❌ 5 failed, ⏭️ 10 skipped)
Duration: 342.1s

--- Warnings ---
⚠️ [warn at /MyFirstEcsCluster/MyFleet] desiredCapacity has been configured...
in: typescript/ecs/cluster
```

### JSON Report

When `--output` is specified, writes a structured report with per-project steps, messages, timings, and language metadata.

## How synth works

Instead of shelling out to `cdk synth`, this tool uses the CDK Toolkit Library programmatically:

1. Reads the `app` command from each project's `cdk.json`
2. For Python projects, prepends venv activation to the app command
3. Creates a `Toolkit` instance with a custom `IIoHost` that collects all messages
4. Calls `toolkit.fromCdkApp(appCommand)` then `toolkit.synth(source)`
5. Copies `scripts/fake.context.json` when no `cdk.context.json` exists

The `IIoHost` captures messages at all levels (trace, debug, info, warn, error, result).

## Project structure

```
scripts/build-toolkit/
src/
index.ts # CLI entry point, arg parsing
types.ts # TypeScript interfaces (Language, StepResult, etc.)
discover.ts # Find CDK projects, detect language, skip flags
runner.ts # Spawn child processes with timeout/capture
build.ts # Language-specific build pipelines
synth.ts # @aws-cdk/toolkit-lib synth with IIoHost
orchestrator.ts # Parallel execution with p-limit
report.ts # JSON report + console summary
```

## Exit code

Exits `1` if any project fails, `0` if all succeed (skipped projects don't count as failures).
Loading
Loading