Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
master
Jules Villard7 years agocommitted byFacebook Github Bot
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$B.foo(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, [Method `SubclassExample$B.foo()` is annotated with `@Nullable` but overrides unannotated method `SubclassExample$A.foo()`.]
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$B.foo(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, [Method `SubclassExample$B.foo()` is annotated with `@Nullable` but overrides unannotated method `SubclassExample$A.foo()`.]
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$C.baz(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, [Method `SubclassExample$C.baz()` is annotated with `@Nullable` but overrides unannotated method `SubclassExample$I.baz()`.]
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$C.baz(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, [Method `SubclassExample$C.baz()` is annotated with `@Nullable` but overrides unannotated method `SubclassExample$I.baz()`.]
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, void SubclassExample$D.deref(SubclassExample$T), 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, [First parameter `t` of method `SubclassExample$D.deref(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `SubclassExample$A.deref(...)`.]
codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java, void SubclassExample$D.deref(SubclassExample$T), 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, [First parameter `t` of method `SubclassExample$D.deref(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `SubclassExample$A.deref(...)`.]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badAtomicReferenceDereference(AtomicReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in eradicate/modelTables.ml at line 37)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badAtomicReferenceDereference(AtomicReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in modelTables.ml at line 37)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badPhantomReferenceDereference(PhantomReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in eradicate/modelTables.ml at line 29)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badPhantomReferenceDereference(PhantomReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in modelTables.ml at line 29)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badReferenceDereference(Reference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in eradicate/modelTables.ml at line 21)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badReferenceDereference(Reference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in modelTables.ml at line 21)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badSoftReferenceDereference(SoftReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in eradicate/modelTables.ml at line 33)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badSoftReferenceDereference(SoftReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in modelTables.ml at line 33)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badWeakReferenceDereference(WeakReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in eradicate/modelTables.ml at line 25)]
codetoanalyze/java/eradicate/LibraryCalls.java, String LibraryCalls.badWeakReferenceDereference(WeakReference), 1, ERADICATE_NULL_METHOD_CALL, [origin,The value of `ref.get()` in the call to `toString()` could be null. (Origin: call to get() modelled in modelTables.ml at line 25)]
codetoanalyze/java/eradicate/NullFieldAccess.java, Object NullFieldAccess.arrayAccess(), 1, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `NullFieldAccess.objects` could be null when accessing element at index `0`. (Origin: field NullFieldAccess.objects at line 63)]
codetoanalyze/java/eradicate/NullFieldAccess.java, Object NullFieldAccess.arrayAccess(), 1, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `NullFieldAccess.objects` could be null when accessing element at index `0`. (Origin: field NullFieldAccess.objects at line 63)]
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.arrayLength(), 1, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `NullFieldAccess.objects` could be null when accessing field `length`. (Origin: field NullFieldAccess.objects at line 59)]
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.arrayLength(), 1, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `NullFieldAccess.objects` could be null when accessing field `length`. (Origin: field NullFieldAccess.objects at line 59)]
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useInterface(NullFieldAccess$I), 2, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `c` could be null when accessing field `NullFieldAccess$C.n`. (Origin: field NullFieldAccess$I.c at line 52)]
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useInterface(NullFieldAccess$I), 2, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `c` could be null when accessing field `NullFieldAccess$C.n`. (Origin: field NullFieldAccess$I.c at line 52)]
@ -39,11 +39,11 @@ codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useX(), 2
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useZ(), 2, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `c` could be null when accessing field `NullFieldAccess$C.n`. (Origin: field NullFieldAccess.z at line 47)]
codetoanalyze/java/eradicate/NullFieldAccess.java, int NullFieldAccess.useZ(), 2, ERADICATE_NULL_FIELD_ACCESS, [origin,Object `c` could be null when accessing field `NullFieldAccess$C.n`. (Origin: field NullFieldAccess.z at line 47)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.fld at line 71)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.fld at line 71)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerPrivateField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.pfld at line 82)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall$Inner.outerPrivateField(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: field NullMethodCall.pfld at line 82)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall.testSystemGetenvBad(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `envValue` in the call to `length()` could be null. (Origin: call to getenv(...) modelled in eradicate/modelTables.ml at line 243)]
codetoanalyze/java/eradicate/NullMethodCall.java, int NullMethodCall.testSystemGetenvBad(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `envValue` in the call to `length()` could be null. (Origin: call to getenv(...) modelled in modelTables.ml at line 243)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.callOnNull(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 22)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.callOnNull(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 22)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testExceptionPerInstruction(int), 6, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 183)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testExceptionPerInstruction(int), 6, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 183)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testFieldAssignmentIfThenElse(String), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 174)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testFieldAssignmentIfThenElse(String), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: null constant at line 174)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testSystemGetPropertyReturn(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: call to getProperty(...) modelled in eradicate/modelTables.ml at line 238)]
codetoanalyze/java/eradicate/NullMethodCall.java, void NullMethodCall.testSystemGetPropertyReturn(), 2, ERADICATE_NULL_METHOD_CALL, [origin,The value of `s` in the call to `length()` could be null. (Origin: call to getProperty(...) modelled in modelTables.ml at line 238)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, ParameterNotNullable$ConstructorCall.<init>(ParameterNotNullable,int), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`ParameterNotNullable$ConstructorCall(...)` needs a non-null value in parameter 2 but argument `null` can be null. (Origin: null constant at line 102)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, ParameterNotNullable$ConstructorCall.<init>(ParameterNotNullable,int), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`ParameterNotNullable$ConstructorCall(...)` needs a non-null value in parameter 2 but argument `null` can be null. (Origin: null constant at line 102)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, String ParameterNotNullable.testSystemGetPropertyArgument(), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`getProperty(...)` needs a non-null value in parameter 1 but argument `null` can be null. (Origin: null constant at line 71)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, String ParameterNotNullable.testSystemGetPropertyArgument(), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`getProperty(...)` needs a non-null value in parameter 1 but argument `null` can be null. (Origin: null constant at line 71)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, String ParameterNotNullable.testSystemGetenvBad(), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`getenv(...)` needs a non-null value in parameter 1 but argument `null` can be null. (Origin: null constant at line 76)]
codetoanalyze/java/eradicate/ParameterNotNullable.java, String ParameterNotNullable.testSystemGetenvBad(), 1, ERADICATE_PARAMETER_NOT_NULLABLE, [origin,`getenv(...)` needs a non-null value in parameter 1 but argument `null` can be null. (Origin: null constant at line 76)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.returnNullable(String), 0, ERADICATE_RETURN_NOT_NULLABLE, [Method `returnNullable(...)` may return null but it is not annotated with `@Nullable`. (Origin: method parameter s)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.returnNullable(String), 0, ERADICATE_RETURN_NOT_NULLABLE, [Method `returnNullable(...)` may return null but it is not annotated with `@Nullable`. (Origin: method parameter s)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch(), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `return_null_in_catch()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 111)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch(), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `return_null_in_catch()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 111)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch_after_throw(), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `return_null_in_catch_after_throw()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 123)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch_after_throw(), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `return_null_in_catch_after_throw()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 123)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, URL ReturnNotNullable.getResourceNullable(Class,String), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `getResourceNullable(...)` may return null but it is not annotated with `@Nullable`. (Origin: call to getResource(...) modelled in eradicate/modelTables.ml at line 128)]
codetoanalyze/java/eradicate/ReturnNotNullable.java, URL ReturnNotNullable.getResourceNullable(Class,String), 0, ERADICATE_RETURN_NOT_NULLABLE, [origin,Method `getResourceNullable(...)` may return null but it is not annotated with `@Nullable`. (Origin: call to getResource(...) modelled in modelTables.ml at line 128)]