예제 #1
0
        public static BuildTargetResult CrossgenSharedFx(BuildTargetContext c, string pathToAssemblies)
        {
            // Check if we need to skip crossgen
            if (string.Equals(Environment.GetEnvironmentVariable("DONT_CROSSGEN_SHAREDFRAMEWORK"), "1"))
            {
                c.Warn("Skipping crossgen for SharedFx because DONT_CROSSGEN_SHAREDFRAMEWORK is set to 1");
                return(c.Success());
            }

            foreach (var file in Directory.GetFiles(pathToAssemblies))
            {
                string fileName = Path.GetFileName(file);

                if (fileName == "mscorlib.dll" || fileName == "mscorlib.ni.dll" || !HasMetadata(file))
                {
                    continue;
                }

                string tempPathName = Path.ChangeExtension(file, "readytorun");

                // This is not always correct. The version of crossgen we need to pick up is whatever one was restored as part
                // of the Microsoft.NETCore.Runtime.CoreCLR package that is part of the shared library. For now, the version hardcoded
                // in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
                // we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
                // was used, and then select that version.
                ExecSilent(Crossgen.GetCrossgenPathForVersion(CompileTargets.CoreCLRVersion),
                           "-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies);

                File.Delete(file);
                File.Move(tempPathName, file);
            }

            return(c.Success());
        }
예제 #2
0
        public SharedFrameworkPublisher(
            string repoRoot,
            string corehostLockedDirectory,
            string corehostLatestDirectory,
            string corehostPackageSource,
            string sharedFrameworkNugetVersion,
            string sharedFrameworkRid,
            string sharedFrameworkTarget)
        {
            _repoRoot = repoRoot;
            _corehostLockedDirectory = corehostLockedDirectory;
            _corehostLatestDirectory = corehostLatestDirectory;
            _corehostPackageSource   = corehostPackageSource;
            _crossgenUtil            = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion, sharedFrameworkRid == "win10-arm64" ? sharedFrameworkRid : null);

            _sharedFrameworkTemplateSourceRoot = Path.Combine(repoRoot, "src", "sharedframework", "framework");
            _sharedFrameworkNugetVersion       = sharedFrameworkNugetVersion;

            _sharedFrameworkRid    = sharedFrameworkRid;
            _sharedFrameworkTarget = sharedFrameworkTarget;

            _sharedFrameworkSourceRoot = GenerateSharedFrameworkProject(
                _sharedFrameworkNugetVersion,
                _sharedFrameworkTemplateSourceRoot,
                _sharedFrameworkRid,
                _sharedFrameworkTarget);
        }
        public SharedFrameworkPublisher(
            string repoRoot,
            string corehostLockedDirectory,
            string corehostLatestDirectory,
            string corehostPackageSource,
            string sharedFrameworkNugetVersion,
            string sharedFrameworkRid,
            string sharedFrameworkTarget)
        {
            _repoRoot = repoRoot;
            _corehostLockedDirectory = corehostLockedDirectory;
            _corehostLatestDirectory = corehostLatestDirectory;
            _corehostPackageSource   = corehostPackageSource;

            string crossgenRID = null;

            // If we are dealing with cross-targeting compilation, then specify the
            // correct RID for crossgen to use when compiling SharedFramework.
            // TODO-ARM-Crossgen: Add ubuntu.14.04-arm and ubuntu.16.04-arm
            string portablePlatformRID = null;

            if ((sharedFrameworkRid == "win8-arm") || (sharedFrameworkRid == "win10-arm64") || (Utils.IsPortableRID(sharedFrameworkRid, out portablePlatformRID)))
            {
                crossgenRID = sharedFrameworkRid;
            }

            _crossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion, crossgenRID);

            _sharedFrameworkTemplateSourceRoot = Path.Combine(repoRoot, "src", "sharedframework", "framework");
            _sharedFrameworkNugetVersion       = sharedFrameworkNugetVersion;

            _sharedFrameworkRid    = sharedFrameworkRid;
            _sharedFrameworkTarget = sharedFrameworkTarget;

            _sharedFrameworkSourceRoot = GenerateSharedFrameworkProject(
                _sharedFrameworkNugetVersion,
                _sharedFrameworkTemplateSourceRoot,
                _sharedFrameworkRid,
                _sharedFrameworkTarget);
        }