Decoupled BuildProfile from Gradle types a bit to ease testing.
Put back some code that is needed by discovery