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
4 changes: 2 additions & 2 deletions aws_lambda_builders/workflows/java_gradle/gradle.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def __init__(self, gradle_binary, os_utils=None):
self.os_utils = os_utils

def build(self, source_dir, build_file, cache_dir=None, init_script_path=None, properties=None):
## Note: build_file parameter is not supported anymore, but kept for backward compatibility
if not self.os_utils.exists(build_file):
raise BuildFileNotFoundError(build_file)

args = ["build", "--build-file", build_file]
args = ["build"]
if cache_dir is not None:
args.extend(["--project-cache-dir", cache_dir])
if properties is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def assertExpectedBuildDir(p) {
}

def createArtifactDir(project) {
def distsDir = project.buildDir.toPath().resolve(project.distsDirName).resolve('lambda-build')
// In Gradle 9, distsDirName was removed. Use 'distributions' as the default directory name
def distsDir = project.buildDir.toPath().resolve('distributions').resolve('lambda-build')
return makeDirs(distsDir)
}

Expand Down
8 changes: 3 additions & 5 deletions tests/unit/workflows/java_gradle/test_gradle.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_build_no_init_script(self):
gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
gradle.build(self.source_dir, self.manifest_path)
self.os_utils.popen.assert_called_with(
[self.gradle_path, "build", "--build-file", self.manifest_path],
[self.gradle_path, "build"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have test that actually runs gradle, rather than the mock?

Copy link
Member

@roger-zhangg roger-zhangg Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the highest gradle version we are testing is gradle 8.4. Did we tested with 9.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this in a new PR: #769

cwd=self.source_dir,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand All @@ -70,7 +70,7 @@ def test_gradlew_path_is_dummy_uses_gradle_binary(self):
gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
gradle.build(self.source_dir, self.manifest_path)
self.os_utils.popen.assert_called_with(
[self.gradle_path, "build", "--build-file", self.manifest_path],
[self.gradle_path, "build"],
cwd=self.source_dir,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand All @@ -80,7 +80,7 @@ def test_build_with_init_script(self):
gradle = SubprocessGradle(gradle_binary=self.gradle_binary, os_utils=self.os_utils)
gradle.build(self.source_dir, self.manifest_path, init_script_path=self.init_script)
self.os_utils.popen.assert_called_with(
[self.gradle_path, "build", "--build-file", self.manifest_path, "--init-script", self.init_script],
[self.gradle_path, "build", "--init-script", self.init_script],
cwd=self.source_dir,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand All @@ -101,8 +101,6 @@ def test_includes_build_properties_in_command(self):
[
self.gradle_path,
"build",
"--build-file",
self.manifest_path,
"-Dfoo=bar",
"--init-script",
self.init_script,
Expand Down
Loading