JavaGradleWorkflow includes extraneous files if other archive artifacts are defined
Maintainer thường phản hồi trong vòng 10 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu với aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle, đặc biệt là phần lựa chọn artifact của archive và các bước GradleBuild và CopyArtifacts của JavaGradleWorkflow. Tái hiện bằng các lệnh sam init, application-plugin edit, sam build và find đã được ghi trong tài liệu. Hoàn tất có nghĩa là build bao gồm các class của ứng dụng và các JAR dependency mà không có thư mục phân phối ứng dụng không cần thiết cùng các tệp của nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description:
In certain Gradle projects, running sam build may include files in the bundle that aren't needed.
This occurs because the logic for grabbing the project's jar is actually pulling the contents of all defined archive artifacts, some of which may be for other purposes entirely. In most cases, this doesn't "break" anything, but just increases the size of the deployment bundle silently.
One example of a situation that would cause this is a Java project with the built-in "application" plugin applied, which then produces additional zip and tar distribution artifacts.
One potential fix would be to change https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle#L27 from def artifactJars = t.project.configurations.archives.artifacts.files.files to def artifactJars = configurations.archives.artifacts.findAll { it.extension == 'jar' }*.file.
Steps to reproduce the issue:
- Run
sam init --runtime java8 --dependency-manager gradle --name gradlebuildtest - Run
cd gradlebuildtest/ - Run
sam build && find .aws-sam/build/HelloWorldFunction -type f(Expected result) - Remove the previous result:
rm -rf .aws-sam/ - Edit
HelloWorldFunction/build.gradleas follows- Add
id 'application'to thepluginsblock - Add
mainClassName = 'helloworld.App'(it's not actually executable yet, but that doesn't matter for demonstrating this behavior)
- Add
- Run
sam build && find .aws-sam/build/HelloWorldFunction -type f(Observed result) - Note that there is now an unnecessary
HelloWorldFunctiondirectory included.
Observed result:
mac-dcarr:gradlebuildtest dcarr$ sam build && find .aws-sam/build/HelloWorldFunction -type f
Building resource 'HelloWorldFunction'
Running JavaGradleWorkflow:GradleBuild
Running JavaGradleWorkflow:CopyArtifacts
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Package: sam package --s3-bucket <yourbucket>
.aws-sam/build/HelloWorldFunction/helloworld/GatewayResponse.class
.aws-sam/build/HelloWorldFunction/helloworld/App.class
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/bin/HelloWorldFunction
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/bin/HelloWorldFunction.bat
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/lib/HelloWorldFunction.jar
.aws-sam/build/HelloWorldFunction/META-INF/MANIFEST.MF
.aws-sam/build/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
mac-dcarr:gradlebuildtest dcarr$
Expected result:
mac-dcarr:gradlebuildtest dcarr$ sam build && find .aws-sam/build/HelloWorldFunction -type f
Building resource 'HelloWorldFunction'
Running JavaGradleWorkflow:GradleBuild
Running JavaGradleWorkflow:CopyArtifacts
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Package: sam package --s3-bucket <yourbucket>
.aws-sam/build/HelloWorldFunction/helloworld/GatewayResponse.class
.aws-sam/build/HelloWorldFunction/helloworld/App.class
.aws-sam/build/HelloWorldFunction/META-INF/MANIFEST.MF
.aws-sam/build/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
mac-dcarr:gradlebuildtest dcarr$
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Scripts were run on Mac OS X 10.14.6; SAM CLI, version 0.23.0.
- Ngôn ngữ chính
- Python
- Star
- 381
- Fork
- 161
- Merge trung bình
- 9 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-lambda-builders
-
python_uv: `UvConfig.compile_bytecode` is never passed to uv, so the option has no effectCó thể đã có người làm @xujiantop-crypto đã nhận 30 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws/aws-lambda-builders#925 · 1 reaction ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Bytecode compiled during build is always discarded at runtime: SAM packaging writes 1980 timestamps, so timestamp-based .pyc never validateCó thể đã có người làm @xujiantop-crypto đã nhận 30 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
aws/aws-lambda-builders#924 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspaceCó thể đã có người làm @noritada đã nhận 99 ngày trước. Đang mởstage/needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
aws/aws-lambda-builders#892 ·
Maintainer thường phản hồi trong vòng 10 ngày
-
stage/needs-triage type/feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
aws/aws-lambda-builders#839 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Feature request: Skip binary validation when builder is not used for any languageCó thể làm lại được @saketh-bandi đã nhận 43 ngày trước và không có pull request nào đang mở. Đang mởarea/build contributors/good-first-issue contributors/welcome type/feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
aws/aws-lambda-builders#831 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
Tất cả issue của aws/aws-lambda-builders
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine-us#10262 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kellyjonbrazil/jc#788 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`/search.json` ignores the documented `editions.sort` parameterCó thể đã có người làm @PranavD2905 đã nhận hôm nay. Đang mởAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
internetarchive/openlibrary#13989 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P2: misleading query
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jeffknupp/association#478 ·