Skip to content

Commit 8481690

Browse files
Merge branch 'develop'
2 parents 96e6e3b + 1e3163d commit 8481690

File tree

147 files changed

+1829
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+1829
-155
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
- uses: actions/setup-java@v3
185185
with:
186186
distribution: 'corretto'
187-
java-version: '11'
187+
java-version: '17'
188188
- run: make init
189189
- run: pytest -vv tests/integration/workflows/java_maven
190190

@@ -213,7 +213,7 @@ jobs:
213213
- uses: actions/setup-java@v3
214214
with:
215215
distribution: 'zulu'
216-
java-version: '11'
216+
java-version: '17'
217217
- run: make init
218218
- run: pytest -vv tests/integration/workflows/java_gradle
219219

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
# Changing version will trigger a new release!
66
# Please make the version change as the last step of your development.
7-
__version__ = "1.29.0"
7+
__version__ = "1.30.0"
88
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/validator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"ruby2.7": [ARM64, X86_64],
2222
"java8": [ARM64, X86_64],
2323
"java11": [ARM64, X86_64],
24+
"java17": [ARM64, X86_64],
2425
"go1.x": [ARM64, X86_64],
2526
"dotnetcore3.1": [ARM64, X86_64],
2627
"dotnet6": [ARM64, X86_64],

tests/integration/workflows/java_gradle/test_java_gradle.py

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from pathlib import Path
77
from os.path import join
88

9+
from parameterized import parameterized_class
10+
911

1012
from aws_lambda_builders.builder import LambdaBuilder
1113
from aws_lambda_builders.exceptions import WorkflowFailedError
@@ -16,6 +18,14 @@
1618
)
1719

1820

21+
@parameterized_class(
22+
("runtime",),
23+
[
24+
["java8"],
25+
["java11"],
26+
["java17"],
27+
],
28+
)
1929
class TestJavaGradle(TestCase):
2030
# Have to use str(Path(__file__).resolve()) here to workaround a Windows VSCode issue
2131
# __file__ will return lower case drive letters. Ex: c:\folder\test.py instead of C:\folder\test.py
@@ -28,23 +38,22 @@ def setUp(self):
2838
self.scratch_dir = tempfile.mkdtemp()
2939
self.dependencies_dir = tempfile.mkdtemp()
3040
self.builder = LambdaBuilder(language="java", dependency_manager="gradle", application_framework=None)
31-
self.runtime = "java11"
3241

3342
def tearDown(self):
3443
shutil.rmtree(self.artifacts_dir)
3544
shutil.rmtree(self.scratch_dir)
3645
shutil.rmtree(self.dependencies_dir)
3746

3847
def test_build_single_build_with_deps(self):
39-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-deps")
48+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
4049
manifest_path = join(source_dir, "build.gradle")
4150
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
42-
expected_files = [join("aws", "lambdabuilders", "Main.class"), join("lib", "annotations-2.1.0.jar")]
4351

52+
expected_files = [join("aws", "lambdabuilders", "Main.class"), join("lib", "annotations-2.1.0.jar")]
4453
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, expected_files))
4554

4655
def test_build_single_build_with_resources(self):
47-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-resources")
56+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-resources")
4857
manifest_path = join(source_dir, "build.gradle")
4958
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
5059
expected_files = [
@@ -56,7 +65,7 @@ def test_build_single_build_with_resources(self):
5665
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, expected_files))
5766

5867
def test_build_single_build_with_test_deps_test_jars_not_included(self):
59-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-test-deps")
68+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-test-deps")
6069
manifest_path = join(source_dir, "build.gradle")
6170
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
6271
expected_files = [join("aws", "lambdabuilders", "Main.class"), join("lib", "annotations-2.1.0.jar")]
@@ -65,7 +74,7 @@ def test_build_single_build_with_test_deps_test_jars_not_included(self):
6574
self.assertFalse(does_folder_contain_file(self.artifacts_dir, join("lib", "s3-2.1.0.jar")))
6675

6776
def test_build_single_build_with_deps_gradlew(self):
68-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-deps-gradlew")
77+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
6978
manifest_path = join(source_dir, "build.gradle")
7079
self.builder.build(
7180
source_dir,
@@ -80,10 +89,11 @@ def test_build_single_build_with_deps_gradlew(self):
8089
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, expected_files))
8190

8291
def test_build_multi_build_with_deps_lambda1(self):
83-
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, "with-deps")
92+
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
8493
manifest_path = join(parent_dir, "lambda1", "build.gradle")
8594

8695
lambda1_source = join(parent_dir, "lambda1")
96+
8797
self.builder.build(lambda1_source, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
8898

8999
lambda1_expected_files = [
@@ -93,7 +103,7 @@ def test_build_multi_build_with_deps_lambda1(self):
93103
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, lambda1_expected_files))
94104

95105
def test_build_multi_build_with_deps_lambda2(self):
96-
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, "with-deps")
106+
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
97107
manifest_path = join(parent_dir, "lambda2", "build.gradle")
98108

99109
lambda2_source = join(parent_dir, "lambda2")
@@ -106,10 +116,11 @@ def test_build_multi_build_with_deps_lambda2(self):
106116
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, lambda2_expected_files))
107117

108118
def test_build_multi_build_with_deps_inter_module(self):
109-
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, "with-deps-inter-module")
119+
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, self.runtime, "with-deps-inter-module")
110120
manifest_path = join(parent_dir, "lambda1", "build.gradle")
111121

112122
lambda1_source = join(parent_dir, "lambda1")
123+
113124
self.builder.build(lambda1_source, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
114125

115126
lambda1_expected_files = [
@@ -120,14 +131,14 @@ def test_build_multi_build_with_deps_inter_module(self):
120131
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, lambda1_expected_files))
121132

122133
def test_build_single_build_with_deps_broken(self):
123-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-deps-broken")
134+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-deps-broken")
124135
manifest_path = join(source_dir, "build.gradle")
125136
with self.assertRaises(WorkflowFailedError) as raised:
126137
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, manifest_path, runtime=self.runtime)
127138
self.assertTrue(raised.exception.args[0].startswith("JavaGradleWorkflow:GradleBuild - Gradle Failed"))
128139

129140
def test_build_single_build_with_deps_dir(self):
130-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-deps")
141+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
131142
manifest_path = join(source_dir, "build.gradle")
132143
self.builder.build(
133144
source_dir,
@@ -137,16 +148,18 @@ def test_build_single_build_with_deps_dir(self):
137148
runtime=self.runtime,
138149
dependencies_dir=self.dependencies_dir,
139150
)
140-
artifact_expected_files = [join("aws", "lambdabuilders", "Main.class"), join("lib", "annotations-2.1.0.jar")]
151+
artifact_expected_files = [
152+
join("aws", "lambdabuilders", "Main.class"),
153+
join("lib", "annotations-2.1.0.jar"),
154+
]
141155
dependencies_expected_files = [join("lib", "annotations-2.1.0.jar")]
142156

143157
self.assertTrue(does_folder_contain_all_files(self.artifacts_dir, artifact_expected_files))
144158
self.assertTrue(does_folder_contain_all_files(self.dependencies_dir, dependencies_expected_files))
145159

146160
def test_build_multi_build_with_deps_dir_inter_module(self):
147-
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, "with-deps-inter-module")
161+
parent_dir = join(self.MULTI_BUILD_TEST_DATA_DIR, self.runtime, "with-deps-inter-module")
148162
manifest_path = join(parent_dir, "lambda1", "build.gradle")
149-
150163
lambda1_source = join(parent_dir, "lambda1")
151164
self.builder.build(
152165
lambda1_source,
@@ -170,7 +183,7 @@ def test_build_multi_build_with_deps_dir_inter_module(self):
170183
self.assertTrue(does_folder_contain_all_files(self.dependencies_dir, dependencies_expected_files))
171184

172185
def test_build_single_build_with_deps_dir_wtihout_combine_dependencies(self):
173-
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-deps")
186+
source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-deps")
174187
manifest_path = join(source_dir, "build.gradle")
175188
self.builder.build(
176189
source_dir,
@@ -194,7 +207,7 @@ def test_build_with_layers_and_scope(self):
194207
self.validate_function_build()
195208

196209
def validate_layer_build(self):
197-
layer_source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "layer")
210+
layer_source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "layer")
198211
layer_manifest_path = join(layer_source_dir, "build.gradle")
199212
self.builder.build(
200213
layer_source_dir,
@@ -212,7 +225,7 @@ def validate_layer_build(self):
212225

213226
def validate_function_build(self):
214227
self.setUp() # re-initialize folders
215-
function_source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, "with-layer-deps")
228+
function_source_dir = join(self.SINGLE_BUILD_TEST_DATA_DIR, self.runtime, "with-layer-deps")
216229
function_manifest_path = join(function_source_dir, "build.gradle")
217230
self.builder.build(
218231
function_source_dir,

tests/integration/workflows/java_gradle/testdata/multi-build/with-deps-inter-module/lambda2/build.gradle renamed to tests/integration/workflows/java_gradle/testdata/multi-build/java11/with-deps-inter-module/common/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ repositories {
99
dependencies {
1010
implementation 'software.amazon.awssdk:annotations:2.1.0'
1111
}
12+
13+
java.sourceCompatibility = JavaVersion.VERSION_11
14+
java.targetCompatibility = JavaVersion.VERSION_11

tests/integration/workflows/java_gradle/testdata/multi-build/with-deps-inter-module/lambda1/build.gradle renamed to tests/integration/workflows/java_gradle/testdata/multi-build/java11/with-deps-inter-module/lambda1/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ dependencies {
1010
implementation 'software.amazon.awssdk:annotations:2.1.0'
1111
implementation project(':common')
1212
}
13+
14+
java.sourceCompatibility = JavaVersion.VERSION_11
15+
java.targetCompatibility = JavaVersion.VERSION_11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
implementation 'software.amazon.awssdk:annotations:2.1.0'
11+
implementation project(':common')
12+
}
13+
14+
java.sourceCompatibility = JavaVersion.VERSION_11
15+
java.targetCompatibility = JavaVersion.VERSION_11

0 commit comments

Comments
 (0)