Skip to content

Commit

Permalink
chore(.NET): CollectionOfErrors; list as string (#1247)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas McDonald <[email protected]>
  • Loading branch information
josecorella and lucasmcdonald3 authored Jan 23, 2025
1 parent deb1ca4 commit 80b6b2e
Show file tree
Hide file tree
Showing 30 changed files with 229 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
require-approvals:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
issues: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_only_keyword.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
grep-only-verification-keyword:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
issues: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
not-grep:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: not-grep
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dafny_verify_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
getDafnyVerifyVersion:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.read_property.outputs.dafnyVerifyVersion }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dafny_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
getDafnyVersion:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.read_property.outputs.dafnyVersion }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/duvet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
duvet:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# This environment stores a token
# that can be used to checkout
# the ESDK specification
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/library_codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# in this workflow.
# The workflow installs black and docformatter and runs them on generated code.
python-version: [3.11]
os: [ubuntu-latest]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/library_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
TestVectorsAwsCryptographicMaterialProviders,
StandardLibrary,
]
os: [ubuntu-latest]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
format_java_misc:
# Don't run the nightly build on forks
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Support longpaths
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/library_interop_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
os: [
# https://taskei.amazon.dev/tasks/CrypTool-5283
# windows-latest,
ubuntu-latest,
macos-13,
ubuntu-22.04,
]
language: [java, net, python]
# https://taskei.amazon.dev/tasks/CrypTool-5284
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
os: [
# TODO just test on mac and ubuntu for now
# windows-latest,
ubuntu-latest,
ubuntu-22.04,
macos-13,
]
encrypting_language: [java, net, python]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/library_java_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
os: [
# TODO just test on mac for now
# windows-latest,
ubuntu-latest,
macos-13,
ubuntu-22.04,
]
runs-on: ${{ matrix.os }}
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/library_net_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
TestVectorsAwsCryptographicMaterialProviders,
]
dotnet-version: ["6.0.x"]
os: [windows-latest, ubuntu-latest, macos-13]
os: [windows-latest, ubuntu-22.04, macos-13]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/library_python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# Note: only tests use the sys.path workaround, not source code.
# Windows source code is tested downstream (ex. ESDK-Python CI).
# windows-latest,
ubuntu-latest,
ubuntu-22.04,
macos-13,
]
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_dafny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
dafny: ${{needs.getVersion.outputs.version}}

cut-issue-on-failure:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- pr-ci-java
- pr-ci-net
- pr-interop-test
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Verify all required jobs passed
uses: re-actors/alls-green@release/v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smithy-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
require-approvals:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
issues: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
cleanup:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Stale issue job
steps:
- uses: aws-actions/stale-issue-cleanup@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/CollectionOfErrors.cs b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/CollectionOfErrors.cs
index 8f7200422..2f36dbdaa 100644
--- a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/CollectionOfErrors.cs
+++ b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/CollectionOfErrors.cs
@@ -1,6 +1,7 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
+using System.Collections.Generic;
using System;
using AWS.Cryptography.MaterialProviders;
namespace AWS.Cryptography.MaterialProviders
@@ -8,9 +9,17 @@ namespace AWS.Cryptography.MaterialProviders
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
+ private static string ListAsString(List<Exception> list)
+ {
+ if (list.Count < 1) return "";
+ string[] msgArr = new string[list.Count];
+ for (int i = 0; i < list.Count; i++)
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
+ return String.Join("\n\t", msgArr);
+ }
}

}
diff --git a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/TypeConversion.cs b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/TypeConversion.cs
index d5ab49915..be1c1fae3 100644
--- a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/TypeConversion.cs
+++ b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographicMaterialProviders/TypeConversion.cs
@@ -3946,7 +3946,9 @@ namespace AWS.Cryptography.MaterialProviders
dafnyVal._ComAmazonawsDynamodb
);
case software.amazon.cryptography.materialproviders.internaldafny.types.Error_ComAmazonawsKms dafnyVal:
- return Com.Amazonaws.KMS.TypeConversion.FromDafny_CommonError(
+ // BEGIN MANUAL EDIT
+ return Com.Amazonaws.Kms.TypeConversion.FromDafny_CommonError(
+ // END MANUAL EDIT
dafnyVal._ComAmazonawsKms
);
case software.amazon.cryptography.materialproviders.internaldafny.types.Error_AwsCryptographicMaterialProvidersException dafnyVal:
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/CollectionOfErrors.cs b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/CollectionOfErrors.cs
index e752a715a..ec2d9c7c2 100644
--- a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/CollectionOfErrors.cs
+++ b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/CollectionOfErrors.cs
@@ -1,6 +1,7 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
+using System.Collections.Generic;
using System;
using AWS.Cryptography.KeyStore;
namespace AWS.Cryptography.KeyStore
@@ -8,9 +9,17 @@ namespace AWS.Cryptography.KeyStore
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
+ private static string ListAsString(List<Exception> list)
+ {
+ if (list.Count < 1) return "";
+ string[] msgArr = new string[list.Count];
+ for (int i = 0; i < list.Count; i++)
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
+ return String.Join("\n\t", msgArr);
+ }
}

}
diff --git a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/TypeConversion.cs b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/TypeConversion.cs
index b7ee7eb89..723714736 100644
--- a/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/TypeConversion.cs
+++ b/AwsCryptographicMaterialProviders/runtimes/net/Generated/AwsCryptographyKeyStore/TypeConversion.cs
@@ -736,7 +736,9 @@ namespace AWS.Cryptography.KeyStore
dafnyVal._ComAmazonawsDynamodb
);
case software.amazon.cryptography.keystore.internaldafny.types.Error_ComAmazonawsKms dafnyVal:
- return Com.Amazonaws.KMS.TypeConversion.FromDafny_CommonError(
+ // BEGIN MANUAL EDIT
+ return Com.Amazonaws.Kms.TypeConversion.FromDafny_CommonError(
+ // END MANUAL EDIT
dafnyVal._ComAmazonawsKms
);
case software.amazon.cryptography.keystore.internaldafny.types.Error_KeyStoreException dafnyVal:
@@ -761,7 +763,9 @@ namespace AWS.Cryptography.KeyStore
{
case "Com.Amazonaws.KMS":
return software.amazon.cryptography.keystore.internaldafny.types.Error.create_ComAmazonawsKms(
- Com.Amazonaws.KMS.TypeConversion.ToDafny_CommonError(value)
+ // BEGIN MANUAL EDIT
+ Com.Amazonaws.Kms.TypeConversion.ToDafny_CommonError(value)
+ // END MANUAL EDIT
);
case "Com.Amazonaws.Dynamodb":
return software.amazon.cryptography.keystore.internaldafny.types.Error.create_ComAmazonawsDynamodb(
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
using System.Collections.Generic;
using System;
using AWS.Cryptography.MaterialProviders;
namespace AWS.Cryptography.MaterialProviders
{
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
private static string ListAsString(List<Exception> list)
{
if (list.Count < 1) return "";
string[] msgArr = new string[list.Count];
for (int i = 0; i < list.Count; i++)
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
return String.Join("\n\t", msgArr);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
using System.Collections.Generic;
using System;
using AWS.Cryptography.KeyStore;
namespace AWS.Cryptography.KeyStore
{
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
private static string ListAsString(List<Exception> list)
{
if (list.Count < 1) return "";
string[] msgArr = new string[list.Count];
for (int i = 0; i < list.Count; i++)
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
return String.Join("\n\t", msgArr);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ sphinx = "^7"
sphinx_rtd_theme = "^2"

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core<2.0.0"]
build-backend = "poetry.core.masonry.api"
31 changes: 31 additions & 0 deletions AwsCryptographyPrimitives/codegen-patches/dotnet/dafny-4.8.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/AwsCryptographyPrimitives/runtimes/net/Generated/CollectionOfErrors.cs b/AwsCryptographyPrimitives/runtimes/net/Generated/CollectionOfErrors.cs
index ed41bb43b..6f4b2c03a 100644
--- a/AwsCryptographyPrimitives/runtimes/net/Generated/CollectionOfErrors.cs
+++ b/AwsCryptographyPrimitives/runtimes/net/Generated/CollectionOfErrors.cs
@@ -1,6 +1,7 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
+using System.Collections.Generic;
using System;
using AWS.Cryptography.Primitives;
namespace AWS.Cryptography.Primitives
@@ -8,9 +9,17 @@ namespace AWS.Cryptography.Primitives
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
- public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
+ public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
+ private static string ListAsString(List<Exception> list)
+ {
+ if (list.Count < 1) return "";
+ string[] msgArr = new string[list.Count];
+ for (int i = 0; i < list.Count; i++)
+ msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
+ return String.Join("\n\t", msgArr);
+ }
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
using System.Collections.Generic;
using System;
using AWS.Cryptography.Primitives;
namespace AWS.Cryptography.Primitives
{
public class CollectionOfErrors : Exception
{
public readonly System.Collections.Generic.List<Exception> list;
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message) { this.list = list; }
public CollectionOfErrors(System.Collections.Generic.List<Exception> list, string message) : base(message + $"\n List: \n{ListAsString(list)}") { this.list = list; }
public CollectionOfErrors(string message) : base(message) { this.list = new System.Collections.Generic.List<Exception>(); }
public CollectionOfErrors() : base("CollectionOfErrors") { this.list = new System.Collections.Generic.List<Exception>(); }
private static string ListAsString(List<Exception> list)
{
if (list.Count < 1) return "";
string[] msgArr = new string[list.Count];
for (int i = 0; i < list.Count; i++)
msgArr[i] = $"{list[i].GetType().Name} :: {list[i].Message}";
return String.Join("\n\t", msgArr);
}
}

}
2 changes: 1 addition & 1 deletion AwsCryptographyPrimitives/runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ twine = "5.1.1"
wheel = "0.38.4"

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core<2.0.0"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 80b6b2e

Please sign in to comment.