Your extension is called day, not Day, so in the second variant it would probably be myplugin.day.SUNDAY.
Alternatively, for the first variant, you probably simply missed to add the necessary import static MyPlugin.Day.SUNDAY etc. statements.
Besides that imperative logic like a switch in a build script is bad practice of course.
Also, I recommend you switch to Kotlin DSL. By now it is the default DSL, you immediately get type-safe build scripts, actually helpful error messages if you mess up the syntax, and amazingly better IDE support if you use a good IDE like IntelliJ IDEA or Android Studio.
Thanks. I’m trying to bring a very old big Gradle build into modernity, so it takes some compromises.
There’s code there that sets variables based on which OS and architecture the build is running on, and also checks if the OS-arch combination is supported at all. That’s what I’m simplifying. What’s the proper way of handling this?
Hard to answer generically.
You sure can do conditional code in build scripts, it is just most often better to instead put imperative logic into convention plugins or custom tasks or similar and then use those from the build scripts.