Ejemplo n.º 1
0
        public override bool Execute()
        {
            if (!Enum.TryParse(ToolMode, true, out m_LocationStrategy))
            {
                Log.LogError("Invalid ToolMode {0}", ToolMode);
                return(false);
            }

            m_responseFile = Path.GetTempFileName();
            List <string> argv = new List <string>();

            if (BootClassPath != null && BootClassPath.Length > 0)
            {
                argv.Add("-bootclasspath");
                argv.Add(string.Join(Path.PathSeparator.ToString(), BootClassPath.Select(x => x.GetMetadata("FullPath"))));
            }

            if (ClassPath != null && ClassPath.Length > 0)
            {
                argv.Add("-classpath");
                argv.Add(string.Join(Path.PathSeparator.ToString(), ClassPath.Select(x => x.GetMetadata("FullPath"))));
            }

            if (OutputDirectory != null)
            {
                argv.Add("-d");
                argv.Add(OutputDirectory.GetMetadata("FullPath"));
            }

            argv.AddRange(ExtraArguments);
            argv.AddRange(ClassNames);

            File.WriteAllLines(m_responseFile, argv);
            bool taskSuccess = base.Execute();

            if (taskSuccess)
            {
                DeleteTempFile(m_responseFile);
            }
            else
            {
                Log.LogMessage(MessageImportance.High, "Rmic arguments can be found here: {0}", m_responseFile);
            }

            return(taskSuccess);
        }