You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -49,7 +49,7 @@ net_4_5_dirs := \
|
||||
mono-symbolicate \
|
||||
linker-analyzer
|
||||
|
||||
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator
|
||||
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker
|
||||
net_4_5_SUBDIRS = gacutil
|
||||
net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs)
|
||||
|
||||
@@ -58,13 +58,6 @@ SUBDIRS = $(build_SUBDIRS) $(net_4_5_dirs)
|
||||
include ../build/rules.make
|
||||
|
||||
DISTFILES = \
|
||||
assemblies.xml \
|
||||
mono-win32-setup-dark.bmp \
|
||||
mono-win32-setup-light.bmp \
|
||||
mono-win32-setup.nsi \
|
||||
scan-tests.pl \
|
||||
tinderbox/smtp.c \
|
||||
tinderbox/tinderbox.sh \
|
||||
removecomments.sh
|
||||
|
||||
test-local csproj-local run-test-local run-test-ondotnet-local all-local install-local uninstall-local doc-update-local:
|
||||
|
@@ -1,21 +0,0 @@
|
||||
<assemblies>
|
||||
<path url="C:\WINNT\Microsoft.NET\Framework\v1.0.3705">
|
||||
<assembly file="mscorlib.dll"/>
|
||||
<assembly file="System.Web.dll"/>
|
||||
<assembly file="System.dll"/>
|
||||
<assembly file="System.Drawing.dll"/>
|
||||
<assembly file="System.Security.dll"/>
|
||||
<assembly file="System.Windows.Forms.dll"/>
|
||||
<assembly file="System.Xml.dll"/>
|
||||
<assembly file="System.Data.dll"/>
|
||||
<assembly file="System.Design.dll"/>
|
||||
<assembly file="System.EnterpriseServices.dll"/>
|
||||
<assembly file="System.Management.dll"/>
|
||||
<assembly file="System.Messaging.dll"/>
|
||||
<assembly file="System.Runtime.Remoting.dll"/>
|
||||
<assembly file="System.ServiceProcess.dll"/>
|
||||
<assembly file="System.Web.RegularExpressions.dll"/>
|
||||
<assembly file="System.Web.Services.dll"/>
|
||||
<assembly file="System.Web.Mobile.dll"/>
|
||||
</path>
|
||||
</assemblies>
|
@@ -5,6 +5,9 @@ include ../../build/rules.make
|
||||
LOCAL_MCS_FLAGS =
|
||||
LIB_REFS = System
|
||||
|
||||
# IMPORTANT: we need to keep the old copy of Cecil we have in this folder since newer Cecil
|
||||
# doesn't support keeping metadata tokens the same which would break AOT compilation
|
||||
|
||||
PROGRAM = mono-cil-strip.exe
|
||||
|
||||
include ../../build/executable.make
|
||||
|
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="Mono.Posix">
|
||||
<type fullname="Mono.Posix.UnixEndPoint" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="System.Core">
|
||||
<type fullname="System.Runtime.CompilerServices.CallSiteOps" preserve="methods" feature="dynamic" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="System.Drawing">
|
||||
<type fullname="System.Drawing.Imaging.BitmapData" preserve="fields" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="System.Web">
|
||||
<type fullname="System.Web.Util.ICalls" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="System">
|
||||
<type fullname="System.Configuration.DefaultConfig" />
|
||||
<type fullname="System.Diagnostics.DefaultTraceListener" />
|
||||
<type fullname="System.Diagnostics.FileVersionInfo" />
|
||||
<type fullname="System.Diagnostics.Process" />
|
||||
<type fullname="System.Diagnostics.ProcessModule" />
|
||||
<type fullname="System.IO.FAMWatcher" />
|
||||
<type fullname="System.IO.FileSystemWatcher" />
|
||||
<type fullname="System.IO.InotifyWatcher" />
|
||||
<type fullname="System.Net.Dns" />
|
||||
<type fullname="System.Net.SocketAddress" />
|
||||
<type fullname="System.Net.Sockets.LingerOption" />
|
||||
<type fullname="System.Net.Sockets.Socket" />
|
||||
<type fullname="System.Net.Sockets.MulticastOption" preserve="fields" />
|
||||
<type fullname="System.Net.Sockets.Socket/SocketAsyncResult" preserve="fields" />
|
||||
<type fullname="System.Net.Sockets.SocketException" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -1,409 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="mscorlib">
|
||||
|
||||
<type fullname="System.AppDomain" preserve="fields">
|
||||
<method name="DoDomainUnload" />
|
||||
<method name="DoTypeResolve" />
|
||||
<method name="DoAssemblyResolve" />
|
||||
<method name="DoAssemblyLoad" />
|
||||
<method name="DoDomainUnload" />
|
||||
<method name="InternalSetContext" />
|
||||
</type>
|
||||
|
||||
<type fullname="System.AppDomainSetup" preserve="fields" />
|
||||
<type fullname="System.AppDomainUnloadedException" />
|
||||
<type fullname="System.ApplicationException" />
|
||||
<type fullname="System.ArgIterator" />
|
||||
<type fullname="System.ArgumentException" />
|
||||
<type fullname="System.ArgumentNullException" />
|
||||
<type fullname="System.ArgumentOutOfRangeException" />
|
||||
<type fullname="System.ArithmeticException" />
|
||||
<type fullname="System.Array">
|
||||
<method name="InternalArray__ICollection_get_Count" />
|
||||
<method name="InternalArray__ICollection_get_IsReadOnly" />
|
||||
<method name="InternalArray__IEnumerable_GetEnumerator" />
|
||||
<method name="InternalArray__ICollection_Clear" />
|
||||
<method name="InternalArray__ICollection_Add" />
|
||||
<method name="InternalArray__ICollection_Remove" />
|
||||
<method name="InternalArray__ICollection_Contains" />
|
||||
<method name="InternalArray__ICollection_CopyTo" />
|
||||
<method name="InternalArray__Insert" />
|
||||
<method name="InternalArray__RemoveAt" />
|
||||
<method name="InternalArray__IndexOf" />
|
||||
<method name="InternalArray__get_Item" />
|
||||
<method name="InternalArray__set_Item" />
|
||||
<method name="InternalArray__IReadOnlyList_get_Item" />
|
||||
<method name="InternalArray__IReadOnlyCollection_get_Count" />
|
||||
</type>
|
||||
<type fullname="System.ArrayTypeMismatchException" />
|
||||
<type fullname="System.Attribute" />
|
||||
<type fullname="System.BadImageFormatException" />
|
||||
<type fullname="System.Boolean" preserve="fields" />
|
||||
<type fullname="System.Byte" preserve="fields" />
|
||||
<type fullname="System.CannotUnloadAppDomainException" />
|
||||
<type fullname="System.Char" preserve="fields" />
|
||||
<type fullname="System.Console" preserve="fields" />
|
||||
<type fullname="System.ConsoleDriver" preserve="fields" />
|
||||
<type fullname="System.ContextBoundObject" preserve="fields" />
|
||||
<!-- <type fullname="System.Convert" /> -->
|
||||
<type fullname="System.CurrentSystemTimeZone" />
|
||||
<type fullname="System.DateTime" preserve="fields" />
|
||||
<type fullname="System.DBNull" preserve="fields" />
|
||||
<type fullname="System.Decimal" preserve="fields" />
|
||||
<type fullname="System.Delegate" preserve="fields" />
|
||||
<type fullname="System.Diagnostics.StackFrame" />
|
||||
<type fullname="System.Diagnostics.StackTrace" />
|
||||
<type fullname="System.DivideByZeroException" />
|
||||
<!-- debugger-agent.c: create_event_list -->
|
||||
<type fullname="System.Diagnostics.DebuggerNonUserCodeAttribute"/>
|
||||
<type fullname="System.Diagnostics.DebuggerHiddenAttribute"/>
|
||||
<type fullname="System.Diagnostics.DebuggerStepThroughAttribute"/>
|
||||
|
||||
<type fullname="System.DllNotFoundException" />
|
||||
<type fullname="System.Double" preserve="fields" />
|
||||
<type fullname="System.Enum" preserve="fields">
|
||||
<method name="GetValues" />
|
||||
</type>
|
||||
<type fullname="System.EntryPointNotFoundException" />
|
||||
<type fullname="System.Environment">
|
||||
<field name="mono_corlib_version" />
|
||||
<method name="get_StackTrace" />
|
||||
</type>
|
||||
<type fullname="System.Exception" />
|
||||
<type fullname="System.ExecutionEngineException" />
|
||||
<type fullname="System.FieldAccessException" />
|
||||
<type fullname="System.FormatException" />
|
||||
<type fullname="System.GC" />
|
||||
<type fullname="System.IndexOutOfRangeException" />
|
||||
<type fullname="System.Int16" preserve="fields" />
|
||||
<type fullname="System.Int32" preserve="fields" />
|
||||
<type fullname="System.Int64" preserve="fields" />
|
||||
<type fullname="System.IntPtr" preserve="fields" />
|
||||
<type fullname="System.InvalidCastException" />
|
||||
<type fullname="System.InvalidOperationException" />
|
||||
<type fullname="System.InvalidProgramException" />
|
||||
<type fullname="System.MarshalByRefObject" preserve="fields" feature="remoting" />
|
||||
<type fullname="System.MethodAccessException" />
|
||||
<type fullname="System.Missing" preserve="fields" />
|
||||
<type fullname="System.MissingFieldException" />
|
||||
<type fullname="System.MissingMethodException" />
|
||||
<type fullname="System.MonoAsyncCall" preserve="fields" />
|
||||
<type fullname="System.MonoCustomAttrs" preserve="fields" />
|
||||
<type fullname="System.MonoCustomAttrs/AttributeInfo" preserve="fields" />
|
||||
<type fullname="System.MonoCQItem" preserve="all" />
|
||||
<type fullname="System.MonoEnumInfo" preserve="fields" />
|
||||
<type fullname="System.MonoListItem" preserve="fields" />
|
||||
<type fullname="System.MonoType" preserve="fields" />
|
||||
<type fullname="System.MulticastDelegate" preserve="fields" />
|
||||
<type fullname="System.NotImplementedException" />
|
||||
<type fullname="System.NotSupportedException" />
|
||||
<type fullname="System.NullReferenceException" />
|
||||
<type fullname="System.Nullable`1" preserve="fields">
|
||||
<method name="Box" />
|
||||
<method name="Unbox" />
|
||||
</type>
|
||||
<type fullname="System.Object" />
|
||||
<type fullname="System.OutOfMemoryException" />
|
||||
<type fullname="System.RuntimeArgumentHandle" preserve="fields" />
|
||||
<type fullname="System.RuntimeFieldHandle" preserve="fields" />
|
||||
<type fullname="System.RuntimeMethodHandle" preserve="fields" />
|
||||
<type fullname="System.RuntimeTypeHandle" preserve="fields" />
|
||||
<type fullname="System.SByte" preserve="fields" />
|
||||
<type fullname="System.Single" preserve="fields" />
|
||||
<type fullname="System.StackOverflowException" />
|
||||
<type fullname="System.STAThreadAttribute" />
|
||||
<type fullname="System.String" preserve="fields">
|
||||
<method name="CreateString" />
|
||||
<method name="InternalAllocateStr" />
|
||||
<method name="FastAllocateString" />
|
||||
<method name="memcpy" />
|
||||
<method name="memset" />
|
||||
<method name="bzero" />
|
||||
<method name="bzero_aligned_1" />
|
||||
<method name="bzero_aligned_2" />
|
||||
<method name="bzero_aligned_4" />
|
||||
<method name="bzero_aligned_8" />
|
||||
<method name="memcpy_aligned_1" />
|
||||
<method name="memcpy_aligned_2" />
|
||||
<method name="memcpy_aligned_4" />
|
||||
<method name="memcpy_aligned_8" />
|
||||
</type>
|
||||
<type fullname="System.SystemException" />
|
||||
<type fullname="System.Type" preserve="fields">
|
||||
<method name="GetTypeFromHandle" />
|
||||
</type>
|
||||
<type fullname="System.TypeInitializationException" />
|
||||
<type fullname="System.TypeLoadException" />
|
||||
<type fullname="System.TypedReference" preserve="fields" />
|
||||
<type fullname="System.UInt16" preserve="fields" />
|
||||
<type fullname="System.UInt32" preserve="fields" />
|
||||
<type fullname="System.UInt64" preserve="fields" />
|
||||
<type fullname="System.UIntPtr" preserve="fields" />
|
||||
<type fullname="System.UnhandledExceptionEventArgs" />
|
||||
<type fullname="System.ValueType" preserve="fields" />
|
||||
<type fullname="System.Variant" preserve="fields" feature="com">
|
||||
<method name="Clear" />
|
||||
</type>
|
||||
<type fullname="System.Version">
|
||||
<method signature="System.Void .ctor(System.Int32,System.Int32,System.Int32,System.Int32)" />
|
||||
</type>
|
||||
<type fullname="System.Void" />
|
||||
<type fullname="System.__ComObject" feature="com" />
|
||||
|
||||
<type fullname="System.Collections.Generic.ICollection`1" />
|
||||
<type fullname="System.Collections.Generic.IEnumerable`1" />
|
||||
<type fullname="System.Collections.Generic.IEnumerator`1" />
|
||||
<type fullname="System.Collections.Generic.IReadOnlyList`1" />
|
||||
<type fullname="System.Collections.Generic.IReadOnlyCollection`1" />
|
||||
|
||||
<type fullname="System.Collections.Generic.IList`1" />
|
||||
<type fullname="System.Collections.Generic.GenericEqualityComparer`1">
|
||||
<method name=".ctor" />
|
||||
</type>
|
||||
<type fullname="System.Collections.Generic.GenericComparer`1">
|
||||
<method name=".ctor" />
|
||||
</type>
|
||||
|
||||
<type fullname="System.Globalization.DateTimeFormatInfo" preserve="fields" />
|
||||
<type fullname="System.Globalization.CompareInfo" preserve="fields" />
|
||||
<type fullname="System.Globalization.CultureInfo" preserve="fields">
|
||||
<method name="CreateCulture" />
|
||||
</type>
|
||||
<type fullname="System.Globalization.NumberFormatInfo" preserve="fields" />
|
||||
<type fullname="System.Globalization.RegionInfo" preserve="fields" />
|
||||
<type fullname="System.Globalization.SortKey" preserve="fields" />
|
||||
|
||||
<!--
|
||||
<type fullname="System.IO.FileMode" />
|
||||
<type fullname="System.IO.FileNotFoundException" />
|
||||
<type fullname="System.IO.FileLoadException" />
|
||||
<type fullname="System.IO.FileStreamAsyncResult" />
|
||||
<type fullname="System.IO.IOException" />
|
||||
<type fullname="System.IO.MonoIO" preserve="fields" />
|
||||
<type fullname="System.IO.Path" />
|
||||
<type fullname="System.IO.StreamReader" />
|
||||
-->
|
||||
|
||||
<type fullname="System.Reflection.MonoAssembly">
|
||||
<method name=".ctor" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.MonoModule">
|
||||
<method name=".ctor" />
|
||||
</type>
|
||||
|
||||
<type fullname="System.Reflection.Assembly" preserve="fields">
|
||||
<method name="MonoDebugger_GetMethodToken" feature="sre" />
|
||||
<method name="GetNamespaces" feature="sre" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.AssemblyName" preserve="fields" />
|
||||
<type fullname="System.Reflection.ConstructorInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.CustomAttributeData" preserve="fields">
|
||||
<method signature="System.Void .ctor(System.Reflection.ConstructorInfo,System.Reflection.Assembly,System.IntPtr,System.UInt32)" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.CustomAttributeNamedArgument" preserve="fields" />
|
||||
<type fullname="System.Reflection.CustomAttributeTypedArgument" preserve="fields" />
|
||||
<type fullname="System.Reflection.EventInfo" preserve="fields">
|
||||
<method name="AddEventFrame" />
|
||||
<method name="StaticAddEventAdapterFrame" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.ExceptionHandlingClause" preserve="fields" />
|
||||
<type fullname="System.Reflection.FieldInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.LocalVariableInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.ManifestResourceInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.MethodBase" preserve="fields" />
|
||||
<type fullname="System.Reflection.MethodBody" preserve="fields" />
|
||||
<type fullname="System.Reflection.MethodInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.Module" preserve="fields">
|
||||
<method name="Mono_GetGuid" feature="sre" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.MonoArrayMethod" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoCMethod" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoEvent" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoEventInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoField" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoGenericClass" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoMethod" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoMethodInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoPropertyInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.MonoProperty" preserve="fields">
|
||||
<method name="GetterAdapterFrame" />
|
||||
<method name="StaticGetterAdapterFrame" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.ParameterInfo" preserve="fields" />
|
||||
<!-- reflection.c: ves_icall_get_parameter_info -->
|
||||
<type fullname="System.Reflection.MonoParameterInfo" preserve="fields" />
|
||||
|
||||
<type fullname="System.Reflection.PropertyInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.ReflectionTypeLoadException" />
|
||||
<type fullname="System.Reflection.TargetException" />
|
||||
<type fullname="System.Reflection.TargetParameterCountException" />
|
||||
|
||||
<type fullname="System.Reflection.Emit.AssemblyBuilder" preserve="fields">
|
||||
<method name="AddPermissionRequests" />
|
||||
<method name="AddModule" />
|
||||
<method name="DefineIconResource" />
|
||||
<method name="AddTypeForwarder" />
|
||||
<method name="EmbedResourceFile" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.ConstructorBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.CustomAttributeBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.DynamicMethod" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.EnumBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.EventBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.FieldBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.GenericTypeParameterBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.ILExceptionBlock" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.ILExceptionInfo" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.ILGenerator" preserve="fields">
|
||||
<method name="Mono_GetCurrentOffset" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.LocalBuilder" preserve="fields">
|
||||
<method name="Mono_GetLocalIndex" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields">
|
||||
<method name="Mono_GetGuid" />
|
||||
<method name="RuntimeResolve" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.MonoResource" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.ParameterBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.PropertyBuilder" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.SignatureHelper" preserve="fields" />
|
||||
<type fullname="System.Reflection.Emit.TypeBuilder" preserve="fields">
|
||||
<method name="SetCharSet" />
|
||||
</type>
|
||||
<type fullname="System.Reflection.Emit.UnmanagedMarshal" preserve="fields">
|
||||
<method name="DefineCustom" />
|
||||
<method name="DefineLPArrayInternal" />
|
||||
</type>
|
||||
|
||||
<!--
|
||||
<type fullname="System.Runtime.CompilerServices.CallConvCdecl" />
|
||||
<type fullname="System.Runtime.CompilerServices.CallConvStdcall" />
|
||||
<type fullname="System.Runtime.CompilerServices.CallConvFastcall" />
|
||||
<type fullname="System.Runtime.CompilerServices.CallConvThiscall" />
|
||||
-->
|
||||
|
||||
<type fullname="System.Runtime.CompilerServices.InternalsVisibleToAttribute" />
|
||||
<type fullname="System.Runtime.CompilerServices.RuntimeWrappedException">
|
||||
<method signature="System.Void .ctor(System.Object)" />
|
||||
</type>
|
||||
<!-- <type fullname="System.Runtime.CompilerServices.RequiredAttributeAttribute" />
|
||||
<type fullname="System.Runtime.CompilerServices.RuntimeHelpers" />
|
||||
<type fullname="System.Runtime.CompilerServices.TypeForwardedToAttribute" /> -->
|
||||
|
||||
<!-- <type fullname="System.Runtime.InteropServices.DllImportAttribute" /> -->
|
||||
<type fullname="System.Runtime.InteropServices.GCHandle" />
|
||||
<!-- <type fullname="System.Runtime.InteropServices.GuidAttribute" /> -->
|
||||
<type fullname="System.Runtime.InteropServices.HandleRef" />
|
||||
<type fullname="System.Runtime.InteropServices.ICustomMarshaler" />
|
||||
<!--<type fullname="System.Runtime.InteropServices.InterfaceTypeAttribute" /> -->
|
||||
<type fullname="System.Runtime.InteropServices.Marshal" />
|
||||
<!-- <type fullname="System.Runtime.InteropServices.MarshalDirectiveException" />
|
||||
<type fullname="System.Runtime.InteropServices.SafeHandle" />
|
||||
<type fullname="System.Runtime.InteropServices.StructLayoutAttribute" />
|
||||
<type fullname="System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute" />-->
|
||||
|
||||
<!-- <type fullname="System.Runtime.Remoting.Activation.ActivationServices" /> -->
|
||||
<type fullname="System.Runtime.Remoting.Contexts.Context" preserve="fields">
|
||||
<method name="get_NeedsContextSink" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.Channels.CrossAppDomainSink" />
|
||||
<type fullname="System.Runtime.Remoting.IRemotingTypeInfo">
|
||||
<method name="CanCastTo" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.Messaging.AsyncResult" preserve="fields" />
|
||||
<type fullname="System.Runtime.Remoting.Messaging.CallContext">
|
||||
<method name="SetCurrentCallContext" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.Messaging.MonoMethodMessage" preserve="fields">
|
||||
<method name="InitMessage" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.Proxies.RealProxy" preserve="fields">
|
||||
<method name="PrivateInvoke" />
|
||||
<method name="GetAppDomainTarget" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.Proxies.TransparentProxy" preserve="fields">
|
||||
<method name="LoadRemoteFieldNew" />
|
||||
<method name="StoreRemoteField" />
|
||||
</type>
|
||||
<type fullname="System.Runtime.Remoting.RemotingServices">
|
||||
<method name="SerializeCallData" />
|
||||
<method name="DeserializeCallData" />
|
||||
<method name="SerializeExceptionData" />
|
||||
</type>
|
||||
|
||||
<!--
|
||||
<type fullname="System.Runtime.Serialization.ISerializable" />
|
||||
<type fullname="System.Runtime.Serialization.SerializationException" />
|
||||
<type fullname="System.Runtime.Serialization.SerializationInfo" />
|
||||
<type fullname="System.Runtime.Serialization.StreamingContext" />
|
||||
-->
|
||||
|
||||
<type fullname="System.Threading.ExecutionContext" />
|
||||
<type fullname="System.Threading.Interlocked">
|
||||
<method name="CompareExchange" />
|
||||
<method name="Exchange" />
|
||||
</type>
|
||||
<type fullname="System.Threading.Monitor">
|
||||
<method name="Enter" />
|
||||
<method name="Exit" />
|
||||
<method name="enter_with_atomic_var" />
|
||||
</type>
|
||||
|
||||
<!--
|
||||
<type fullname="System.Threading.Mutex" />
|
||||
<type fullname="System.Threading.NativeEventCalls" />
|
||||
<type fullname="System.Threading.Semaphore" />
|
||||
-->
|
||||
|
||||
<type fullname="System.Threading.SynchronisationLockException" />
|
||||
<type fullname="System.Threading.Thread" preserve="fields">
|
||||
<method name="get_CurrentContext" />
|
||||
</type>
|
||||
<type fullname="System.Threading.InternalThread" preserve="fields" />
|
||||
<type fullname="System.Threading.ThreadAbortException" />
|
||||
<type fullname="System.Threading.ThreadInterruptedException" />
|
||||
<!--<type fullname="System.Threading.ThreadPool" />-->
|
||||
<type fullname="System.Threading.ThreadState" preserve="fields" />
|
||||
<type fullname="System.Threading.ThreadStateException" />
|
||||
<type fullname="System.Threading.WaitHandle" preserve="fields">
|
||||
<method name="set_Handle" />
|
||||
</type>
|
||||
<type fullname="System.Threading._ThreadPoolWaitCallback">
|
||||
<method name="PerformWaitCallback"/>
|
||||
</type>
|
||||
|
||||
<type fullname="System.Text.StringBuilder" preserve="fields" />
|
||||
|
||||
<type fullname="System.Security.AllowPartiallyTrustedCallersAttribute" />
|
||||
<type fullname="System.Security.Policy.Evidence" />
|
||||
<!--
|
||||
<type fullname="System.Security.Principal.WindowsIdentity" />
|
||||
<type fullname="System.Security.Principal.WindowsImpersonationContext" />
|
||||
<type fullname="System.Security.Principal.WindowsPrincipal" />
|
||||
<type fullname="System.Security.RuntimeSecurityFrame" />
|
||||
<type fullname="System.Security.SecurityCriticalAttribute" />
|
||||
<type fullname="System.Security.SecurityException" />
|
||||
-->
|
||||
<type fullname="System.Security.SecurityManager" />
|
||||
<!--
|
||||
<type fullname="System.Security.SuppressUnmanagedCodeSecurityAttribute" />
|
||||
<type fullname="System.Security.VerificationException" />
|
||||
-->
|
||||
|
||||
<namespace fullname="System.Security.Cryptography" feature="crypto" />
|
||||
|
||||
<type fullname="Mono.Interop.ComInteropProxy" feature="com" />
|
||||
<type fullname="Mono.Interop.IDispatch" feature="com" />
|
||||
<type fullname="Mono.Interop.IUnknown" feature="com"/>
|
||||
|
||||
<!-- by convention (and see #34671) -->
|
||||
<type fullname="Mono.Runtime" />
|
||||
|
||||
<type fullname="Mono.RuntimeStructs/HandleStackMark" />
|
||||
<type fullname="Mono.RuntimeStructs/MonoError" />
|
||||
</assembly>
|
||||
</linker>
|
@@ -2,21 +2,43 @@ thisdir = tools/linker
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
RESOURCES = \
|
||||
Descriptors/mscorlib.xml \
|
||||
Descriptors/System.xml \
|
||||
Descriptors/System.Core.xml \
|
||||
Descriptors/System.Drawing.xml \
|
||||
Descriptors/System.Web.xml \
|
||||
Descriptors/Mono.Posix.xml \
|
||||
|
||||
PROGRAM = monolinker.exe
|
||||
|
||||
$(PROGRAM): $(RESOURCES)
|
||||
|
||||
LIB_REFS = System System.Core System.Xml Mono.Cecil
|
||||
LOCAL_MCS_FLAGS = $(RESOURCES:%=-resource:%)
|
||||
|
||||
EXTRA_DISTFILES = $(RESOURCES)
|
||||
TEST_CASES = \
|
||||
mscorlib/test-array.cs
|
||||
|
||||
ifndef AOT_FRIENDLY_PROFILE
|
||||
TEST_CASES += \
|
||||
mscorlib/test-reflection.cs
|
||||
endif
|
||||
|
||||
TESTS_COMPILER = $(MCS) -nologo -noconfig -debug:portable -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
|
||||
|
||||
check: compile-tests
|
||||
$(MAKE) run-tests
|
||||
|
||||
compile-tests: $(TEST_CASES)
|
||||
|
||||
mscorlib/test-%.cs:
|
||||
$(TESTS_COMPILER) Tests/$@ /out:Tests/$(@:.cs=.exe)
|
||||
|
||||
run-tests: $(TEST_CASES:.cs=.exe)
|
||||
|
||||
LINKER_OUTPUT := illink-output-$(PROFILE_DIRECTORY)
|
||||
PROFILE_PATH = $(topdir)/class/lib/$(PROFILE_DIRECTORY)
|
||||
LINKER = MONO_PATH=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/monolinker.exe -c link -out $(LINKER_OUTPUT) -b true -d $(PROFILE_PATH)
|
||||
TEST_EXEC = MONO_PATH=$(LINKER_OUTPUT) $(RUNTIME) $(RUNTIME_FLAGS) --debug -O=-aot
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
mscorlib/test-%.exe:
|
||||
@rm -rf $(LINKER_OUTPUT)
|
||||
@mkdir $(LINKER_OUTPUT)
|
||||
@echo Testing $@
|
||||
$(LINKER) -a Tests/$@
|
||||
$(TEST_EXEC) $(LINKER_OUTPUT)/$(@F)
|
||||
@rm -rf $(LINKER_OUTPUT)
|
||||
|
||||
include ../../build/executable.make
|
||||
|
@@ -2,6 +2,7 @@
|
||||
../../../external/linker/linker/Mono.Linker/AssemblyInfo.cs
|
||||
../../../external/linker/linker/Mono.Linker/AssemblyResolver.cs
|
||||
../../../external/linker/linker/Mono.Linker/TypePreserve.cs
|
||||
../../../external/linker/linker/Mono.Linker/TypeReferenceExtensions.cs
|
||||
../../../external/linker/linker/Mono.Linker/Annotations.cs
|
||||
../../../external/linker/linker/Mono.Linker/LinkContext.cs
|
||||
../../../external/linker/linker/Mono.Linker/AssemblyAction.cs
|
||||
@@ -12,6 +13,7 @@
|
||||
../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
|
||||
../../../external/linker/linker/Mono.Linker/LoadException.cs
|
||||
../../../external/linker/linker/Mono.Linker/MarkException.cs
|
||||
../../../external/linker/linker/Mono.Linker/MethodReferenceExtensions.cs
|
||||
../../../external/linker/linker/Mono.Linker.Steps/BaseStep.cs
|
||||
../../../external/linker/linker/Mono.Linker.Steps/LoadReferencesStep.cs
|
||||
../../../external/linker/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
|
||||
|
@@ -2,20 +2,26 @@ thisdir = tools/mdoc
|
||||
SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
MDOC_COMMON_FLAGS = \
|
||||
/resource:../../class/monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl \
|
||||
/resource:../../class/monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl \
|
||||
/resource:../../class/monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl \
|
||||
/resource:../../class/monodoc/Resources/mono-ecma-css.xsl,mono-ecma-css.xsl \
|
||||
/resource:Resources/defaulttemplate.xsl,defaulttemplate.xsl \
|
||||
/resource:Resources/monodoc-ecma.xsd,monodoc-ecma.xsd \
|
||||
/resource:Resources/msitomsx.xsl,msitomsx.xsl \
|
||||
/resource:Resources/overview.xsl,overview.xsl \
|
||||
/resource:Resources/stylesheet.xsl,stylesheet.xsl \
|
||||
MONODOC_RESOURCES = \
|
||||
Resources/mdoc-html-format.xsl \
|
||||
Resources/mdoc-html-utils.xsl \
|
||||
Resources/mdoc-sections-css.xsl \
|
||||
Resources/mono-ecma-css.xsl
|
||||
|
||||
MDOC_RESOURCES = \
|
||||
Resources/defaulttemplate.xsl \
|
||||
Resources/monodoc-ecma.xsd \
|
||||
Resources/msitomsx.xsl \
|
||||
Resources/overview.xsl \
|
||||
Resources/stylesheet.xsl
|
||||
|
||||
MDOC_RESOURCES_COMMAND = $(foreach file,$(MDOC_RESOURCES),/resource:../../../external/api-doc-tools/mdoc/$(file),$(notdir $(file)))
|
||||
|
||||
MONODOC_RESOURCES_COMMAND = $(foreach file,$(MONODOC_RESOURCES),/resource:../../../external/api-doc-tools/monodoc/$(file),$(notdir $(file)))
|
||||
|
||||
LIB_REFS = monodoc System System.Xml System.Core Mono.Cecil ICSharpCode.SharpZipLib System.Xml.Linq System.Web
|
||||
|
||||
LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS)
|
||||
LOCAL_MCS_FLAGS = $(MDOC_RESOURCES_COMMAND) $(MONODOC_RESOURCES_COMMAND)
|
||||
PROGRAM = $(topdir)/class/lib/$(PROFILE)/mdoc.exe
|
||||
PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
|
||||
|
||||
@@ -31,18 +37,6 @@ copy-with-deps:
|
||||
cp $(topdir)/class/lib/$(PROFILE)/monodoc.dll mdoc-net
|
||||
endif
|
||||
|
||||
MONODOC_RESOURCES = \
|
||||
../../class/monodoc/Resources/mdoc-html-utils.xsl \
|
||||
../../class/monodoc/Resources/mdoc-sections-css.xsl \
|
||||
../../class/monodoc/Resources/mono-ecma-css.xsl
|
||||
|
||||
MDOC_RESOURCES = \
|
||||
Resources/defaulttemplate.xsl \
|
||||
Resources/monodoc-ecma.xsd \
|
||||
Resources/msitomsx.xsl \
|
||||
Resources/overview.xsl \
|
||||
Resources/stylesheet.xsl
|
||||
|
||||
MDOC_TEST_FILES = \
|
||||
Test/CLILibraryTypes.dtd \
|
||||
Test/DocTest-v1.cs \
|
||||
@@ -53,16 +47,12 @@ MDOC_TEST_FILES = \
|
||||
Test/validate.check.monodocer.importslashdoc \
|
||||
Test/validate.check.monodocer.since
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
$(MDOC_RESOURCES) \
|
||||
$(MDOC_TEST_FILES)
|
||||
|
||||
MULTI-CLASSIC = Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-multitest.dll
|
||||
MULTI-UNIFIED = Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-unified-multitest.dll
|
||||
|
||||
$(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
|
||||
$(PROGRAM): $(PROGRAM_DEPS)
|
||||
|
||||
PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
|
||||
PROGRAM_COMPILE = $(CSCOMPILE)
|
||||
|
||||
include ../../build/executable.make
|
||||
|
||||
@@ -72,7 +62,7 @@ MONO = \
|
||||
|
||||
DIFF = diff -rup
|
||||
DIFF_QUIET = diff --brief
|
||||
ifeq ($(PLATFORM), win32)
|
||||
ifeq ($(BUILD_PLATFORM), win32)
|
||||
DIFF = diff -rupZ
|
||||
DIFF_QUIET = diff --brief -Z
|
||||
endif
|
||||
|
@@ -1,83 +0,0 @@
|
||||
//
|
||||
// MdocFile.cs: File utility methods
|
||||
//
|
||||
// Author:
|
||||
// Jonathan Pryor <jpryor@novell.com>
|
||||
//
|
||||
// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
static class MdocFile {
|
||||
|
||||
public static void UpdateFile (string file, Action<string> creator)
|
||||
{
|
||||
if (!File.Exists (file) || file == "-") {
|
||||
creator (file);
|
||||
return;
|
||||
}
|
||||
|
||||
string temp = Path.GetTempFileName ();
|
||||
bool move = true;
|
||||
try {
|
||||
creator (temp);
|
||||
|
||||
using (var a = File.OpenRead (file))
|
||||
using (var b = File.OpenRead (temp)) {
|
||||
if (a.Length == b.Length)
|
||||
move = !FileContentsIdentical (a, b);
|
||||
}
|
||||
|
||||
if (move) {
|
||||
File.Delete (file);
|
||||
File.Move (temp, file);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (!move && File.Exists (temp))
|
||||
File.Delete (temp);
|
||||
}
|
||||
}
|
||||
|
||||
static bool FileContentsIdentical (Stream a, Stream b)
|
||||
{
|
||||
byte[] ba = new byte[4096];
|
||||
byte[] bb = new byte[4096];
|
||||
int ra, rb;
|
||||
|
||||
while ((ra = a.Read (ba, 0, ba.Length)) > 0 &&
|
||||
(rb = b.Read (bb, 0, bb.Length)) > 0) {
|
||||
if (ra != rb)
|
||||
return false;
|
||||
for (int i = 0; i < ra; ++i) {
|
||||
if (ba [i] != bb [i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,252 +0,0 @@
|
||||
//
|
||||
// XhtmlWriter.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
// Jonathan Pryor <jpryor@novell.com>
|
||||
//
|
||||
// (C)2004 Atsushi Enomoto
|
||||
//
|
||||
//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
class XhtmlWriter : DelegatingXmlWriter {
|
||||
XmlWriter writer;
|
||||
Stack<string> localNames;
|
||||
Stack<string> namespaces;
|
||||
|
||||
public XhtmlWriter (XmlWriter writer) : base (writer)
|
||||
{
|
||||
this.writer = writer;
|
||||
localNames = new Stack<string> ();
|
||||
namespaces = new Stack<string> ();
|
||||
}
|
||||
|
||||
public override void WriteStartElement (string prefix, string localName, string ns)
|
||||
{
|
||||
localNames.Push (localName);
|
||||
namespaces.Push (ns);
|
||||
writer.WriteStartElement (prefix, localName, ns);
|
||||
}
|
||||
|
||||
public override void WriteEndElement ()
|
||||
{
|
||||
WriteWiseEndElement (false);
|
||||
}
|
||||
|
||||
public override void WriteFullEndElement ()
|
||||
{
|
||||
WriteWiseEndElement (true);
|
||||
}
|
||||
|
||||
void WriteWiseEndElement (bool full)
|
||||
{
|
||||
string localName = localNames.Pop ();
|
||||
/* string ns = */ namespaces.Pop ();
|
||||
if (true /* ns == "http://www.w3.org/1999/xhtml" */) {
|
||||
switch (localName.ToLower (CultureInfo.InvariantCulture)) {
|
||||
case "area":
|
||||
case "base":
|
||||
case "basefont":
|
||||
case "br":
|
||||
case "col":
|
||||
case "frame":
|
||||
case "hr":
|
||||
case "img":
|
||||
case "input":
|
||||
case "isindex":
|
||||
case "link":
|
||||
case "meta":
|
||||
case "param":
|
||||
full = false;
|
||||
break;
|
||||
default:
|
||||
full = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (full)
|
||||
writer.WriteFullEndElement ();
|
||||
else
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
}
|
||||
|
||||
class DelegatingXmlWriter : XmlWriter {
|
||||
XmlWriter writer;
|
||||
|
||||
public DelegatingXmlWriter (XmlWriter writer)
|
||||
{
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
{
|
||||
writer.Close ();
|
||||
}
|
||||
|
||||
public override void Flush ()
|
||||
{
|
||||
writer.Flush ();
|
||||
}
|
||||
|
||||
public override string LookupPrefix (string ns)
|
||||
{
|
||||
return writer.LookupPrefix (ns);
|
||||
}
|
||||
|
||||
public override void WriteBase64 (byte [] buffer, int index, int count)
|
||||
{
|
||||
writer.WriteBase64 (buffer, index, count);
|
||||
}
|
||||
|
||||
public override void WriteBinHex (byte [] buffer, int index, int count)
|
||||
{
|
||||
writer.WriteBinHex (buffer, index, count);
|
||||
}
|
||||
|
||||
public override void WriteCData (string text)
|
||||
{
|
||||
writer.WriteCData (text);
|
||||
}
|
||||
|
||||
public override void WriteCharEntity (char ch)
|
||||
{
|
||||
writer.WriteCharEntity (ch);
|
||||
}
|
||||
|
||||
public override void WriteChars (char [] buffer, int index, int count)
|
||||
{
|
||||
writer.WriteChars (buffer, index, count);
|
||||
}
|
||||
|
||||
public override void WriteComment (string text)
|
||||
{
|
||||
writer.WriteComment (text);
|
||||
}
|
||||
|
||||
public override void WriteDocType (string name, string pubid, string sysid, string subset)
|
||||
{
|
||||
writer.WriteDocType (name, pubid, sysid, subset);
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute ()
|
||||
{
|
||||
writer.WriteEndAttribute ();
|
||||
}
|
||||
|
||||
public override void WriteEndDocument ()
|
||||
{
|
||||
writer.WriteEndDocument ();
|
||||
}
|
||||
|
||||
public override void WriteEndElement ()
|
||||
{
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
|
||||
public override void WriteEntityRef (string name)
|
||||
{
|
||||
writer.WriteEntityRef (name);
|
||||
}
|
||||
|
||||
public override void WriteFullEndElement ()
|
||||
{
|
||||
writer.WriteFullEndElement ();
|
||||
}
|
||||
|
||||
public override void WriteName (string name)
|
||||
{
|
||||
writer.WriteName (name);
|
||||
}
|
||||
|
||||
public override void WriteNmToken (string name)
|
||||
{
|
||||
writer.WriteNmToken (name);
|
||||
}
|
||||
|
||||
public override void WriteNode (XmlReader reader, bool defattr)
|
||||
{
|
||||
writer.WriteNode (reader, defattr);
|
||||
}
|
||||
|
||||
public override void WriteProcessingInstruction (string name, string text)
|
||||
{
|
||||
writer.WriteProcessingInstruction (name, text);
|
||||
}
|
||||
|
||||
public override void WriteQualifiedName (string localName, string ns)
|
||||
{
|
||||
writer.WriteQualifiedName (localName, ns);
|
||||
}
|
||||
|
||||
public override void WriteRaw (string data)
|
||||
{
|
||||
writer.WriteRaw (data);
|
||||
}
|
||||
|
||||
public override void WriteRaw (char [] buffer, int index, int count)
|
||||
{
|
||||
writer.WriteRaw (buffer, index, count);
|
||||
}
|
||||
|
||||
public override void WriteStartAttribute (string prefix, string localName, string ns)
|
||||
{
|
||||
writer.WriteStartAttribute (prefix, localName, ns);
|
||||
}
|
||||
|
||||
public override void WriteStartDocument (bool standalone)
|
||||
{
|
||||
writer.WriteStartDocument (standalone);
|
||||
}
|
||||
|
||||
public override void WriteStartDocument ()
|
||||
{
|
||||
writer.WriteStartDocument ();
|
||||
}
|
||||
|
||||
public override void WriteStartElement (string prefix, string localName, string ns)
|
||||
{
|
||||
writer.WriteStartElement (prefix, localName, ns);
|
||||
}
|
||||
|
||||
public override void WriteString (string text)
|
||||
{
|
||||
writer.WriteString (text);
|
||||
}
|
||||
|
||||
public override void WriteSurrogateCharEntity (char lowChar, char highChar)
|
||||
{
|
||||
writer.WriteSurrogateCharEntity (lowChar, highChar);
|
||||
}
|
||||
|
||||
public override void WriteWhitespace (string ws)
|
||||
{
|
||||
writer.WriteWhitespace (ws);
|
||||
}
|
||||
|
||||
public override WriteState WriteState {
|
||||
get {
|
||||
return writer.WriteState;
|
||||
}
|
||||
}
|
||||
|
||||
public override string XmlLang {
|
||||
get {
|
||||
return writer.XmlLang;
|
||||
}
|
||||
}
|
||||
|
||||
public override XmlSpace XmlSpace {
|
||||
get {
|
||||
return writer.XmlSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,415 +0,0 @@
|
||||
//
|
||||
// The assembler: Help compiler.
|
||||
//
|
||||
// Author:
|
||||
// Miguel de Icaza (miguel@gnome.org)
|
||||
//
|
||||
// (C) 2003 Ximian, Inc.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Monodoc;
|
||||
using Monodoc.Providers;
|
||||
using Mono.Options;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Monodoc.Ecma;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
public class MDocAssembler : MDocCommand {
|
||||
static readonly string[] ValidFormats = {
|
||||
"ecma",
|
||||
"ecmaspec",
|
||||
"error",
|
||||
"hb",
|
||||
"man",
|
||||
"simple",
|
||||
"xhtml"
|
||||
};
|
||||
|
||||
string droppedNamespace = null;
|
||||
|
||||
public static Option[] CreateFormatOptions (MDocCommand self, Dictionary<string, List<string>> formats)
|
||||
{
|
||||
string cur_format = "ecma";
|
||||
var options = new OptionSet () {
|
||||
{ "f|format=",
|
||||
"The documentation {FORMAT} used in DIRECTORIES. " +
|
||||
"Valid formats include:\n " +
|
||||
string.Join ("\n ", ValidFormats) + "\n" +
|
||||
"If not specified, the default format is `ecma'.",
|
||||
v => {
|
||||
if (Array.IndexOf (ValidFormats, v) < 0)
|
||||
self.Error ("Invalid documentation format: {0}.", v);
|
||||
cur_format = v;
|
||||
} },
|
||||
{ "<>", v => AddFormat (self, formats, cur_format, v) },
|
||||
};
|
||||
return new Option[]{options[0], options[1]};
|
||||
}
|
||||
|
||||
public override void Run (IEnumerable<string> args)
|
||||
{
|
||||
bool replaceNTypes = false;
|
||||
var formats = new Dictionary<string, List<string>> ();
|
||||
string prefix = "tree";
|
||||
var formatOptions = CreateFormatOptions (this, formats);
|
||||
var options = new OptionSet () {
|
||||
formatOptions [0],
|
||||
{ "o|out=",
|
||||
"Provides the output file prefix; the files {PREFIX}.zip and " +
|
||||
"{PREFIX}.tree will be created.\n" +
|
||||
"If not specified, `tree' is the default PREFIX.",
|
||||
v => prefix = v },
|
||||
formatOptions [1],
|
||||
{"dropns=","The namespace that has been dropped from this version of the assembly.", v => droppedNamespace = v },
|
||||
{"ntypes","Replace references to native types with their original types.", v => replaceNTypes=true },
|
||||
};
|
||||
List<string> extra = Parse (options, args, "assemble",
|
||||
"[OPTIONS]+ DIRECTORIES",
|
||||
"Assemble documentation within DIRECTORIES for use within the monodoc browser.");
|
||||
if (extra == null)
|
||||
return;
|
||||
|
||||
List<Provider> list = new List<Provider> ();
|
||||
EcmaProvider ecma = null;
|
||||
bool sort = false;
|
||||
|
||||
foreach (string format in formats.Keys) {
|
||||
switch (format) {
|
||||
case "ecma":
|
||||
if (ecma == null) {
|
||||
ecma = new EcmaProvider ();
|
||||
list.Add (ecma);
|
||||
sort = true;
|
||||
}
|
||||
ecma.FileSource = new MDocFileSource(droppedNamespace, string.IsNullOrWhiteSpace(droppedNamespace) ? ApiStyle.Unified : ApiStyle.Classic) {
|
||||
ReplaceNativeTypes = replaceNTypes
|
||||
};
|
||||
foreach (string dir in formats [format])
|
||||
ecma.AddDirectory (dir);
|
||||
break;
|
||||
|
||||
case "xhtml":
|
||||
case "hb":
|
||||
list.AddRange (formats [format].Select (d => (Provider) new XhtmlProvider (d)));
|
||||
break;
|
||||
|
||||
case "man":
|
||||
list.Add (new ManProvider (formats [format].ToArray ()));
|
||||
break;
|
||||
|
||||
case "error":
|
||||
list.AddRange (formats [format].Select (d => (Provider) new ErrorProvider (d)));
|
||||
break;
|
||||
|
||||
case "ecmaspec":
|
||||
list.AddRange (formats [format].Select (d => (Provider) new EcmaSpecProvider (d)));
|
||||
break;
|
||||
|
||||
case "addins":
|
||||
list.AddRange (formats [format].Select (d => (Provider) new AddinsProvider (d)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HelpSource hs = new HelpSource (prefix, true);
|
||||
hs.TraceLevel = TraceLevel;
|
||||
|
||||
foreach (Provider p in list) {
|
||||
p.PopulateTree (hs.Tree);
|
||||
}
|
||||
|
||||
if (sort && hs.Tree != null)
|
||||
hs.Tree.RootNode.Sort ();
|
||||
|
||||
//
|
||||
// Flushes the EcmaProvider
|
||||
//
|
||||
foreach (Provider p in list)
|
||||
p.CloseTree (hs, hs.Tree);
|
||||
|
||||
hs.Save ();
|
||||
}
|
||||
|
||||
private static void AddFormat (MDocCommand self, Dictionary<string, List<string>> d, string format, string file)
|
||||
{
|
||||
if (format == null)
|
||||
self.Error ("No format specified.");
|
||||
List<string> l;
|
||||
if (!d.TryGetValue (format, out l)) {
|
||||
l = new List<string> ();
|
||||
d.Add (format, l);
|
||||
}
|
||||
l.Add (file);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A custom provider file source that lets us modify the source files before they are processed by monodoc.
|
||||
/// </summary>
|
||||
internal class MDocFileSource : IEcmaProviderFileSource {
|
||||
private string droppedNamespace;
|
||||
private bool shouldDropNamespace = false;
|
||||
private ApiStyle styleToDrop;
|
||||
|
||||
public bool ReplaceNativeTypes { get; set; }
|
||||
|
||||
/// <param name="ns">The namespace that is being dropped.</param>
|
||||
/// <param name="style">The style that is being dropped.</param>
|
||||
public MDocFileSource(string ns, ApiStyle style)
|
||||
{
|
||||
droppedNamespace = ns;
|
||||
shouldDropNamespace = !string.IsNullOrWhiteSpace (ns);
|
||||
styleToDrop = style;
|
||||
}
|
||||
|
||||
public XmlReader GetIndexReader(string path)
|
||||
{
|
||||
XDocument doc = XDocument.Load (path);
|
||||
|
||||
DropApiStyle (doc, path);
|
||||
DropNSFromDocument (doc);
|
||||
|
||||
// now put the modified contents into a stream for the XmlReader that monodoc will use.
|
||||
MemoryStream io = new MemoryStream ();
|
||||
using (var writer = XmlWriter.Create (io)) {
|
||||
doc.WriteTo (writer);
|
||||
}
|
||||
io.Seek (0, SeekOrigin.Begin);
|
||||
|
||||
return XmlReader.Create (io);
|
||||
}
|
||||
|
||||
public XElement GetNamespaceElement(string path)
|
||||
{
|
||||
var element = XElement.Load (path);
|
||||
|
||||
var attributes = element.Descendants ().Concat(new XElement[] { element }).SelectMany (n => n.Attributes ());
|
||||
var textNodes = element.Nodes ().OfType<XText> ();
|
||||
|
||||
DropNS (attributes, textNodes);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
void DropApiStyle(XDocument doc, string path)
|
||||
{
|
||||
string styleString = styleToDrop.ToString ().ToLower ();
|
||||
var items = doc
|
||||
.Descendants ()
|
||||
.Where (n => n.Attributes ()
|
||||
.Any (a => a.Name.LocalName == "apistyle" && a.Value == styleString))
|
||||
.ToArray ();
|
||||
|
||||
foreach (var element in items) {
|
||||
element.Remove ();
|
||||
}
|
||||
|
||||
if (styleToDrop == ApiStyle.Classic && ReplaceNativeTypes) {
|
||||
RewriteCrefsIfNecessary (doc, path);
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteCrefsIfNecessary (XDocument doc, string path)
|
||||
{
|
||||
// we also have to rewrite crefs
|
||||
var sees = doc.Descendants ().Where (d => d.Name.LocalName == "see").ToArray ();
|
||||
foreach (var see in sees) {
|
||||
var cref = see.Attribute ("cref");
|
||||
if (cref == null) {
|
||||
continue;
|
||||
}
|
||||
EcmaUrlParser parser = new EcmaUrlParser ();
|
||||
EcmaDesc reference;
|
||||
if (!parser.TryParse (cref.Value, out reference)) {
|
||||
continue;
|
||||
}
|
||||
if ((new EcmaDesc.Kind[] {
|
||||
EcmaDesc.Kind.Constructor,
|
||||
EcmaDesc.Kind.Method
|
||||
}).Any (k => k == reference.DescKind)) {
|
||||
string ns = reference.Namespace;
|
||||
string type = reference.TypeName;
|
||||
string memberName = reference.MemberName;
|
||||
if (reference.MemberArguments != null) {
|
||||
XDocument refDoc = FindReferenceDoc (path, doc, ns, type);
|
||||
if (refDoc == null) {
|
||||
continue;
|
||||
}
|
||||
// look in the refDoc for the memberName, and match on parameters and # of type parameters
|
||||
var overloads = refDoc.XPathSelectElements ("//Member[@MemberName='" + memberName + "']").ToArray ();
|
||||
// Do some initial filtering to find members that could potentially match (based on parameter and typeparam counts)
|
||||
var members = overloads.Where (e => reference.MemberArgumentsCount == e.XPathSelectElements ("Parameters/Parameter[not(@apistyle) or @apistyle='classic']").Count () && reference.GenericMemberArgumentsCount == e.XPathSelectElements ("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']").Count ()).Select (m => new {
|
||||
Node = m,
|
||||
AllParameters = m.XPathSelectElements ("Parameters/Parameter").ToArray (),
|
||||
Parameters = m.XPathSelectElements ("Parameters/Parameter[not(@apistyle) or @apistyle='classic']").ToArray (),
|
||||
NewParameters = m.XPathSelectElements ("Parameters/Parameter[@apistyle='unified']").ToArray ()
|
||||
}).ToArray ();
|
||||
// now find the member that matches on types
|
||||
var member = members.FirstOrDefault (m => reference.MemberArguments.All (r => m.Parameters.Any (mp => mp.Attribute ("Type").Value.Contains (r.TypeName))));
|
||||
if (member == null || member.NewParameters.Length == 0)
|
||||
continue;
|
||||
foreach (var arg in reference.MemberArguments) {
|
||||
// find the "classic" parameter
|
||||
var oldParam = member.Parameters.First (p => p.Attribute ("Type").Value.Contains (arg.TypeName));
|
||||
var newParam = member.NewParameters.FirstOrDefault (p => oldParam.Attribute ("Name").Value == p.Attribute ("Name").Value);
|
||||
if (newParam != null) {
|
||||
// this means there was a change made, and we should try to convert this cref
|
||||
arg.TypeName = NativeTypeManager.ConvertToNativeType (arg.TypeName);
|
||||
}
|
||||
}
|
||||
var rewrittenReference = reference.ToEcmaCref ();
|
||||
Console.WriteLine ("From {0} to {1}", cref.Value, rewrittenReference);
|
||||
cref.Value = rewrittenReference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XDocument FindReferenceDoc (string currentPath, XDocument currentDoc, string ns, string type)
|
||||
{
|
||||
if (currentPath.Length <= 1) {
|
||||
return null;
|
||||
}
|
||||
// build up the supposed path to the doc
|
||||
string dir = Path.GetDirectoryName (currentPath);
|
||||
if (dir.Equals (currentPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
string supposedPath = Path.Combine (dir, ns, type + ".xml");
|
||||
|
||||
// if it's the current path, return currentDoc
|
||||
if (supposedPath == currentPath) {
|
||||
return currentDoc;
|
||||
}
|
||||
|
||||
if (!File.Exists (supposedPath)) {
|
||||
// hmm, file not there, look one directory up
|
||||
return FindReferenceDoc (dir, currentDoc, ns, type);
|
||||
}
|
||||
|
||||
// otherwise, load the XDoc and return
|
||||
return XDocument.Load (supposedPath);
|
||||
}
|
||||
|
||||
void DropNSFromDocument (XDocument doc)
|
||||
{
|
||||
var attributes = doc.Descendants ().SelectMany (n => n.Attributes ());
|
||||
var textNodes = doc.DescendantNodes().OfType<XText> ().ToArray();
|
||||
|
||||
DropNS (attributes, textNodes);
|
||||
}
|
||||
|
||||
void DropNS(IEnumerable<XAttribute> attributes, IEnumerable<XText> textNodes)
|
||||
{
|
||||
if (!shouldDropNamespace) {
|
||||
return;
|
||||
}
|
||||
|
||||
string nsString = string.Format ("{0}.", droppedNamespace);
|
||||
foreach (var attr in attributes) {
|
||||
if (attr.Value.Contains (nsString)) {
|
||||
attr.Value = attr.Value.Replace (nsString, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var textNode in textNodes) {
|
||||
if (textNode.Value.Contains (nsString)) {
|
||||
textNode.Value = textNode.Value.Replace (nsString, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <param name="nsName">This is the type's name in the processed XML content.
|
||||
/// If dropping the namespace, we'll need to append it so that it's found in the source.</param>
|
||||
/// <param name="typeName">Type name.</param>
|
||||
public string GetTypeXmlPath(string basePath, string nsName, string typeName)
|
||||
{
|
||||
string nsNameToUse = nsName;
|
||||
if (shouldDropNamespace) {
|
||||
nsNameToUse = string.Format ("{0}.{1}", droppedNamespace, nsName);
|
||||
|
||||
var droppedPath = BuildTypeXmlPath (basePath, typeName, nsNameToUse);
|
||||
var origPath = BuildTypeXmlPath (basePath, typeName, nsName);
|
||||
|
||||
if (!File.Exists (droppedPath)) {
|
||||
if (File.Exists (origPath)) {
|
||||
return origPath;
|
||||
}
|
||||
}
|
||||
|
||||
return droppedPath;
|
||||
} else {
|
||||
|
||||
var finalPath = BuildTypeXmlPath (basePath, typeName, nsNameToUse);
|
||||
|
||||
return finalPath;
|
||||
}
|
||||
}
|
||||
|
||||
static string BuildTypeXmlPath (string basePath, string typeName, string nsNameToUse)
|
||||
{
|
||||
string finalPath = Path.Combine (basePath, nsNameToUse, Path.ChangeExtension (typeName, ".xml"));
|
||||
return finalPath;
|
||||
}
|
||||
|
||||
static string BuildNamespaceXmlPath (string basePath, string ns)
|
||||
{
|
||||
var nsFileName = Path.Combine (basePath, String.Format ("ns-{0}.xml", ns));
|
||||
return nsFileName;
|
||||
}
|
||||
|
||||
/// <returns>The namespace for path, with the dropped namespace so it can be used to pick the right file if we're dropping it.</returns>
|
||||
/// <param name="ns">This namespace will already have "dropped" the namespace.</param>
|
||||
public string GetNamespaceXmlPath(string basePath, string ns)
|
||||
{
|
||||
string nsNameToUse = ns;
|
||||
if (shouldDropNamespace) {
|
||||
nsNameToUse = string.Format ("{0}.{1}", droppedNamespace, ns);
|
||||
|
||||
var droppedPath = BuildNamespaceXmlPath (basePath, nsNameToUse);
|
||||
var origPath = BuildNamespaceXmlPath (basePath, ns);
|
||||
|
||||
if (!File.Exists (droppedPath) && File.Exists(origPath)) {
|
||||
return origPath;
|
||||
}
|
||||
|
||||
return droppedPath;
|
||||
} else {
|
||||
var path = BuildNamespaceXmlPath (basePath, ns);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
public XDocument GetTypeDocument(string path)
|
||||
{
|
||||
var doc = XDocument.Load (path);
|
||||
DropApiStyle (doc, path);
|
||||
DropNSFromDocument (doc);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
public XElement ExtractNamespaceSummary (string path)
|
||||
{
|
||||
using (var reader = GetIndexReader (path)) {
|
||||
reader.ReadToFollowing ("Namespace");
|
||||
var name = reader.GetAttribute ("Name");
|
||||
var summary = reader.ReadToFollowing ("summary") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("summary");
|
||||
var remarks = reader.ReadToFollowing ("remarks") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("remarks");
|
||||
|
||||
return new XElement ("namespace",
|
||||
new XAttribute ("ns", name ?? string.Empty),
|
||||
summary,
|
||||
remarks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Monodoc;
|
||||
using Mono.Options;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
class MDocTreeDumper : MDocCommand {
|
||||
|
||||
public override void Run (IEnumerable<string> args)
|
||||
{
|
||||
var validFormats = RootTree.GetSupportedFormats ();
|
||||
string cur_format = "";
|
||||
var formats = new Dictionary<string, List<string>> ();
|
||||
var options = new OptionSet () {
|
||||
{ "f|format=",
|
||||
"The documentation {FORMAT} used in FILES. " +
|
||||
"Valid formats include:\n " +
|
||||
string.Join ("\n ", validFormats) + "\n" +
|
||||
"If not specified, no HelpSource is used. This may " +
|
||||
"impact the PublicUrls displayed for nodes.",
|
||||
v => {
|
||||
if (Array.IndexOf (validFormats, v) < 0)
|
||||
Error ("Invalid documentation format: {0}.", v);
|
||||
cur_format = v;
|
||||
} },
|
||||
{ "<>", v => AddFormat (formats, cur_format, v) },
|
||||
};
|
||||
List<string> files = Parse (options, args, "dump-tree",
|
||||
"[OPTIONS]+ FILES",
|
||||
"Print out the nodes within the assembled .tree FILES,\n" +
|
||||
"as produced by 'mdoc assemble'.");
|
||||
if (files == null)
|
||||
return;
|
||||
|
||||
foreach (string format in formats.Keys) {
|
||||
foreach (string file in formats [format]) {
|
||||
HelpSource hs = format == ""
|
||||
? null
|
||||
: RootTree.GetHelpSource (format, file.Replace (".tree", ""));
|
||||
Tree t = new Tree (hs, file);
|
||||
TreeDumper.PrintTree (t.RootNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFormat (Dictionary<string, List<string>> d, string format, string file)
|
||||
{
|
||||
if (format == null)
|
||||
format = "";
|
||||
List<string> l;
|
||||
if (!d.TryGetValue (format, out l)) {
|
||||
l = new List<string> ();
|
||||
d.Add (format, l);
|
||||
}
|
||||
l.Add (file);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,331 +0,0 @@
|
||||
//
|
||||
// ecmadoc.cs
|
||||
//
|
||||
// Author:
|
||||
// Jonathan Pryor <jpryor@novell.com>
|
||||
//
|
||||
// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using Monodoc;
|
||||
using Mono.Documentation;
|
||||
|
||||
using Mono.Options;
|
||||
using Mono.Rocks;
|
||||
|
||||
namespace Mono.Documentation
|
||||
{
|
||||
public class MDocUpdateEcmaXml : MDocCommand
|
||||
{
|
||||
string file = "CLILibraryTypes.xml";
|
||||
List<string> directories;
|
||||
Dictionary<string, HashSet<string>> libraries = new Dictionary<string, HashSet<string>>();
|
||||
|
||||
public override void Run (IEnumerable<string> args)
|
||||
{
|
||||
string current_library = "";
|
||||
|
||||
var options = new OptionSet () {
|
||||
{ "o|out=",
|
||||
"{FILE} to generate/update documentation within.\n" +
|
||||
"If not specified, will process " + file + ".\n" +
|
||||
"Set to '-' to skip updates and write to standard output.",
|
||||
v => file = v },
|
||||
{ "library=",
|
||||
"The {LIBRARY} that the following --type=TYPE types should be a part of.",
|
||||
v => current_library = v },
|
||||
{ "type=",
|
||||
"The full {TYPE} name of a type to copy into the output file.",
|
||||
v => AddTypeToLibrary (current_library, v) },
|
||||
};
|
||||
directories = Parse (options, args, "export-ecma-xml",
|
||||
"[OPTIONS]+ DIRECTORIES",
|
||||
"Export mdoc documentation within DIRECTORIES into ECMA-format XML.\n\n" +
|
||||
"DIRECTORIES are mdoc(5) directories as produced by 'mdoc update'.");
|
||||
if (directories == null || directories.Count == 0)
|
||||
return;
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
void AddTypeToLibrary (string library, string type)
|
||||
{
|
||||
HashSet<string> types;
|
||||
if (!libraries.TryGetValue (library, out types))
|
||||
libraries.Add (library, types = new HashSet<string> ());
|
||||
types.Add (type.Replace ('/', '.').Replace ('+', '.'));
|
||||
}
|
||||
|
||||
void Update ()
|
||||
{
|
||||
Action<string> creator = file => {
|
||||
XDocument docs = LoadFile (this.file);
|
||||
|
||||
var seenLibraries = new HashSet<string> ();
|
||||
|
||||
UpdateExistingLibraries (docs, seenLibraries);
|
||||
GenerateMissingLibraries (docs, seenLibraries);
|
||||
|
||||
SortLibraries (docs.Root);
|
||||
SortTypes (docs.Root);
|
||||
|
||||
using (var output = CreateWriter (file)) {
|
||||
foreach (var node in docs.Nodes ()) {
|
||||
if (node.NodeType == XmlNodeType.Element || node.NodeType == XmlNodeType.Text)
|
||||
continue;
|
||||
node.WriteTo (output);
|
||||
}
|
||||
docs.Root.WriteTo (output);
|
||||
output.WriteWhitespace ("\r\n");
|
||||
}
|
||||
};
|
||||
MdocFile.UpdateFile (this.file, creator);
|
||||
}
|
||||
|
||||
static XDocument LoadFile (string file)
|
||||
{
|
||||
if (file == "-" || !File.Exists (file))
|
||||
return CreateDefaultDocument ();
|
||||
|
||||
var settings = new XmlReaderSettings {
|
||||
DtdProcessing = DtdProcessing.Parse
|
||||
};
|
||||
using (var reader = XmlReader.Create (file, settings))
|
||||
return XDocument.Load (reader);
|
||||
}
|
||||
|
||||
static XDocument CreateDefaultDocument ()
|
||||
{
|
||||
return new XDocument (
|
||||
new XComment (" ====================================================================== "),
|
||||
new XComment (" This XML is a description of the Common Language Infrastructure (CLI) library. "),
|
||||
new XComment (" This file is a normative part of Partition IV of the following standards: ISO/IEC 23271 and ECMA 335 "),
|
||||
new XComment (" ====================================================================== "),
|
||||
new XDocumentType ("Libraries", null, "CLILibraryTypes.dtd", null),
|
||||
new XElement ("Libraries"));
|
||||
}
|
||||
|
||||
static XmlWriter CreateWriter (string file)
|
||||
{
|
||||
var settings = new XmlWriterSettings {
|
||||
Indent = true,
|
||||
IndentChars = "\t",
|
||||
NewLineChars = "\r\n",
|
||||
OmitXmlDeclaration = true,
|
||||
};
|
||||
|
||||
if (file == "-")
|
||||
return XmlWriter.Create (Console.Out, settings);
|
||||
|
||||
settings.Encoding = new UTF8Encoding (false);
|
||||
return XmlWriter.Create (file, settings);
|
||||
}
|
||||
|
||||
void UpdateExistingLibraries (XDocument docs, HashSet<string> seenLibraries)
|
||||
{
|
||||
foreach (XElement types in docs.Root.Elements ("Types")) {
|
||||
XAttribute library = types.Attribute ("Library");
|
||||
HashSet<string> libraryTypes;
|
||||
if (library == null || !libraries.TryGetValue (library.Value, out libraryTypes)) {
|
||||
continue;
|
||||
}
|
||||
seenLibraries.Add (library.Value);
|
||||
var seenTypes = new HashSet<string> ();
|
||||
foreach (XElement type in types.Elements ("Type").ToList ()) {
|
||||
XAttribute fullName = type.Attribute ("FullName");
|
||||
string typeName = fullName == null
|
||||
? null
|
||||
: XmlDocUtils.ToEscapedTypeName (fullName.Value);
|
||||
if (typeName == null || !libraryTypes.Contains (typeName)) {
|
||||
continue;
|
||||
}
|
||||
type.Remove ();
|
||||
seenTypes.Add (typeName);
|
||||
types.Add (LoadType (typeName, library.Value));
|
||||
}
|
||||
foreach (string typeName in libraryTypes.Except (seenTypes))
|
||||
types.Add (LoadType (typeName, library.Value));
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateMissingLibraries (XDocument docs, HashSet<string> seenLibraries)
|
||||
{
|
||||
foreach (KeyValuePair<string, HashSet<string>> lib in libraries) {
|
||||
if (seenLibraries.Contains (lib.Key))
|
||||
continue;
|
||||
seenLibraries.Add (lib.Key);
|
||||
docs.Root.Add (new XElement ("Types", new XAttribute ("Library", lib.Key),
|
||||
lib.Value.Select (type => LoadType (type, lib.Key))));
|
||||
}
|
||||
}
|
||||
|
||||
XElement LoadType (string type, string library)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> permutation in GetTypeDirectoryFilePermutations (type)) {
|
||||
foreach (string root in directories) {
|
||||
string path = Path.Combine (root, Path.Combine (permutation.Key, permutation.Value + ".xml"));
|
||||
if (File.Exists (path))
|
||||
return FixupType (path, library);
|
||||
}
|
||||
}
|
||||
throw new FileNotFoundException ("Unable to find documentation file for type: " + type + ".");
|
||||
}
|
||||
|
||||
// type has been "normalized", which (alas) means we have ~no clue which
|
||||
// part is the namespace and which is the type name, particularly
|
||||
// problematic as types may be nested to any level.
|
||||
// Try ~all permutations. :-)
|
||||
static IEnumerable<KeyValuePair<string, string>> GetTypeDirectoryFilePermutations (string type)
|
||||
{
|
||||
int end = type.Length;
|
||||
int dot;
|
||||
while ((dot = type.LastIndexOf ('.', end-1)) >= 0) {
|
||||
yield return new KeyValuePair<string, string> (
|
||||
type.Substring (0, dot),
|
||||
type.Substring (dot+1).Replace ('.', '+'));
|
||||
end = dot;
|
||||
}
|
||||
yield return new KeyValuePair<string, string> ("", type.Replace ('.', '+'));
|
||||
}
|
||||
|
||||
static XElement FixupType (string path, string library)
|
||||
{
|
||||
var type = XElement.Load (path);
|
||||
|
||||
XAttribute fullName = type.Attribute ("FullName");
|
||||
XAttribute fullNameSp = type.Attribute ("FullNameSP");
|
||||
if (fullNameSp == null && fullName != null) {
|
||||
type.Add (new XAttribute ("FullNameSP", fullName.Value.Replace ('.', '_')));
|
||||
}
|
||||
if (type.Element ("TypeExcluded") == null)
|
||||
type.Add (new XElement ("TypeExcluded", "0"));
|
||||
if (type.Element ("MemberOfLibrary") == null) {
|
||||
XElement member = new XElement ("MemberOfLibrary", library);
|
||||
XElement assemblyInfo = type.Element ("AssemblyInfo");
|
||||
if (assemblyInfo != null)
|
||||
assemblyInfo.AddBeforeSelf (member);
|
||||
else
|
||||
type.Add (member);
|
||||
}
|
||||
|
||||
XElement ai = type.Element ("AssemblyInfo");
|
||||
|
||||
XElement assembly =
|
||||
XElement.Load (
|
||||
Path.Combine (
|
||||
Path.Combine (Path.GetDirectoryName (path), ".."),
|
||||
"index.xml"))
|
||||
.Element ("Assemblies")
|
||||
.Elements ("Assembly")
|
||||
.FirstOrDefault (a => a.Attribute ("Name").Value == ai.Element ("AssemblyName").Value &&
|
||||
a.Attribute ("Version").Value == ai.Element ("AssemblyVersion").Value);
|
||||
if (assembly == null)
|
||||
return type;
|
||||
|
||||
if (assembly.Element ("AssemblyPublicKey") != null)
|
||||
ai.Add (assembly.Element ("AssemblyPublicKey"));
|
||||
|
||||
if (assembly.Element ("AssemblyCulture") != null)
|
||||
ai.Add (assembly.Element ("AssemblyCulture"));
|
||||
else
|
||||
ai.Add (new XElement ("AssemblyCulture", "neutral"));
|
||||
|
||||
// TODO: assembly attributes?
|
||||
// The problem is that .NET mscorlib.dll v4.0 has ~26 attributes, and
|
||||
// importing these for every time seems like some serious bloat...
|
||||
var clsDefAttr = assembly.Elements ("Attributes").Elements ("Attribute")
|
||||
.FirstOrDefault (a => a.Element ("AttributeName").Value.StartsWith ("System.CLSCompliant"));
|
||||
if (clsDefAttr != null &&
|
||||
ai.Elements ("Attributes").Elements ("Attribute")
|
||||
.FirstOrDefault (a => a.Element ("AttributeName").Value.StartsWith ("System.CLSCompliant")) == null) {
|
||||
var dest = ai.Element ("Attributes");
|
||||
if (dest == null)
|
||||
ai.Add (dest = new XElement ("Attributes"));
|
||||
dest.Add (clsDefAttr);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void SortLibraries (XContainer libraries)
|
||||
{
|
||||
SortElements (libraries, (x, y) => x.Attribute ("Library").Value.CompareTo (y.Attribute ("Library").Value));
|
||||
}
|
||||
|
||||
static void SortElements (XContainer container, Comparison<XElement> comparison)
|
||||
{
|
||||
var items = new List<XElement> ();
|
||||
foreach (var e in container.Elements ())
|
||||
items.Add (e);
|
||||
items.Sort (comparison);
|
||||
for (int i = items.Count - 1; i > 0; --i) {
|
||||
items [i-1].Remove ();
|
||||
items [i].AddBeforeSelf (items [i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void SortTypes (XContainer libraries)
|
||||
{
|
||||
foreach (var types in libraries.Elements ("Types")) {
|
||||
SortElements (types, (x, y) => {
|
||||
string xName, yName;
|
||||
int xCount, yCount;
|
||||
|
||||
GetTypeSortName (x, out xName, out xCount);
|
||||
GetTypeSortName (y, out yName, out yCount);
|
||||
|
||||
int c = xName.CompareTo (yName);
|
||||
if (c != 0)
|
||||
return c;
|
||||
if (xCount < yCount)
|
||||
return -1;
|
||||
if (yCount < xCount)
|
||||
return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void GetTypeSortName (XElement element, out string name, out int typeParamCount)
|
||||
{
|
||||
typeParamCount = 0;
|
||||
name = element.Attribute ("Name").Value;
|
||||
|
||||
int lt = name.IndexOf ('<');
|
||||
if (lt >= 0) {
|
||||
int gt = name.IndexOf ('>', lt);
|
||||
if (gt >= 0) {
|
||||
typeParamCount = name.Substring (lt, gt-lt).Count (c => c == ',') + 1;
|
||||
}
|
||||
name = name.Substring (0, lt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,213 +0,0 @@
|
||||
//
|
||||
// Mono.Documentation/exceptions.cs
|
||||
//
|
||||
// Authors:
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// (C) 2008 Novell, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
[Flags]
|
||||
public enum ExceptionLocations {
|
||||
Member = 0x0,
|
||||
Assembly = 0x1,
|
||||
DependentAssemblies = 0x2,
|
||||
AddedMembers = 0x4,
|
||||
}
|
||||
|
||||
public class ExceptionSources {
|
||||
internal ExceptionSources (TypeReference exception)
|
||||
{
|
||||
Exception = exception;
|
||||
Sources = new HashSet<MemberReference> ();
|
||||
}
|
||||
|
||||
public TypeReference Exception { get; private set; }
|
||||
internal HashSet<MemberReference> Sources;
|
||||
}
|
||||
|
||||
|
||||
public class ExceptionLookup {
|
||||
|
||||
SlashDocMemberFormatter xdoc = new SlashDocMemberFormatter ();
|
||||
|
||||
// xdoc(MemberRef) -> xdoc(TypeRef) -> ExceptionSource
|
||||
// where ExceptionSource.Exception == xdoc(TypeRef)
|
||||
Dictionary<string, Dictionary<string, ExceptionSources>> db = new Dictionary<string, Dictionary<string, ExceptionSources>> ();
|
||||
|
||||
ExceptionLocations locations;
|
||||
|
||||
public ExceptionLookup (ExceptionLocations locations)
|
||||
{
|
||||
this.locations = locations;
|
||||
}
|
||||
|
||||
public IEnumerable<ExceptionSources> this [MemberReference member] {
|
||||
get {
|
||||
if (member == null)
|
||||
throw new ArgumentNullException ("member");
|
||||
|
||||
var memberDef = member.Resolve ();
|
||||
if (memberDef == null) {
|
||||
ArrayType array = member.DeclaringType as ArrayType;
|
||||
if (array != null && array.Rank > 1) {
|
||||
// Multi-dimensional array; the member is runtime generated,
|
||||
// doesn't "really" exist (in a form that we can resolve),
|
||||
// so we can't do anything further.
|
||||
return new ExceptionSources[0];
|
||||
}
|
||||
throw new NotSupportedException (string.Format (
|
||||
"Unable to resolve member {0}::{1}.",
|
||||
member.DeclaringType.FullName, member.Name));
|
||||
}
|
||||
string memberDecl = xdoc.GetDeclaration (member);
|
||||
Dictionary<string, ExceptionSources> e;
|
||||
if (!db.TryGetValue (memberDecl, out e)) {
|
||||
e = new Dictionary<string, ExceptionSources> ();
|
||||
db.Add (memberDecl, e);
|
||||
var bodies = GetMethodBodies (member);
|
||||
foreach (var body in bodies) {
|
||||
if (body == null)
|
||||
continue;
|
||||
FillExceptions (body, e);
|
||||
}
|
||||
}
|
||||
return e.Values;
|
||||
}
|
||||
}
|
||||
|
||||
MethodBody[] GetMethodBodies (MemberReference member)
|
||||
{
|
||||
if (member is MethodReference) {
|
||||
return new[]{ (((MethodReference) member).Resolve ()).Body };
|
||||
}
|
||||
if (member is PropertyReference) {
|
||||
PropertyDefinition prop = (PropertyDefinition) member;
|
||||
return new[]{
|
||||
prop.GetMethod != null ? prop.GetMethod.Body : null,
|
||||
prop.SetMethod != null ? prop.SetMethod.Body : null,
|
||||
};
|
||||
}
|
||||
if (member is FieldReference)
|
||||
return new MethodBody[]{};
|
||||
if (member is EventReference) {
|
||||
EventDefinition ev = (EventDefinition) member;
|
||||
return new[]{
|
||||
ev.AddMethod != null ? ev.AddMethod.Body : null,
|
||||
ev.InvokeMethod != null ? ev.InvokeMethod.Body : null,
|
||||
ev.RemoveMethod != null ? ev.RemoveMethod.Body : null,
|
||||
};
|
||||
}
|
||||
throw new NotSupportedException ("Unsupported member type: " + member.GetType().FullName);
|
||||
}
|
||||
|
||||
void FillExceptions (MethodBody body, Dictionary<string, ExceptionSources> exceptions)
|
||||
{
|
||||
for (int i = 0; i < body.Instructions.Count; ++i) {
|
||||
Instruction instruction = body.Instructions [i];
|
||||
switch (instruction.OpCode.Code) {
|
||||
case Code.Call:
|
||||
case Code.Callvirt: {
|
||||
if ((locations & ExceptionLocations.Assembly) == 0 &&
|
||||
(locations & ExceptionLocations.DependentAssemblies) == 0)
|
||||
break;
|
||||
MemberReference memberRef = ((MemberReference) instruction.Operand);
|
||||
if (((locations & ExceptionLocations.Assembly) != 0 &&
|
||||
body.Method.DeclaringType.Scope.Name == memberRef.DeclaringType.Scope.Name) ||
|
||||
((locations & ExceptionLocations.DependentAssemblies) != 0 &&
|
||||
body.Method.DeclaringType.Scope.Name != memberRef.DeclaringType.Scope.Name)) {
|
||||
|
||||
IEnumerable<ExceptionSources> memberExceptions = this [memberRef];
|
||||
AddExceptions (body, instruction,
|
||||
memberExceptions.Select (es => es.Exception),
|
||||
memberExceptions.SelectMany (es => es.Sources),
|
||||
exceptions);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Code.Newobj: {
|
||||
MethodReference ctor = (MethodReference) instruction.Operand;
|
||||
if (IsExceptionConstructor (ctor)) {
|
||||
AddExceptions (body, instruction,
|
||||
new TypeReference[]{ctor.DeclaringType},
|
||||
new MemberReference[]{body.Method},
|
||||
exceptions);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddExceptions (MethodBody body, Instruction instruction, IEnumerable<TypeReference> add, IEnumerable<MemberReference> sources,
|
||||
Dictionary<string, ExceptionSources> exceptions)
|
||||
{
|
||||
var handlers = body.ExceptionHandlers.Cast<ExceptionHandler> ()
|
||||
.Where (eh => instruction.Offset >= eh.TryStart.Offset &&
|
||||
instruction.Offset <= eh.TryEnd.Offset);
|
||||
foreach (var ex in add) {
|
||||
if (!handlers.Any (h => IsExceptionCaught (ex, h.CatchType))) {
|
||||
ExceptionSources s;
|
||||
string eName = xdoc.GetDeclaration (ex);
|
||||
if (!exceptions.TryGetValue (eName, out s)) {
|
||||
s = new ExceptionSources (ex);
|
||||
exceptions.Add (eName, s);
|
||||
}
|
||||
foreach (var m in sources)
|
||||
s.Sources.Add (m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsExceptionConstructor (MethodReference ctor)
|
||||
{
|
||||
return GetBases (ctor.DeclaringType)
|
||||
.Any (t => t.FullName == "System.Exception");
|
||||
}
|
||||
|
||||
bool IsExceptionCaught (TypeReference exception, TypeReference catcher)
|
||||
{
|
||||
return GetBases (exception).Select (e => xdoc.GetDeclaration (e))
|
||||
.Union (GetBases (catcher).Select (e => xdoc.GetDeclaration (e)))
|
||||
.Any ();
|
||||
}
|
||||
|
||||
static IEnumerable<TypeReference> GetBases (TypeReference type)
|
||||
{
|
||||
yield return type;
|
||||
TypeDefinition def = type.Resolve ();
|
||||
while (def != null && def.BaseType != null) {
|
||||
yield return def.BaseType;
|
||||
def = def.BaseType.Resolve ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
//
|
||||
// index.cs
|
||||
// Index maker (both normal and Lucene-based)
|
||||
//
|
||||
// Authors:
|
||||
// Jérémie Laval <jeremie dot laval at xamarin dot com>
|
||||
//
|
||||
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Mono.Options;
|
||||
using Monodoc;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
class MDocIndex : MDocCommand {
|
||||
public override void Run (IEnumerable<string> args)
|
||||
{
|
||||
string rootPath = null;
|
||||
|
||||
var options = new OptionSet () {
|
||||
{ "r=|root=", "Specify which documentation root to use. Default is $libdir/monodoc", v => rootPath = v },
|
||||
};
|
||||
|
||||
var extra = Parse (options, args, "index",
|
||||
"[OPTIONS]+ ACTION",
|
||||
"Create Monodoc indexes depending on ACTION. Possible values are \"tree\" or \"search\" for, respectively, mdoc tree and lucene search");
|
||||
if (extra == null)
|
||||
return;
|
||||
|
||||
var root = string.IsNullOrEmpty (rootPath) ? RootTree.LoadTree () : RootTree.LoadTree (rootPath);
|
||||
|
||||
foreach (var action in extra) {
|
||||
switch (action) {
|
||||
case "tree":
|
||||
root.GenerateIndex ();
|
||||
break;
|
||||
case "search":
|
||||
root.GenerateSearchIndex ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,182 +0,0 @@
|
||||
// Part of the mdoc(7) suite of tools.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Mono.Options;
|
||||
|
||||
namespace Mono.Documentation {
|
||||
|
||||
class MDoc {
|
||||
|
||||
private static bool debug;
|
||||
|
||||
private static void Main (string[] args)
|
||||
{
|
||||
MDoc d = new MDoc ();
|
||||
try {
|
||||
d.Run (args);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (debug) {
|
||||
Console.Error.WriteLine ("mdoc: {0}", e.ToString ());
|
||||
}
|
||||
else {
|
||||
Console.Error.WriteLine ("mdoc: {0}", e.Message);
|
||||
}
|
||||
Console.Error.WriteLine ("See `mdoc help' for more information or use --debug to diagnose.");
|
||||
Environment.ExitCode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int verbosity = 2;
|
||||
|
||||
internal Dictionary<string, MDocCommand> subcommands;
|
||||
|
||||
private void Run (string[] args)
|
||||
{
|
||||
subcommands = new Dictionary<string, MDocCommand> () {
|
||||
{ "assemble", new MDocAssembler () },
|
||||
{ "dump-tree", new MDocTreeDumper () },
|
||||
{ "export-html", new MDocToHtmlConverter () },
|
||||
{ "export-html-webdoc", new MDocExportWebdocHtml () },
|
||||
{ "export-msxdoc", new MDocToMSXDocConverter () },
|
||||
{ "help", new MDocHelpCommand (this) },
|
||||
{ "update", new MDocUpdater () },
|
||||
{ "update-ecma-xml", new MDocUpdateEcmaXml () },
|
||||
{ "validate", new MDocValidator () },
|
||||
{ "index", new MDocIndex () },
|
||||
{ "preserve", new MDocPreserve () }
|
||||
};
|
||||
|
||||
bool showVersion = false;
|
||||
bool showHelp = false;
|
||||
var p = new OptionSet () {
|
||||
{ "version", v => showVersion = v != null },
|
||||
{ "v:", (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
|
||||
{ "debug", v => debug = v != null },
|
||||
{ "h|?|help", v => showHelp = v != null },
|
||||
new ResponseFileSource (),
|
||||
};
|
||||
|
||||
var extra = p.Parse (args);
|
||||
|
||||
if (showVersion) {
|
||||
Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
|
||||
return;
|
||||
}
|
||||
if (extra.Count == 0) {
|
||||
Console.WriteLine ("Use `mdoc help' for usage.");
|
||||
return;
|
||||
}
|
||||
if (showHelp) {
|
||||
extra.Add ("--help");
|
||||
}
|
||||
switch (extra [0]) {
|
||||
case "x-msitomsx":
|
||||
new MsidocToMsxdocConverter ().Run (extra);
|
||||
break;
|
||||
default:
|
||||
GetCommand (extra [0]).Run (extra);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal MDocCommand GetCommand (string command)
|
||||
{
|
||||
MDocCommand h;
|
||||
if (!subcommands.TryGetValue (command, out h)) {
|
||||
Error ("Unknown command: {0}.", command);
|
||||
}
|
||||
h.TraceLevel = (TraceLevel) verbosity;
|
||||
h.DebugOutput = debug;
|
||||
return h;
|
||||
}
|
||||
|
||||
private static void Error (string format, params object[] args)
|
||||
{
|
||||
throw new Exception (string.Format (format, args));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class MDocCommand {
|
||||
|
||||
public TraceLevel TraceLevel { get; set; }
|
||||
public bool DebugOutput { get; set; }
|
||||
|
||||
public abstract void Run (IEnumerable<string> args);
|
||||
|
||||
protected List<string> Parse (OptionSet p, IEnumerable<string> args,
|
||||
string command, string prototype, string description)
|
||||
{
|
||||
bool showHelp = false;
|
||||
p.Add ("h|?|help",
|
||||
"Show this message and exit.",
|
||||
v => showHelp = v != null );
|
||||
|
||||
List<string> extra = null;
|
||||
if (args != null) {
|
||||
extra = p.Parse (args.Skip (1));
|
||||
}
|
||||
if (args == null || showHelp) {
|
||||
Console.WriteLine ("usage: mdoc {0} {1}",
|
||||
args == null ? command : args.First(), prototype);
|
||||
Console.WriteLine ();
|
||||
Console.WriteLine (description);
|
||||
Console.WriteLine ();
|
||||
Console.WriteLine ("Available Options:");
|
||||
p.WriteOptionDescriptions (Console.Out);
|
||||
return null;
|
||||
}
|
||||
return extra;
|
||||
}
|
||||
|
||||
public void Error (string format, params object[] args)
|
||||
{
|
||||
throw new Exception (string.Format (format, args));
|
||||
}
|
||||
|
||||
public void Message (TraceLevel level, string format, params object[] args)
|
||||
{
|
||||
if ((int) level > (int) TraceLevel)
|
||||
return;
|
||||
if (level == TraceLevel.Error)
|
||||
Console.Error.WriteLine (format, args);
|
||||
else
|
||||
Console.WriteLine (format, args);
|
||||
}
|
||||
}
|
||||
|
||||
class MDocHelpCommand : MDocCommand {
|
||||
|
||||
MDoc instance;
|
||||
|
||||
public MDocHelpCommand (MDoc instance)
|
||||
{
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public override void Run (IEnumerable<string> args)
|
||||
{
|
||||
if (args != null && args.Count() > 1) {
|
||||
foreach (var arg in args.Skip (1)) {
|
||||
instance.GetCommand (arg).Run (new string[]{arg, "--help"});
|
||||
}
|
||||
return;
|
||||
}
|
||||
Message (TraceLevel.Warning,
|
||||
"usage: mdoc COMMAND [OPTIONS]\n" +
|
||||
"Use `mdoc help COMMAND' for help on a specific command.\n" +
|
||||
"\n" +
|
||||
"Available commands:\n\n " +
|
||||
string.Join ("\n ", instance.subcommands.Keys.OrderBy (v => v).ToArray()) +
|
||||
"\n\n" +
|
||||
"mdoc is a tool for documentation management.\n" +
|
||||
"For additional information, see http://www.mono-project.com/"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user