예제 #1
0
// EmitCompilationMessage
//------------------------------------------------------------------------------
void LibraryNode::EmitCompilationMessage( const Args & fullArgs ) const
{
	AStackString<> output;
	output += "Lib: ";
	output += GetName();
	output += '\n';
	if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
	{
		output += m_LibrarianPath;
		output += ' ';
		output += fullArgs.GetRawArgs();
		output += '\n';
	}
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #2
0
// EmitStampMessage
//------------------------------------------------------------------------------
void LinkerNode::EmitStampMessage() const
{
    ASSERT( m_LinkerStampExe );

    AStackString<> output;
    output += "Stamp: ";
    output += GetName();
    output += '\n';
    if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
    {
        output += m_LinkerStampExe->GetName();
        output += ' ';
        output += m_LinkerStampExeArgs;
        output += '\n';
    }
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #3
0
// EmitStampMessage
//------------------------------------------------------------------------------
void LinkerNode::EmitStampMessage() const
{
    ASSERT( m_LinkerStampExe.IsEmpty() == false );
    const Node * linkerStampExe = m_StaticDependencies.End()[ -1 ].GetNode();

    AStackString<> output;
    output += "Stamp: ";
    output += GetName();
    output += '\n';
    if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
    {
        output += linkerStampExe->GetName();
        output += ' ';
        output += m_LinkerStampExeArgs;
        output += '\n';
    }
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #4
0
파일: CSNode.cpp 프로젝트: ClxS/fastbuild
// EmitCompilationMessage
//------------------------------------------------------------------------------
void CSNode::EmitCompilationMessage( const Args & fullArgs ) const
{
	// print basic or detailed output, depending on options
	// we combine everything into one string to ensure it is contiguous in
	// the output
	AStackString<> output;
	output += "C#: ";
	output += GetName();
	output += '\n';
	if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
	{
		output += m_CompilerPath;
		output += ' ';
		output += fullArgs.GetRawArgs();
		output += '\n';
	}
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #5
0
// DoBuild
//------------------------------------------------------------------------------
/*virtual*/ Node::BuildResult RemoveDirNode::DoBuild( Job * UNUSED( job ) )
{
    ASSERT( !m_StaticDependencies.IsEmpty() );

    m_Stamp = 0; // Trigger DoBuild() every time

    // Iterate all the DirectoryListNodes
    const Dependency * const depEnd = m_StaticDependencies.End();
    for ( const Dependency * dep = m_StaticDependencies.Begin();
          dep != depEnd;
          ++dep )
    {
        // Grab the files
        DirectoryListNode * dln = dep->GetNode()->CastTo< DirectoryListNode >();
        const Array< FileIO::FileInfo > & files = dln->GetFiles();
        const FileIO::FileInfo * const fEnd = files.End();
        for ( const FileIO::FileInfo * fIt = files.Begin();
              fIt != fEnd;
              ++fIt )
        {
            // source file (full path)
            const AString & srcFile = fIt->m_Name;

            // remove the file
            if ( FileIO::FileDelete( srcFile.Get() ) == false )
            {
                FLOG_ERROR( "Remove failed (error %i) '%s'", Env::GetLastErr(), srcFile.Get() );
                return NODE_RESULT_FAILED; // remove failed
            }

            // we combine everything into one string to ensure it is contiguous in
            // the output
            AStackString<> output;
            output += "Remove: ";
            output += srcFile;
            output += '\n';
            FLOG_BUILD_DIRECT( output.Get() );
        }
    }

    return NODE_RESULT_OK;
}
예제 #6
0
// EmitCompilationMessage
//------------------------------------------------------------------------------
void TestNode::EmitCompilationMessage( const char * workingDir ) const
{
	AStackString<> output;
	output += "Running Test: ";
	output += GetName();
	output += '\n';
	if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
	{
		output += GetTestExecutable()->GetName();
		output += ' ';
		output += m_TestArguments;
		output += '\n';
		if ( workingDir )
		{
			output += "Working Dir: ";
			output += workingDir;
			output += '\n';
		}
	}
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #7
0
// EmitCompilationMessage
//------------------------------------------------------------------------------
void ExecNode::EmitCompilationMessage( const AString & args ) const
{
    // basic info
    AStackString< 2048 > output;
    output += "Run: ";
    output += GetName();
    output += '\n';

    // verbose mode
    if ( FLog::ShowInfo() || FBuild::Get().GetOptions().m_ShowCommandLines )
    {
        AStackString< 1024 > verboseOutput;
        verboseOutput.Format( "%s %s\nWorkingDir: %s\nExpectedReturnCode: %i\n",
                              m_Executable->GetName().Get(),
                              args.Get(),
                              m_WorkingDir.Get(),
                              m_ExpectedReturnCode );
        output += verboseOutput;
    }

    // output all at once for contiguousness
    FLOG_BUILD_DIRECT( output.Get() );
}
예제 #8
0
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionPrint::ParseFunction( const BFFIterator & functionNameStart,
        const BFFIterator * functionBodyStartToken,
        const BFFIterator * functionBodyStopToken,
        const BFFIterator * functionHeaderStartToken,
        const BFFIterator * functionHeaderStopToken ) const
{
    (void)functionNameStart;
    (void)functionBodyStartToken;
    (void)functionBodyStopToken;

    if ( functionHeaderStartToken && functionHeaderStopToken &&
            ( functionHeaderStartToken->GetDistTo( *functionHeaderStopToken ) >= 1 ) )
    {
        BFFIterator start( *functionHeaderStartToken );
        ASSERT( *start == BFFParser::BFF_FUNCTION_ARGS_OPEN );
        start++;
        start.SkipWhiteSpace();

        // a quoted string?
        const char c = *start;
        if ( ( c == '"' ) || ( c == '\'' ) )
        {
            // find end of string
            BFFIterator stop( start );
            stop.SkipString( c );
            ASSERT( stop.GetCurrent() <= functionHeaderStopToken->GetCurrent() ); // should not be in this function if strings are not validly terminated

            // perform variable substitutions
            AStackString< 1024 > tmp;

            start++; // skip past opening quote
            if ( BFFParser::PerformVariableSubstitutions( start, stop, tmp ) == false )
            {
                return false; // substitution will have emitted an error
            }
            tmp += '\n';

            FLOG_BUILD_DIRECT( tmp.Get() );
        }
        else if ( c == BFFParser::BFF_DECLARE_VAR_INTERNAL ||
                  c == BFFParser::BFF_DECLARE_VAR_PARENT )
        {
            // find end of var name
            BFFIterator stop( start );
            AStackString< BFFParser::MAX_VARIABLE_NAME_LENGTH > varName;
            bool parentScope = false;
            if ( BFFParser::ParseVariableName( stop, varName, parentScope ) == false )
            {
                return false;
            }

            ASSERT( stop.GetCurrent() <= functionHeaderStopToken->GetCurrent() ); // should not be in this function if strings are not validly terminated

            const BFFVariable * var = nullptr;
            BFFStackFrame * const varFrame = ( parentScope )
                                             ? BFFStackFrame::GetParentDeclaration( varName, BFFStackFrame::GetCurrent()->GetParent(), var )
                                             : nullptr;

            if ( false == parentScope )
            {
                var = BFFStackFrame::GetVar( varName, nullptr );
            }

            if ( ( parentScope && ( nullptr == varFrame ) ) || ( nullptr == var ) )
            {
                Error::Error_1009_UnknownVariable( start, this );
                return false;
            }

            // dump the contents
            PrintVarRecurse( *var, 0 );
        }
        else
        {
            Error::Error_1001_MissingStringStartToken( start, this );
            return false;
        }
    }

    return true;
}
예제 #9
0
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionPrint::ParseFunction( const BFFIterator & functionNameStart,
											   const BFFIterator * functionBodyStartToken, 
											   const BFFIterator * functionBodyStopToken,
											   const BFFIterator * functionHeaderStartToken,
											   const BFFIterator * functionHeaderStopToken ) const
{
	(void)functionNameStart;
	(void)functionBodyStartToken;
	(void)functionBodyStopToken;

	if ( functionHeaderStartToken && functionHeaderStopToken && 
		 ( functionHeaderStartToken->GetDistTo( *functionHeaderStopToken ) >= 1 ) )
	{
		BFFIterator start( *functionHeaderStartToken );
		ASSERT( *start == BFFParser::BFF_FUNCTION_ARGS_OPEN );
		start++;
		start.SkipWhiteSpace();

		// a quoted string?
		const char c = *start;
		if ( ( c == '"' ) || ( c == '\'' ) )
		{
			// find end of string
			BFFIterator stop( start );
			stop.SkipString( c );
			ASSERT( stop.GetCurrent() <= functionHeaderStopToken->GetCurrent() ); // should not be in this function if strings are not validly terminated

			// perform variable substitutions
			AStackString< 1024 > tmp;

			start++; // skip past opening quote
			if ( BFFParser::PerformVariableSubstitutions( start, stop, tmp ) == false )
			{
				return false; // substitution will have emitted an error
			}
			tmp += '\n';

			FLOG_BUILD_DIRECT( tmp.Get() );
		}
		else if ( c == '.' )
		{
			// find end of var name
			BFFIterator stop( start );
			stop++; // skip past '.'
			stop.SkipVariableName();

			// get the var
			AStackString<> varName( start.GetCurrent(), stop.GetCurrent() );
			const BFFVariable * var = BFFStackFrame::GetVar( varName );
			if ( !var )
			{
				Error::Error_1009_UnknownVariable( start, this );
				return false;
			}

			// dump the contents
			PrintVarRecurse( *var, 0 );
		}
		else
		{
			Error::Error_1001_MissingStringStartToken( start, this ); 
			return false;
		}
	}

	return true;
}