Skip to content

Commit

Permalink
Manually set the archive version
Browse files Browse the repository at this point in the history
  • Loading branch information
heojay committed Aug 19, 2023
1 parent 8f3b227 commit 28254a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/java-gradle-8/nixpacks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[start]
cmd = "gradle -v && java $JAVA_OPTS -jar build/libs/*.jar"
4 changes: 3 additions & 1 deletion src/providers/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct JavaProvider {}

const DEFAULT_JDK_VERSION: u32 = 17;
const DEFAULT_GRADLE_VERSION: u32 = 7;
const GRADLE_NIXPKGS_ARCHIVE: &str = "2f9286912cb215969ece465147badf6d07aa43fe";

impl Provider for JavaProvider {
fn name(&self) -> &str {
Expand All @@ -36,7 +37,8 @@ impl Provider for JavaProvider {
fn get_build_plan(&self, app: &App, env: &Environment) -> Result<Option<BuildPlan>> {
let (setup, build) = if self.is_using_gradle(app) {
let pkgs = self.get_jdk_and_gradle_pkgs(app, env)?;
let setup = Phase::setup(Some(pkgs));
let mut setup = Phase::setup(Some(pkgs));
setup.set_nix_archive(GRADLE_NIXPKGS_ARCHIVE.to_string());

let mut build = Phase::build(None);
let gradle_exe = self.get_gradle_exe(app);
Expand Down
1 change: 1 addition & 0 deletions tests/docker_run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ async fn test_dart() {
async fn test_java_gradle_8() {
let name = simple_build("./examples/java-gradle-8").await;
let output = run_image(&name, None).await;
assert!(output.contains("Gradle 8"));
assert!(output.contains("Hello from Java Gradle"));
}

Expand Down

0 comments on commit 28254a3

Please sign in to comment.