bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Outdated compilation when src dir is removed and added back

Open odisseus opened this issue 5 years ago • 2 comments

Environment details

$ bloop about
bloop v1.4.3

Using Scala v2.12.8 and Zinc v1.3.0-M4+45-d4354be3
Running on Java JDK v11.0.6 (~/.sdkman/candidates/java/11.0.6.hs-adpt)
  -> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center (Jorge Vicente Cantero, Martin Duhem)

Steps to reproduce

Download the example project

ipfs get --output bloop-bug-example QmaRTWDyJp3GeiAQQdLrjSXcE99sn4GVMAJ2QEgDQVXKBv

or:

curl --silent --output bloop-bug-example.tar.gz 'https://gateway.pinata.cloud/api/v0/get?arg=QmaRTWDyJp3GeiAQQdLrjSXcE99sn4GVMAJ2QEgDQVXKBv&archive=true&compress=true'
mkdir bloop-bug-example
tar -xvf bloop-bug-example.tar.gz -C bloop-bug-example --strip-components=1

Compile and run for the first time

cd bloop-bug-example
bloop run -p hello-world_app

Expected output: 14

Exclude one of the source directories

vim .bloop/hello-world_app.json

Find the source entry called "/tmp/fury-testing/src2", and remove it from the configuration file.

Compile and run for the second time

bloop run -p hello-world_app

The code will still compile, but the application will behave differently.

Expected output: 5

Bring back the source directory that was excluded:

vim .bloop/hello-world_app.json

Edit the configuration file again to restore the source entry that was removed previously.

Compile and run for the third time

bloop run -p hello-world_app

Since the project configuration is now the same as it was during the first run, the output should also be the same, shouldn't it?

Expected output: 14 Actual output: 5

Clean and recompile

The problem disappears if the project is cleaned:

bloop clean -p hello-world_app
bloop run -p hello-world_app

Expected output: 14

odisseus avatar Jul 21 '20 05:07 odisseus

@odisseus It looks like your reproduction has a few absolute paths to JAR files in it, notably the Scala compiler JARs. I'm not sure the best way to make this repeatable, given that they will be in different locations for every user. Is there any sort of Bloop docker build we could extend?

propensive avatar Jul 21 '20 07:07 propensive

Thank you for spotting this omission! I have created a Docker file with the example project and the complete environment needed to test it: https://gist.github.com/odisseus/e849e1800b79abee7c5bd69229ad0cfd

Build and run the image:

docker build --tag "bloop-1347" .
docker run -i -t bloop-1347 /bin/bash

Inside the container:

bloop run -p hello-world_app
ls .bloop

odisseus avatar Jul 22 '20 01:07 odisseus