add support for csharp net40 (#6792)

This commit is contained in:
wing328
2017-10-27 22:47:02 +08:00
committed by GitHub
parent fe2ed67f20
commit cab4fc0fed
162 changed files with 18297 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
@SuppressWarnings({"hiding"})
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
private static final String NET45 = "v4.5";
private static final String NET40 = "v4.0";
private static final String NET35 = "v3.5";
private static final String NETSTANDARD = "v5.0";
private static final String UWP = "uwp";
@@ -75,6 +76,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
);
frameworks = new ImmutableMap.Builder<String, String>()
.put(NET35, ".NET Framework 3.5 compatible")
.put(NET40, ".NET Framework 4.0 compatible")
.put(NET45, ".NET Framework 4.5+ compatible")
.put(NETSTANDARD, ".NET Standard 1.3 compatible")
.put(UWP, "Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0)")
@@ -227,7 +229,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
setSupportsUWP(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync);
additionalProperties.put("supportsUWP", this.supportsUWP);
} else if (NET40.equals(this.targetFramework)) {
setTargetFrameworkNuget("net40");
setSupportsAsync(Boolean.FALSE);
if (additionalProperties.containsKey("supportsAsync")) {
additionalProperties.remove("supportsAsync");
}
additionalProperties.put("isNet40", true);
} else {
setTargetFrameworkNuget("net45");
setSupportsAsync(Boolean.TRUE);

View File

@@ -15,8 +15,8 @@ mono nuget.exe install src/{{packageName}}/packages.config -o packages;
echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin;
cp packages/Newtonsoft.Json.10.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll;
cp packages/Newtonsoft.Json.{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}/RestSharp.dll bin/RestSharp.dll;
{{#generatePropertyChanged}}
cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll
cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll

View File

@@ -15,8 +15,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient
if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll
copy packages\Newtonsoft.Json.{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll bin\RestSharp.dll
{{#generatePropertyChanged}}
copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll
copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
{{#generatePropertyChanged}}
<package id="Fody" version="1.29.4" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />

View File

@@ -2,5 +2,5 @@
<packages>
<package id="NUnit" version="2.6.4" targetFramework="{{targetFrameworkNuget}}" />
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
</packages>