예제 #1
0
        protected HashSet <string> GetExcludeSet(string projectDir, BuildConfig config)
        {
            var excludes = new HashSet <string>();

            for (var i = 0; i < config.Excludes.Count; i++)
            {
                var file = Path.Combine(projectDir, config.Excludes[i]);
                if (Path.GetExtension(file) == "")
                {
                    file = file + ".tfs";
                }
                excludes.Add(file);
            }
            return(excludes);
        }
예제 #2
0
 public abstract CompilerResult CompileCode(string code, BuildConfig config);
예제 #3
0
        protected void VerifyReferencesExists(string projectDir, Action <string> onReference, BuildConfig config)
        {
            // Todo:     Look for assemblies in the global assembly cache
            // Update:   After some tinkering, it seems this is not easily achieved.
            //           The best way to determine if an assembly exists is to use gacutil,
            //           however, I cannot figure out a way to find a path to the asm.
            //           You could just force search %windir%\Microsoft.NET\assembly
            //           but you'd have top at least guess that one folder will be the correct one.
            //           Still, here is some psuedo code to do so.
            //           I'm not currently using it becuase it's not stable enough.
            //           Still, it could be useful. Maybe used when a compile option is specified
            // Update 2: There might be some helper functions in the Microsoft.Build assembly.
            //           Further research is needed.

            /*
             * var cpuArchitecture = "64";
             * var folderName = Path.GetFileNameWithoutExtension(config.References[i]);
             * var basePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Microsoft.NET", "assembly");
             * var archPath = Path.Combine(basePath, $"GAC_{cpuArchitecture}", folderName);
             * var msilPath = Path.Combine(basePath, "GAC_MSIL", folderName);
             * if (Directory.Exists(archPath))
             * {
             *  asmExpectedLocation = Path.Combine(archPath, Directory.EnumerateDirectories(archPath).First(), config.References[i]);
             * }
             * else if(Directory.Exists(msilPath))
             * {
             *  asmExpectedLocation = Path.Combine(msilPath, Directory.EnumerateDirectories(msilPath).First(), config.References[i]);
             * }
             */

            for (var i = 0; i < config.References.Count; i++)
            {
                var asmExpectedLocation = Path.Combine(projectDir, config.References[i]);
                if (!File.Exists(asmExpectedLocation))
                {
                    asmExpectedLocation = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "Libraries", config.References[i]);
                    if (!File.Exists(asmExpectedLocation))
                    {
                        _logger.Error($"Could not find the specified reference: {config.References[i]}", null);
                    }
                    else
                    {
                        onReference?.Invoke(asmExpectedLocation);
                    }
                }
                else
                {
                    onReference?.Invoke(asmExpectedLocation);
                }
            }
        }