Exclude demos from mini builds

Fixes #17750.

(cherry picked from commit 91916e77967e485182e753b7513c80efd84b926b)
(cherry picked from commit 4cf9f8422f5afa9adb5eef1396c4afe750f9488c)
(cherry picked from commit bd61892569044b0040ef8ac95dfed5da5593fdc4)