Block buildscript - what it's for?

Please explain diferences between blocks
buildscript {}
allprojects {}
and
subprojects{}

what every of them is for?

Thanks.

Hello,

The buildscript block is tied to the legacy binary plugin use as explained in this section of the userguide. With this block you configure the classpath used to evaluate the build.gradle file.

The others block mentioned in your question are configuration closures applied to all projects or the sub projects. You can read more about this in the multi-project build section of the userguide. With these structures you can apply generic configuration in your projects.

Thank you for helping