|
| 1 | +<!-- |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + contributor license agreements. See the NOTICE file distributed with |
| 4 | + this work for additional information regarding copyright ownership. |
| 5 | + The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + the "License"); you may not use this file except in compliance with |
| 7 | + the License. You may obtain a copy of the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + Unless required by applicable law or agreed to in writing, software |
| 12 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + See the License for the specific language governing permissions and |
| 15 | + limitations under the License. |
| 16 | + --> |
| 17 | + |
| 18 | +This is a record of changes to the modernized gradle build. |
| 19 | + |
| 20 | +### ```buildOptions``` plugin instead of ```propertyOrDefault``` method |
| 21 | + |
| 22 | +All "propertyOrDefault*" methods have been removed and an external |
| 23 | +plugin for configuring various build options is now used. This is |
| 24 | +the plugin (blame me for any shortcomings): |
| 25 | + |
| 26 | +https://github.com/carrotsearch/gradle-build-infra#plugin-comcarrotsearchgradlebuildinfrabuildoptionsbuildoptionsplugin |
| 27 | + |
| 28 | +this plugin will source the value of a given build option from |
| 29 | +several places, in order: |
| 30 | +- system property (```-Dfoo=value```), |
| 31 | +- gradle property (```-Pfoo=value```), |
| 32 | +- environment variable (```foo=value ./gradlew ...```) |
| 33 | +- a *non-versioned*, ```build-options.local.properties``` property file |
| 34 | + (for your personal, local tweaks), |
| 35 | +- a *versioned* ```build-options.properties``` property file. |
| 36 | + |
| 37 | +It works much like before - you can override any build option |
| 38 | +temporarily by passing, for example, ```-Ptests.verbose=true```. But you |
| 39 | +can also make such changes locally persistent by placing them |
| 40 | +in your ```build-options.local.properties``` file. Alternatively, |
| 41 | +the generated ```gradle.properties``` is also supported since it declares |
| 42 | +project properties (equivalent to ```-Pkey=value```). At some point |
| 43 | +in the future, we may want to keep gradle.properties versioned though, |
| 44 | +so it's probably a good idea to switch over to |
| 45 | +```build-options.local.properties```. |
| 46 | + |
| 47 | +The biggest gain from using build options is that you can now see |
| 48 | +all declared options and their values, including their source (where their |
| 49 | +value comes from). To see what I mean, try running these: |
| 50 | +``` |
| 51 | +./gradlew :buildOptions |
| 52 | +./gradlew -p lucene/core buildOptions |
| 53 | +``` |
| 54 | + |
| 55 | +### Lucene 'base version' string moved |
| 56 | + |
| 57 | +* Various Lucene's "version" properties are now full build options (as described above). |
| 58 | +Their default values are in ```build-options.properties```. You can override |
| 59 | +any of ```version.suffix```, ```version.base``` or ```version.release``` |
| 60 | +using any of the build option plugin's methods. If you'd like to bump |
| 61 | +Lucene's base version, it now lives in the versioned ```build-options.properties```. |
| 62 | + |
| 63 | +### Tweaks to properties and options |
| 64 | + |
| 65 | +* ```runtime.java.home``` is a build option now but the support for |
| 66 | +```RUNTIME_JAVA_HOME``` env. variable has been implemented for backward |
| 67 | +compatibility. |
| 68 | + |
| 69 | +* ```tests.neverUpToDate``` option is renamed ```tests.rerun```. |
| 70 | +The value of ```true``` indicates test tasks will re-run even if |
| 71 | +nothing has changed. |
| 72 | + |
| 73 | +### Changes to project structure |
| 74 | + |
| 75 | +* ```build-tools/missing-doclet``` is now a regular project within Lucene (not |
| 76 | +an included composite project). This simplifies the build and ensures we apply |
| 77 | +the same checks to this subproject as we do to everything else. |
| 78 | + |
| 79 | +* all gradle build scripts are converted to convention plugins (in groovy) and |
| 80 | +live under ```dev-tools/build-infra/src/main/groovy```. The long-term |
| 81 | +plan is to move some or all of these groovy plugins to Java (so that the code is |
| 82 | +easier to read and debug for non-groovians). |
| 83 | + |
| 84 | +* ```tidy``` is now applied to groovy/gradle scripts (formatting is enforced). |
| 85 | + |
| 86 | +### Security manager support |
| 87 | + |
| 88 | +* parts of the build supporting security manager settings have been just |
| 89 | +removed, without any replacement. |
| 90 | + |
| 91 | +### Other notable changes |
| 92 | + |
| 93 | +* The legacy ```precommit``` task has been removed; use gradle's ```check```. |
| 94 | + |
| 95 | +* Removed dependency on jgit entirely. This is replaced by forking the system's git |
| 96 | +in porcelain mode (which should be stable and portable). This logic is implemented |
| 97 | +in [this plugin](https://github.com/carrotsearch/gradle-build-infra/?tab=readme-ov-file#plugin-comcarrotsearchgradlebuildinfraenvironmentgitinfoplugin). |
| 98 | +An additional benefit is that all features of git should now work (including worktrees). |
| 99 | + |
| 100 | +* Added support for owasp API keys in the form of ```validation.owasp.apikey``` build option. Owasp check is |
| 101 | +still very, very slow. We should probably just drop it. |
| 102 | + |
| 103 | +* I've changed the default on ```gradle.ge``` (Gradle Enterprise, develocity) to ```false``` |
| 104 | +on non-CI builds. |
| 105 | + |
| 106 | +* I've tried to clean up lots and lots of gradle/groovy code related to eager initialization of |
| 107 | +tasks as well as update deprecated APIs. This isn't always straightforward and I might have broken |
| 108 | +some things... |
| 109 | + |
| 110 | +### Fixes to existing issues |
| 111 | + |
| 112 | +* ```gradlew clean check``` will work now (https://github.com/apache/lucene/issues/13567) |
0 commit comments