Search in sources :

Example 1 with EnvironmentExtension

use of com.google.devtools.build.lib.packages.PackageFactory.EnvironmentExtension in project bazel by bazelbuild.

the class WorkspaceFactory method addWorkspaceFunctions.

private void addWorkspaceFunctions(Environment workspaceEnv, StoredEventHandler localReporter) {
    try {
        workspaceEnv.setup("workspace", newWorkspaceFunction.apply(allowOverride, ruleFactory));
        for (Map.Entry<String, BaseFunction> function : workspaceFunctions.entrySet()) {
            workspaceEnv.update(function.getKey(), function.getValue());
        }
        if (installDir != null) {
            workspaceEnv.update("__embedded_dir__", installDir.getPathString());
        }
        if (workspaceDir != null) {
            workspaceEnv.update("__workspace_dir__", workspaceDir.getPathString());
        }
        File jreDirectory = new File(System.getProperty("java.home"));
        workspaceEnv.update("DEFAULT_SERVER_JAVABASE", jreDirectory.getParentFile().toString());
        for (EnvironmentExtension extension : environmentExtensions) {
            extension.updateWorkspace(workspaceEnv);
        }
        workspaceEnv.setupDynamic(PackageFactory.PKG_CONTEXT, new PackageFactory.PackageContext(builder, null, localReporter, AttributeContainer.ATTRIBUTE_CONTAINER_FACTORY));
    } catch (EvalException e) {
        throw new AssertionError(e);
    }
}
Also used : BaseFunction(com.google.devtools.build.lib.syntax.BaseFunction) EnvironmentExtension(com.google.devtools.build.lib.packages.PackageFactory.EnvironmentExtension) EvalException(com.google.devtools.build.lib.syntax.EvalException) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) File(java.io.File)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 EnvironmentExtension (com.google.devtools.build.lib.packages.PackageFactory.EnvironmentExtension)1 BaseFunction (com.google.devtools.build.lib.syntax.BaseFunction)1 EvalException (com.google.devtools.build.lib.syntax.EvalException)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1