Example #1
0
        private static void SetCompilerOptions(TestCase tc, CompilerLanguage lang, CompilerOptions options)
        {
            options.Language = lang;
            options.Debug    = tc.Debug;
            options.Optimize = tc.Optimize;
            options.Unsafe   = tc.Unsafe;
            options.Output   = tc.ExePath;
            options.Target   = CompilerTarget.ConsoleApp;
            options.NoLogo   = true;
            options.Checked  = false;

            options.Define("TARGET_JVM");             //to remove unsafe
            options.Define("NET_2_0");
            options.Defines.AddRange(tc.Defines);

            if (tc.VM == VM.CLR)
            {
                options.Define("MSCLR");
            }
            else if (tc.VM == VM.AVM)
            {
                options.Define("AVM");
            }

            //common refs
            if (tc.VM == VM.AVM)
            {
                GlobalSettings.AddCommonReferences(options);

                options.AddRef(Path.Combine(GlobalSettings.LibsDirectory, "flash.v10.2.dll"));

                options.NoConfig = true;
                options.NoStdlib = true;

                if (lang == CompilerLanguage.VB)
                {
                    //options.NoVBRuntime = true;
                    options.VBRuntime = GlobalSettings.Libs.VBRuntime;
                    //options.CompactFramework = true;
                    options.SDKPath = GlobalSettings.Dirs.Libs;
                    options.NoWarn  = true;
                }
            }
            else
            {
                options.AddRef("System.Core.dll");
            }

            if (tc.IsNUnit)
            {
                if (tc.VM == VM.CLR)
                {
                    string nunit = QA.GetNUnitFrameworkPath(GlobalOptions.UseCommonDirectory ? "" : tc.Root);
                    options.AddRef(nunit);
                }
                else
                {
                    options.AddRef(GlobalSettings.GetLibPath(QA.NUnitFrameworkDll));
                }
                options.AddRef(tc.GetNUnitTestsPath(tc.Root));
            }

            options.Input.AddRange(tc.SourceFiles.Names);
        }