Esempio n. 1
0
        public void SetInputsOutputsIncremental()
        {
            string oldFile = null, newFile = null;

            try
            {
                oldFile = GetTempFiles(1, new DateTime(2005, 1, 1))[0];
                newFile = GetTempFiles(1, new DateTime(2006, 1, 1))[0];

                MockLogger logger = new MockLogger();
                Project    p      = ObjectModelHelpers.CreateInMemoryProject(@"
                <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                  <Target Name=`t` Inputs=`" + newFile + "` Outputs=`" + oldFile + @"`>
                    <Message Text=`building target !!`/>                  
                </Target>
                </Project>
            ", logger);
                p.Build(new string[] { "t" });

                logger.AssertLogContains(new string[] { "building target !!" });
                logger.ClearLog();

                Target t = p.Targets["t"];

                // reverse inputs and outputs
                t.Inputs  = (string)oldFile;
                t.Outputs = (string)newFile;

                p.ResetBuildStatus();
                p.Build(new string[] { "t" });

                logger.AssertLogDoesntContain("building target !!");
            }
            finally
            {
                DeleteTempFiles(new string[] { oldFile });
                DeleteTempFiles(new string[] { newFile });
            }
        }
Esempio n. 2
0
        public void SetInputsOutputsIncremental()
        {
            string oldFile = null, newFile = null;
            try
            {
                oldFile = GetTempFiles(1, new DateTime(2005, 1, 1))[0];
                newFile = GetTempFiles(1, new DateTime(2006, 1, 1))[0];

                MockLogger logger = new MockLogger();
                Project p = ObjectModelHelpers.CreateInMemoryProject(@"
                <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                  <Target Name=`t` Inputs=`" + newFile + "` Outputs=`" + oldFile + @"`>
                    <Message Text=`building target !!`/>                  
                </Target>
                </Project>
            ", logger);
                p.Build(new string[] { "t" });

                logger.AssertLogContains(new string[] { "building target !!" });
                logger.ClearLog();

                Target t = p.Targets["t"];

                // reverse inputs and outputs
                t.Inputs = (string)oldFile;
                t.Outputs = (string)newFile;

                p.ResetBuildStatus();
                p.Build(new string[] { "t" });

                logger.AssertLogDoesntContain("building target !!");
                

            }
            finally
            {
                DeleteTempFiles(new string[] { oldFile });
                DeleteTempFiles(new string[] { newFile });
            }
        }