本文整理汇总了Java中com.facebook.buck.model.Flavor类的典型用法代码示例。如果您正苦于以下问题:Java Flavor类的具体用法?Java Flavor怎么用?Java Flavor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Flavor类属于com.facebook.buck.model包,在下文中一共展示了Flavor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHeaderSymlinkTree
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
public static HeaderSymlinkTree createHeaderSymlinkTree(
BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
HeaderMode mode,
ImmutableMap<Path, SourcePath> headers,
HeaderVisibility headerVisibility,
Flavor... flavors) {
BuildTarget headerSymlinkTreeTarget =
CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(
buildTarget, headerVisibility, flavors);
Path headerSymlinkTreeRoot =
CxxDescriptionEnhancer.getHeaderSymlinkTreePath(
projectFilesystem, buildTarget, headerVisibility, flavors);
return CxxPreprocessables.createHeaderSymlinkTreeBuildRule(
headerSymlinkTreeTarget, projectFilesystem, headerSymlinkTreeRoot, headers, mode);
}
示例2: hasFlavors
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
@Override
public boolean hasFlavors(ImmutableSet<Flavor> flavors) {
if (FluentIterable.from(flavors).allMatch(SUPPORTED_FLAVORS::contains)) {
return true;
}
ImmutableSet<Flavor> delegateFlavors =
ImmutableSet.copyOf(Sets.difference(flavors, NON_DELEGATE_FLAVORS));
if (swiftDelegate.map(swift -> swift.hasFlavors(delegateFlavors)).orElse(false)) {
return true;
}
ImmutableList<ImmutableSortedSet<Flavor>> thinFlavorSets =
generateThinDelegateFlavors(delegateFlavors);
if (thinFlavorSets.size() > 0) {
return Iterables.all(thinFlavorSets, cxxBinaryFlavored::hasFlavors);
} else {
return cxxBinaryFlavored.hasFlavors(delegateFlavors);
}
}
示例3: createSharedLibraryBuildTarget
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
public static BuildTarget createSharedLibraryBuildTarget(
BuildTarget target, Flavor platform, Linker.LinkType linkType) {
Flavor linkFlavor;
switch (linkType) {
case SHARED:
linkFlavor = SHARED_FLAVOR;
break;
case MACH_O_BUNDLE:
linkFlavor = MACH_O_BUNDLE_FLAVOR;
break;
case EXECUTABLE:
default:
throw new IllegalStateException(
"Only SHARED and MACH_O_BUNDLE types expected, got: " + linkType);
}
return target.withAppendedFlavors(platform, linkFlavor);
}
示例4: getStaticLibraryPath
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
public static Path getStaticLibraryPath(
ProjectFilesystem filesystem,
BuildTarget target,
Flavor platform,
PicType pic,
Optional<String> staticLibraryBasename,
String extension,
String suffix,
boolean uniqueLibraryNameEnabled) {
String basename;
if (staticLibraryBasename.isPresent()) {
basename = staticLibraryBasename.get();
} else {
basename = getStaticLibraryBasename(target, suffix, uniqueLibraryNameEnabled);
}
String name = String.format("lib%s.%s", basename, extension);
return BuildTargets.getGenPath(
filesystem, createStaticLibraryBuildTarget(target, platform, pic), "%s")
.resolve(name);
}
示例5: addImplicitFlavorsForRuleTypes
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
public ImmutableSortedSet<Flavor> addImplicitFlavorsForRuleTypes(
ImmutableSortedSet<Flavor> argDefaultFlavors, BuildRuleType... types) {
Optional<Flavor> platformFlavor =
getCxxPlatformsProvider().getCxxPlatforms().getFlavor(argDefaultFlavors);
for (BuildRuleType type : types) {
ImmutableMap<String, Flavor> libraryDefaults =
cxxBuckConfig.getDefaultFlavorsForRuleType(type);
if (!platformFlavor.isPresent()) {
platformFlavor =
Optional.ofNullable(libraryDefaults.get(CxxBuckConfig.DEFAULT_FLAVOR_PLATFORM));
}
}
if (platformFlavor.isPresent()) {
return ImmutableSortedSet.of(platformFlavor.get());
} else {
// To avoid changing the output path of binaries built without a flavor,
// we'll default to no flavor, which implicitly builds the default platform.
return ImmutableSortedSet.of();
}
}
示例6: getJobArgs
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
private String getJobArgs(SourcePathResolver resolver, Path outputPath) {
ImmutableSortedSet<Flavor> flavors = getBuildTarget().getFlavors();
return JsonBuilder.object()
.addString("command", "library-files")
.addBoolean("release", flavors.contains(JsFlavors.RELEASE))
.addString("rootPath", getProjectFilesystem().getRootPath().toString())
.addString("platform", JsUtil.getPlatformString(flavors))
.addString("outputFilePath", outputPath.toString())
.addArray(
"sourceFilePaths",
sources
.stream()
.map(resolver::getAbsolutePath)
.map(Path::toString)
.collect(JsonBuilder.toArrayOfStrings()))
.toString();
}
示例7: createInputBasedRule
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
private static AbstractCachingBuildRuleWithInputs createInputBasedRule(
ProjectFilesystem filesystem,
BuildRuleResolver ruleResolver,
ImmutableSortedSet<BuildRule> deps,
List<Step> buildSteps,
ImmutableList<Step> postBuildSteps,
@Nullable String pathToOutputFile,
ImmutableList<Flavor> flavors,
ImmutableSortedSet<SourcePath> inputs,
ImmutableSortedSet<SourcePath> depfileInputs) {
BuildTarget buildTarget = BUILD_TARGET.withFlavors(flavors);
AbstractCachingBuildRuleWithInputs rule =
new AbstractCachingBuildRuleWithInputs(
buildTarget,
filesystem,
pathToOutputFile,
buildSteps,
postBuildSteps,
deps,
inputs,
depfileInputs);
ruleResolver.addToIndex(rule);
return rule;
}
示例8: requireTransitiveDependentLibraries
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
private <T extends BuildRule> ImmutableSet<T> requireTransitiveDependentLibraries(
final CxxPlatform cxxPlatform,
final Iterable<? extends BuildRule> deps,
final Flavor requiredFlavor,
final Class<T> ruleClass) {
final ImmutableSet.Builder<T> depsBuilder = ImmutableSet.builder();
new AbstractBreadthFirstTraversal<BuildRule>(deps) {
@Override
public Iterable<BuildRule> visit(BuildRule buildRule) {
if (buildRule instanceof CxxLibrary) {
CxxLibrary library = (CxxLibrary) buildRule;
depsBuilder.add(
(ruleClass.cast(library.requireBuildRule(requiredFlavor, cxxPlatform.getFlavor()))));
return buildRule.getBuildDeps();
}
return ImmutableSet.of();
}
}.start();
return depsBuilder.build();
}
示例9: hasFlavors
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
@Override
public boolean hasFlavors(final ImmutableSet<Flavor> flavors) {
if (appleLibraryDescription.hasFlavors(flavors)) {
return true;
}
ImmutableSet.Builder<Flavor> flavorBuilder = ImmutableSet.builder();
for (Flavor flavor : flavors) {
if (AppleDebugFormat.FLAVOR_DOMAIN.getFlavors().contains(flavor)) {
continue;
}
if (AppleDescriptions.INCLUDE_FRAMEWORKS.getFlavors().contains(flavor)) {
continue;
}
flavorBuilder.add(flavor);
}
return appleBinaryDescription.hasFlavors(flavorBuilder.build());
}
示例10: LibraryFilesBuilder
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
public LibraryFilesBuilder(
BuildRuleResolver resolver,
BuildTarget baseTarget,
BuildRuleParams baseParams,
ImmutableBiMap<Either<SourcePath, Pair<SourcePath, String>>, Flavor> sourcesToFlavors) {
this.resolver = resolver;
this.baseTarget = baseTarget;
this.sourcesToFlavors = sourcesToFlavors;
// Platform information is only relevant when building release-optimized files.
// Stripping platform targets from individual files allows us to use the base version of
// every file in the build for all supported platforms, leading to improved cache reuse.
this.fileBaseTarget =
!baseTarget.getFlavors().contains(JsFlavors.RELEASE)
? baseTarget.withFlavors()
: baseTarget;
this.baseParams = baseParams;
}
示例11: runAndAssertSpinningTestTimesOutWithPerRuleTimeout
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
private void runAndAssertSpinningTestTimesOutWithPerRuleTimeout(
ImmutableSet<Flavor> targetFlavors) throws IOException {
assumeThat(Platform.detect(), Matchers.oneOf(Platform.LINUX, Platform.MACOS));
ProjectWorkspace workspace =
TestDataHelper.createProjectWorkspaceForScenario(
this, "slow_cxx_tests_per_rule_timeout", temp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//:spinning");
target = target.withFlavors(targetFlavors);
ProcessResult result = workspace.runBuckCommand("test", target.getFullyQualifiedName());
result.assertSpecialExitCode("test should fail", ExitCode.TEST_ERROR);
String stderr = result.getStderr();
assertThat(stderr, Matchers.containsString("Timed out after 100 ms running test command"));
}
示例12: getApplePlatformForTarget
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
private Optional<ApplePlatform> getApplePlatformForTarget(
BuildTarget buildTarget, FlavorDomain<AppleCxxPlatform> appleCxxPlatformsFlavorDomain) {
CxxPlatformsProvider cxxPlatformsProvider = getCxxPlatformsProvider();
FlavorDomain<CxxPlatform> cxxPlatforms = cxxPlatformsProvider.getCxxPlatforms();
Flavor defaultCxxFlavor = cxxPlatformsProvider.getDefaultCxxPlatform().getFlavor();
CxxPlatform cxxPlatform =
cxxPlatforms.getValue(buildTarget).orElse(cxxPlatforms.getValue(defaultCxxFlavor));
if (!appleCxxPlatformsFlavorDomain.contains(cxxPlatform.getFlavor())) {
return Optional.empty();
}
return Optional.of(
appleCxxPlatformsFlavorDomain
.getValue(cxxPlatform.getFlavor())
.getAppleSdk()
.getApplePlatform());
}
示例13: generateThinFlavors
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
/**
* Expand flavors representing a fat binary into its thin binary equivalents.
*
* <p>Useful when dealing with functions unaware of fat binaries.
*
* <p>This does not actually check that the particular flavor set is valid.
*/
public static ImmutableList<ImmutableSortedSet<Flavor>> generateThinFlavors(
Set<Flavor> platformFlavors, SortedSet<Flavor> flavors) {
Set<Flavor> platformFreeFlavors = Sets.difference(flavors, platformFlavors);
ImmutableList.Builder<ImmutableSortedSet<Flavor>> thinTargetsBuilder = ImmutableList.builder();
for (Flavor flavor : flavors) {
if (platformFlavors.contains(flavor)) {
thinTargetsBuilder.add(
ImmutableSortedSet.<Flavor>naturalOrder()
.addAll(platformFreeFlavors)
.add(flavor)
.build());
}
}
return thinTargetsBuilder.build();
}
示例14: getTranslateBuildTarget
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
/**
* @return the {@link BuildTarget} to use in the resolved target graph, formed by adding a flavor
* generated from the given version selections.
*/
private Optional<BuildTarget> getTranslateBuildTarget(
TargetNode<?, ?> node, ImmutableMap<BuildTarget, Version> selectedVersions) {
BuildTarget originalTarget = node.getBuildTarget();
node = resolveVersions(node, selectedVersions);
BuildTarget newTarget = node.getBuildTarget();
if (TargetGraphVersionTransformations.isVersionPropagator(node)) {
VersionInfo info = getVersionInfo(node);
Collection<BuildTarget> versionedDeps = info.getVersionDomain().keySet();
TreeMap<BuildTarget, Version> versions = new TreeMap<>();
for (BuildTarget depTarget : versionedDeps) {
versions.put(depTarget, selectedVersions.get(depTarget));
}
if (!versions.isEmpty()) {
Flavor versionedFlavor = getVersionedFlavor(versions);
newTarget = node.getBuildTarget().withAppendedFlavors(versionedFlavor);
}
}
return newTarget.equals(originalTarget) ? Optional.empty() : Optional.of(newTarget);
}
示例15: createCompileBuildTarget
import com.facebook.buck.model.Flavor; //导入依赖的package包/类
/**
* @return a build target for a {@link CxxCompile} rule for the source with the given name.
*/
public static BuildTarget createCompileBuildTarget(
BuildTarget target,
String name) {
return BuildTargets.extendFlavoredBuildTarget(
target,
new Flavor(String.format(
"compile-%s",
getOutputName(name).replace('/', '-').replace('.', '-'))));
}