From 9cbcfa9c1fb89efd0b4cdafdc4246ce027f74ebb Mon Sep 17 00:00:00 2001 From: Gregor Uhlenheuer Date: Sat, 15 Dec 2018 01:14:31 +0100 Subject: Discover - break overridesRoutes into fixed size chunks (#509) * Discover - break overridesRoutes into fixed size chunks * Discover - simplify lambda creation * add LargeProjectTests * LargeProjectTests: remove Ydelambdafy --- main/core/src/define/Discover.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main/core') diff --git a/main/core/src/define/Discover.scala b/main/core/src/define/Discover.scala index f0c668e6..c7dab54c 100644 --- a/main/core/src/define/Discover.scala +++ b/main/core/src/define/Discover.scala @@ -79,9 +79,12 @@ object Discover { } if overridesRoutes.nonEmpty } yield { + // by wrapping the `overridesRoutes` in a lambda function we kind of work around + // the problem of generating a *huge* macro method body that finally exceeds the + // JVM's maximum allowed method size + val overridesLambda = q"(() => $overridesRoutes)()" val lhs = q"classOf[${discoveredModuleType.typeSymbol.asClass}]" - val rhs = q"scala.Seq[(Int, mill.util.Router.EntryPoint[_])](..$overridesRoutes)" - q"$lhs -> $rhs" + q"$lhs -> $overridesLambda" } c.Expr[Discover[T]](q"mill.define.Discover(scala.collection.immutable.Map(..$mapping))") -- cgit v1.2.3