public DebugProject()
            : base(typeof(Target), typeof(Configuration), isInternal: true)
        {
            _projectInfo = DebugProjectGenerator.DebugProjects[GetType()];

            // set paths
            RootPath       = _projectInfo.ProjectFolder;
            SourceRootPath = RootPath;

            // add selected source files
            SourceFiles.AddRange(_projectInfo.ProjectFiles);

            // ensure that no file will be automagically added
            SourceFilesExtensions.Clear();
            ResourceFilesExtensions.Clear();
            PRIFilesExtensions.Clear();
            ResourceFiles.Clear();
            NoneExtensions.Clear();
            VsctExtension.Clear();

            Name = _projectInfo.DisplayName;

            // Use the new csproj style
            ProjectSchema = CSharpProjectSchema.NetCore;

            // prevents output dir to have a framework subfolder
            CustomProperties.Add("AppendTargetFrameworkToOutputPath", "false");

            // we need to disable determinism while because we are using wildcards in assembly versions
            // error CS8357: The specified version string contains wildcards, which are not compatible with determinism
            CustomProperties.Add("Deterministic", "false");

            AddTargets(DebugProjectGenerator.GetTargets());
        }
Esempio n. 2
0
        public DebugProject()
            : base(typeof(Target))
        {
            // set paths
            RootPath       = DebugProjectGenerator.DebugProjects[GetType()].ProjectFolder;
            SourceRootPath = RootPath;

            // add selected source files
            SourceFiles.AddRange(DebugProjectGenerator.DebugProjects[GetType()].ProjectFiles);

            // ensure that no file will be automagically added
            SourceFilesExtensions.Clear();
            ResourceFilesExtensions.Clear();
            PRIFilesExtensions.Clear();
            ResourceFiles.Clear();
            NoneExtensions.Clear();

            AddTargets(DebugProjectGenerator.GetTargets());
        }
Esempio n. 3
0
        public void ReadXml(XmlReader reader)
        {
            reader.Read();

            XmlSerializer serializer = new XmlSerializer(typeof(string), new XmlRootAttribute(typeof(string).Name.ToLower()));

            _loc = serializer.Deserialize(reader) as string;

            serializer = new XmlSerializer(typeof(List <SourceFile>), new XmlRootAttribute("SourceFiles"));
            SourceFiles.AddRange(serializer.Deserialize(reader) as List <SourceFile>);

            serializer = new XmlSerializer(typeof(List <string>), new XmlRootAttribute("IncludeFolders"));
            IncludeFolders.AddRange(serializer.Deserialize(reader) as List <string>);

            serializer = new XmlSerializer(typeof(List <string>), new XmlRootAttribute("SystemDependencies"));
            SystemDeps.AddRange(serializer.Deserialize(reader) as List <string>);

            serializer = new XmlSerializer(typeof(ProjectProperties), new XmlRootAttribute("ProjectProperties"));
            Properties = serializer.Deserialize(reader) as ProjectProperties;
        }
Esempio n. 4
0
        public DebugProject()
            : base(typeof(Target), typeof(Configuration), isInternal: true)
        {
            _projectInfo = DebugProjectGenerator.DebugProjects[GetType()];

            // set paths
            RootPath       = _projectInfo.ProjectFolder;
            SourceRootPath = RootPath;

            // add selected source files
            SourceFiles.AddRange(_projectInfo.ProjectFiles);

            // ensure that no file will be automagically added
            SourceFilesExtensions.Clear();
            ResourceFilesExtensions.Clear();
            PRIFilesExtensions.Clear();
            ResourceFiles.Clear();
            NoneExtensions.Clear();
            VsctExtension.Clear();

            Name = _projectInfo.DisplayName;

            AddTargets(DebugProjectGenerator.GetTargets());
        }
Esempio n. 5
0
        public void Build()
        {
            string projectLocation = Path.GetDirectoryName(_loc);
            string objFolder       = Path.Combine(projectLocation, "obj");
            string binFolder       = Path.Combine(projectLocation, "bin");
            string includes        = BuildIncludeString().Trim('\n');
            string propStr         = BuildPropertiesString().Trim('\n');

            if (!Directory.Exists(objFolder))
            {
                Directory.CreateDirectory(objFolder);
            }

            if (File.Exists($"{projectLocation}/scripts/prebuildScript.sh"))
            {
                Console.Write(ExternalPrograms.RunScript($"{projectLocation}/scripts/prebuildScript.sh"));
            }

            IEnumerable <SourceFile> viewCode = null;

            if (SourceFiles.Any(f => f.FileType == SourceCodeType.View))
            {
                IEnumerable <string> viewFiles = SourceFiles
                                                 .Where(f => f.FileType == SourceCodeType.View)
                                                 .Select(f => f.Path);

                GMLInterface.ProcessFiles(viewFiles, IncludeFolders.First());

                viewCode = viewFiles.Select(f => new SourceFile($"{Path.GetDirectoryName(f)}/{Path.GetFileNameWithoutExtension(f)}.g.c")).ToArray();
                SourceFiles.AddRange(viewCode);
            }

            System.Console.WriteLine("Builing...");

            foreach (SourceFile file in SourceFiles.Where(f => f.FileType == SourceCodeType.Code))
            {
                string fileName = System.IO.Path.GetFileName(file.Path).Split('.', StringSplitOptions.RemoveEmptyEntries)[0];

                ExternalPrograms.RunCompiler($"-c {file.Path} -o {objFolder}/{fileName}.o {includes} {propStr}");
            }

            if (viewCode != null)
            {
                foreach (SourceFile viewFile in viewCode)
                {
                    SourceFiles.Remove(viewFile);
                }
                viewCode = null;
            }

            var objFiles = Directory.GetFiles(objFolder)
                           .Where(f => string.Compare(Path.GetExtension(f), ".o") == 0);

            if (objFiles.Any())
            {
                System.Console.WriteLine("Linking...");
                string        link = BuildLinkString().Trim('\n');
                StringBuilder sb   = new StringBuilder(link);

                foreach (string o in objFiles)
                {
                    sb.Append($"{o} ");
                }

                string outName = Path.GetFileNameWithoutExtension(_loc);

                if (!Directory.Exists(binFolder))
                {
                    Directory.CreateDirectory(binFolder);
                }

                sb.Append($"-o {binFolder}/{outName}.lef");

                ExternalPrograms.RunCompiler(sb.ToString());

                if (File.Exists($"{projectLocation}/scripts/postbuildScript.sh"))
                {
                    Console.Write(ExternalPrograms.RunScript($"{projectLocation}/scripts/postbuildScript.sh"));
                }
            }
        }
 protected override void Analyze(string fileName, ExceptionHandler exceptionHandler)
 {
     ProjectFilename = fileName;
     //var path = ProjectPath;
     foreach (var item in Items)
     {
         try
         {
             var propertyGroup = item as PropertyGroup;
             if (propertyGroup != null)
             {
                 var assembly = propertyGroup.AssemblyName;
                 if (assembly != null)
                 {
                     Assemblies.Add(new VsAssemblyInfo(propertyGroup));
                 }
                 if (!string.IsNullOrWhiteSpace(propertyGroup.TargetFrameworkVersion))
                 {
                     TargetFrameworkVersion = propertyGroup.TargetFrameworkVersion;
                 }
                 continue;
             }
             var itemGroup = item as ItemGroup;
             if (itemGroup != null)
             {
                 if (itemGroup?.Reference != null)
                 {
                     foreach (var reference in itemGroup.Reference)
                     {
                         var r = VsAssemblyInfo.CreateIfValid(reference, this);
                         if (r != null)
                         {
                             References.Add(r);
                         }
                     }
                 }
                 SourceFiles.AddRange(itemGroup.SourceFiles(this));
             }
         }
         catch (Exception exc)
         {
             if (exceptionHandler != null)
             {
                 exceptionHandler(null, exc);
             }
             else
             {
                 throw;
             }
         }
     }
     base.Analyze(fileName, exceptionHandler);
     foreach (var r in References)
     {
         if (!r.Exists)
         {
             if (!string.IsNullOrWhiteSpace(r.Path))
             {
                 MissingFiles.Add(new ProjectFile(r.Name, ResourceType.Reference, r.Path));
             }
             else
             {
                 MissingFiles.Add(new ProjectFile(r.Name, ResourceType.Reference, this));
             }
         }
     }
 }