Search in sources :

Example 1 with CompilerOutputFileNamingSchemeFactory

use of org.gradle.nativeplatform.internal.CompilerOutputFileNamingSchemeFactory in project gradle by gradle.

the class CppModelBuilder method buildAll.

@Override
public Object buildAll(String modelName, Project project) {
    DefaultProjectIdentifier projectIdentifier = new DefaultProjectIdentifier(project.getRootDir(), project.getPath());
    CompilerOutputFileNamingSchemeFactory namingSchemeFactory = new CompilerOutputFileNamingSchemeFactory(((ProjectInternal) project).getFileResolver());
    DefaultCppComponentModel mainComponent = null;
    CppApplication application = project.getComponents().withType(CppApplication.class).findByName("main");
    if (application != null) {
        mainComponent = new DefaultCppApplicationModel(application.getName(), application.getBaseName().get(), binariesFor(application, application.getPrivateHeaderDirs(), projectIdentifier, namingSchemeFactory));
    } else {
        DefaultCppLibrary library = (DefaultCppLibrary) project.getComponents().withType(CppLibrary.class).findByName("main");
        if (library != null) {
            mainComponent = new DefaultCppLibraryModel(library.getName(), library.getBaseName().get(), binariesFor(library, library.getAllHeaderDirs(), projectIdentifier, namingSchemeFactory));
        }
    }
    DefaultCppComponentModel testComponent = null;
    CppTestSuite testSuite = project.getComponents().withType(CppTestSuite.class).findByName("test");
    if (testSuite != null) {
        testComponent = new DefaultCppTestSuiteModel(testSuite.getName(), testSuite.getBaseName().get(), binariesFor(testSuite, testSuite.getPrivateHeaderDirs(), projectIdentifier, namingSchemeFactory));
    }
    return new DefaultCppProjectModel(projectIdentifier, mainComponent, testComponent);
}
Also used : CompilerOutputFileNamingSchemeFactory(org.gradle.nativeplatform.internal.CompilerOutputFileNamingSchemeFactory) CppTestSuite(org.gradle.nativeplatform.test.cpp.CppTestSuite) CppApplication(org.gradle.language.cpp.CppApplication) DefaultCppLibrary(org.gradle.language.cpp.internal.DefaultCppLibrary) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Aggregations

CppApplication (org.gradle.language.cpp.CppApplication)1 DefaultCppLibrary (org.gradle.language.cpp.internal.DefaultCppLibrary)1 CompilerOutputFileNamingSchemeFactory (org.gradle.nativeplatform.internal.CompilerOutputFileNamingSchemeFactory)1 CppTestSuite (org.gradle.nativeplatform.test.cpp.CppTestSuite)1 DefaultProjectIdentifier (org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)1