rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
11.04k stars 545 forks source link

Unable to compile due to toStream #410

Closed AcidCrash1337 closed 3 years ago

AcidCrash1337 commented 3 years ago

First I attempted to build the master repo. When I found it would not compile, I attempted to build the latest tag. Both attempts failed in the same way. Using: Ubuntu, Java 11, using sbt from sbt's ubuntu repo (as documented on their Setup page)

Steps to reproduce:

git clone https://github.com/rtyley/bfg-repo-cleaner
cd bfg-repo-cleaner
git checkout v1.13.0
sbt
bfg/assembly

Output:

[error] /home/user/bfg-repo-cleaner/bfg-library/src/main/scala/com/madgag/git/bfg/model/Commit.scala:69:36: value toStream is not a member of java.util.stream.Stream[String]
[error]   lazy val subject = message.lines.toStream.headOption
[error]                                    ^
[error] /home/user/bfg-repo-cleaner/bfg-library/src/main/scala/com/madgag/git/bfg/model/Commit.scala:72:83: missing parameter type for expanded function
[error] The argument types of an anonymous function must be fully known. (SLS 8.5)
[error] Expected type was: java.util.stream.Collector[? >: String, ?, ?]
[error]   lazy val footers: List[Footer] = message.drop(lastParagraphBreak).lines.collect {
[error]                                                                                   ^
[error] two errors found
[error] (bfg-library/compile:compileIncremental) Compilation failed
[error] Total time: 9 s, completed Nov 11, 2020, 12:50:16 PM
jmatias commented 3 years ago

Use JDK 8. It does not work with 11 or higher.

AcidCrash1337 commented 3 years ago

Danke! I was able to compile the tagged version with JDK 8 and it compiled with one failed test case (com.madgag.git.bfg.cli.MassiveNonFileObjectsRequiresOwnJvmSpec). As this ticket was not about test cases passing, but rather just about compilation being functional, I am closing this ticket. I'm also submitting a pull request to update the build instructions to indicate that JDK 8 is required (it currently says "JDK 8 or above").

AcidCrash1337 commented 3 years ago

Attempting to compile on the master branch failed. Something in the process compilation was killed for using too much memory. This may have been the reason for the test case failure in the tagged version.

The machine I was using did not have any GUI and so I only gave it 512MB of RAM. I'm not sure what the minimum requirements are for compiling this package. It'd be interesting to figure this out, but since I've worked around my original problem a few weeks ago, I'm not feeling especially motivated to create a series of VMs to do so. In case anyone wants to try to debug this further to determine what is taking up so much memory, or how the requirements can be reduced, here's the relevant output from my attempt at compiling master as of commit b4fe952dc5d480b3ceb52fef81c10cc1701e73de:

[warn] either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key
[info] sbt server started at local:///home/vagrant/.sbt/1.0/server/d85d9ae4b328e3d04db2/sock
sbt:bfg-parent> bfg/assembly
[warn] 18.716 seconds of the last 10 seconds were spent in garbage collection. You may want to increase the project heap size using `-Xmx` or try a different gc algorithm, e.g. `-XX:+UseG1GC`, for better performance.
[info] compiling 27 Scala sources to /home/vagrant/bfg-repo-cleaner/bfg-library/target/scala-2.12/classes ...
[warn] 10.776 seconds of the last 10 seconds were spent in garbage collection. You may want to increase the project heap size using `-Xmx` or try a different gc algorithm, e.g. `-XX:+UseG1GC`, for better performance.
[info] compiling 1 Scala source to /home/vagrant/bfg-repo-cleaner/bfg-test/target/scala-2.12/classes ...
[warn] 16.985 seconds of the last 10 seconds were spent in garbage collection. You may want to increase the project heap size using `-Xmx` or try a different gc algorithm, e.g. `-XX:+UseG1GC`, for better performance.
[info] compiling 4 Scala sources to /home/vagrant/bfg-repo-cleaner/bfg/target/classes ...
[info] Including: scala-library-2.12.4.jar
Killed
rtyley commented 3 years ago

The BFG now compiles on both Java 8 & Java 11, fixed with abfc2c764b7, and CI-tested with Travis:

image

I've also updated the Scala version to 2.12.12, which the Scala project documents as compatible with JDK 11:

image

Thanks for reporting the issue, apologies that - like many things - it's often a long time before I can get around to replying!

jmatias commented 3 years ago

Thanks for reporting the issue, apologies that - like many things - it's often a long time before I can get around to replying!

No apologies needed, friend. This is software we get for free. Thank you.