Search in sources :

Example 1 with NativeComponentSpec

use of org.gradle.nativeplatform.NativeComponentSpec in project gradle by gradle.

the class NativeTestSuiteBinaryRenderer method renderDetails.

@Override
protected void renderDetails(NativeTestSuiteBinarySpec binary, TextReportBuilder builder) {
    NativeTestSuiteSpec testSuite = binary.getTestSuite();
    NativeComponentSpec testedComponent = testSuite.getTestedComponent();
    if (testedComponent != null) {
        builder.item("component under test", testedComponent.getDisplayName());
    }
    NativeBinarySpec testedBinary = binary.getTestedBinary();
    if (testedBinary != null) {
        builder.item("binary under test", testedBinary.getDisplayName());
    }
    super.renderDetails(binary, builder);
}
Also used : NativeTestSuiteSpec(org.gradle.nativeplatform.test.NativeTestSuiteSpec) NativeComponentSpec(org.gradle.nativeplatform.NativeComponentSpec) NativeBinarySpec(org.gradle.nativeplatform.NativeBinarySpec)

Example 2 with NativeComponentSpec

use of org.gradle.nativeplatform.NativeComponentSpec in project gradle by gradle.

the class NativeDependentBinariesResolutionStrategy method buildState.

private State buildState() {
    State state = new State();
    List<ProjectInternal> orderedProjects = Ordering.usingToString().sortedCopy(projectRegistry.getAllProjects());
    for (ProjectInternal project : orderedProjects) {
        if (project.getPlugins().hasPlugin(ComponentModelBasePlugin.class)) {
            ModelRegistry modelRegistry = projectModelResolver.resolveProjectModel(project.getPath());
            ModelMap<NativeComponentSpec> components = modelRegistry.realize("components", ModelTypes.modelMap(NativeComponentSpec.class));
            for (NativeBinarySpecInternal binary : allBinariesOf(components.withType(VariantComponentSpec.class))) {
                state.registerBinary(binary);
            }
            ModelMap<Object> testSuites = modelRegistry.find("testSuites", ModelTypes.modelMap(Object.class));
            if (testSuites != null) {
                for (NativeBinarySpecInternal binary : allBinariesOf(testSuites.withType(NativeComponentSpec.class).withType(VariantComponentSpec.class))) {
                    state.registerBinary(binary);
                }
            }
        }
    }
    for (NativeBinarySpecInternal nativeBinary : state.dependencies.keySet()) {
        for (NativeLibraryBinary libraryBinary : nativeBinary.getDependentBinaries()) {
            // Skip prebuilt libraries
            if (libraryBinary instanceof NativeBinarySpecInternal) {
                // Unfortunate cast! see LibraryBinaryLocator
                state.dependencies.get(nativeBinary).add((NativeBinarySpecInternal) libraryBinary);
            }
        }
        if (testSupport != null) {
            state.dependencies.get(nativeBinary).addAll(testSupport.getTestDependencies(nativeBinary));
        }
    }
    return state;
}
Also used : NativeLibraryBinary(org.gradle.nativeplatform.NativeLibraryBinary) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) NativeComponentSpec(org.gradle.nativeplatform.NativeComponentSpec) ProjectInternal(org.gradle.api.internal.project.ProjectInternal)

Aggregations

NativeComponentSpec (org.gradle.nativeplatform.NativeComponentSpec)2 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)1 NativeBinarySpec (org.gradle.nativeplatform.NativeBinarySpec)1 NativeLibraryBinary (org.gradle.nativeplatform.NativeLibraryBinary)1 NativeTestSuiteSpec (org.gradle.nativeplatform.test.NativeTestSuiteSpec)1 VariantComponentSpec (org.gradle.platform.base.VariantComponentSpec)1