|  | 
| 3 | 3 | require_relative 'spec_helper' | 
| 4 | 4 | 
 | 
| 5 | 5 | describe 'Scala buildpack' do | 
| 6 |  | -  it 'caches compiled artifacts between builds' do | 
|  | 6 | +  it 'caches compiled artifacts between builds (Play 3.x)' do | 
| 7 | 7 |     new_default_hatchet_runner('sbt-0.11.7-play-3.x-scala-2.13.x').tap do |app| | 
| 8 | 8 |       app.deploy do | 
| 9 | 9 |         # First build should compile everything from scratch | 
|  | 
| 35 | 35 |           remote:        \\[info\\]    / /  / /_/ // // /_/ // /_/ / | 
| 36 | 36 |           remote:        \\[info\\]   /_/  / .___//_/ \\\\__,_/ \\\\__, / | 
| 37 | 37 |           remote:        \\[info\\]       /_/               /____/ | 
| 38 |  | -          remote:        \\[info\\]  | 
|  | 38 | +          remote:        \\[info\\] | 
| 39 | 39 |           remote:        \\[info\\] Version 3.0.9 running Java 21.0.[0-9]+ | 
| 40 |  | -          remote:        \\[info\\]  | 
|  | 40 | +          remote:        \\[info\\] | 
| 41 | 41 |           remote:        \\[info\\] Play is run entirely by the community. Please consider contributing and/or donating: | 
| 42 | 42 |           remote:        \\[info\\] https://www.playframework.com/sponsors | 
| 43 |  | -          remote:        \\[info\\]  | 
|  | 43 | +          remote:        \\[info\\] | 
| 44 | 44 |           remote:        \\[info\\] Executing in batch mode. For better performance use sbt's shell | 
| 45 | 45 |           remote:        \\[info\\] compiling 7 Scala sources and 1 Java source to /tmp/scala_buildpack_build_dir/target/scala-2.13/classes ... | 
| 46 | 46 |           remote:        \\[info\\] done compiling | 
|  | 
| 55 | 55 |           remote: -----> Discovering process types | 
| 56 | 56 |           remote:        Procfile declares types     -> \\(none\\) | 
| 57 | 57 |           remote:        Default types for buildpack -> web | 
| 58 |  | -          remote:  | 
|  | 58 | +          remote: | 
| 59 | 59 |           remote: -----> Compressing... | 
| 60 | 60 |         REGEX | 
| 61 | 61 | 
 | 
|  | 
| 78 | 78 |           remote:        \\[info\\]    / /  / /_/ // // /_/ // /_/ / | 
| 79 | 79 |           remote:        \\[info\\]   /_/  / .___//_/ \\\\__,_/ \\\\__, / | 
| 80 | 80 |           remote:        \\[info\\]       /_/               /____/ | 
| 81 |  | -          remote:        \\[info\\]  | 
|  | 81 | +          remote:        \\[info\\] | 
| 82 | 82 |           remote:        \\[info\\] Version 3.0.9 running Java 21.0.[0-9]+ | 
| 83 |  | -          remote:        \\[info\\]  | 
|  | 83 | +          remote:        \\[info\\] | 
| 84 | 84 |           remote:        \\[info\\] Play is run entirely by the community. Please consider contributing and/or donating: | 
| 85 | 85 |           remote:        \\[info\\] https://www.playframework.com/sponsors | 
| 86 |  | -          remote:        \\[info\\]  | 
|  | 86 | +          remote:        \\[info\\] | 
| 87 | 87 |           remote:        \\[info\\] Executing in batch mode. For better performance use sbt's shell | 
| 88 | 88 |           remote:        \\[success\\] Total time: .* s, completed .* | 
| 89 | 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 | 
|  | 
| 96 | 96 |           remote: -----> Discovering process types | 
| 97 | 97 |           remote:        Procfile declares types     -> \\(none\\) | 
| 98 | 98 |           remote:        Default types for buildpack -> web | 
| 99 |  | -          remote:  | 
|  | 99 | +          remote: | 
| 100 | 100 |           remote: -----> Compressing... | 
| 101 | 101 |         REGEX | 
| 102 | 102 |       end | 
| 103 | 103 |     end | 
| 104 | 104 |   end | 
|  | 105 | + | 
|  | 106 | +  it 'caches compiled artifacts between builds (Play 2.4.x)' do | 
|  | 107 | +    new_default_hatchet_runner('play-2.4.x-scala').tap do |app| | 
|  | 108 | +      app.deploy do | 
|  | 109 | +        # First build should compile everything from scratch | 
|  | 110 | +        expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE)) | 
|  | 111 | +          remote: -----> Scala app detected | 
|  | 112 | +          remote: -----> Installing Azul Zulu OpenJDK 1.8.0_[0-9]+ | 
|  | 113 | +          remote: | 
|  | 114 | +          remote:  !     Warning: Unsupported sbt version detected. | 
|  | 115 | +          remote:  ! | 
|  | 116 | +          remote:  !     This buildpack does not officially support sbt 0.13.9. You are using | 
|  | 117 | +          remote:  !     an end-of-life version that no longer receives security updates or bug fixes. | 
|  | 118 | +          remote:  !     Support for sbt 0.x was ended by the upstream sbt project on November 30, 2018. | 
|  | 119 | +          remote:  ! | 
|  | 120 | +          remote:  !     Please upgrade to sbt 1.x for active support. | 
|  | 121 | +          remote:  ! | 
|  | 122 | +          remote:  !     The buildpack will attempt to build your application, but compatibility | 
|  | 123 | +          remote:  !     is not guaranteed and may break at any time. | 
|  | 124 | +          remote:  ! | 
|  | 125 | +          remote:  !     For more information: | 
|  | 126 | +          remote:  !     - https://web.archive.org/web/20210918065807/https://www.lightbend.com/blog/scala-sbt-127-patchnotes | 
|  | 127 | +          remote:  ! | 
|  | 128 | +          remote:  !     Upgrade guide: | 
|  | 129 | +          remote:  !     - https://www.scala-sbt.org/1.x/docs/Migrating-from-sbt-013x.html | 
|  | 130 | +          remote: | 
|  | 131 | +          remote: -----> Running: sbt compile stage | 
|  | 132 | +          remote: Downloading sbt launcher for 0.13.9: | 
|  | 133 | +          remote:   From  https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/0.13.9/sbt-launch-0.13.9.jar | 
|  | 134 | +          remote:     To  /tmp/[^/]+/.sbt_home/launchers/0.13.9/sbt-launch.jar | 
|  | 135 | +          remote: Downloading sbt launcher 0.13.9 md5 hash: | 
|  | 136 | +          remote:   From  https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/0.13.9/sbt-launch-0.13.9.jar.md5 | 
|  | 137 | +          remote:     To  /tmp/[^/]+/.sbt_home/launchers/0.13.9/sbt-launch.jar.md5 | 
|  | 138 | +          remote:        /tmp/[^/]+/.sbt_home/launchers/0.13.9/sbt-launch.jar: OK | 
|  | 139 | +          remote:        \\[info\\] Loading global plugins from /tmp/[^/]+/.sbt_home/plugins | 
|  | 140 | +          remote:        \\[info\\] Compiling 1 Scala source to /tmp/[^/]+/.sbt_home/plugins/target/scala-2.10/sbt-0.13/classes... | 
|  | 141 | +          remote:        \\[info\\] Updating \\{file:/tmp/[^/]+/.sbt_home/plugins/\\}plugins... | 
|  | 142 | +          remote:        \\[info\\] Resolving .* \\.\\.\\. | 
|  | 143 | +          remote:        \\[info\\] Done updating. | 
|  | 144 | +          remote:        \\[info\\] Set current project to play-2.4.x-scala \\(in build file:/tmp/[^/]+/\\) | 
|  | 145 | +          remote:        \\[info\\] Updating \\{file:/tmp/[^/]+/\\}root... | 
|  | 146 | +          remote:        \\[info\\] Resolving .* \\.\\.\\. | 
|  | 147 | +          remote:        \\[info\\] Done updating. | 
|  | 148 | +          remote:        \\[info\\] Compiling [0-9]+ Scala sources? and [0-9]+ Java sources? to /tmp/[^/]+/target/scala-2.11/classes... | 
|  | 149 | +          remote:        \\[success\\] Total time: .* | 
|  | 150 | +          remote:        \\[info\\] Packaging /tmp/[^/]+/target/scala-2.11/play-[^/]+_2.11-1.0-SNAPSHOT.jar ... | 
|  | 151 | +          remote:        \\[info\\] Done packaging. | 
|  | 152 | +          remote:        \\[success\\] Total time: .* | 
|  | 153 | +        REGEX | 
|  | 154 | + | 
|  | 155 | +        app.commit! | 
|  | 156 | +        app.push! | 
|  | 157 | + | 
|  | 158 | +        # Second build should use cached artifacts and doesn't recompile previously compiled application files | 
|  | 159 | +        expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX, Regexp::MULTILINE)) | 
|  | 160 | +          remote: -----> Scala app detected | 
|  | 161 | +          remote: -----> Installing Azul Zulu OpenJDK 1.8.0_[0-9]+ | 
|  | 162 | +          remote: -----> Running: sbt compile stage | 
|  | 163 | +          remote:        \\[info\\] Loading global plugins from /tmp/[^/]+/.sbt_home/plugins | 
|  | 164 | +          remote:        \\[info\\] Set current project to play-2.4.x-scala \\(in build file:/tmp/[^/]+/\\) | 
|  | 165 | +          remote:        \\[info\\] Updating \\{file:/tmp/[^/]+/\\}root... | 
|  | 166 | +          remote:        \\[info\\] Resolving .* \\.\\.\\. | 
|  | 167 | +          remote:        \\[info\\] Done updating. | 
|  | 168 | +          remote:        \\[success\\] Total time: .* | 
|  | 169 | +          remote:        \\[info\\] Packaging /tmp/[^/]+/target/scala-2.11/play-[^/]+_2.11-1.0-SNAPSHOT.jar ... | 
|  | 170 | +          remote:        \\[info\\] Done packaging. | 
|  | 171 | +          remote:        \\[success\\] Total time: .* | 
|  | 172 | +        REGEX | 
|  | 173 | +      end | 
|  | 174 | +    end | 
|  | 175 | +  end | 
| 105 | 176 | end | 
0 commit comments