From 6f3f21b4b437b5c01796e934d2d84d82f742ec03 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:10:20 +0200 Subject: [PATCH 01/22] add unquote project.json --- Unquote/project.json | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Unquote/project.json diff --git a/Unquote/project.json b/Unquote/project.json new file mode 100644 index 0000000..779da40 --- /dev/null +++ b/Unquote/project.json @@ -0,0 +1,47 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "Utils/Prelude.fs", + "Utils/Regex.fs", + "Utils/Printf.fs", + "Utils/List.fs", + "Utils/Type.fs", + "AssemblyInfo.fs", + "DynamicOperators.fs", + "EvaluationException.fs", + "Evaluation.fs", + "OperatorPrecedence.fs", + "ExtraReflection.fs", + "ExtraPatterns.fs", + "ReductionException.fs", + "Decompilation.fs", + "Reduction.fs", + "UnquotedExpression.fs", + "Extensions.fs", + "Operators.fs", + "AssertionFailedException.fs", + "Assertions.fs" + ] + } + }, + "dependencies": { + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*" + }, + "frameworks": { + "netstandard1.6": { + "dependencies": { + "NETStandard.Library": "1.6.0" + } + } + }, + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-preview2-*", + "imports": "dnxcore50" + } + } +} \ No newline at end of file From bd29779a73f44a6157f479d5543116bdaf8b65a5 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:14:00 +0200 Subject: [PATCH 02/22] no exception serialization, like portable profile --- Unquote/AssertionFailedException.fs | 7 +++++-- Unquote/EvaluationException.fs | 7 +++++-- Unquote/ReductionException.fs | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Unquote/AssertionFailedException.fs b/Unquote/AssertionFailedException.fs index 44b1467..19b7258 100644 --- a/Unquote/AssertionFailedException.fs +++ b/Unquote/AssertionFailedException.fs @@ -1,11 +1,14 @@ namespace Swensen.Unquote open System +#if NETSTANDARD1_6 +#else open System.Runtime.Serialization +#endif ///Exception used to signal assertion failure to be caught by any exception framework ///(used when not NUnit or xUnit.net or when compiled for framework versions lacking serialization features) -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else [] #endif @@ -14,7 +17,7 @@ type AssertionFailedException = new () = { inherit exn() } new (message:string) = { inherit exn(message) } new (message:string, innerException:Exception) = { inherit exn(message, innerException) } -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed diff --git a/Unquote/EvaluationException.fs b/Unquote/EvaluationException.fs index 0cc8f84..55b8e13 100644 --- a/Unquote/EvaluationException.fs +++ b/Unquote/EvaluationException.fs @@ -1,11 +1,14 @@ namespace Swensen.Unquote open System +#if NETSTANDARD1_6 +#else open System.Runtime.Serialization +#endif //see http://stackoverflow.com/questions/1619567/f-type-inheritance //see http://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable //see http://msdn.microsoft.com/en-us/library/ms229064.aspx ///Exception used to distinguish an error in the quotation evaluation engine. -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else [] //must mark as Serializable for serialization to succeed #endif @@ -14,7 +17,7 @@ type EvaluationException = new () = { inherit exn() } new (message:string) = { inherit exn(message) } new (message:string, innerException:Exception) = { inherit exn(message, innerException) } -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed diff --git a/Unquote/ReductionException.fs b/Unquote/ReductionException.fs index acf795c..e002a08 100644 --- a/Unquote/ReductionException.fs +++ b/Unquote/ReductionException.fs @@ -1,17 +1,20 @@ namespace Swensen.Unquote open System +#if NETSTANDARD1_6 +#else open System.Runtime.Serialization +#endif ///Exception used to indicate an exception captured during reduction (typically not raised itself). -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else [] #endif type ReductionException = inherit exn new (inner:Exception) = { inherit exn("An exception was raised during quotation reduction", inner) } -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed From c33c5b9652a20573f7603733d2ad2d399c8964b0 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:14:42 +0200 Subject: [PATCH 03/22] ignore project.lock.json --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 62accad..31c6582 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ builds/ packages/ .vs/ *.suo +project.lock.json From f03ec26d901952dce30fe8a15fa4ee759d13b109 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:15:07 +0200 Subject: [PATCH 04/22] no appdomain --- Unquote/Assertions.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unquote/Assertions.fs b/Unquote/Assertions.fs index c3b92f8..b2ac5a7 100644 --- a/Unquote/Assertions.fs +++ b/Unquote/Assertions.fs @@ -58,7 +58,7 @@ module Internal = (reducedExprs |> List.map decompile |> String.concat "\n") output msg -#if PORTABLE +#if PORTABLE || NETSTANDARD1_6 outputReducedExprsMsg outputGenericTestFailedMsg #else //moved from top-level private module function since silverlight does not support printf (i.e. standard out) From 03bc3d6ad54ac84e73a52902ff6d560d09cecc00 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:24:05 +0200 Subject: [PATCH 05/22] IsGenericType,GetGenericTypeDefinition are defined in TypeInfo --- Unquote/ExtraReflection.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Unquote/ExtraReflection.fs b/Unquote/ExtraReflection.fs index a2d7750..d0fbbe9 100644 --- a/Unquote/ExtraReflection.fs +++ b/Unquote/ExtraReflection.fs @@ -180,7 +180,11 @@ module SymbolicOps = | _ -> None let inline isGenericTypeDefinedFrom<'a> (ty:Type) = +#if NETSTANDARD1_6 + ty.GetTypeInfo().IsGenericType && ty.GetTypeInfo().GetGenericTypeDefinition() = typedefof<'a> +#else ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof<'a> +#endif ///is the top-level FSI module let inline isFsiModule (declaringType:Type) = From a566bb23d7612d201195448a326e42239b33fac5 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:24:54 +0200 Subject: [PATCH 06/22] compiler bug? without the open System.Reflection, the compiler return error on IsGenericType --- Unquote/ExtraReflection.fs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Unquote/ExtraReflection.fs b/Unquote/ExtraReflection.fs index d0fbbe9..9e23de3 100644 --- a/Unquote/ExtraReflection.fs +++ b/Unquote/ExtraReflection.fs @@ -179,6 +179,8 @@ module SymbolicOps = Some(sprintf "(%s)" symbol) | _ -> None +open System.Reflection + let inline isGenericTypeDefinedFrom<'a> (ty:Type) = #if NETSTANDARD1_6 ty.GetTypeInfo().IsGenericType && ty.GetTypeInfo().GetGenericTypeDefinition() = typedefof<'a> From 1e93a19663133422187c43229c8a67cdcc507eca Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:26:31 +0200 Subject: [PATCH 07/22] GetCustomAttributes is in TypeInfo and is seq not array --- Unquote/ExtraReflection.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Unquote/ExtraReflection.fs b/Unquote/ExtraReflection.fs index 9e23de3..8ed331a 100644 --- a/Unquote/ExtraReflection.fs +++ b/Unquote/ExtraReflection.fs @@ -196,7 +196,11 @@ let inline isFsiModule (declaringType:Type) = //best we can seem to do let isOpenModule (declaringType:Type) = isFsiModule declaringType || +#if NETSTANDARD1_6 + declaringType.GetTypeInfo().GetCustomAttributes(true) |> Array.ofSeq +#else declaringType.GetCustomAttributes(true) +#endif |> Array.tryFind (function | :? AutoOpenAttribute -> true | _ -> false) |> (function | Some _ -> true | None -> false) From 8e8abb8422a2fda8151e9f5f00999ad57830940a Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:27:33 +0200 Subject: [PATCH 08/22] IsGenericTypeDefinition is inside TypeInfo --- Unquote/ExtraReflection.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Unquote/ExtraReflection.fs b/Unquote/ExtraReflection.fs index 8ed331a..94576c7 100644 --- a/Unquote/ExtraReflection.fs +++ b/Unquote/ExtraReflection.fs @@ -318,7 +318,11 @@ let sprintSig (outerTy:Type) = match ty.GetGenericArgumentsArrayInclusive() with | args when args.Length = 0 -> +#if NETSTANDARD1_6 + (if outerTy.GetTypeInfo().IsGenericTypeDefinition then "'" else "") + (displayName cleanName) + arrSig +#else (if outerTy.IsGenericTypeDefinition then "'" else "") + (displayName cleanName) + arrSig +#endif | args when cleanName = "System.Tuple" -> (applyParens (if arrSig.Length > 0 then 0 else 3) (sprintf "%s" (args |> Array.map (sprintSig 3) |> String.concat " * "))) + arrSig | [|lhs;rhs|] when cleanName = "Microsoft.FSharp.Core.FSharpFunc" -> //right assoc, binding not as strong as tuples From 4663b7c232ee0c5a7a62e17c56abcf72a78293f3 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:32:05 +0200 Subject: [PATCH 09/22] reflection, refactored to avoid duplicate logic --- Unquote/ExtraReflection.fs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Unquote/ExtraReflection.fs b/Unquote/ExtraReflection.fs index 94576c7..d1cf91d 100644 --- a/Unquote/ExtraReflection.fs +++ b/Unquote/ExtraReflection.fs @@ -345,8 +345,13 @@ let genericArgsInferable (mi:MethodInfo) = |> Seq.append (Seq.singleton miDefinition.ReturnParameter) |> Seq.map (fun p -> - if p.ParameterType.IsGenericParameter then [|p.ParameterType|] - elif p.ParameterType.ContainsGenericParameters then p.ParameterType.GetGenericArguments() +#if NETSTANDARD1_6 + let pti = p.ParameterType.GetTypeInfo() +#else + let pti = p.ParameterType +#endif + if pti.IsGenericParameter then [|p.ParameterType|] + elif pti.ContainsGenericParameters then pti.GetGenericArguments() else [||]) |> Seq.concat |> Seq.map (fun t -> t.Name) From b06d495ddac63d9f7e69e58e468c1e8ebc95e6a3 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 18:54:03 +0200 Subject: [PATCH 10/22] temporary fail on netstandard, to make it build --- Unquote/Decompilation.fs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Unquote/Decompilation.fs b/Unquote/Decompilation.fs index 4f96bd0..6173576 100644 --- a/Unquote/Decompilation.fs +++ b/Unquote/Decompilation.fs @@ -99,7 +99,11 @@ let decompile expr = let decompiledTarget = match target with | Some(target) -> (decompile (OP.Dot,OP.Left) target) //instance +#if NETSTANDARD1_6 + | None -> failwith "not implemented" +#else | None -> ER.sourceName <| mi.DeclaringType.GetTypeInfo() +#endif sprintf "%s.%s" decompiledTarget (ER.sourceName mi) match suppliedArgs.Length with @@ -152,7 +156,11 @@ let decompile expr = let decompiledTarget = match target with | Some(target) -> (decompile (OP.Dot,OP.Left) target) //instance +#if NETSTANDARD1_6 + | None -> failwith "not implemented" +#else | None -> ER.sourceName <| mi.DeclaringType.GetTypeInfo() +#endif applyParens OP.Application (sprintf "%s.%s%s" decompiledTarget methodName sprintedArgs) | P.Call(target, mi, args) -> //a "normal" .net instance or static call From 129a5046c4a6b58d422039c56cea0fdd2db1cc8d Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:04:08 +0200 Subject: [PATCH 11/22] add UnquoteTests project.json --- UnquoteTests/project.json | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 UnquoteTests/project.json diff --git a/UnquoteTests/project.json b/UnquoteTests/project.json new file mode 100644 index 0000000..a79fa08 --- /dev/null +++ b/UnquoteTests/project.json @@ -0,0 +1,49 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "EvaluationTests.fs", + "DynamicOperatorsEvaluationTests.fs", + "CheckedDynamicOperatorsEvaluationTests.fs", + "FSharpNameTests.fs", + "DecompilationTests.fs", + "ReductionTests.fs", + "AssertionOperatorsTests.fs", + "UnquotedExpressionTests.fs" + ] + } + }, + "dependencies": { + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + "System.Runtime.Serialization.Primitives": "4.1.1", + "xunit": "2.2.0-beta2-build3300", + "dotnet-test-xunit": "2.2.0-preview2-build1029", + "Unquote": { "target": "project" } + }, + "testRunner": "xunit", + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": [ + "dotnet5.4", + "portable-net451+win8" + ] + } + }, + + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-preview2-*", + "imports": "dnxcore50" + } + } + +} From e8308ac39da24a44cf4d013a7539b368e324017f Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:17:44 +0200 Subject: [PATCH 12/22] no stackframe in netstandard --- UnquoteTests/DecompilationTests.fs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UnquoteTests/DecompilationTests.fs b/UnquoteTests/DecompilationTests.fs index 9c70c91..87713fe 100644 --- a/UnquoteTests/DecompilationTests.fs +++ b/UnquoteTests/DecompilationTests.fs @@ -398,6 +398,8 @@ let ``generic NewUnionCase with nested construction`` () = #else #if PORTABLE //can't access stack frame #else +#if NETCOREAPP1_0 //can't access stack frame +#else #if NET40 //relative file names cause issues #else //issue #3 -- UnionCaseTests @@ -413,6 +415,7 @@ let ``union case test list not requiring op_Dynamic`` () = //this test is a litt #endif #endif #endif +#endif let h = World (Hello2(Hello 3, true)) [] //issue #3 From fa2660e2df4a9e533677a77943b3b2eb3832cd15 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:24:26 +0200 Subject: [PATCH 13/22] need to open System.Reflection to use GetTypeInfo (compiler bug?) --- Unquote/Decompilation.fs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Unquote/Decompilation.fs b/Unquote/Decompilation.fs index 6173576..87636ae 100644 --- a/Unquote/Decompilation.fs +++ b/Unquote/Decompilation.fs @@ -34,6 +34,9 @@ module CustomContext = module CC = CustomContext + +open System.Reflection + //todo: // precedence applied to lhs of . not right, see skipped SourceOpTests // note: Dictionary<_,_> values are not sprinted as nicely as in FSI, consider using FSI style @@ -99,11 +102,7 @@ let decompile expr = let decompiledTarget = match target with | Some(target) -> (decompile (OP.Dot,OP.Left) target) //instance -#if NETSTANDARD1_6 - | None -> failwith "not implemented" -#else | None -> ER.sourceName <| mi.DeclaringType.GetTypeInfo() -#endif sprintf "%s.%s" decompiledTarget (ER.sourceName mi) match suppliedArgs.Length with @@ -156,11 +155,7 @@ let decompile expr = let decompiledTarget = match target with | Some(target) -> (decompile (OP.Dot,OP.Left) target) //instance -#if NETSTANDARD1_6 - | None -> failwith "not implemented" -#else | None -> ER.sourceName <| mi.DeclaringType.GetTypeInfo() -#endif applyParens OP.Application (sprintf "%s.%s%s" decompiledTarget methodName sprintedArgs) | P.Call(target, mi, args) -> //a "normal" .net instance or static call From 2f03a947cace0d451f0e04a5677c29a7228939bf Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:30:50 +0200 Subject: [PATCH 14/22] skip failing test, dont know if should fail on .net core (like mono) or not --- UnquoteTests/CheckedDynamicOperatorsEvaluationTests.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UnquoteTests/CheckedDynamicOperatorsEvaluationTests.fs b/UnquoteTests/CheckedDynamicOperatorsEvaluationTests.fs index bdf671f..14c5da9 100644 --- a/UnquoteTests/CheckedDynamicOperatorsEvaluationTests.fs +++ b/UnquoteTests/CheckedDynamicOperatorsEvaluationTests.fs @@ -94,7 +94,11 @@ let ``ToUInt64 reflective`` () = #if MONO #else +#if NETCOREAPP1_0 +[] +#else [] +#endif let ``ToUIntPtr primitive`` () = testEvalCheckedOverflow <@ Checked.unativeint UInt64.MaxValue @> #endif From 50cdfd16e65d3b2dd8cbca61ec2c7b4a2f33b991 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:35:17 +0200 Subject: [PATCH 15/22] add VerifyNonFrameworkSupport project.json --- VerifyNonFrameworkSupport/project.json | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 VerifyNonFrameworkSupport/project.json diff --git a/VerifyNonFrameworkSupport/project.json b/VerifyNonFrameworkSupport/project.json new file mode 100644 index 0000000..e7a08d1 --- /dev/null +++ b/VerifyNonFrameworkSupport/project.json @@ -0,0 +1,36 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "emitEntryPoint": true, + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "Program.fs" + ] + } + }, + "dependencies": { + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + "Unquote": { + "target": "project" + } + }, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": "dnxcore50" + } + }, + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-preview2-*", + "imports": "dnxcore50" + } + } +} \ No newline at end of file From 5178fb4410da69bff63d73151be9f236191f1532 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:38:09 +0200 Subject: [PATCH 16/22] add VerifyXunit2Support project.json --- VerifyXunit2Support/project.json | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 VerifyXunit2Support/project.json diff --git a/VerifyXunit2Support/project.json b/VerifyXunit2Support/project.json new file mode 100644 index 0000000..854574d --- /dev/null +++ b/VerifyXunit2Support/project.json @@ -0,0 +1,42 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "VerifyXunit2Support.fs" + ] + } + }, + "dependencies": { + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + "System.Runtime.Serialization.Primitives": "4.1.1", + "xunit": "2.2.0-beta2-build3300", + "dotnet-test-xunit": "2.2.0-preview2-build1029", + "Unquote": { "target": "project" } + }, + "testRunner": "xunit", + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + "imports": [ + "dotnet5.4", + "portable-net451+win8" + ] + } + }, + + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-preview2-*", + "imports": "dnxcore50" + } + } + +} From ec022cadc5ab0346918d50743b68f4afe41a7fb4 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:40:28 +0200 Subject: [PATCH 17/22] add VerifyNunit3Support project.json --- VerifyNunit3Support/project.json | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 VerifyNunit3Support/project.json diff --git a/VerifyNunit3Support/project.json b/VerifyNunit3Support/project.json new file mode 100644 index 0000000..a45fa5e --- /dev/null +++ b/VerifyNunit3Support/project.json @@ -0,0 +1,41 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "debugType": "portable", + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "VerifyNunit3Support.fs" + ] + } + }, + + "dependencies": { + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + "NUnit": "3.4.1", + "dotnet-test-nunit": "3.4.0-beta-1", + "Unquote": { "target": "project" } + }, + + "testRunner": "nunit", + + "frameworks": { + "netcoreapp1.0": { + "imports": "portable-net45+win8", + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0-*", + "type": "platform" + } + } + } + }, + + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-preview2-*", + "imports": "dnxcore50" + } + } + +} From d32f657cb26c9d840a319aa96f69761ae3ae1623 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:44:49 +0200 Subject: [PATCH 18/22] add dotnet-mergenupkg tool --- Unquote/project.json | 1 + 1 file changed, 1 insertion(+) diff --git a/Unquote/project.json b/Unquote/project.json index 779da40..e47f644 100644 --- a/Unquote/project.json +++ b/Unquote/project.json @@ -39,6 +39,7 @@ } }, "tools": { + "dotnet-mergenupkg": { "target": "package", "version": "1.0.*" }, "dotnet-compile-fsc": { "version": "1.0.0-preview2-*", "imports": "dnxcore50" From 5dabdf9ae81e1fbbcd9b243394b32a0c1541f883 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 19:54:19 +0200 Subject: [PATCH 19/22] build.bat will add netstandard to package, if UNQUOTE_NETCORE env var is 1 note: need to manually change version inside ./Unquote/project.json before build.bat --- build.bat | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.bat b/build.bat index 78b3299..282824e 100644 --- a/build.bat +++ b/build.bat @@ -51,6 +51,17 @@ REM create nuget package... copy Unquote.%versionNumber%.nupkg builds del Unquote.%versionNumber%.nupkg +if "%UNQUOTE_NETCORE%" == "1" ( + pushd Unquote + REM restore packages + dotnet restore + REM build package + dotnet pack -c Release + REM merge package + dotnet mergenupkg --source "..\builds\Unquote.%versionNumber%.nupkg" --other "bin\Release\Unquote.%versionNumber%.nupkg" --framework netstandard1.6 + popd +) + REM cleanup... rd /q /s staging From 5de36f2354461d7d5f3c18c8bdeb8ccc7f4cf789 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Tue, 26 Jul 2016 20:08:00 +0200 Subject: [PATCH 20/22] dont use f# 4 compiler define conditionals --- Unquote/AssertionFailedException.fs | 10 ++++++++-- Unquote/Assertions.fs | 5 ++++- Unquote/EvaluationException.fs | 12 +++++++++--- Unquote/ReductionException.fs | 10 ++++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Unquote/AssertionFailedException.fs b/Unquote/AssertionFailedException.fs index 19b7258..cc10fe2 100644 --- a/Unquote/AssertionFailedException.fs +++ b/Unquote/AssertionFailedException.fs @@ -8,17 +8,23 @@ open System.Runtime.Serialization ///Exception used to signal assertion failure to be caught by any exception framework ///(used when not NUnit or xUnit.net or when compiled for framework versions lacking serialization features) -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else [] #endif +#endif type AssertionFailedException = inherit exn new () = { inherit exn() } new (message:string) = { inherit exn(message) } new (message:string, innerException:Exception) = { inherit exn(message, innerException) } -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed +#endif #endif \ No newline at end of file diff --git a/Unquote/Assertions.fs b/Unquote/Assertions.fs index b2ac5a7..1942c53 100644 --- a/Unquote/Assertions.fs +++ b/Unquote/Assertions.fs @@ -58,7 +58,10 @@ module Internal = (reducedExprs |> List.map decompile |> String.concat "\n") output msg -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE + outputReducedExprsMsg outputGenericTestFailedMsg +#endif +#if NETSTANDARD1_6 outputReducedExprsMsg outputGenericTestFailedMsg #else //moved from top-level private module function since silverlight does not support printf (i.e. standard out) diff --git a/Unquote/EvaluationException.fs b/Unquote/EvaluationException.fs index 55b8e13..7acd267 100644 --- a/Unquote/EvaluationException.fs +++ b/Unquote/EvaluationException.fs @@ -8,17 +8,23 @@ open System.Runtime.Serialization //see http://stackoverflow.com/questions/94488/what-is-the-correct-way-to-make-a-custom-net-exception-serializable //see http://msdn.microsoft.com/en-us/library/ms229064.aspx ///Exception used to distinguish an error in the quotation evaluation engine. -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else [] //must mark as Serializable for serialization to succeed #endif +#endif type EvaluationException = inherit exn new () = { inherit exn() } new (message:string) = { inherit exn(message) } new (message:string, innerException:Exception) = { inherit exn(message, innerException) } -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed -#endif \ No newline at end of file +#endif +#endif diff --git a/Unquote/ReductionException.fs b/Unquote/ReductionException.fs index e002a08..66cf3de 100644 --- a/Unquote/ReductionException.fs +++ b/Unquote/ReductionException.fs @@ -7,16 +7,22 @@ open System.Runtime.Serialization #endif ///Exception used to indicate an exception captured during reduction (typically not raised itself). -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else [] #endif +#endif type ReductionException = inherit exn new (inner:Exception) = { inherit exn("An exception was raised during quotation reduction", inner) } -#if PORTABLE || NETSTANDARD1_6 +#if PORTABLE +#else +#if NETSTANDARD1_6 #else //although we should, we can't make this protected: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2010/08/10/using-a-proxy-class-to-fix-f-protected-access-limitation.aspx new (info:SerializationInfo, context:StreamingContext) = { inherit exn(info, context) } //must implement for Serilization to succeed #endif +#endif From ab53b9cd3552f5bbaa6c5f0f09e8f44f1f164a4c Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Thu, 28 Jul 2016 11:36:53 +0200 Subject: [PATCH 21/22] fix portable profile --- Unquote/Assertions.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Unquote/Assertions.fs b/Unquote/Assertions.fs index 1942c53..b399d56 100644 --- a/Unquote/Assertions.fs +++ b/Unquote/Assertions.fs @@ -60,7 +60,7 @@ module Internal = #if PORTABLE outputReducedExprsMsg outputGenericTestFailedMsg -#endif +#else #if NETSTANDARD1_6 outputReducedExprsMsg outputGenericTestFailedMsg #else @@ -124,6 +124,7 @@ module Internal = (fun msg -> del.Invoke(msg)) |> outputReducedExprsMsg | Generic -> outputGenericTestFailedMsg |> outputReducedExprsMsg +#endif #endif let inline expectedExnButWrongExnRaisedMsg ty1 ty2 = sprintf "Expected exception of type '%s', but '%s' was raised instead" ty1 ty2 From 81b71edbdad7ceff57208f9f383a435e10c1aa1b Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Thu, 28 Jul 2016 11:56:38 +0200 Subject: [PATCH 22/22] build .net core if .net core sdk is installed, dont check env var --- build.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.bat b/build.bat index 282824e..4e72d98 100644 --- a/build.bat +++ b/build.bat @@ -51,7 +51,9 @@ REM create nuget package... copy Unquote.%versionNumber%.nupkg builds del Unquote.%versionNumber%.nupkg -if "%UNQUOTE_NETCORE%" == "1" ( +REM build .net core if .net core sdk is installed +dotnet --info +if "%ERRORLEVEL%" == "0" ( pushd Unquote REM restore packages dotnet restore