Esempio n. 1
0
REGISTER_TESTS_END

// CreateNode
//------------------------------------------------------------------------------
void TestExe::CreateNode() const
{
    FBuild fb;
    NodeGraph & ng = fb.GetDependencyGraph();

    Dependencies inputLibraries( 1, false );
    inputLibraries.Append( Dependency( ng.CreateFileNode( AStackString<>( "dummy.lib" ) ) ) );

    ExeNode * exeNode = ng.CreateExeNode( AStackString<>( "exe.exe" ),
                                          inputLibraries,
                                          Dependencies(),
                                          AString::GetEmpty(),
                                          AStackString<>( "linker.exe" ),
                                          AString::GetEmpty(), // args
                                          0, // flags
                                          Dependencies(),
                                          AStackString<>(),
                                          nullptr,
                                          AString::GetEmpty() ); // assembly resources

    TEST_ASSERT( exeNode->GetType() == Node::EXE_NODE );
    TEST_ASSERT( ExeNode::GetTypeS() == Node::EXE_NODE );
    TEST_ASSERT( AStackString<>( "Exe" ) == exeNode->GetTypeName() );
}
Esempio n. 2
0
// GetCompilerNode
//------------------------------------------------------------------------------
bool FunctionObjectList::GetCompilerNode( const BFFIterator & iter, const AString & compiler, CompilerNode * & compilerNode ) const
{
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();
	Node * cn = ng.FindNode( compiler );
	compilerNode = nullptr;
	if ( cn != nullptr )
	{
		if ( cn->GetType() == Node::ALIAS_NODE )
		{
			AliasNode * an = cn->CastTo< AliasNode >();
			cn = an->GetAliasedNodes()[ 0 ].GetNode();
		}
		if ( cn->GetType() != Node::COMPILER_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, "Compiler", cn->GetName(), cn->GetType(), Node::COMPILER_NODE );
			return false;
		}
		compilerNode = cn->CastTo< CompilerNode >();
	}
	else
	{
		// create a compiler node - don't allow distribution
		// (only explicitly defined compiler nodes can be distributed)
#ifdef USE_NODE_REFLECTION
		compilerNode = ng.CreateCompilerNode( compiler );
        VERIFY( compilerNode->GetReflectionInfoV()->SetProperty( compilerNode, "AllowDistribution", false ) );
#else
		const bool allowDistribution = false;
		compilerNode = ng.CreateCompilerNode( compiler, Dependencies( 0, false ), allowDistribution );
#endif
	}

	return true;
}
void CIAUpdateNodeDependencyXmlParser::ConstructL()
    {
    CIAUpdateXmlSubParser::ConstructL( IAUpdateProtocolConsts::KNodeDependencies() );    

    // Add sub parsers to the list
    
    CIAUpdateInterDepXmlParser* parser(
        CIAUpdateInterDepXmlParser::NewLC( Dependencies() ) );
    SubParsers().AppendL( parser );
    CleanupStack::Pop( parser );
    }
Esempio n. 4
0
Dependencies Context::getDependencies(const String & database_name, const String & table_name) const
{
	auto lock = getLock();

	String db = database_name.empty() ? current_database : database_name;
	checkDatabaseAccessRights(db);

	ViewDependencies::const_iterator iter = shared->view_dependencies.find(DatabaseAndTableName(db, table_name));
	if (iter == shared->view_dependencies.end())
		return {};

	return Dependencies(iter->second.begin(), iter->second.end());
}
Esempio n. 5
0
bool Maker::CreateDependencyTree()
{
    if (goals.size() == 0)
    {
        Variable *dg = VariableContainer::Instance()->Lookup(".DEFAULT_GOAL");
        std::string value;
        if (dg && dg->GetValue().size() != 0)
        {
            value = dg->GetValue();
            if (dg->GetFlavor() == Variable::f_recursive)
            {
                Eval r(value, false);
                value = r.Evaluate();
            }
        }
        else
        {
            value = firstGoal;
        }
        if (value.size() == 0)
            return true; // nothing to do
        AddGoal(value);
    }
    EnterSuffixTerminals();
    std::string intermediate;
    Variable *v = VariableContainer::Instance()->Lookup(".INTERMEDIATE");
    if (v)
    {
        intermediate = v->GetValue();
    }
    for (std::deque<std::string>::iterator it = goals.begin(); it != goals.end(); ++it)
    {
        Time tv1, tv2;
        Depends *t = Dependencies(*it, "", tv1);
        if (t || OnList(*it,".PHONY"))
        {
            depends.push_back(t);
        }
        else if (t)
            delete t;
    }
    v = VariableContainer::Instance()->Lookup(".INTERMEDIATE");
    if (v)
    {
        v->SetValue(intermediate);
    }
    return !missingTarget;
}
Esempio n. 6
0
globle void DependenciesCommand(
  void *theEnv)
  {
   DATA_OBJECT item;
   void *ptr;

   if (EnvArgCountCheck(theEnv,"dependencies",EXACTLY,1) == -1) return;

   ptr = GetFactOrInstanceArgument(theEnv,1,&item,"dependencies");

   if (ptr == NULL) return;

#if DEFRULE_CONSTRUCT
   Dependencies(theEnv,(struct patternEntity *) ptr);
#else
   EnvPrintRouter(theEnv,WDISPLAY,"None\n");
#endif
  }
Esempio n. 7
0
void DependenciesCommand(
  Environment *theEnv,
  UDFContext *context,
  UDFValue *returnValue)
  {
   UDFValue item;
   void *ptr;

   ptr = GetFactOrInstanceArgument(context,1,&item);

   if (ptr == NULL) return;

#if DEFRULE_CONSTRUCT
   Dependencies(theEnv,(struct patternEntity *) ptr);
#else
   WriteString(theEnv,STDOUT,"None\n");
#endif
  }
Esempio n. 8
0
Maker::Depends *Maker::Dependencies(const std::string &goal, const std::string &preferredPath, Time &timeval)
{
    Time goalTime;
    Time dependsTime;
    Depends *rv = Depends::Lookup(goal);
    bool intermediate = OnList(goal, ".INTERMEDIATE");
    bool secondary = OnList(goal, ".SECONDARY");
    bool precious = OnList(goal, ".PRECIOUS");
    if (!rv)
    {
        Time xx;
        RuleList *ruleList = RuleContainer::Instance()->Lookup(goal);
        bool remake = false;
        if (ruleList)
        {
            RuleList::iterator it;
            for (it = ruleList->begin(); it != ruleList->end(); ++it)
            {
                if ((*it)->HasCommands())
                    break;
            }
            if (it == ruleList->end())
            {
                Time xx;
                SearchImplicitRules(goal, preferredPath, true, false, xx);
            }
            std::string foundPath = GetFileTime(goal ,preferredPath, goalTime);
            bool exists = ! !goalTime;
            rv = new Depends(goal, xx, intermediate && !precious && !secondary);
            Rule *executionRule = NULL;
            std::string newerPrereqs;
            for (RuleList::iterator it = ruleList->begin(); it != ruleList->end(); ++it)
            {
                std::string working = (*it)->GetPrerequisites();
                bool remakeThis = false;
                while (working.size())
                {
                    Time current;
                    std::string thisOne = Eval::ExtractFirst(working, " ");
                    Depends *dp = Dependencies(thisOne, foundPath, current);
                    if (current > dependsTime)
                    {
                        dependsTime = current;
                    }
                    if (dp)
                    {
                        *rv += (dp);
                    }
                    if (current > goalTime || rebuildAll)
                    {
                        if (newerPrereqs.size())
                            newerPrereqs += " ";
                        newerPrereqs += thisOne;
                        remakeThis = true;
                    }
                }
                working = (*it)->GetOrderPrerequisites();
                while (working.size())
                {
                    Time current;
                    std::string thisOne = Eval::ExtractFirst(working, " ");
                    Depends *dp = Dependencies(thisOne, preferredPath, current);
                    if (dp)
                    {
                        dp->SetOrdered(true);
                        (*rv) += dp;
                    }
                }
                if ((*it)->HasCommands())
                    if (ruleList->GetDoubleColon() && remakeThis || !ruleList->GetDoubleColon())
                        if (executionRule)
                            Eval::warning("Conflicting command lists for goal '" + goal + "'");
                        else
                            executionRule = *it;
            }
            if (executionRule)
            {
                rv->SetRuleList(ruleList);
                rv->SetRule(executionRule);
                ruleList->SetNewerPrerequisites(newerPrereqs);
            }
            else
            {
                rv->SetRuleList(ruleList);
            }
        }
        else
        {
            if (SearchImplicitRules(goal, preferredPath, true, true, timeval))
                rv = Dependencies(goal, preferredPath, timeval);
        }
    }
    if (rv && !rebuildAll)
    {
        if (goalTime > dependsTime)
        {
            if (!rv->size())
            {
                    delete rv;
                    rv = NULL;
            }
            else
            {
                bool check = true;
                for (Depends::iterator it = rv->begin(); check && it != rv->end(); ++it)
                {
                    check &= (*it)->IsSecondary();
                }
                if (check)
                {
                    delete rv;
                    rv = NULL;
                }
            }
        }
    }
    if (rv)
    {
        rv->SetSecondary(secondary || intermediate);
    }
    if (dependsTime > goalTime)
    {
        if (dependsTime > timeval)
            timeval = dependsTime;
    }
    else
    {
        if (goalTime > timeval)
            timeval = goalTime;
    }
    return rv;
}