/** * @param rules the raw rule objects to parse. */ @VisibleForTesting synchronized void parseRawRulesInternal(Iterable<Map<String, Object>> rules) throws BuildTargetException, IOException { for (Map<String, Object> map : rules) { if (isMetaRule(map)) { parseMetaRule(map); continue; } BuildTarget target = parseBuildTargetFromRawRule(map); BuildRuleType buildRuleType = parseBuildRuleTypeFromRawRule(map); Description<?> description = repository.getDescription(buildRuleType); if (description == null) { throw new HumanReadableException("Unrecognized rule %s while parsing %s.", buildRuleType, repository.getAbsolutePathToBuildFile(target)); } state.put(target, map); } }
protected ProjectBuildFileParser( ProjectFilesystem projectFilesystem, Iterable<String> commonIncludes, String pythonInterpreter, ImmutableSet<Description<?>> descriptions, Console console, ImmutableMap<String, String> environment) { this.projectRoot = projectFilesystem.getRootPath(); this.descriptions = Preconditions.checkNotNull(descriptions); this.ignorePaths = projectFilesystem.getIgnorePaths(); this.commonIncludes = ImmutableList.copyOf(commonIncludes); this.pythonInterpreter = Preconditions.checkNotNull(pythonInterpreter); this.pathToBuckPy = Optional.absent(); this.console = Preconditions.checkNotNull(console); this.environment = Preconditions.checkNotNull(environment); // Default to server mode unless explicitly unset internally. setServerMode(true); }
public static MissingSymbolsHandler create( ProjectFilesystem projectFilesystem, ImmutableSet<Description<?>> descriptions, BuckConfig config, BuckEventBus buckEventBus, Console console, ImmutableMap<String, String> environment) { SrcRootsFinder srcRootsFinder = new SrcRootsFinder(projectFilesystem); ProjectBuildFileParserFactory projectBuildFileParserFactory = new DefaultProjectBuildFileParserFactory( projectFilesystem, config.getPythonInterpreter(), descriptions); JavaSymbolFinder javaSymbolFinder = new JavaSymbolFinder( projectFilesystem, srcRootsFinder, projectBuildFileParserFactory, config, buckEventBus, console, environment); return new MissingSymbolsHandler( console, javaSymbolFinder); }
@Test public void testImplicitDepsAreAddedCorrectly() throws NoSuchBuildTargetException { Description<GenruleDescription.Arg> genruleDescription = new GenruleDescription(); Map<String, ?> instance = ImmutableMap.of( "srcs", ImmutableList.of(":baz", "//biz:baz"), "out", "AndroidManifest.xml", "cmd", "$(exe //bin:executable) $(location :arg)"); ProjectFilesystem projectFilesystem = new AllExistingProjectFilesystem(); BuildRuleFactoryParams params = new BuildRuleFactoryParams( instance, projectFilesystem, new BuildTargetParser(projectFilesystem), BuildTargetFactory.newInstance("//foo:bar"), new FakeRuleKeyBuilderFactory()); TargetNode<GenruleDescription.Arg> targetNode = new TargetNode<>(genruleDescription, params); assertEquals( "SourcePaths and targets from cmd string should be extracted as extra deps.", ImmutableSet.of( "//foo:baz", "//biz:baz", "//bin:executable", "//foo:arg"), FluentIterable.from(targetNode.getExtraDeps()) .transform(Functions.toStringFunction()) .toSet()); }
private static TargetNode<?> createTargetNode( BuildTarget buildTarget, ImmutableSet<Path> inputs) { Description<FakeDescription.FakeArg> description = new FakeDescription(); BuildRuleFactoryParams params = NonCheckingBuildRuleFactoryParams.createNonCheckingBuildRuleFactoryParams( Maps.<String, Object>newHashMap(), new BuildTargetParser(new FakeProjectFilesystem()), buildTarget); return new TargetNode<>( description, params, inputs, ImmutableSet.<BuildTarget>of(), ImmutableSet.<BuildTargetPattern>of()); }
public DependencyInfo findDependencyInfoForGraph(final TargetGraph graph) { final DependencyInfo dependencyInfo = new DependencyInfo(); // Walk the graph and for each Java rule we record the Java entities it provides. // // Currently, we traverse the entire target graph using a single thread. However, the work to // visit each node could be done in parallel, so long as the updates to the above collections // were thread-safe. for (TargetNode<?, ?> node : graph.getNodes()) { if (!RULES_TO_VISIT.contains(Description.getBuildRuleType(node.getDescription()))) { continue; } if (!(node.getConstructorArg() instanceof JavaLibraryDescription.CoreArg) && !(node.getConstructorArg() instanceof PrebuiltJarDescriptionArg)) { throw new IllegalStateException("This rule is not supported by suggest: " + node); } Symbols symbols = getJavaFileFeatures(node); for (String providedEntity : symbols.provided) { dependencyInfo.symbolToProviders.put(providedEntity, node); } } return dependencyInfo; }
/** * Callers are responsible for managing the life-cycle of the created {@link * ProjectBuildFileParser}. */ public static ProjectBuildFileParser createBuildFileParser( Cell cell, TypeCoercerFactory typeCoercerFactory, Console console, BuckEventBus eventBus, ExecutableFinder executableFinder, Iterable<Description<?>> descriptions) { return createBuildFileParser( cell, typeCoercerFactory, console, eventBus, new ParserPythonInterpreterProvider(cell.getBuckConfig(), executableFinder), descriptions, /* enableProfiling */ false); }
/** * Callers are responsible for managing the life-cycle of the created {@link * ProjectBuildFileParser}. */ public static ProjectBuildFileParser createBuildFileParser( Cell cell, TypeCoercerFactory typeCoercerFactory, Console console, BuckEventBus eventBus, ParserPythonInterpreterProvider pythonInterpreterProvider, Iterable<Description<?>> descriptions) { return createBuildFileParser( cell, typeCoercerFactory, console, eventBus, pythonInterpreterProvider, descriptions, /* enableProfiling */ false); }
private HumanReadableException getUnexpectedVersionedNodeError(TargetNode<?, ?> node) { String msg = String.format( "Found versioned node %s from unversioned, top-level target:%s", node.getBuildTarget(), System.lineSeparator()); ArrayList<TargetNode<?, ?>> trace = new ArrayList<>(); for (TargetNode<?, ?> n = node; n != null; n = getVersionedSubGraphParent(n)) { trace.add(n); } msg += trace .stream() .map( n -> String.format( " %s (%s)", n, Description.getBuildRuleType(n.getDescription()))) .collect(Collectors.joining(" depended on by" + System.lineSeparator())); return new HumanReadableException(msg); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { BuckConfig buckConfig = context.getBuckConfig(); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(buckConfig); PythonBuckConfig pyConfig = new PythonBuckConfig(buckConfig); ToolchainProvider toolchainProvider = context.getToolchainProvider(); PythonBinaryDescription pythonBinaryDescription = new PythonBinaryDescription(toolchainProvider, pyConfig, cxxBuckConfig); return Arrays.asList( pythonBinaryDescription, new PrebuiltPythonLibraryDescription(), new PythonLibraryDescription(toolchainProvider), new PythonTestDescription( toolchainProvider, pythonBinaryDescription, pyConfig, cxxBuckConfig), new CxxPythonExtensionDescription(toolchainProvider, cxxBuckConfig)); }
private AppleBundle getBuildRuleForTestHostAppTarget( BuildTarget buildTarget, BuildRuleResolver resolver, BuildTarget testHostBuildTarget, AppleDebugFormat debugFormat, Iterable<Flavor> additionalFlavors, String testHostKeyName) { BuildRule rule = resolver.requireRule( testHostBuildTarget.withAppendedFlavors( ImmutableSet.<Flavor>builder() .addAll(additionalFlavors) .add(debugFormat.getFlavor(), StripStyle.NON_GLOBAL_SYMBOLS.getFlavor()) .build())); if (!(rule instanceof AppleBundle)) { throw new HumanReadableException( "Apple test rule '%s' has %s '%s' not of type '%s'.", buildTarget, testHostKeyName, testHostBuildTarget, Description.getBuildRuleType(AppleBundleDescription.class)); } return (AppleBundle) rule; }
@SuppressWarnings("unchecked") public static <T> ImmutableSet<T> collectTransitiveBuildRules( TargetGraph targetGraph, Optional<AppleDependenciesCache> cache, ImmutableSet<Class<? extends Description<?>>> descriptionClasses, Collection<TargetNode<?, ?>> targetNodes) { return RichStream.from(targetNodes) .flatMap( targetNode -> getRecursiveTargetNodeDependenciesOfTypes( targetGraph, cache, RecursiveDependenciesMode.COPYING, targetNode, descriptionClasses) .stream()) .map(input -> (T) input.getConstructorArg()) .toImmutableSet(); }
@SuppressWarnings("unchecked") private static Optional<TargetNode<CxxLibraryDescription.CommonArg, ?>> getAppleNativeNodeOfType( TargetGraph targetGraph, TargetNode<?, ?> targetNode, Set<Class<? extends Description<?>>> nodeTypes, Set<AppleBundleExtension> bundleExtensions) { Optional<TargetNode<CxxLibraryDescription.CommonArg, ?>> nativeNode = Optional.empty(); if (nodeTypes.contains(targetNode.getDescription().getClass())) { nativeNode = Optional.of((TargetNode<CxxLibraryDescription.CommonArg, ?>) targetNode); } else if (targetNode.getDescription() instanceof AppleBundleDescription) { TargetNode<AppleBundleDescriptionArg, ?> bundle = (TargetNode<AppleBundleDescriptionArg, ?>) targetNode; Either<AppleBundleExtension, String> extension = bundle.getConstructorArg().getExtension(); if (extension.isLeft() && bundleExtensions.contains(extension.getLeft())) { nativeNode = Optional.of( (TargetNode<CxxLibraryDescription.CommonArg, ?>) targetGraph.get(bundle.getConstructorArg().getBinary())); } } return nativeNode; }
ImmutableSortedSet<JsLibrary> collect(Collection<BuildTarget> deps) { ImmutableSortedSet.Builder<JsLibrary> jsLibraries = ImmutableSortedSet.naturalOrder(); new AbstractBreadthFirstTraversal<BuildTarget>(deps) { @Override public Iterable<BuildTarget> visit(BuildTarget target) throws RuntimeException { final TargetNode<?, ?> targetNode = targetGraph.get(target); final Description<?> description = targetNode.getDescription(); if (description instanceof JsLibraryDescription) { final JsLibrary library = requireLibrary(target); jsLibraries.add(library); return getLibraryDependencies(library); } else if (description instanceof AndroidLibraryDescription || description instanceof AppleLibraryDescription) { return targetNode.getDeclaredDeps(); } return ImmutableList.of(); } }.start(); return jsLibraries.build(); }
@SuppressWarnings("unchecked") private Optional<ImmutableSet<Class<? extends Description<?>>>> getDescriptionClassFromParams( CommandRunnerParams params) { ImmutableSet<String> types = getTypes(); ImmutableSet.Builder<Class<? extends Description<?>>> descriptionClassesBuilder = ImmutableSet.builder(); for (String name : types) { try { KnownBuildRuleTypes knownBuildRuleTypes = params.getKnownBuildRuleTypesProvider().get(params.getCell()); BuildRuleType type = knownBuildRuleTypes.getBuildRuleType(name); Description<?> description = knownBuildRuleTypes.getDescription(type); descriptionClassesBuilder.add((Class<? extends Description<?>>) description.getClass()); } catch (IllegalArgumentException e) { params.getBuckEventBus().post(ConsoleEvent.severe("Invalid build rule type: " + name)); return Optional.empty(); } } return Optional.of(descriptionClassesBuilder.build()); }
/** * Create a Skylark definition for the {@code ruleClass} rule. * * <p>This makes functions like @{code java_library} available in build files. All they do is * capture passed attribute values in a map and adds them to the {@code ruleRegistry}. * * @param ruleClass The name of the rule to to define. * @return Skylark function to handle the Buck rule. */ private BuiltinFunction newRuleDefinition(Description<?> ruleClass) { String name = Description.getBuildRuleType(ruleClass).getName(); return new BuiltinFunction( name, FunctionSignature.KWARGS, BuiltinFunction.USE_AST_ENV, /*isRule=*/ true) { @SuppressWarnings({"unused"}) public Runtime.NoneType invoke( Map<String, Object> kwargs, FuncallExpression ast, Environment env) throws EvalException { ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder() .put("buck.base_path", env.lookup(Runtime.PKG_NAME)) .put("buck.type", name); ImmutableMap<String, ParamInfo> allParamInfo = CoercedTypeCache.INSTANCE.getAllParamInfo( typeCoercerFactory, ruleClass.getConstructorArgType()); populateAttributes(kwargs, builder, allParamInfo); throwOnMissingRequiredAttribute(kwargs, allParamInfo, getName(), ast); ParseContext parseContext = getParseContext(env, ast); parseContext.recordRule(builder.build()); return Runtime.NONE; } }; }
public DefaultProjectBuildFileParserFactory( ProjectFilesystem projectFilesystem, String pythonInterpreter, ImmutableSet<Description<?>> descriptions) { this.projectFilesystem = Preconditions.checkNotNull(projectFilesystem); this.pythonInterpreter = Preconditions.checkNotNull(pythonInterpreter); this.descriptions = Preconditions.checkNotNull(descriptions); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig config = context.getBuckConfig(); JavaBuckConfig javaConfig = config.getView(JavaBuckConfig.class); return Arrays.asList( new JarGenruleDescription(toolchainProvider, context.getSandboxExecutionStrategy()), new JavaBinaryDescription(toolchainProvider, javaConfig), new JavaAnnotationProcessorDescription(), new JavaLibraryDescription(toolchainProvider, javaConfig), new JavaTestDescription(toolchainProvider, javaConfig), new KeystoreDescription()); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig config = context.getBuckConfig(); ScalaBuckConfig scalaConfig = new ScalaBuckConfig(config); JavaBuckConfig javaConfig = config.getView(JavaBuckConfig.class); return Arrays.asList( new ScalaLibraryDescription(toolchainProvider, scalaConfig, javaConfig), new ScalaTestDescription(toolchainProvider, scalaConfig, javaConfig)); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig config = context.getBuckConfig(); GroovyBuckConfig groovyBuckConfig = new GroovyBuckConfig(config); JavaBuckConfig javaConfig = config.getView(JavaBuckConfig.class); return Arrays.asList( new GroovyLibraryDescription(toolchainProvider, groovyBuckConfig, javaConfig), new GroovyTestDescription(toolchainProvider, groovyBuckConfig, javaConfig)); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig config = context.getBuckConfig(); KotlinBuckConfig kotlinBuckConfig = new KotlinBuckConfig(config); JavaBuckConfig javaConfig = config.getView(JavaBuckConfig.class); return Arrays.asList( new KotlinLibraryDescription(toolchainProvider, kotlinBuckConfig, javaConfig), new KotlinTestDescription(toolchainProvider, kotlinBuckConfig, javaConfig)); }
private PrebuiltCxxLibraryPaths getPaths( BuildTarget target, AbstractPrebuiltCxxLibraryDescriptionArg args, Optional<String> versionSubDir) { if (args.isNewApiUsed() && args.isOldApiUsed()) { throw new HumanReadableException("%s: cannot use both old and new APIs", target); } if (args.isOldApiUsed()) { if (!cxxBuckConfig.isDeprecatedPrebuiltCxxLibraryApiEnabled()) { throw new HumanReadableException( "%s(%s) uses the deprecated API, but `cxx.enable_deprecated_prebuilt_cxx_library_api` " + "isn't set. Please see the `prebuilt_cxx_library` documentation for details and " + "examples on how to port to the new API.", Description.getBuildRuleType(this).toString(), target); } return DeprecatedPrebuiltCxxLibraryPaths.builder() .setTarget(target) .setVersionSubdir(versionSubDir) .setIncludeDirs(args.getIncludeDirs().orElse(ImmutableList.of())) .setLibDir(args.getLibDir()) .setLibName(args.getLibName()) .build(); } return NewPrebuiltCxxLibraryPaths.builder() .setTarget(target) .setHeaderDirs(args.getHeaderDirs()) .setPlatformHeaderDirs(args.getPlatformHeaderDirs()) .setVersionedHeaderDirs(args.getVersionedHeaderDirs()) .setSharedLib(args.getSharedLib()) .setPlatformSharedLib(args.getPlatformSharedLib()) .setVersionedSharedLib(args.getVersionedSharedLib()) .setStaticLib(args.getStaticLib()) .setPlatformStaticLib(args.getPlatformStaticLib()) .setVersionedStaticLib(args.getVersionedStaticLib()) .setStaticPicLib(args.getStaticPicLib()) .setPlatformStaticPicLib(args.getPlatformStaticPicLib()) .setVersionedStaticPicLib(args.getVersionedStaticPicLib()) .build(); }
private ProjectBuildFileParser createBuildFileParser( Cell cell, Iterable<Description<?>> descriptions) { return ProjectBuildFileParserFactory.createBuildFileParser( cell, this.parser.getTypeCoercerFactory(), console, eventBus, parserPythonInterpreterProvider, descriptions, enableProfiling); }
@Override public ImmutableMap<BuildTarget, Optional<TargetNode<?, ?>>> filter( Iterable<TargetNode<?, ?>> nodes) { ImmutableMap.Builder<BuildTarget, Optional<TargetNode<?, ?>>> resultBuilder = ImmutableMap.builder(); for (TargetNode<?, ?> node : nodes) { if (!onlyTests() || Description.getBuildRuleType(node.getDescription()).isTestRule()) { resultBuilder.put(node.getBuildTarget(), Optional.of(node)); } } return resultBuilder.build(); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig config = context.getBuckConfig(); SwiftBuckConfig swiftBuckConfig = new SwiftBuckConfig(config); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(config); return Collections.singleton( new SwiftLibraryDescription(toolchainProvider, cxxBuckConfig, swiftBuckConfig)); }
public static <A, B extends Description<A>> Iterable<BuildTarget> getDeps( TypeCoercerFactory typeCoercerFactory, TargetNode<A, B> node) { return Iterables.concat( node.getDeclaredDeps(), node.getExtraDeps(), getVersionedDeps(typeCoercerFactory, node).keySet()); }
private synchronized Path getPathToBuckPy(ImmutableSet<Description<?>> descriptions) throws IOException { if (buckPythonProgram == null) { buckPythonProgram = BuckPythonProgram.newInstance( typeCoercerFactory, descriptions, !options.getEnableProfiling()); } return buckPythonProgram.getExecutablePath(); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { GoBuckConfig goBuckConfig = new GoBuckConfig(context.getBuckConfig()); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(context.getBuckConfig()); ToolchainProvider toolchainProvider = context.getToolchainProvider(); return Arrays.asList( new GoBinaryDescription(goBuckConfig, toolchainProvider), new GoLibraryDescription(goBuckConfig, toolchainProvider), new CgoLibraryDescription(goBuckConfig, cxxBuckConfig, toolchainProvider), new GoTestDescription(goBuckConfig, toolchainProvider)); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); BuckConfig buckConfig = context.getBuckConfig(); DBuckConfig dBuckConfig = new DBuckConfig(buckConfig); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(buckConfig); return Arrays.asList( new DBinaryDescription(toolchainProvider, dBuckConfig, cxxBuckConfig), new DLibraryDescription(toolchainProvider, dBuckConfig, cxxBuckConfig), new DTestDescription(toolchainProvider, dBuckConfig, cxxBuckConfig)); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(context.getBuckConfig()); return Arrays.asList( new CxxLuaExtensionDescription(toolchainProvider, cxxBuckConfig), new LuaBinaryDescription(toolchainProvider, cxxBuckConfig), new LuaLibraryDescription()); }
@Override public ImmutableSortedSet<Flavor> addImplicitFlavors( ImmutableSortedSet<Flavor> argDefaultFlavors) { // Use defaults.apple_library if present, but fall back to defaults.cxx_library otherwise. return cxxLibraryImplicitFlavors.addImplicitFlavorsForRuleTypes( argDefaultFlavors, Description.getBuildRuleType(this), Description.getBuildRuleType(CxxLibraryDescription.class)); }
public static ImmutableSet<TargetNode<?, ?>> getRecursiveTargetNodeDependenciesOfTypes( final TargetGraph targetGraph, final Optional<AppleDependenciesCache> cache, final RecursiveDependenciesMode mode, final TargetNode<?, ?> targetNode, final Optional<ImmutableSet<Class<? extends Description<?>>>> descriptionClasses) { LOG.verbose( "Getting recursive dependencies of node %s, mode %s, including only types %s\n", targetNode, mode, descriptionClasses); Predicate<TargetNode<?, ?>> isDependencyNode = descriptionClasses .map( classes -> (Predicate<TargetNode<?, ?>>) node -> classes.contains(node.getDescription().getClass())) .orElse(x -> true); ImmutableSet<TargetNode<?, ?>> result = getRecursiveTargetNodeDependenciesOfTypes( targetGraph, cache, mode, targetNode, isDependencyNode); LOG.verbose( "Got recursive dependencies of node %s mode %s types %s: %s\n", targetNode, mode, descriptionClasses, result); return result; }
public static ImmutableSet<TargetNode<?, ?>> getRecursiveTargetNodeDependenciesOfTypes( TargetGraph targetGraph, Optional<AppleDependenciesCache> cache, RecursiveDependenciesMode mode, TargetNode<?, ?> input, ImmutableSet<Class<? extends Description<?>>> descriptionClasses) { return getRecursiveTargetNodeDependenciesOfTypes( targetGraph, cache, mode, input, Optional.of(descriptionClasses)); }
private static boolean canGenerateImplicitWorkspaceForDescription(Description<?> description) { // We weren't given a workspace target, but we may have been given something that could // still turn into a workspace (for example, a library or an actual app rule). If that's the // case we still want to generate a workspace. return description instanceof AppleBinaryDescription || description instanceof AppleBundleDescription || description instanceof AppleLibraryDescription; }
/** List of frameworks and libraries that goes into the "Link Binary With Libraries" phase. */ private Iterable<FrameworkPath> collectRecursiveFrameworkDependencies( TargetNode<?, ?> targetNode) { return FluentIterable.from( AppleBuildRules.getRecursiveTargetNodeDependenciesOfTypes( targetGraph, Optional.of(dependenciesCache), AppleBuildRules.RecursiveDependenciesMode.LINKING, targetNode, ImmutableSet.<Class<? extends Description<?>>>builder() .addAll(AppleBuildRules.XCODE_TARGET_DESCRIPTION_CLASSES) .add(PrebuiltAppleFrameworkDescription.class) .build())) .transformAndConcat( input -> { // Libraries and bundles which has system frameworks and libraries. Optional<TargetNode<CxxLibraryDescription.CommonArg, ?>> library = getLibraryNode(targetGraph, input); if (library.isPresent() && !AppleLibraryDescription.isNotStaticallyLinkedLibraryNode(library.get())) { return Iterables.concat( library.get().getConstructorArg().getFrameworks(), library.get().getConstructorArg().getLibraries()); } Optional<TargetNode<PrebuiltAppleFrameworkDescriptionArg, ?>> prebuilt = input.castArg(PrebuiltAppleFrameworkDescriptionArg.class); if (prebuilt.isPresent()) { return Iterables.concat( prebuilt.get().getConstructorArg().getFrameworks(), prebuilt.get().getConstructorArg().getLibraries(), ImmutableList.of( FrameworkPath.ofSourcePath( prebuilt.get().getConstructorArg().getFramework()))); } return ImmutableList.of(); }); }
@Override public ImmutableSortedSet<Flavor> addImplicitFlavors( ImmutableSortedSet<Flavor> argDefaultFlavors) { // Use defaults.apple_binary if present, but fall back to defaults.cxx_binary otherwise. return cxxBinaryImplicitFlavors.addImplicitFlavorsForRuleTypes( argDefaultFlavors, Description.getBuildRuleType(this), Description.getBuildRuleType(CxxBinaryDescription.class)); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); RustBuckConfig rustBuckConfig = new RustBuckConfig(context.getBuckConfig()); return Arrays.asList( new RustBinaryDescription(toolchainProvider, rustBuckConfig), new RustLibraryDescription(toolchainProvider, rustBuckConfig), new RustTestDescription(toolchainProvider, rustBuckConfig), new PrebuiltRustLibraryDescription()); }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { ToolchainProvider toolchainProvider = context.getToolchainProvider(); return Arrays.asList( new JsLibraryDescription(), new JsBundleGenruleDescription(toolchainProvider, context.getSandboxExecutionStrategy()), new JsBundleDescription(toolchainProvider)); }
JsLibrary verifyIsJsLibraryRule(BuildRule rule) { if (!(rule instanceof JsLibrary)) { BuildTarget target = rule.getBuildTarget(); throw new HumanReadableException( "js_library target '%s' can only depend on other js_library targets, but one of its " + "dependencies, '%s', is of type %s.", baseTarget, target, Description.getBuildRuleType(targetGraph.get(target).getDescription()).getName()); } return (JsLibrary) rule; }
@Override public Collection<Description<?>> getDescriptions(DescriptionCreationContext context) { BuckConfig buckConfig = context.getBuckConfig(); CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(buckConfig); HalideBuckConfig halideBuckConfig = new HalideBuckConfig(buckConfig); return Collections.singleton( new HalideLibraryDescription( context.getToolchainProvider(), cxxBuckConfig, halideBuckConfig)); }