예제 #1
0
파일: Arguments.cs 프로젝트: socat/BuildXL
 /// <nodoc/>
 public Artifact(ArtifactKind kind, FileArtifact file)
     : this()
 {
     Kind           = kind;
     m_fileArtifact = file;
     Type           = ArtifactValueType.File;
 }
예제 #2
0
파일: Arguments.cs 프로젝트: socat/BuildXL
        /// <nodoc/>
        public Artifact(ArtifactKind kind, DirectoryArtifact directory)
            : this()
        {
            // Rewrite only works for files.
            Contract.Requires(kind != ArtifactKind.Rewritten);

            Kind = kind;
            m_directoryArtifact = directory;
            Type = ArtifactValueType.Directory;
        }
예제 #3
0
파일: Arguments.cs 프로젝트: socat/BuildXL
        /// <nodoc/>
        public Artifact(ArtifactKind kind, AbsolutePath path, FileArtifact original = default(FileArtifact))
            : this()
        {
            Contract.Requires(kind != ArtifactKind.Rewritten || original.IsValid); // i.e., kind == ArtifactKind.Rewritten ==> original.IsValid

            Kind           = kind;
            m_absolutePath = path;
            Type           = ArtifactValueType.AbsolutePath;
            Original       = original;
        }
예제 #4
0
        private static IEnumerable DownloadAndUnpackAsync(string product, SemanticVersion version, ArtifactKind kind, string destinationDirectory, Action <string, float> progressCallback = null)
        {
            var packageId = GetPackageId(product);

            var getContentAsync = Feed.GetPackageContent(packageId, version, progressCallback);

            yield return(getContentAsync);

            var touchedFiles     = new List <FileInfo>();
            var packageDirectory = getContentAsync.GetResult();
            var toolsDirectory   = packageDirectory.GetDirectories().FirstOrDefault(d => string.Equals(d.Name, "tools", StringComparison.OrdinalIgnoreCase));
            var libDirectory     = packageDirectory.GetDirectories().FirstOrDefault(d => string.Equals(d.Name, "lib", StringComparison.OrdinalIgnoreCase));

            if (kind == ArtifactKind.Library && libDirectory != null && libDirectory.Exists)
            {
                var prefTargets = default(string[]);
                if (Environment.Version > new Version(4, 0))
                {
                    prefTargets = new string[] { "net46", "net452", "net451", "net45", "net403", "net40", "net35", "net20", "net11" };
                }
                else
                {
                    prefTargets = new string[] { "net35", "net20", "net11" };
                }

                var targetFrameworkDirectories = libDirectory.GetDirectories().Where(d => Array.IndexOf(prefTargets, d.Name) >= 0).ToArray();
                Array.Sort(targetFrameworkDirectories, (x, y) => Array.IndexOf(prefTargets, x.Name).CompareTo(Array.IndexOf(prefTargets, y.Name)));

                foreach (var targetFrameworkDirectory in targetFrameworkDirectories)
                {
                    if (Directory.Exists(destinationDirectory) == false)
                    {
                        Directory.CreateDirectory(destinationDirectory);
                    }

                    foreach (var file in targetFrameworkDirectory.GetFiles())
                    {
                        touchedFiles.Add(DeployAtPath(file, destinationDirectory));
                    }

                    yield return(touchedFiles.ToArray());

                    yield break;
                }
            }
            else if (kind == ArtifactKind.Tool && toolsDirectory != null && toolsDirectory.Exists)
            {
                if (Directory.Exists(destinationDirectory) == false)
                {
                    Directory.CreateDirectory(destinationDirectory);
                }

                foreach (var file in toolsDirectory.GetFiles())
                {
                    touchedFiles.Add(DeployAtPath(file, destinationDirectory));
                }

                yield return(touchedFiles.ToArray());

                yield break;
            }
            throw new InvalidOperationException("Package '{0}' doesn't contains libraries or tools to deploy.");
        }
예제 #5
0
        public static Promise <FileInfo[]> DownloadAndUnpack(string product, SemanticVersion version, ArtifactKind kind, string destinationDirectory, Action <string, float> progressCallback = null)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }
            if (destinationDirectory == null)
            {
                throw new ArgumentNullException("destinationDirectory");
            }

            return(new Coroutine <FileInfo[]>(DownloadAndUnpackAsync(product, version, kind, destinationDirectory, progressCallback)));
        }
예제 #6
0
파일: Arguments.cs 프로젝트: socat/BuildXL
 /// <nodoc/>
 public static ArgumentValue FromArtifact(ArtifactKind kind, DirectoryArtifact directory)
 {
     return(new ArgumentValue(new Artifact(kind, directory)));
 }
예제 #7
0
파일: Arguments.cs 프로젝트: socat/BuildXL
 /// <nodoc/>
 public static ArgumentValue FromAbsolutePath(ArtifactKind kind, AbsolutePath file, FileArtifact original = default(FileArtifact))
 {
     return(new ArgumentValue(new Artifact(kind, file, original)));
 }
예제 #8
0
파일: Arguments.cs 프로젝트: socat/BuildXL
 /// <nodoc/>
 public static ArgumentValue FromArtifact(ArtifactKind kind, FileArtifact file)
 {
     return(new ArgumentValue(new Artifact(kind, file)));
 }