public static boolean isBuildConfigurationActive()

in src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java [108:150]


    public static boolean isBuildConfigurationActive(String requestedConfigurations, Project p, String message) {
        if (requestedConfigurations == null) {
            p.log(message + " not bound to any build configuration", Project.MSG_DEBUG);
            return true;
        }
        List<String> buildConfigurationsList = buildList(requestedConfigurations);

        // check consistency, here we consider that a build configuration must
        // be explicitly declared
        if (p.getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS) == null) {
            throw new BuildException("there is no available build configuration");
        }

        List<String> availableBuildConfigurations = Arrays.asList(p.getProperty(
                EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS).split(","));

        for (String conf : buildConfigurationsList) {
            if (!availableBuildConfigurations.contains(conf)) {
                throw new BuildException("unknown build configuration named " + conf);
            }
        }

        // is there any activated build configuration matching with the build
        // configurations defined?
        if (p.getProperty(EasyAntMagicNames.MAIN_CONFS) != null) {
            String buildConf = getFirstBuildConfigurationMatching(requestedConfigurations,
                    p.getProperty(EasyAntMagicNames.MAIN_CONFS));
            if (buildConf != null) {
                p.log(message + " bound to build configuration " + buildConf, Project.MSG_DEBUG);
                return true;
            } else {
                // if no activated build configuration match with required build
                // configuration, it means
                // that related element should not be loaded
                p.log(message + " not bound to any active build configuration. Requested build configuration was "
                        + requestedConfigurations, Project.MSG_DEBUG);
                return false;
            }
        } else {
            p.log("there is no activated build configuration", Project.MSG_DEBUG);
            return false;
        }
    }