コード例 #1
0
ファイル: Summary.cs プロジェクト: becheran/Amg.Build
        internal static IWritable Print(IEnumerable <InvocationInfo> invocations) => TextFormatExtensions.GetWritable(@out =>
        {
            var begin = invocations
                        .Select(_ => _.Begin.GetValueOrDefault(DateTime.MaxValue))
                        .Min();

            var end = invocations
                      .Select(_ => _.End.GetValueOrDefault(DateTime.MinValue))
                      .Max();

            var success = invocations.All(_ => !_.Failed);

            @out.WriteLine();
            new
            {
                success,
                begin,
                end,
                duration = end - begin
            }.ToPropertiesTable().Write(@out);

            @out.WriteLine();

            invocations.OrderBy(_ => _.End)
            .Select(_ => new
            {
                Name     = _.Id.Truncate(32),
                State    = _.State,
                Duration = _.Duration.HumanReadable(),
                Timeline = TextFormatExtensions.TimeBar(80, begin, end, _.Begin.Value, _.End.Value)
            })
            .ToTable()
            .Write(@out);
        });
コード例 #2
0
 IWritable PublicApi(Assembly a) => TextFormatExtensions.GetWritable(w =>
 {
     foreach (var t in a.GetTypes()
              .Where(_ => _.IsPublic))
     {
         w.Write(PublicApi(t));
     }
 });
コード例 #3
0
 IWritable PublicApi(Type t) => TextFormatExtensions.GetWritable(w =>
 {
     foreach (var i in t.GetMethods()
              .Where(_ => _.DeclaringType.Equals(t))
              )
     {
         w.WriteLine($"{i.DeclaringType.Assembly.GetName().Name}:{i.DeclaringType.FullName}.{i.Name}({Parameters(i)}): {Nice(i.ReturnType)}");
     }
 });
コード例 #4
0
ファイル: Summary.cs プロジェクト: becheran/Amg.Build
        internal static IWritable Error(IEnumerable <InvocationInfo> invocations) => TextFormatExtensions.GetWritable(@out =>
        {
            foreach (var failedTarget in invocations.OrderBy(_ => _.End)
                     .Where(_ => _.State == InvocationInfo.States.Failed))
            {
                var r = GetRootCause(failedTarget.Exception);
                @out.WriteLine($"{failedTarget} failed because: {r.Message}");
                if (!(r is InvocationFailed))
                {
                    @out.WriteLine($@"
{r}
");
                }
            }
        });