Discriminate between local build and CI build

On my gradle I have something like this:

def DEV_MODE=false
def myloader="com.github.Pesegato"
def myversion="-SNAPSHOT"
if (DEV_MODE){
 myloader="com.pesegato"
 myversion="latest.integration"
}

I’m not super happy with it, because I need to keep DEV_MODE to true on my development machine, and when committing I must ignore a line of the file… is there a cleaner way to do this? Like check the presence of a local file or something?

I usually do it the other way around, I have the CI build set an environment variable.

Eg for travis

1 Like

you can also detect if you’re on CI or not. Usually the different CI servers out there expose this via a environment variable or system property. We at gradle for example use teamcity and do it like this: https://github.com/gradle/gradle/blob/feb4c534f3b55331edf3d6279df25ba0b9f86162/build.gradle#L145-L145

cheers,
René

1 Like

Cool idea but

 Could not find property 'CI' on root project

Unless I redefine with def…?

Cool the answer below is for travis: