org.gradle.platform.base.BinaryContainer Java Examples

The following examples show how to use org.gradle.platform.base.BinaryContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: pushfish-android   Author: PushFish   File: JvmComponentPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder,
                           NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);

    List<Action<? super JarBinarySpec>> actions = Lists.newArrayList();
    actions.add(new JarBinarySpecInitializer(buildDir));
    actions.add(new MarkBinariesBuildable());
    Action<JarBinarySpec> initAction = Actions.composite(actions);
    JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction);

    Action<JvmLibrarySpec> createBinariesAction =
            new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms);

    for (JvmLibrarySpec jvmLibrary : libraries) {
        createBinariesAction.execute(jvmLibrary);
        binaries.addAll(jvmLibrary.getBinaries());
    }
}
 
Example #2
Source Project: pushfish-android   Author: PushFish   File: LanguageBasePlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) {
    Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME);
    for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
        if (!binary.isLegacyBinary()) {
            Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName());
            binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
            binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary));
            binary.setBuildTask(binaryLifecycleTask);

            if (binary.isBuildable()) {
                assembleTask.dependsOn(binary);
            }
        }
    }
}
 
Example #3
Source Project: pushfish-android   Author: PushFish   File: NativeBinariesTestPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Finalize
public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary;
        final BinaryNamingScheme namingScheme = binary.getNamingScheme();

        RunTestExecutable runTask = tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class);
        final Project project = runTask.getProject();
        runTask.setDescription(String.format("Runs the %s", binary.getNamingScheme().getDescription()));

        final InstallExecutable installTask = binary.getTasks().withType(InstallExecutable.class).iterator().next();
        runTask.getInputs().files(installTask.getOutputs().getFiles());
        runTask.setExecutable(installTask.getRunScript().getPath());
        runTask.setOutputDir(new File(project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase()));
    }
}
 
Example #4
Source Project: pushfish-android   Author: PushFish   File: NativeComponentModelPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
public void createNativeBinaries(BinaryContainer binaries, NamedDomainObjectSet<NativeComponentSpec> nativeComponents,
                                 LanguageRegistry languages, NativeToolChainRegistryInternal toolChains,
                                 PlatformContainer platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
                                 ServiceRegistry serviceRegistry, @Path("buildDir") File buildDir) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    NativeDependencyResolver resolver = serviceRegistry.get(NativeDependencyResolver.class);
    Action<NativeBinarySpec> configureBinaryAction = new NativeBinarySpecInitializer(buildDir);
    Action<NativeBinarySpec> setToolsAction = new ToolSettingNativeBinaryInitializer(languages);
    Action<NativeBinarySpec> setDefaultTargetsAction = new ToolSettingNativeBinaryInitializer(languages);
    @SuppressWarnings("unchecked") Action<NativeBinarySpec> initAction = Actions.composite(configureBinaryAction, setToolsAction, new MarkBinariesBuildable());
    NativeBinariesFactory factory = new DefaultNativeBinariesFactory(instantiator, initAction, resolver);
    BinaryNamingSchemeBuilder namingSchemeBuilder = new DefaultBinaryNamingSchemeBuilder();
    Action<NativeComponentSpec> createBinariesAction =
            new NativeComponentSpecInitializer(factory, namingSchemeBuilder, toolChains, platforms, buildTypes, flavors);

    for (NativeComponentSpec component : nativeComponents) {
        createBinariesAction.execute(component);
        binaries.addAll(component.getBinaries());
    }
}
 
Example #5
Source Project: pushfish-android   Author: PushFish   File: LegacyJavaComponentPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final Project target) {

        target.getPlugins().apply(LanguageBasePlugin.class);
        BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class);
        binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() {
            public ClassDirectoryBinarySpec create(String name) {
                return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current()));
            }
        });

        binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() {
            public void execute(ClassDirectoryBinarySpecInternal binary) {
                createBinaryLifecycleTask(binary, target);
                setClassesDirConvention(binary, target);
                createProcessResourcesTaskForBinary(binary, target);
                createCompileJavaTaskForBinary(binary, target);
            }
        });
    }
 
Example #6
Source Project: javaide   Author: tranleduy2000   File: BaseComponentModelPlugin.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void createBinaryTasks(
        final ModelMap<Task> tasks,
        BinaryContainer binaries,
        ModelMap<AndroidComponentSpec> specs,
        TaskManager taskManager) {
    final VariantManager variantManager =
            ((DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME)).getVariantManager();
    binaries.withType(AndroidBinary.class, new Action<AndroidBinary>() {
        @Override
        public void execute(AndroidBinary androidBinary) {
            DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
            variantManager.createTasksForVariantData(
                    new TaskModelMapAdaptor(tasks),
                    binary.getVariantData());
        }
    });
}
 
Example #7
Source Project: Pushjet-Android   Author: Pushjet   File: JvmComponentPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder,
                           NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);

    List<Action<? super JarBinarySpec>> actions = Lists.newArrayList();
    actions.add(new JarBinarySpecInitializer(buildDir));
    actions.add(new MarkBinariesBuildable());
    Action<JarBinarySpec> initAction = Actions.composite(actions);
    JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction);

    Action<JvmLibrarySpec> createBinariesAction =
            new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms);

    for (JvmLibrarySpec jvmLibrary : libraries) {
        createBinariesAction.execute(jvmLibrary);
        binaries.addAll(jvmLibrary.getBinaries());
    }
}
 
Example #8
Source Project: Pushjet-Android   Author: Pushjet   File: LanguageBasePlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) {
    Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME);
    for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
        if (!binary.isLegacyBinary()) {
            Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName());
            binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
            binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary));
            binary.setBuildTask(binaryLifecycleTask);

            if (binary.isBuildable()) {
                assembleTask.dependsOn(binary);
            }
        }
    }
}
 
Example #9
Source Project: Pushjet-Android   Author: Pushjet   File: NativeBinariesTestPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Finalize
public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary;
        final BinaryNamingScheme namingScheme = binary.getNamingScheme();

        RunTestExecutable runTask = tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class);
        final Project project = runTask.getProject();
        runTask.setDescription(String.format("Runs the %s", binary.getNamingScheme().getDescription()));

        final InstallExecutable installTask = binary.getTasks().withType(InstallExecutable.class).iterator().next();
        runTask.getInputs().files(installTask.getOutputs().getFiles());
        runTask.setExecutable(installTask.getRunScript().getPath());
        runTask.setOutputDir(new File(project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase()));
    }
}
 
Example #10
Source Project: Pushjet-Android   Author: Pushjet   File: NativeComponentModelPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Mutate
public void createNativeBinaries(BinaryContainer binaries, NamedDomainObjectSet<NativeComponentSpec> nativeComponents,
                                 LanguageRegistry languages, NativeToolChainRegistryInternal toolChains,
                                 PlatformContainer platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
                                 ServiceRegistry serviceRegistry, @Path("buildDir") File buildDir) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    NativeDependencyResolver resolver = serviceRegistry.get(NativeDependencyResolver.class);
    Action<NativeBinarySpec> configureBinaryAction = new NativeBinarySpecInitializer(buildDir);
    Action<NativeBinarySpec> setToolsAction = new ToolSettingNativeBinaryInitializer(languages);
    Action<NativeBinarySpec> setDefaultTargetsAction = new ToolSettingNativeBinaryInitializer(languages);
    @SuppressWarnings("unchecked") Action<NativeBinarySpec> initAction = Actions.composite(configureBinaryAction, setToolsAction, new MarkBinariesBuildable());
    NativeBinariesFactory factory = new DefaultNativeBinariesFactory(instantiator, initAction, resolver);
    BinaryNamingSchemeBuilder namingSchemeBuilder = new DefaultBinaryNamingSchemeBuilder();
    Action<NativeComponentSpec> createBinariesAction =
            new NativeComponentSpecInitializer(factory, namingSchemeBuilder, toolChains, platforms, buildTypes, flavors);

    for (NativeComponentSpec component : nativeComponents) {
        createBinariesAction.execute(component);
        binaries.addAll(component.getBinaries());
    }
}
 
Example #11
Source Project: Pushjet-Android   Author: Pushjet   File: LegacyJavaComponentPlugin.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final Project target) {

        target.getPlugins().apply(LanguageBasePlugin.class);
        BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class);
        binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() {
            public ClassDirectoryBinarySpec create(String name) {
                return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current()));
            }
        });

        binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() {
            public void execute(ClassDirectoryBinarySpecInternal binary) {
                createBinaryLifecycleTask(binary, target);
                setClassesDirConvention(binary, target);
                createProcessResourcesTaskForBinary(binary, target);
                createCompileJavaTaskForBinary(binary, target);
            }
        });
    }
 
Example #12
Source Project: pushfish-android   Author: PushFish   File: JvmComponentPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
    for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
        Task jarTask = createJarTask(tasks, projectJarBinary);
        projectJarBinary.builtBy(jarTask);
        projectJarBinary.getTasks().add(jarTask);
    }
}
 
Example #13
public void mutate(TaskContainer container, Inputs inputs) {
    BinaryContainer binaries = inputs.get(0, ModelType.of(BinaryContainer.class)).getInstance();
    for (T binary : binaries.withType(binaryType)) {
        NamedEntityInstantiator<Task> instantiator = new Instantiator<Task>(binary, container);
        DefaultCollectionBuilder<Task> collectionBuilder = new DefaultCollectionBuilder<Task>(
                getSubject().getPath(),
                instantiator,
                new SimpleModelRuleDescriptor("Project.<init>.tasks()"),
                inputs,
                modelRegistry);

        invoke(inputs, collectionBuilder, binary, binaries);
    }
}
 
Example #14
private <T extends BinarySpec, U extends BaseBinarySpec> void doRegister(BinaryContainer binaries, ModelType<T> type, final ModelType<U> implementation) {
    binaries.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            BinaryNamingScheme binaryNamingScheme = new DefaultBinaryNamingSchemeBuilder()
                    .withComponentName(name)
                    .build();

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseBinarySpec.create(implementation.getConcreteClass(), binaryNamingScheme, instantiator);

            return created;
        }
    });
}
 
Example #15
Source Project: pushfish-android   Author: PushFish   File: LanguageBasePlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project target) {
    target.getPlugins().apply(LifecycleBasePlugin.class);

    target.getExtensions().create("sources", DefaultProjectSourceSet.class, instantiator);
    DefaultBinaryContainer binaries = target.getExtensions().create("binaries", DefaultBinaryContainer.class, instantiator);

    modelRegistry.create(
            ModelCreators.of(ModelReference.of("binaries", BinaryContainer.class), binaries)
                    .simpleDescriptor("Project.<init>.binaries()")
                    .withProjection(new PolymorphicDomainObjectContainerModelProjection<DefaultBinaryContainer, BinarySpec>(binaries, BinarySpec.class))
                    .build()
    );


}
 
Example #16
Source Project: pushfish-android   Author: PushFish   File: VisualStudioPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
public static void createVisualStudioModelForBinaries(VisualStudioExtensionInternal visualStudioExtension, BinaryContainer binaryContainer) {
    for (NativeBinarySpec binary : binaryContainer.withType(NativeBinarySpec.class)) {
        VisualStudioProjectConfiguration configuration = visualStudioExtension.getProjectRegistry().addProjectConfiguration(binary);

        // Only create a solution if one of the binaries is buildable
        if (binary.isBuildable()) {
            DefaultVisualStudioProject visualStudioProject = configuration.getProject();
            visualStudioExtension.getSolutionRegistry().addSolution(visualStudioProject);
        }
    }
}
 
Example #17
Source Project: pushfish-android   Author: PushFish   File: CUnitPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
public void createCUnitTestBinaries(final BinaryContainer binaries, TestSuiteContainer testSuites, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry) {
    for (final CUnitTestSuiteSpec cUnitTestSuite : testSuites.withType(CUnitTestSuiteSpec.class)) {
        for (NativeBinarySpec testedBinary : cUnitTestSuite.getTestedComponent().getNativeBinaries()) {

            DefaultCUnitTestSuiteBinary testBinary = createTestBinary(serviceRegistry, cUnitTestSuite, testedBinary);

            configure(testBinary, buildDir);

            cUnitTestSuite.getBinaries().add(testBinary);
            binaries.add(testBinary);
        }
    }
}
 
Example #18
Source Project: pushfish-android   Author: PushFish   File: NativeBinariesTestPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize // Must run after test binaries have been created (currently in CUnit plugin)
void attachTestedBinarySourcesToTestBinaries(BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testSuiteBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpec testedBinary = testSuiteBinary.getTestedBinary();
        testSuiteBinary.source(testedBinary.getSource());

        for (DependentSourceSet testSource : testSuiteBinary.getSource().withType(DependentSourceSet.class)) {
            testSource.lib(testedBinary.getSource());
        }
    }
}
 
Example #19
Source Project: pushfish-android   Author: PushFish   File: ComponentReport.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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();
}
 
Example #20
Source Project: Pushjet-Android   Author: Pushjet   File: JvmComponentPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
    for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
        Task jarTask = createJarTask(tasks, projectJarBinary);
        projectJarBinary.builtBy(jarTask);
        projectJarBinary.getTasks().add(jarTask);
    }
}
 
Example #21
public void mutate(TaskContainer container, Inputs inputs) {
    BinaryContainer binaries = inputs.get(0, ModelType.of(BinaryContainer.class)).getInstance();
    for (T binary : binaries.withType(binaryType)) {
        NamedEntityInstantiator<Task> instantiator = new Instantiator<Task>(binary, container);
        DefaultCollectionBuilder<Task> collectionBuilder = new DefaultCollectionBuilder<Task>(
                getSubject().getPath(),
                instantiator,
                new SimpleModelRuleDescriptor("Project.<init>.tasks()"),
                inputs,
                modelRegistry);

        invoke(inputs, collectionBuilder, binary, binaries);
    }
}
 
Example #22
private <T extends BinarySpec, U extends BaseBinarySpec> void doRegister(BinaryContainer binaries, ModelType<T> type, final ModelType<U> implementation) {
    binaries.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            BinaryNamingScheme binaryNamingScheme = new DefaultBinaryNamingSchemeBuilder()
                    .withComponentName(name)
                    .build();

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseBinarySpec.create(implementation.getConcreteClass(), binaryNamingScheme, instantiator);

            return created;
        }
    });
}
 
Example #23
Source Project: Pushjet-Android   Author: Pushjet   File: LanguageBasePlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project target) {
    target.getPlugins().apply(LifecycleBasePlugin.class);

    target.getExtensions().create("sources", DefaultProjectSourceSet.class, instantiator);
    DefaultBinaryContainer binaries = target.getExtensions().create("binaries", DefaultBinaryContainer.class, instantiator);

    modelRegistry.create(
            ModelCreators.of(ModelReference.of("binaries", BinaryContainer.class), binaries)
                    .simpleDescriptor("Project.<init>.binaries()")
                    .withProjection(new PolymorphicDomainObjectContainerModelProjection<DefaultBinaryContainer, BinarySpec>(binaries, BinarySpec.class))
                    .build()
    );


}
 
Example #24
Source Project: Pushjet-Android   Author: Pushjet   File: VisualStudioPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
public static void createVisualStudioModelForBinaries(VisualStudioExtensionInternal visualStudioExtension, BinaryContainer binaryContainer) {
    for (NativeBinarySpec binary : binaryContainer.withType(NativeBinarySpec.class)) {
        VisualStudioProjectConfiguration configuration = visualStudioExtension.getProjectRegistry().addProjectConfiguration(binary);

        // Only create a solution if one of the binaries is buildable
        if (binary.isBuildable()) {
            DefaultVisualStudioProject visualStudioProject = configuration.getProject();
            visualStudioExtension.getSolutionRegistry().addSolution(visualStudioProject);
        }
    }
}
 
Example #25
Source Project: Pushjet-Android   Author: Pushjet   File: CUnitPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
public void createCUnitTestBinaries(final BinaryContainer binaries, TestSuiteContainer testSuites, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry) {
    for (final CUnitTestSuiteSpec cUnitTestSuite : testSuites.withType(CUnitTestSuiteSpec.class)) {
        for (NativeBinarySpec testedBinary : cUnitTestSuite.getTestedComponent().getNativeBinaries()) {

            DefaultCUnitTestSuiteBinary testBinary = createTestBinary(serviceRegistry, cUnitTestSuite, testedBinary);

            configure(testBinary, buildDir);

            cUnitTestSuite.getBinaries().add(testBinary);
            binaries.add(testBinary);
        }
    }
}
 
Example #26
Source Project: Pushjet-Android   Author: Pushjet   File: NativeBinariesTestPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Finalize // Must run after test binaries have been created (currently in CUnit plugin)
void attachTestedBinarySourcesToTestBinaries(BinaryContainer binaries) {
    for (NativeTestSuiteBinarySpec testSuiteBinary : binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpec testedBinary = testSuiteBinary.getTestedBinary();
        testSuiteBinary.source(testedBinary.getSource());

        for (DependentSourceSet testSource : testSuiteBinary.getSource().withType(DependentSourceSet.class)) {
            testSource.lib(testedBinary.getSource());
        }
    }
}
 
Example #27
Source Project: Pushjet-Android   Author: Pushjet   File: ComponentReport.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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();
}
 
Example #28
public BinaryTaskRule(ModelReference<TaskContainer> subject, final Class<T> binaryType, MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry) {
    super(subject, binaryType, ruleDefinition, ModelReference.of("binaries", BinaryContainer.class));
    this.binaryType = binaryType;
    this.modelRegistry = modelRegistry;
}
 
Example #29
public void execute(RegistrationContext<BinarySpec, BaseBinarySpec> context) {
    BinaryContainer binaries = context.getExtensions().getByType(BinaryContainer.class);
    doRegister(binaries, context.getType(), context.getImplementation());
}
 
Example #30
Source Project: javaide   Author: tranleduy2000   File: JavaBasePlugin.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Mutate
void attachBridgedBinaries(BinaryContainer binaries, BridgedBinaries bridgedBinaries) {
    for (BinarySpecInternal binary : bridgedBinaries.binaries) {
        binaries.put(binary.getProjectScopedName(), binary);
    }
}