foursquare / fsqio

A monorepo that holds all of Foursquare's opensource projects
Apache License 2.0
252 stars 54 forks source link

Spindle doesn't support i64 consts? #45

Open omerzach opened 7 years ago

omerzach commented 7 years ago

I have

const i64 MaxTotalAttachmentBytes = 10000000000
const i64 MaxCoverPhotoBytes = 50000000 // 50 MB

in my Thrift and get the following when I compile:

Omers-MacBook-Pro:sigma-monorepo-2point0 omer$ ./pants compile src/thrift/::

18:11:15 00:00 [main]
               (To run a reporting server: ./pants server)
18:11:15 00:00   [setup]
18:11:15 00:00     [parse]
               Executing tasks in goals: bootstrap -> imports -> unpack-jars -> deferred-sources -> gen -> jvm-platform-validate -> resolve -> compile
18:11:15 00:00   [bootstrap]
18:11:15 00:00     [jar-dependency-management]
18:11:15 00:00     [bootstrap-jvm-tools]
18:11:15 00:00   [imports]
18:11:15 00:00     [ivy-imports]
18:11:15 00:00   [unpack-jars]
18:11:15 00:00     [unpack-jars]
18:11:15 00:00   [deferred-sources]
18:11:15 00:00     [deferred-sources]
18:11:15 00:00   [gen]
18:11:15 00:00     [spindle]
18:11:16 00:01     [thrift]
18:11:16 00:01     [protoc]
18:11:16 00:01     [antlr]
18:11:16 00:01     [ragel]
18:11:16 00:01     [jaxb]
18:11:16 00:01     [wire]
18:11:16 00:01   [jvm-platform-validate]
18:11:16 00:01     [jvm-platform-validate]WARN] No default jvm platform is defined.

18:11:16 00:01       [cache]
                   No cached artifacts for 55 targets.
                   Invalidated 55 targets.
18:11:16 00:01   [resolve]
18:11:16 00:01     [ivy]
18:11:16 00:01   [compile]
18:11:16 00:01     [compile-jvm-prep-command]
18:11:16 00:01       [jvm_prep_command]
18:11:16 00:01     [compile-prep-command]
18:11:16 00:01     [compile]
18:11:16 00:01     [zinc]
18:11:16 00:01       [cache]
                   No cached artifacts for 1 target.
                   Invalidated 1 target.
18:11:16 00:01       [isolation-zinc-pool-bootstrap]
                   [1/1] Compiling 2 zinc sources in 1 target (.pants.d/gen/spindle/src/jvm:src.thrift.com.thesigma.merit.merit-scala).
18:11:16 00:01       [compile]

18:11:16 00:01         [zinc]
                       [info] Compiling 1 Scala source and 1 Java source to /Users/omer/code/sigma-monorepo-2point0/.pants.d/compile/zinc/252d64521cf9/.pants.d.gen.spindle.src.jvm.src.thrift.com.thesigma.merit.merit-scala/current/classes...
                       [error] /Users/omer/code/sigma-monorepo-2point0/.pants.d/gen/spindle/src/jvm/com/thesigma/merit/gen/merit.scala:24: integer number too large
                       [error]       val MaxTotalAttachmentBytes: Long = 10000000000
                       [error]                                           ^
                       [error] /Users/omer/code/sigma-monorepo-2point0/.pants.d/gen/spindle/src/jvm/com/thesigma/merit/gen/merit.scala:25: ';' expected but 'val' found.
                       [error]       val MaxCoverPhotoBytes: Long = 50000000
                       [error]       ^
                       [error] two errors found
                       [error] Compile failed at Jul 27, 2017 6:11:16 PM [0.427s]

                   compile(.pants.d/gen/spindle/src/jvm:src.thrift.com.thesigma.merit.merit-scala) failed: Zinc compile failed.
FAILURE: Compilation failure: Failed jobs: compile(.pants.d/gen/spindle/src/jvm:src.thrift.com.thesigma.merit.merit-scala)

18:11:16 00:01   [complete]
               FAILURE

It seems like just having Spindle output 10000000000L instead of 10000000000 would fix the problem.

jvandew commented 7 years ago

Hello! 👋

We don't actually use const i64 internally (the only instance of it I can find is here which obviously doesn't hit this bug). This looks pretty clearly broken though, so feel free to submit a pull request if you have a fix. Otherwise I will see if someone here has time to take a look next week.

omerzach commented 7 years ago

Hey there :)

Have a trivial workaround for now but I'll try to come back and submit a PR. Just wanted to make sure I wasn't crazy.