public FilePath getModuleRoot ( Map < String , String > globalEnv ) throws IOException , InterruptedException { FilePath someWorkspace = project . getSomeWorkspace ( ) ; if ( someWorkspace == null ) { throw new IllegalStateException ( "Couldn't find workspace" ) ; } Map < String , String > workspaceEnv = Maps . newHashMap ( ) ; workspaceEnv . put ( "WORKSPACE" , someWorkspace . getRemote ( ) ) ; for ( Builder builder : getBuilders ( ) ) { if ( builder instanceof Gradle ) { Gradle gradleBuilder = ( Gradle ) builder ; String rootBuildScriptDir = gradleBuilder . getRootBuildScriptDir ( ) ; if ( rootBuildScriptDir != null && rootBuildScriptDir . trim ( ) . length ( ) != 0 ) { String rootBuildScriptNormalized = Util . replaceMacro ( rootBuildScriptDir . trim ( ) , workspaceEnv ) ; rootBuildScriptNormalized = Util . replaceMacro ( rootBuildScriptNormalized , globalEnv ) ; return new FilePath ( someWorkspace , rootBuildScriptNormalized ) ; } else { return someWorkspace ; } } } throw new IllegalArgumentException ( "Couldn't find Gradle builder in the current builders list" ) ; }
Get the root path where the build is located the project may be checked out to a sub - directory from the root workspace location .