Exemple #1
0
        // Used only for Xenko 1.x and 2.x
        private void UpdateTargetsHelper()
        {
            if (oldRootDirectory == null)
            {
                return;
            }

            // Get latest package only for each MainPackageIds (up to 2.x)
            var xenkoOldPackages = GetLocalPackages("Xenko").Where(package => !((package.Tags != null) && package.Tags.Contains("internal"))).Where(x => x.Version.Version.Major < 3).ToList();

            // Generate target file
            var targetGenerator   = new TargetGenerator(this, xenkoOldPackages, "SiliconStudioPackage");
            var targetFileContent = targetGenerator.TransformText();
            var targetFile        = Path.Combine(oldRootDirectory, @"Targets\SiliconStudio.Common.targets");

            var targetFilePath = Path.GetDirectoryName(targetFile);

            // Make sure directory exists
            if (targetFilePath != null && !Directory.Exists(targetFilePath))
            {
                Directory.CreateDirectory(targetFilePath);
            }

            File.WriteAllText(targetFile, targetFileContent, Encoding.UTF8);
        }
Exemple #2
0
        /// <summary>
        /// See <see cref="UpdateTargets"/>. This is the non-concurrent version, always make sure
        /// to hold the lock for the local repository.
        /// </summary>
        private void UpdateTargetsHelper()
        {
            var packages = new List <NugetLocalPackage>();

            // Get latest package only for each MainPackageIds (up to 2.x)
            var xenkoOldPackage = GetLocalPackages("Xenko").Where(package => !((package.Tags != null) && package.Tags.Contains("internal"))).Where(x => x.Version.Version.Major < 3).OrderByDescending(p => p.Version).FirstOrDefault();

            if (xenkoOldPackage != null)
            {
                packages.Add(xenkoOldPackage);
            }

            // Xenko 1.x and 2.x are using SiliconStudio target files
            var oldPackages = packages.Where(x => x.Id == "Xenko" && x.Version.Version.Major < 3).ToList();
            var newPackages = packages.Where(x => !oldPackages.Contains(x)).ToList();

            foreach (var target in new[] { new { File = TargetFile, PackageVersionPrefix = "XenkoPackage", Packages = newPackages }, new { File = TargetFileOld, PackageVersionPrefix = "SiliconStudioPackage", Packages = oldPackages } })
            {
                // Generate target file
                var targetGenerator   = new TargetGenerator(this, target.Packages, target.PackageVersionPrefix);
                var targetFileContent = targetGenerator.TransformText();

                var targetFilePath = Path.GetDirectoryName(target.File);

                // Make sure directory exists
                if (targetFilePath != null && !Directory.Exists(targetFilePath))
                {
                    Directory.CreateDirectory(targetFilePath);
                }

                File.WriteAllText(target.File, targetFileContent, Encoding.UTF8);
            }
        }