Remove support for old .net core project type (#3937)

This commit is contained in:
wiruzman
2019-10-24 10:06:48 -05:00
committed by William Cheng
parent 4de3b3f473
commit d15a4c3e8e
10 changed files with 20 additions and 259 deletions

View File

@@ -181,14 +181,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
"C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only).",
this.optionalMethodArgumentFlag);
addSwitch(CodegenConstants.OPTIONAL_ASSEMBLY_INFO,
CodegenConstants.OPTIONAL_ASSEMBLY_INFO_DESC,
this.optionalAssemblyInfoFlag);
addSwitch(CodegenConstants.OPTIONAL_PROJECT_FILE,
CodegenConstants.OPTIONAL_PROJECT_FILE_DESC,
this.optionalProjectFileFlag);
// NOTE: This will reduce visibility of all public members in templates. Users can use InternalsVisibleTo
// https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(v=vs.110).aspx
// to expose to shared code if the generated code is not embedded into another project. Otherwise, users of codegen
@@ -496,7 +488,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
setSupportsAsync(Boolean.TRUE);
setNetStandard(strategy.isNetStandard);
setNetCoreProjectFileFlag(!strategy.isNetStandard);
if (additionalProperties.containsKey(CodegenConstants.GENERATE_PROPERTY_CHANGED)) {
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in the .NET Standard generator.");
@@ -517,9 +508,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
syncBooleanProperty(additionalProperties, CodegenConstants.VALIDATABLE, this::setValidatable, this.validatable);
syncBooleanProperty(additionalProperties, CodegenConstants.SUPPORTS_ASYNC, this::setSupportsAsync, this.supportsAsync);
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_PROJECT_FILE, this::setOptionalProjectFileFlag, optionalProjectFileFlag);
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag);
syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_ASSEMBLY_INFO, this::setOptionalAssemblyInfoFlag, optionalAssemblyInfoFlag);
syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi());
final String testPackageName = testPackageName();
@@ -553,10 +542,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs"));
supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs"));
if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("project.json.mustache", packageFolder + File.separator, "project.json"));
}
supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache",
clientPackageDir, "IReadableConfiguration.cs"));
supportingFiles.add(new SupportingFile("GlobalConfiguration.mustache",
@@ -572,30 +557,11 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
if (optionalAssemblyInfoFlag && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs"));
}
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
if (optionalProjectFileFlag) {
supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln"));
if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj"));
} else {
supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, packageName + ".csproj"));
if (Boolean.FALSE.equals(this.netStandard)) {
supportingFiles.add(new SupportingFile("nuspec.mustache", packageFolder, packageName + ".nuspec"));
}
}
if (Boolean.FALSE.equals(excludeTests.get())) {
// NOTE: This exists here rather than previous excludeTests block because the test project is considered an optional project file.
if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
} else {
supportingFiles.add(new SupportingFile("TestProject.mustache", testPackageFolder, testPackageName + ".csproj"));
}
}
if (Boolean.FALSE.equals(excludeTests.get())) {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
}
additionalProperties.put("apiDocPath", apiDocPath);
@@ -606,14 +572,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
this.netStandard = netStandard;
}
public void setOptionalAssemblyInfoFlag(boolean flag) {
this.optionalAssemblyInfoFlag = flag;
}
public void setOptionalProjectFileFlag(boolean flag) {
this.optionalProjectFileFlag = flag;
}
public void setPackageGuid(String packageGuid) {
this.packageGuid = packageGuid;
}

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
{{#appName}}
{{{appName}}}
{{/appName}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
{{#version}}The version of the OpenAPI document: {{version}}{{/version}}
{{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{{packageGuid}}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>{{packageName}}</RootNamespace>
<AssemblyName>{{packageName}}</AssemblyName>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>{{targetFramework}}</TargetFramework>
<FileAlignment>512</FileAlignment>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.57.0" />
<PackageReference Include="JsonSubTypes" Version="1.5.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="RestSharp" Version="106.6.7" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
</Project>

View File

@@ -27,18 +27,4 @@
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
{{^netStandard}}
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
</ItemGroup>
{{/netStandard}}
</Project>

View File

@@ -1,14 +0,0 @@
{
"supports": {},
"dependencies": {
"Newtonsoft.Json": "12.0.1",
{{#useCompareNetObjects}}
"CompareNETObjects": "4.57.0",
{{/useCompareNetObjects}}
"JsonSubTypes": "1.5.2",
"RestSharp": "106.6.7"
},
"frameworks": {
"{{targetFrameworkNuget}}": {}
}
}

View File

@@ -1,32 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{321C8C3F-0156-40C1-AE42-D59761FB9B6C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Org.OpenAPITools</RootNamespace>
<AssemblyName>Org.OpenAPITools</AssemblyName>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>netstandard2.0</TargetFramework>
<FileAlignment>512</FileAlignment>
<AssemblyName>Org.OpenAPITools</AssemblyName>
<PackageId>Org.OpenAPITools</PackageId>
<OutputType>Library</OutputType>
<Authors>OpenAPI</Authors>
<Company>OpenAPI</Company>
<AssemblyTitle>OpenAPI Library</AssemblyTitle>
<Description>A library generated from a OpenAPI doc</Description>
<Copyright>No Copyright</Copyright>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<RootNamespace>Org.OpenAPITools</RootNamespace>
<Version>1.0.0</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.57.0" />
<PackageReference Include="JsonSubTypes" Version="1.5.2" />
@@ -34,4 +26,5 @@ The version of the OpenAPI document: 1.0.0
<PackageReference Include="RestSharp" Version="106.6.7" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
</Project>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<title>OpenAPI Library</title>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to earily find other packages by the same owners. -->
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>A library generated from a OpenAPI doc</description>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="12.0.1" />
<dependency id="JsonSubTypes" version="1.5.1" />
<dependency id="RestSharp" version="106.6.7" />
</dependencies>
</metadata>
<files>
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />
</files>
</package>

View File

@@ -1,12 +0,0 @@
{
"supports": {},
"dependencies": {
"Newtonsoft.Json": "12.0.1",
"CompareNETObjects": "4.57.0",
"JsonSubTypes": "1.5.2",
"RestSharp": "106.6.7"
},
"frameworks": {
"netstandard2.0": {}
}
}

View File

@@ -27,16 +27,4 @@
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
</ItemGroup>
</Project>

View File

@@ -1,44 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<title>OpenAPI Library</title>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to earily find other packages by the same owners. -->
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>A library generated from a OpenAPI doc</description>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="12.0.1" />
<dependency id="JsonSubTypes" version="1.5.1" />
<dependency id="RestSharp" version="106.6.7" />
<dependency id="CompareNETObjects" version="4.57.0" />
<dependency id="JsonSubTypes" version="1.5.2" />
<dependency id="System.ComponentModel.Annotations" version="4.5.0" />
</dependencies>
</metadata>
<files>
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />
</files>
</package>

View File

@@ -1,12 +0,0 @@
{
"supports": {},
"dependencies": {
"Newtonsoft.Json": "12.0.1",
"CompareNETObjects": "4.57.0",
"JsonSubTypes": "1.5.2",
"RestSharp": "106.6.7"
},
"frameworks": {
"netcoreapp2.0": {}
}
}