Beispiel #1
0
        public bool IsMonoPath(string path)
        {
            // remove the intall dir and append the mono source path
            if (path.StartsWith(MonoPathMangler.iOSFramework, StringComparison.Ordinal) || path.StartsWith(MonoPathMangler.MacFramework, StringComparison.Ordinal))
            {
                // dealing with the jenkins paths
                if (Verbose)
                {
                    Console.WriteLine($"Install dir is {InstallDir}");
                    Console.WriteLine($"Original path os {path}");
                }

                var srcDir = path.Contains(xamariniOSDir) ? MonoPathMangler.iOSFramework : MonoPathMangler.MacFramework;
                if (Verbose)
                {
                    Console.WriteLine($"Src path to remove {srcDir}");
                }
                var relative = path.Remove(0, srcDir.Length);
                if (Verbose)
                {
                    Console.WriteLine($"Relative path is {relative}");
                }
                if (relative.StartsWith("/", StringComparison.Ordinal))
                {
                    relative = relative.Remove(0, 1);
                }
                var monoPath = Path.Combine(MonoSourcePath, relative);
                if (Verbose)
                {
                    Console.WriteLine($"Mono path is {monoPath}");
                }
                return(File.Exists(monoPath));
            }
            // check if the path is the xamarin source path + the mono external submodule
            var monoSubmodule = Path.Combine(XamarinSourcePath.Replace("src/", ""), "external", "mono");

            if (path.StartsWith(monoSubmodule, StringComparison.Ordinal))
            {
                return(true);
            }
            if (path.StartsWith(XamarinSourcePath, StringComparison.Ordinal))
            {
                return(false);
            }
            var xamarinRuntimePath = XamarinSourcePath.Replace($"/{srcSubPath}/", $"/{runtimeSubPath}/");

            if (path.StartsWith(xamarinRuntimePath, StringComparison.Ordinal))
            {
                return(false);
            }
            return(path.StartsWith(MonoSourcePath, StringComparison.Ordinal));
        }
 string GetSourcePathForRuntimeSource(string path)
 {
     Console.WriteLine($"Path is {path}");
     if (path.StartsWith(InstallDir, StringComparison.Ordinal))
     {
         var removalPath = Path.Combine(InstallDir, FrameworkPath.Replace(".framework", ""), "src");
         Console.WriteLine($"Removal path s {removalPath}");
         var src = path.Remove(0, removalPath.Length);
         Console.WriteLine($"Src is {src}");
         if (src.StartsWith("/", StringComparison.Ordinal))
         {
             src = src.Remove(0, 1);
         }
         return(Path.Combine(XamarinSourcePath.Replace("src", "runtime"), src));
     }
     return(path);
 }
        public bool IsMonoPath(string path)
        {
            // remove the intall dir and append the mono source path
            if (path.StartsWith(InstallDir, StringComparison.Ordinal))
            {
                // dealing with the jenkins paths
                if (Verbose)
                {
                    Console.WriteLine($"Install dir is {InstallDir}");
                    Console.WriteLine($"Original path os {path}");
                }

                var srcDir = Path.Combine(InstallDir, srcSubPath,
                                          (InstallDir.Contains(xamariniOSDir) ? xamariniOSDir : xamarinMacDir));
                if (Verbose)
                {
                    Console.WriteLine($"Src path to remove {srcDir}");
                }
                var relative = path.Remove(0, srcDir.Length);
                if (Verbose)
                {
                    Console.WriteLine($"Relative path is {relative}");
                }
                if (relative.StartsWith("/", StringComparison.Ordinal))
                {
                    relative = relative.Remove(0, 1);
                }
                var monoPath = Path.Combine(MonoSourcePath, relative);
                if (Verbose)
                {
                    Console.WriteLine($"Mono path is {monoPath}");
                }
                return(File.Exists(monoPath));
            }
            if (path.StartsWith(XamarinSourcePath, StringComparison.Ordinal))
            {
                return(false);
            }
            var xamarinRuntimePath = XamarinSourcePath.Replace($"/{srcSubPath}/", $"/{runtimeSubPath}/");

            if (path.StartsWith(xamarinRuntimePath, StringComparison.Ordinal))
            {
                return(false);
            }
            return(path.StartsWith(MonoSourcePath, StringComparison.Ordinal));
        }