Ruling static final variables before compilation

Hello, i have constant

public static final boolean DEBUG = true;

and i want create two tasks, like buildDebug - before compilation, tasks must set DEBUG variable to true buildRelease - before compilation, tasks must set DEBUG variable to false

How i can do this?