本文整理汇总了Java中org.gradle.platform.base.ComponentSpecContainer类的典型用法代码示例。如果您正苦于以下问题:Java ComponentSpecContainer类的具体用法?Java ComponentSpecContainer怎么用?Java ComponentSpecContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentSpecContainer类属于org.gradle.platform.base包,在下文中一共展示了ComponentSpecContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachBinariesToAssembleLifecycle
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Mutate
void attachBinariesToAssembleLifecycle(@Path("tasks.assemble") Task assemble, ComponentSpecContainer components) {
List<BinarySpecInternal> notBuildable = Lists.newArrayList();
boolean hasBuildableBinaries = false;
for (VariantComponentSpec component : components.withType(VariantComponentSpec.class)) {
for (BinarySpecInternal binary : component.getBinaries().withType(BinarySpecInternal.class)) {
if (binary.isBuildable()) {
assemble.dependsOn(binary);
hasBuildableBinaries = true;
} else {
notBuildable.add(binary);
}
}
}
if (!hasBuildableBinaries && !notBuildable.isEmpty()) {
assemble.doFirst(new CheckForNotBuildableBinariesAction(notBuildable));
}
}
示例2: getBinaries
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Nullable
@Override
public DomainObjectSet<NativeLibraryBinary> getBinaries(LibraryIdentifier libraryIdentifier) {
ModelRegistry projectModel = projectModelResolver.resolveProjectModel(libraryIdentifier.getProjectPath());
ComponentSpecContainer components = projectModel.find("components", ComponentSpecContainer.class);
if (components == null) {
return null;
}
String libraryName = libraryIdentifier.getLibraryName();
NativeLibrarySpec library = components.withType(NativeLibrarySpec.class).get(libraryName);
if (library == null) {
return null;
}
ModelMap<NativeBinarySpec> projectBinaries = library.getBinaries().withType(NativeBinarySpec.class);
DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
for (NativeBinarySpec nativeBinarySpec : projectBinaries.values()) {
binaries.add((NativeLibraryBinary) nativeBinarySpec);
}
return binaries;
}
示例3: createBuildDependentComponentsTasks
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
public static void createBuildDependentComponentsTasks(ModelMap<Task> tasks, ComponentSpecContainer components) {
for (final VariantComponentSpec component : components.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class)) {
tasks.create(getAssembleDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
@Override
public void execute(DefaultTask assembleDependents) {
assembleDependents.setGroup("Build Dependents");
assembleDependents.setDescription("Assemble dependents of " + component.getDisplayName() + ".");
}
});
tasks.create(getBuildDependentComponentsTaskName(component), DefaultTask.class, new Action<DefaultTask>() {
@Override
public void execute(DefaultTask buildDependents) {
buildDependents.setGroup("Build Dependents");
buildDependents.setDescription("Build dependents of " + component.getDisplayName() + ".");
}
});
}
}
示例4: configurePrefixHeaderGenerationTasks
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Mutate
void configurePrefixHeaderGenerationTasks(final TaskContainer tasks, ComponentSpecContainer components) {
for (final SourceComponentSpec nativeComponentSpec : components.withType(SourceComponentSpec.class).values()) {
for (final DependentSourceSetInternal dependentSourceSet : nativeComponentSpec.getSources().withType(DependentSourceSetInternal.class).values()) {
if (dependentSourceSet.getPrefixHeaderFile() != null) {
String taskName = "generate" + StringUtils.capitalize(nativeComponentSpec.getName()) + StringUtils.capitalize(dependentSourceSet.getName()) + "PrefixHeaderFile";
tasks.create(taskName, PrefixHeaderFileGenerateTask.class, new Action<PrefixHeaderFileGenerateTask>() {
@Override
public void execute(PrefixHeaderFileGenerateTask prefixHeaderFileGenerateTask) {
prefixHeaderFileGenerateTask.setPrefixHeaderFile(dependentSourceSet.getPrefixHeaderFile());
prefixHeaderFileGenerateTask.setHeader(dependentSourceSet.getPreCompiledHeader());
}
});
}
}
}
}
示例5: apply
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
public void apply(final Project project) {
project.getPlugins().apply(ComponentModelBasePlugin.class);
ComponentSpecContainer componentSpecs = project.getExtensions().getByType(ComponentSpecContainer.class);
final ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
componentSpecs.registerFactory(JvmLibrarySpec.class, new NamedDomainObjectFactory<JvmLibrarySpec>() {
public JvmLibrarySpec create(String name) {
ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(project.getPath(), name);
return new DefaultJvmLibrarySpec(id, sources.maybeCreate(name));
}
});
final NamedDomainObjectContainer<JvmLibrarySpec> jvmLibraries = componentSpecs.containerWithType(JvmLibrarySpec.class);
project.getExtensions().create("jvm", DefaultJvmComponentExtension.class, jvmLibraries);
}
示例6: apply
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
public void apply(final ProjectInternal project) {
project.getPlugins().apply(ComponentModelBasePlugin.class);
ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
ComponentSpecContainer components = project.getExtensions().getByType(ComponentSpecContainer.class);
components.registerFactory(NativeExecutableSpec.class, new NativeExecutableSpecFactory(instantiator, sources, project));
NamedDomainObjectContainer<NativeExecutableSpec> nativeExecutables = components.containerWithType(NativeExecutableSpec.class);
components.registerFactory(NativeLibrarySpec.class, new NativeLibrarySpecFactory(instantiator, sources, project));
NamedDomainObjectContainer<NativeLibrarySpec> nativeLibraries = components.containerWithType(NativeLibrarySpec.class);
project.getExtensions().create("nativeRuntime", DefaultNativeComponentExtension.class, nativeExecutables, nativeLibraries);
// TODO:DAZ Remove these: should not pollute the global namespace
project.getExtensions().add("nativeComponents", components.withType(NativeComponentSpec.class));
project.getExtensions().add("executables", nativeExecutables);
project.getExtensions().add("libraries", nativeLibraries);
}
示例7: collectBinaries
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Mutate
void collectBinaries(BinaryContainer binaries, ComponentSpecContainer componentSpecs) {
for (VariantComponentSpec componentSpec : componentSpecs.withType(VariantComponentSpec.class)) {
for (BinarySpecInternal binary : componentSpec.getBinaries().withType(BinarySpecInternal.class).values()) {
binaries.put(binary.getProjectScopedName(), binary);
}
}
}
示例8: getAllComponents
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
public static Set<ComponentSpec> getAllComponents(ModelRegistry registry) {
Set<ComponentSpec> components = Sets.newLinkedHashSet();
ComponentSpecContainer componentSpecs = modelElement(registry, "components", ComponentSpecContainer.class);
if (componentSpecs != null) {
components.addAll(componentSpecs.values());
}
return components;
}
示例9: report
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@TaskAction
public void report() {
Project project = getProject();
StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
renderer.setOutput(textOutput);
renderer.startProject(project);
Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
ComponentSpecContainer componentSpecs = modelElement("components", ComponentSpecContainer.class);
if (componentSpecs != null) {
components.addAll(componentSpecs.values());
}
ModelMap<ComponentSpec> testSuites = modelElement("testSuites", modelMap(ComponentSpec.class));
if (testSuites != null) {
components.addAll(testSuites.values());
}
renderer.renderComponents(components);
ProjectSourceSet sourceSets = modelElement("sources", ProjectSourceSet.class);
if (sourceSets != null) {
renderer.renderSourceSets(sourceSets);
}
BinaryContainer binaries = modelElement("binaries", BinaryContainer.class);
if (binaries != null) {
renderer.renderBinaries(binaries.values());
}
renderer.completeProject(project);
renderer.complete();
}
示例10: createModelBuilder
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
private ModelBuilder createModelBuilder() {
AndroidBuilder androidBuilder = registry.realize(
new ModelPath(ANDROID_BUILDER),
ModelType.of(AndroidBuilder.class));
DefaultAndroidComponentSpec componentSpec = (DefaultAndroidComponentSpec) registry.realize(
new ModelPath(COMPONENTS),
ModelType.of(ComponentSpecContainer.class))
.get(AndroidComponentModelPlugin.COMPONENT_NAME);
VariantManager variantManager = componentSpec.getVariantManager();
TaskManager taskManager = registry.realize(
new ModelPath(TASK_MANAGER),
ModelType.of(TaskManager.class));
AndroidConfig extension = registry.realize(
new ModelPath(ANDROID_CONFIG_ADAPTOR),
ModelType.of(AndroidConfig.class));
ExtraModelInfo extraModelInfo = registry.realize(
new ModelPath(EXTRA_MODEL_INFO),
ModelType.of(ExtraModelInfo.class));
Boolean isApplication = registry.realize(
new ModelPath(IS_APPLICATION),
ModelType.of(Boolean.class));
NdkHandler ndkHandler = registry.realize(
new ModelPath(NDK_HANDLER),
ModelType.of(NdkHandler.class));
BinaryContainer binaries = registry.realize(
new ModelPath(BINARIES),
ModelType.of(BinaryContainer.class));
return new ModelBuilder(
androidBuilder, variantManager, taskManager,
extension, extraModelInfo, ndkHandler,
new ComponentNativeLibraryFactory(binaries, ndkHandler),
!isApplication);
}
示例11: createNativeLibrary
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Mutate
public void createNativeLibrary(
final ComponentSpecContainer specs,
@Path("android.ndk") final NdkConfig ndkConfig,
final NdkHandler ndkHandler,
@Path("android.sources") final AndroidComponentModelSourceSet sources,
@Path("buildDir") final File buildDir) {
if (!ndkHandler.isNdkDirConfigured()) {
return;
}
if (!ndkConfig.getModuleName().isEmpty()) {
specs.create(
ndkConfig.getModuleName(),
NativeLibrarySpec.class,
new Action<NativeLibrarySpec>() {
@Override
public void execute(final NativeLibrarySpec nativeLib) {
((DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME))
.setNativeLibrary(nativeLib);
NdkConfiguration.configureProperties(
nativeLib,
sources,
buildDir,
ndkHandler);
}
});
DefaultAndroidComponentSpec androidSpecs =
(DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME);
androidSpecs.setNativeLibrary(
(NativeLibrarySpec) specs.get(ndkConfig.getModuleName()));
}
}
示例12: configureNativeBinary
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Mutate
public void configureNativeBinary(
BinaryContainer binaries,
ComponentSpecContainer specs,
@Path("android.ndk") final NdkConfig ndkConfig,
@Path("buildDir") final File buildDir,
final NdkHandler ndkHandler) {
if (!ndkConfig.getModuleName().isEmpty()) {
final NativeLibrarySpec library = specs.withType(NativeLibrarySpec.class)
.get(ndkConfig.getModuleName());
binaries.withType(DefaultAndroidBinary.class, new Action<DefaultAndroidBinary>() {
@Override
public void execute(DefaultAndroidBinary binary) {
binary.computeMergedNdk(
ndkConfig,
binary.getProductFlavors(),
binary.getBuildType());
Collection<SharedLibraryBinarySpec> nativeBinaries =
getNativeBinaries(
library,
binary.getBuildType(),
binary.getProductFlavors());
binary.getNativeBinaries().addAll(nativeBinaries);
for (SharedLibraryBinarySpec nativeBin : nativeBinaries) {
NdkConfiguration.configureBinary(
nativeBin,
buildDir,
binary.getMergedNdkConfig(),
ndkHandler);
}
}
});
}
}
示例13: getBinaries
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
public DomainObjectSet<NativeLibraryBinary> getBinaries(NativeLibraryRequirement requirement) {
Project project = findProject(requirement);
ComponentSpecContainer componentSpecContainer = project.getExtensions().findByType(ComponentSpecContainer.class);
if (componentSpecContainer == null) {
throw new LibraryResolveException(String.format("Project does not have a libraries container: '%s'", project.getPath()));
}
DomainObjectSet<NativeBinarySpec> projectBinaries = componentSpecContainer.withType(NativeLibrarySpec.class).getByName(requirement.getLibraryName()).getNativeBinaries();
DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
// TODO:DAZ Convert, don't cast
for (NativeBinarySpec nativeBinarySpec : projectBinaries) {
binaries.add((NativeLibraryBinary) nativeBinarySpec);
}
return binaries;
}
示例14: report
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@TaskAction
public void report() {
Project project = getProject();
StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver());
renderer.setOutput(textOutput);
renderer.startProject(project);
Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
ComponentSpecContainer componentSpecs = project.getExtensions().findByType(ComponentSpecContainer.class);
if (componentSpecs != null) {
components.addAll(componentSpecs);
}
try {
TestSuiteContainer testSuites = getModelRegistry().get(ModelPath.path("testSuites"), ModelType.of(TestSuiteContainer.class));
components.addAll(testSuites);
} catch (IllegalStateException e) {
// TODO - need a better contract here
// Ignore for now
}
renderer.renderComponents(components);
ProjectSourceSet sourceSets = project.getExtensions().findByType(ProjectSourceSet.class);
if (sourceSets != null) {
renderer.renderSourceSets(sourceSets);
}
BinaryContainer binaries = project.getExtensions().findByType(BinaryContainer.class);
if (binaries != null) {
renderer.renderBinaries(binaries);
}
renderer.completeProject(project);
renderer.complete();
}
示例15: components
import org.gradle.platform.base.ComponentSpecContainer; //导入依赖的package包/类
@Model
void components(ComponentSpecContainer componentSpecs) {
}