|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require_relative 'spec_helper' |
| 4 | + |
| 5 | +describe 'Scala buildpack' do |
| 6 | + it 'caches compiled artifacts between builds' do |
| 7 | + new_default_hatchet_runner('sbt-0.11.7-play-3.x-scala-2.13.x').tap do |app| |
| 8 | + app.deploy do |
| 9 | + # First build should compile everything from scratch |
| 10 | + expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE)) |
| 11 | + remote: -----> Scala app detected |
| 12 | + remote: -----> Installing Azul Zulu OpenJDK 21.0.[0-9]+ |
| 13 | + remote: -----> Running: sbt compile stage |
| 14 | + remote: Downloading sbt launcher for 1.11.7: |
| 15 | + remote: From https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.11.7/sbt-launch-1.11.7.jar |
| 16 | + remote: To /tmp/scala_buildpack_build_dir/.sbt_home/launchers/1.11.7/sbt-launch.jar |
| 17 | + remote: Downloading sbt launcher 1.11.7 md5 hash: |
| 18 | + remote: From https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.11.7/sbt-launch-1.11.7.jar.md5 |
| 19 | + remote: To /tmp/scala_buildpack_build_dir/.sbt_home/launchers/1.11.7/sbt-launch.jar.md5 |
| 20 | + remote: /tmp/scala_buildpack_build_dir/.sbt_home/launchers/1.11.7/sbt-launch.jar: OK |
| 21 | + remote: \\[info\\] \\[launcher\\] getting org.scala-sbt sbt 1.11.7 \\(this may take some time\\)... |
| 22 | + remote: \\[info\\] \\[launcher\\] getting Scala 2.12.20 \\(for sbt\\)... |
| 23 | + remote: \\[info\\] welcome to sbt 1.11.7 \\(Azul Systems, Inc. Java 21.0.[0-9]+\\) |
| 24 | + remote: \\[info\\] loading global plugins from /tmp/scala_buildpack_build_dir/.sbt_home/plugins |
| 25 | + remote: \\[info\\] compiling 1 Scala source to /tmp/scala_buildpack_build_dir/.sbt_home/plugins/target/scala-2.12/sbt-1.0/classes ... |
| 26 | + remote: \\[info\\] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.20. Compiling... |
| 27 | + remote: \\[info\\] Compilation completed in .*s. |
| 28 | + remote: \\[info\\] done compiling |
| 29 | + remote: \\[info\\] loading settings for project scala_buildpack_build_dir-build from plugins.sbt... |
| 30 | + remote: \\[info\\] loading project definition from /tmp/scala_buildpack_build_dir/project |
| 31 | + remote: \\[info\\] loading settings for project root from build.sbt... |
| 32 | + remote: \\[info\\] __ __ |
| 33 | + remote: \\[info\\] \\\\ \\\\ ____ / /____ _ __ __ |
| 34 | + remote: \\[info\\] \\\\ \\\\ / __ \\\\ / // __ `// / / / |
| 35 | + remote: \\[info\\] / / / /_/ // // /_/ // /_/ / |
| 36 | + remote: \\[info\\] /_/ / .___//_/ \\\\__,_/ \\\\__, / |
| 37 | + remote: \\[info\\] /_/ /____/ |
| 38 | + remote: \\[info\\] |
| 39 | + remote: \\[info\\] Version 3.0.9 running Java 21.0.[0-9]+ |
| 40 | + remote: \\[info\\] |
| 41 | + remote: \\[info\\] Play is run entirely by the community. Please consider contributing and/or donating: |
| 42 | + remote: \\[info\\] https://www.playframework.com/sponsors |
| 43 | + remote: \\[info\\] |
| 44 | + remote: \\[info\\] Executing in batch mode. For better performance use sbt's shell |
| 45 | + remote: \\[info\\] compiling 7 Scala sources and 1 Java source to /tmp/scala_buildpack_build_dir/target/scala-2.13/classes ... |
| 46 | + remote: \\[info\\] done compiling |
| 47 | + remote: \\[success\\] Total time: .* s, completed .* |
| 48 | + remote: \\[info\\] Wrote /tmp/scala_buildpack_build_dir/target/scala-2.13/sbt-0-11-7-play-3-x-scala-2-13-x_2.13-1.0-SNAPSHOT.pom |
| 49 | + remote: \\[success\\] Total time: .* |
| 50 | + remote: -----> Collecting dependency information |
| 51 | + remote: -----> Dropping ivy cache from the slug |
| 52 | + remote: -----> Dropping sbt boot dir from the slug |
| 53 | + remote: -----> Dropping sbt cache dir from the slug |
| 54 | + remote: -----> Dropping compilation artifacts from the slug |
| 55 | + remote: -----> Discovering process types |
| 56 | + remote: Procfile declares types -> \\(none\\) |
| 57 | + remote: Default types for buildpack -> web |
| 58 | + remote: |
| 59 | + remote: -----> Compressing... |
| 60 | + REGEX |
| 61 | + |
| 62 | + app.commit! |
| 63 | + app.push! |
| 64 | + |
| 65 | + # Second build should use cached artifacts and doesn't recompile previously compiled application files |
| 66 | + expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE)) |
| 67 | + remote: -----> Scala app detected |
| 68 | + remote: -----> Installing Azul Zulu OpenJDK 21.0.[0-9]+ |
| 69 | + remote: -----> Running: sbt compile stage |
| 70 | + remote: \\[info\\] welcome to sbt 1.11.7 \\(Azul Systems, Inc. Java 21.0.[0-9]+\\) |
| 71 | + remote: \\[info\\] loading global plugins from /tmp/scala_buildpack_build_dir/.sbt_home/plugins |
| 72 | + remote: \\[info\\] loading settings for project scala_buildpack_build_dir-build from plugins.sbt... |
| 73 | + remote: \\[info\\] loading project definition from /tmp/scala_buildpack_build_dir/project |
| 74 | + remote: \\[info\\] loading settings for project root from build.sbt... |
| 75 | + remote: \\[info\\] __ __ |
| 76 | + remote: \\[info\\] \\\\ \\\\ ____ / /____ _ __ __ |
| 77 | + remote: \\[info\\] \\\\ \\\\ / __ \\\\ / // __ `// / / / |
| 78 | + remote: \\[info\\] / / / /_/ // // /_/ // /_/ / |
| 79 | + remote: \\[info\\] /_/ / .___//_/ \\\\__,_/ \\\\__, / |
| 80 | + remote: \\[info\\] /_/ /____/ |
| 81 | + remote: \\[info\\] |
| 82 | + remote: \\[info\\] Version 3.0.9 running Java 21.0.[0-9]+ |
| 83 | + remote: \\[info\\] |
| 84 | + remote: \\[info\\] Play is run entirely by the community. Please consider contributing and/or donating: |
| 85 | + remote: \\[info\\] https://www.playframework.com/sponsors |
| 86 | + remote: \\[info\\] |
| 87 | + remote: \\[info\\] Executing in batch mode. For better performance use sbt's shell |
| 88 | + remote: \\[success\\] Total time: .* s, completed .* |
| 89 | + remote: \\[info\\] Wrote /tmp/scala_buildpack_build_dir/target/scala-2.13/sbt-0-11-7-play-3-x-scala-2-13-x_2.13-1.0-SNAPSHOT.pom |
| 90 | + remote: \\[success\\] Total time: .* |
| 91 | + remote: -----> Collecting dependency information |
| 92 | + remote: -----> Dropping ivy cache from the slug |
| 93 | + remote: -----> Dropping sbt boot dir from the slug |
| 94 | + remote: -----> Dropping sbt cache dir from the slug |
| 95 | + remote: -----> Dropping compilation artifacts from the slug |
| 96 | + remote: -----> Discovering process types |
| 97 | + remote: Procfile declares types -> \\(none\\) |
| 98 | + remote: Default types for buildpack -> web |
| 99 | + remote: |
| 100 | + remote: -----> Compressing... |
| 101 | + REGEX |
| 102 | + end |
| 103 | + end |
| 104 | + end |
| 105 | +end |
0 commit comments