Ejemplo n.º 1
0
        private bool RunJavac()
        {
            List <String> paramList = new List <String>();

            temp = GetFullPath(Path.Combine("obj", platform, configuration));
            paramList.Add("-d");
            paramList.Add(temp);

            if (sources != null)
            {
                for (int i = 0; i < sources.Length; i++)
                {
                    string sourceFile = GetFullPath(sources[i].ItemSpec);
                    RemoveBOM(sourceFile);
                    paramList.Add(sourceFile);
                }
            }
            String[]    parameters = paramList.ToArray();
            PrintWriter pw         = new PrintWriter(new LogWriter(Log), true);
            int         result     = Javac.compile(parameters, pw);

            pw.close();
            return(result == 0);
        }
Ejemplo n.º 2
0
        private bool RunJavac()
        {
            List <string> paramList = new List <string>();

            paramList.Add("-bootclasspath");
            paramList.Add(Path.Combine(GetStubPath(), "rt.jar"));

            string        stubpath = GetStubPath();
            StringBuilder sb       = new StringBuilder();

            foreach (string file in Directory.GetFiles(stubpath, "*.jar"))
            {
                if (Path.GetFileName(file) != "rt.jar")
                {
                    if (sb.Length != 0)
                    {
                        sb.Append(Path.PathSeparator);
                    }
                    sb.Append(file);
                }
            }
            if (sb.Length != 0)
            {
                paramList.Add("-classpath");
                paramList.Add(sb.ToString());
            }

            string classes = GetClassesPath();

            Directory.CreateDirectory(classes);
            paramList.Add("-d");
            paramList.Add(classes);

            if (emitDebugInformation)
            {
                paramList.Add("-g");
            }

            if (sources != null)
            {
                for (int i = 0; i < sources.Length; i++)
                {
                    string sourceFile = Path.GetFullPath(sources[i].ItemSpec);
                    RemoveBOM(sourceFile);
                    paramList.Add(sourceFile);
                }
            }

            using (PrintWriter pw = new PrintWriter(new LogWriter(Log), true))
            {
                //StringBuilder sb = new StringBuilder();
                //foreach (string str in paramList)
                //{
                //    sb.Append('"').Append(str).Append("\" ");
                //}
                //ProcessStartInfo psi = new ProcessStartInfo(Path.Combine(GetAssemblyPath(), "javac.exe"), sb.ToString());
                //psi.UseShellExecute = false;
                //using (Process p = Process.Start(psi))
                //{
                //    p.WaitForExit();
                //    if (p.ExitCode != 0)
                //    {
                //        return false;
                //    }
                //}
                //return true;
                return(Javac.compile(paramList.ToArray(), pw) == 0);
            }
        }