Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DD2C5200D69 for ; Wed, 27 Dec 2017 13:22:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D2AA8160C23; Wed, 27 Dec 2017 12:22:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F0C46160C20 for ; Wed, 27 Dec 2017 13:22:48 +0100 (CET) Received: (qmail 49526 invoked by uid 500); 27 Dec 2017 12:22:48 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 49494 invoked by uid 99); 27 Dec 2017 12:22:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2017 12:22:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5971B18061F for ; Wed, 27 Dec 2017 12:22:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.701 X-Spam-Level: X-Spam-Status: No, score=-0.701 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id SDZ5no-rrbEp for ; Wed, 27 Dec 2017 12:22:45 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 185065F3DF for ; Wed, 27 Dec 2017 12:22:45 +0000 (UTC) Received: from [192.168.1.3] ([89.13.194.57]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MRFwV-1eNy1b2Uvv-00UdVu for ; Wed, 27 Dec 2017 13:22:44 +0100 Subject: Re: A reminder about how things are compiled To: dev@groovy.apache.org References: From: Jochen Theodorou Message-ID: <38b4c011-e43b-92e1-1489-3c663e7c787d@gmx.org> Date: Wed, 27 Dec 2017 13:22:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:PEomiP67Y+vvSaOQqfb05sKLNRGGSI9D07MWfTNVaO9LaFjqG4w Inj+JNoSybbBtrjkNlEShq0iEqJhxp453MaEsJphCPmmHy0OwOPkHgivt6BWIAFtnI5xQP9 W63jGiZmR8sDWqKyVyN1dd73URi27Dc0oUZAHZ0W5sZoVFVmQDa4M/Wl6dOUvrHiU04y9PC KQa7pqq31m3sUiJ1OAzAw== X-UI-Out-Filterresults: notjunk:1;V01:K0:8Ek5Jj9FWrM=:ciDJ+g5+WjWAWpmOuK177x 5II34Rfvqo25+4q5iZtmP/T7DZpPECPmOhw04pswz5MEBr8ZLZ1cXJh+M4snDYXyCllabgy2Y RSpGPTpfQaWOBjzKtsuy2yR8qrOYsl9Nyi+gHjCYGD+iEFTJUxWAaCQJdp3R4dYtp6pyXPiLe 6kifjcZxee+9soSTuyGsrAFq+bjfKKlYDkqRk1Xz1mEi24fCIrQMg8Yoln5R4gbTkl6l0lIRd 6Rvf7FM1c2HpO2PneLuEzc1yS0Wprw30Wku9KMVoBT/t3cROb2JeuaB4u3SAcmxWnZ2uXtQ8v CbfBjehrrAYPETwz45vairfc+Ip/LbWjv5+cVuZsP0+PomIviH4kG9T5r703PI/+bcLDRWvuR AJPYvj/H9cdB/BdVygF3ukgzsmEp31eBuOi3brG/C0YRTGjkADvAyBY3ISBpuk4q+ULfKALWt nLzRLwALbB+893m+pVQhp4x/MIf+KobmicJWayPJocLYo6OHpXUOr99sUavImM7rKDIA7FKH9 4qDNeXQunIsEGKCW8QjxsenleIJ/mEu5nlgmfjOVrAYHUNtmrLKhdZoUOGIYegyE4PXW/6vql kK9ltIofe2IhIapimACxdDA7vmcv1ziLF1tVOUX8B2TmNLYWeB+puFg9QsaW68Sdhwxn7mWLe 8bNEIpKN6cLhQllOLcxvwdz9yj1ecbuELjXZ8Q9vnjTwvfvrvMZRYGiDw0i7DPB8+Yc3nzsbV ULFb3lWRQiR2Eoj9n1beUiJbwV6CrhxUW1/9mzvmIesDDeEm8VU5aRHfDJ7IBtBLbd5bewytI m38Oga8efdybf6wF5wyVlq4hLACQejlOS2tzFsy5kUFLzhMGEIuNowYSqPOC14dSnFxB892 archived-at: Wed, 27 Dec 2017 12:22:50 -0000 On 27.12.2017 10:04, Cédric Champeau wrote: [...] > The consequence, however, is that any change to a Java class in Groovy > core is going to produce a different compiler. This is fine in the IDE, as long as I do not have to bootstrap immediately... which I do not have to. But I must say the IDEA setup is still annoying as hell. I freshly generated the modules and ended up with a project I cannot compile, because of the examples. I then switched to build, but ignore errors, which resulted in my main (FileSystemCompiler, GroovyMain) classes not being found, because they have not been compiled and I did not add the Groovy global lib. Then I added the bootstrap and while the main classes now have been found, they have been of course from the bootstrap, not the source. I will always have to have a really, really, really good look at things to see if I am using bootstrap or not. I mean imagine you remove a class and then run from the IDE to see if your test still works. And it will, because the damn class is still in the bootstrap jar, which of course you did not create a new one. I easily lost more than half a day just trying to setup things again. Together with the installation and fixing of intellij itself... that was no fun day at all and lost time for Groovy development. > For Gradle, which is > aware of inputs/outputs, it means that the compiler has changed, and > that it needs to recompile downstream consumers (subprojects) and, of > course, re-execute their tests. This is the _correct behavior_. Gradle > is right to do so, because the compiler has changed, so the bytecode > generated might be different, but also since Groovy provides a runtime, > it also needs to re-execute the tests because the runtime has changed. > > What I explain is also true of the other tasks we use, like groovydoc, > or docgenerator. that part is perfectly fine. > Now, let me explain why changing the strategy to use > compiler N-1 is not necessarily a good idea for us: as I explained, > Groovy also comes with a runtime. Say that in Groovy 3, we decide to get > rid of call site caching, to only use invokedynamic. Then it means that > the runtime of Groovy 3 will no longer include call site caching. > However, the Groovy classes of the compiler would have been compiled > with call site caching, so a _consumer_ of the compiler would fail, > because those classes would no longer be there at runtime! > > Of course one might say "then you can use the invokedynamic version" of > Groovy to compile Groovy 3, which leads to the last bit of complexity of > our build. What you normally do is compiler with N-1 to get a compiler for N' and then use that compiler to get the real N. Very common strategy. Of course that means in a build where we would depend on an older release (N-1), we not be able to use features in the new version (N') before we have created N', which can actually compile the new features. And only then N could be compiled using the new features from N'. Using Java is kind of like saying we stay with N'. So there are pros and cons to this approach, it surely does not make things more easy from the build side. It would make the program code more easy and would be better in terms of "eat you own dog food". what me really prevents from doing something like this is that the static compiler has to many fallbacks to dynamic code where I do not want them. > Some would have noticed that we now have a "testAll" task for > each project. This task executes tests with the "indy" version of the > compiler. Which means that in practice, we produce 2 versions of the > compiler, not just one. This was the main reason for the complexity of > the previous build, that I recently got rid of by using a different > strategy and leveraging the Gradle build cache. So, instead of using the > same outputs for both compilers, they are now separate, and we can run > the tests in 2 flavors. The consequence is that tests are executed twice > (one for `test`, the other for `testWithIndy`), but the outcome is much > cleaner. > > I hope this clarifies things a bit. Now for daily development, you can use: > > ./gradlew :test : will only execute the call site caching version of > tests for the "core" project > ./gradlew :testWithIndy : will only execute the indy version of tests > for the "core" project > ./gradlew :testAll : will execute both flavors of tests (indy and non > indy) for the "core" project > > And of course you can do the same for any subproject: > > ./gradlew :groovy-xml:test > > You can also choose precisely which test to execute by adding `--tests > *MyTest*` to the command line. testAll and testWithIndy I did not realize,thanks. bye Jcohen