aws-amplify / aws-amplify/amplify-cli
use gradle nativeBuild instead of gradle build for java lambda function build with Graal
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
**Please describe which feature you have a question about?**
In amplify cicd in the backend section I need to use gradle nativeImage to build my lambda function. Probably gradle build is executed instead by default. Can I somehow in the amplify.yml specify that gradle nativeImage should be used?
this is my build.gradle file
plugins {
id 'org.springframework.boot' version '2.5.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'org.springframework.experimental.aot' version '0.10.2'
id 'org.graalvm.buildtools.native' version '0.9.1'
}
group = 'example'
repositories {
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
mavenCentral()
}
dependencies {
implementation('org.springframework.cloud:spring-cloud-function-adapter-aws:3.1.3')
implementation 'org.springframework.cloud:spring-cloud-starter-function-web:3.1.3'
implementation('org.springframework.boot:spring-boot-configuration-processor:2.5.3')
compileOnly("com.amazonaws:aws-lambda-java-events:3.9.0")
compileOnly("com.amazonaws:aws-lambda-java-core:1.2.1")
testImplementation('org.springframework.boot:spring-boot-starter-test:2.5.3')
}
test {
useJUnitPlatform()
}
nativeBuild {
classpath "$buildDir/resources/aot", "$buildDir/classes/java/aot"
}
task buildZip(type: Zip) {
from compileJava
from processResources
into('lib') {
from configurations.runtimeClasspath
}
archiveFileName = 'latest_build.zip'
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/native/dealstatus", "bootstrap")
}
task buildZipDist(type: Zip) {
from compileJava
from processResources
into('lib') {
from configurations.runtimeClasspath
}
archiveFileName = 'latest_build.zip'
destinationDirectory = file("/dist")
from ("$buildDir/native/dealstatus", "bootstrap")
}
build.dependsOn buildZip
build.dependsOn buildZipDist
Contributor guide
Research direction
Start with the Amplify CI/CD backend build handling and the amplify.yml configuration described in the issue, then compare how the Gradle build task invokes the nativeBuild or nativeImage flow in the supplied build.gradle. Determine whether selecting that task is supported and define completion as documented configuration or an implemented way to use the native build for the Lambda package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, ci-cd, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100