コード例 #1
0
//--------------------------------------------------------------------------------------------------
static void GenerateIpcBindingConfig
(
    std::ofstream& cfgStream,
    legato::App& app,
    const legato::BuildParams_t& buildParams ///< Build parameters, such as the "is verbose" flag.
)
//--------------------------------------------------------------------------------------------------
{
    // Create nodes under "bindings", where each binding has its own node, named with the client
    // interface service name.
    cfgStream << "  \"bindings\"" << std::endl;
    cfgStream << "  {" << std::endl;

    // If cross-building for an embedded target (not "localhost"),
    if (buildParams.Target() != "localhost")
    {
        // Add a bind to the Log Client interface of the Log Control Daemon (which runs as root).
        GenerateSingleApiBindingToUser(cfgStream,
                                       "LogClient",
                                       "root",
                                       "LogClient");
    }

    // Add all the binds that were specified in the .adef file or .sdef file for this app.
    for (const auto& mapEntry : app.ExternalApiBinds())
    {
        GenerateApiBindConfig(cfgStream, app, mapEntry.second);
    }
    for (const auto& mapEntry : app.InternalApiBinds())
    {
        GenerateApiBindConfig(cfgStream, app, mapEntry.second);
    }

    cfgStream << "  }" << std::endl << std::endl;
}
コード例 #2
0
ファイル: mkexe.cpp プロジェクト: hakanernam/legato-af
//--------------------------------------------------------------------------------------------------
static void Build
(
    legato::Executable& exe
)
//--------------------------------------------------------------------------------------------------
{
    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    // Auto-generate the source code file containing main() and add it to the default component.
    ExecutableBuilder_t exeBuilder(BuildParams);
    exeBuilder.GenerateMain(exe);

    // Build all the components.
    ComponentBuilder_t componentBuilder(BuildParams);
    for (auto componentInstance : exe.ComponentInstanceList())
    {
        // Generate the IPC import/export code.
        componentBuilder.GenerateInterfaceCode(componentInstance.GetComponent());

        // Build the component.
        componentBuilder.Build(componentInstance.GetComponent());
    }

    // Do the final build step for the executable.
    // Note: All the components need to be built before this.
    exeBuilder.Build(exe);
}
コード例 #3
0
ファイル: mksys.cpp プロジェクト: mbarazzouq/legato-af
//--------------------------------------------------------------------------------------------------
void MakeSystem
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    // Parse the .sdef file, populating the System object with the results.
    legato::parser::ParseSystem(&System, BuildParams);

    Build();
}
コード例 #4
0
ファイル: mkcomp.cpp プロジェクト: andreasanna/legato-af
//--------------------------------------------------------------------------------------------------
void MakeComponent
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    ConstructObjectModel();

    if (IsStandAlone)
    {
        BuildStandAlone();
    }
    else
    {
        Build();
    }
}
コード例 #5
0
ファイル: mksys.cpp プロジェクト: mbarazzouq/legato-af
//--------------------------------------------------------------------------------------------------
static void Build
(
    void
)
//--------------------------------------------------------------------------------------------------
{
    // Construct the working directory structure, which consists of an "obj" directory and
    // a "staging" directory.  Application bundles will be put inside the "staging" directory.
    // The "staging" directory will get tarred to become the actual system bundle.
    // The "obj" directory is for intermediate build output, like generated .c
    // files and .o files.  Under the "obj" directory each app has its own subdirectory to work in.
    if (BuildParams.IsVerbose())
    {
        std::cout << "Creating working directories under '" << BuildParams.ObjOutputDir() << "'."
                  << std::endl;
    }
    std::string objDirPath = BuildParams.ObjOutputDir() + "/obj";
    std::string stagingDirPath = BuildParams.ObjOutputDir() + "/staging";

    // Clean the staging area.
    legato::CleanDir(stagingDirPath);

    // Create the staging and working directories.
    legato::MakeDir(objDirPath);
    legato::MakeDir(stagingDirPath);

    // For each app in the system,
    for (auto& mapEntry : System.Apps())
    {
        auto& app = mapEntry.second;

        // Create an Application Builder object to use to build this app.
        // Give it the appropriate build parameters.
        legato::BuildParams_t appBuildParams(BuildParams);
        appBuildParams.ObjOutputDir(legato::CombinePath(objDirPath, app.Name()));
        appBuildParams.StagingDir(legato::CombinePath(appBuildParams.ObjOutputDir(), "staging"));
        ApplicationBuilder_t appBuilder(appBuildParams);

        // Build the app.  This should result in an application bundle appearing in the
        // staging directory.
        appBuilder.Build(app, stagingDirPath);
    }

    // TODO: Copy in metadata for use by Developer Studio.

    // Generate a configuration data file containing user-to-app and user-to-user bindings.
    GenerateSystemConfig(stagingDirPath);

    // Create the tarball file name.
    std::string outputPath = legato::CombinePath(OutputDir, System.Name());
    outputPath += "." + BuildParams.Target() + "_sys";  // Add the file name extension.
    if (!legato::IsAbsolutePath(outputPath))
    {
        outputPath = legato::GetWorkingDir() + "/" + outputPath;
    }

    // Create the tarball.
    std::string tarCommandLine = "tar cf \"" + outputPath + "\" -C \"" + stagingDirPath + "\" .";
    if (BuildParams.IsVerbose())
    {
        std::cout << "Packaging system into '" << outputPath << "'." << std::endl;
        std::cout << std::endl << "$ "<< tarCommandLine << std::endl << std::endl;
    }
    mk::ExecuteCommandLine(tarCommandLine);
}