public bool Equals(LockFileTargetLibrary other)
        {
            if (other == null)
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return(string.Equals(Name, other.Name) &&
                   VersionComparer.Default.Equals(Version, other.Version) &&
                   string.Equals(Type, other.Type, StringComparison.Ordinal) &&
                   string.Equals(Framework, other.Framework, StringComparison.Ordinal) &&
                   Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Id, StringComparer.OrdinalIgnoreCase) &&
                   FrameworkAssemblies.OrderedEquals(other.FrameworkAssemblies, s => s, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase) &&
                   FrameworkReferences.OrderedEquals(other.FrameworkReferences, s => s, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase) &&
                   RuntimeAssemblies.OrderedEquals(other.RuntimeAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   ResourceAssemblies.OrderedEquals(other.ResourceAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   CompileTimeAssemblies.OrderedEquals(other.CompileTimeAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   NativeLibraries.OrderedEquals(other.NativeLibraries, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   ContentFiles.OrderedEquals(other.ContentFiles, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   RuntimeTargets.OrderedEquals(other.RuntimeTargets, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   Build.OrderedEquals(other.Build, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   BuildMultiTargeting.OrderedEquals(other.BuildMultiTargeting, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   ToolsAssemblies.OrderedEquals(other.ToolsAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) &&
                   EmbedAssemblies.OrderedEquals(other.EmbedAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase));
        }
 public void SetXSharpSpecificOptions(CSharpCompilationOptions opt)
 {
     ArrayZero         = opt.ArrayZero;
     MacroScript       = opt.MacroScript;
     Dialect           = opt.Dialect;
     ImplicitNameSpace = opt.ImplicitNameSpace;
     LateBinding       = opt.LateBinding;
     TargetDLL         = opt.TargetDLL;
     RuntimeAssemblies = opt.RuntimeAssemblies;
     //VoInitAxitMethods = opt.VoInitAxitMethods; // vo1 // Handled in the parser
     VONullStrings              = opt.VONullStrings;                                // vo2
     VirtualInstanceMethods     = opt.VirtualInstanceMethods;                       // vo3
     VOSignedUnsignedConversion = opt.VOSignedUnsignedConversion;                   // vo4
     //VOClipperCallingConvention = opt.VOClipperCallingConvention;  // vo5  // Handled in the parser
     VOResolveTypedFunctionPointersToPtr = opt.VOResolveTypedFunctionPointersToPtr; // vo6
     VOImplicitCastsAndConversions       = opt.VOImplicitCastsAndConversions;       // vo7
     //VOPreprocessorBehaviour = opt.VOPreprocessorBehaviour; // vo8 // Handled in the parser
     //VOAllowMissingReturns = opt.VOAllowMissingReturns; // vo9 // Handled in the parser
     VOCompatibleIIF         = opt.VOCompatibleIIF;         // vo10
     VOArithmeticConversions = opt.VOArithmeticConversions; // vo11
     //VOClipperIntegerDivisions = opt.VOClipperIntegerDivisions; // vo12    // Handled in the parser
     VOStringComparisons = opt.VOStringComparisons;         // vo13
     //VOFloatConstants = opt.VOFloatConstants; // vo14  // Handled in the parser
     //VOUntypedAllowed = opt.VOUntypedAllowed; // vo15  // Handled in the parser
     //VOClipperConstructors = opt.VOClipperConstructors; // vo16// Handled in the parser
     ConsoleOutput     = opt.ConsoleOutput;
     UndeclaredMemVars = opt.UndeclaredMemVars;
     MemVars           = opt.MemVars;
     //InitLocals = opt.InitLocals;
     AllowUnsafe      = opt.AllowUnsafe;
     UseNativeVersion = opt.UseNativeVersion;
 }
Beispiel #3
0
 public RuntimeAssemblies ResolveRuntimeAssemblies() => Helpers.Resolve(
     ref _runtimeAssemblies,
     _metadata.RuntimeAssembliesAreAvailable(_version, _runtimeIdentifier),
     () => RuntimeAssemblies.FromDirectory(RuntimeAssembliesDirectory()),
     () =>
 {
     _console.Out.WriteLine($"Failed to find the runtime assemblies for {_runtimeIdentifier}");
     InstallRuntimeAssemblies();
 });
Beispiel #4
0
        /// <summary>
        ///     获取当前运行环境下符合筛选条件的程序集
        /// </summary>
        /// <param name="predicate">筛选条件</param>
        public Assembly[] GetRuntimeAssemblies(Func <AssemblyName, bool> predicate)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            var list = RuntimeAssemblies.Where(predicate).Select(Assembly.Load);

            return(list.ToArray());
        }
        public override int GetHashCode()
        {
            var combiner = new HashCodeCombiner();

            combiner.AddObject(Name);
            combiner.AddObject(Version);
            combiner.AddObject(Type);
            combiner.AddObject(Framework);

            foreach (var dependency in Dependencies.OrderBy(dependency => dependency.Id, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(dependency);
            }

            foreach (var reference in FrameworkAssemblies.OrderBy(s => s, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddStringIgnoreCase(reference);
            }

            foreach (var item in RuntimeAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            foreach (var item in ResourceAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            foreach (var item in CompileTimeAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            foreach (var item in NativeLibraries.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            foreach (var item in ContentFiles.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            foreach (var item in RuntimeTargets.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase))
            {
                combiner.AddObject(item);
            }

            return(combiner.CombinedHash);
        }
        internal static Type ConcreteType <T>()
        {
            Contract.Ensures(Contract.Result <Type>() != null);

            var targetType = typeof(T);
            var typeName   = RuntimeAssemblies.PrepareTypeName(targetType, "DTO");

            var module = Module;

            lock (module)
            {
                var type = module.Builder.GetType(typeName, false, false) ?? EmitDTO <T> .BuildDTO(module, typeName);

                return(type);
            }
        }
Beispiel #7
0
        public void InstallRuntimeAssemblies()
        {
            var path = RuntimeAssembliesDirectory();

            var packageName    = $"Microsoft.NETCore.App.Runtime.{_runtimeIdentifier}";
            var packageVersion = _version.Version;

            _console.Out.WriteLine($"Installing runtime assemblies for {_runtimeIdentifier}");
            Helpers.DownloadPackageFromDotnetFeed("runtime assemblies", packageName, packageVersion, _version.Major, _console, pkgDir =>
            {
                IO.Move(Path.Combine(pkgDir, "runtimes", _runtimeIdentifier.ToString(), "lib", _version.Moniker), path);
                _console.Out.WriteLine($"Copied runtime assemblies to '{path}'");

                _runtimeAssemblies = RuntimeAssemblies.FromDirectory(path);
                _metadata.AddRuntimeAssemblies(_version, _runtimeIdentifier);
            });
        }
        public void SetXSharpSpecificOptions(XSharpSpecificCompilationOptions opt)
        {
            if (opt != null)
            {
                ArrayZero = opt.ArrayZero;
                //VoInitAxitMethods = opt.Vo1;              // Handled in the parser
                VONullStrings              = opt.Vo2;
                VirtualInstanceMethods     = opt.Vo3;
                VOSignedUnsignedConversion = opt.Vo4;
                //VOClipperCallingConvention = opt.Vo5;     // Handled in the parser
                VOResolveTypedFunctionPointersToPtr = opt.Vo6;
                VOImplicitCastsAndConversions       = opt.Vo7;
                //VOPreprocessorBehaviour = opt.Vo8;        // Handled in the parser
                //VOAllowMissingReturns = opt.Vo9;          // Handled in the parser
                VOCompatibleIIF         = opt.Vo10;
                VOArithmeticConversions = opt.Vo11;
                //VOClipperIntegerDivisions = opt.Vo12;     // Handled in the parser
                VOStringComparisons = opt.Vo13;
                //VOFloatConstants = opt.Vo14;              // Handled in the parser
                //VOUntypedAllowed = opt.Vo15;              // Handled in the parser
                //VOClipperConstructors = opt.Vo16;         // Handled in the parser
                //XPPInheritFromAbstract = opt.Xpp1;        // Handled in the parser
                //XPPUntypedmain= opt.Xpp2;                 // Handled in the parser
                //FoxInheritUnknown= opt.Fox1;              // Handled in the parser

                Dialect           = opt.Dialect;
                ImplicitNameSpace = opt.ImplicitNameSpace;
                LateBinding       = opt.LateBinding;
                UndeclaredMemVars = opt.UndeclaredMemVars;
                MemVars           = opt.MemVars;
                TargetDLL         = opt.TargetDLL;
                RuntimeAssemblies = opt.RuntimeAssemblies;
                //InitLocals = opt.InitLocals;
                AllowUnsafe = opt.AllowUnsafe;
            }
        }