Skip to content

Commit

Permalink
Obsolete and remove most usages of TargetPlatform (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Svensson authored Jun 12, 2024
1 parent 6e0bcfc commit 172316c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public EnableClientAccessAttribute() { }
/// Gets or sets a value indicating whether the <see cref="DomainService"/>
/// may only be accessed using a secure endpoint.
/// </summary>
#if NET
[Obsolete("RequiresSecureEndpoint is not enforced by AspNetCore Hosting, please enforce it using standard AspNetCore practices instead https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?")]
#endif
public bool RequiresSecureEndpoint { get; set; }

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace OpenRiaServices.Server
[AttributeUsage(
AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property,
AllowMultiple = false, Inherited = true)]
#if NET
[Obsolete("OutputCacheAttribute is not applied by AspNetCore hosting, please se Readme of how caching can be achived.\nThe attribute will probably be removed in future releases")]
#endif
public sealed class OutputCacheAttribute : Attribute
{
/// <summary>
Expand Down Expand Up @@ -94,4 +97,4 @@ public OutputCacheAttribute(string cacheProfile)
this.CacheProfile = cacheProfile;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ public class ClientCodeGenerationOptionsBinder : BinderBase<ClientCodeGeneration
private readonly Option<string> _clientRootNamespace;
private readonly Option<string> _serverRootNamespace;
private readonly Option<bool> _isApplicationContextGenerationEnabled;
private readonly Option<TargetPlatform> _clientProjectTargetPlatform;
private readonly Option<bool> _useFullTypeNames;

/// <summary>
/// Constructor that sets all arguments
/// </summary>
public ClientCodeGenerationOptionsBinder(Option<string> language, Option<string> clientFrameworkPath, Option<string> serverProjectPath, Option<string> clientProjectPath, Option<string> clientRootNamespace, Option<string> serverRootNamespace, Option<bool> isApplicationContextGenerationEnabled, Option<TargetPlatform> clientProjectTargetPlatform, Option<bool> useFullTypeNames)
public ClientCodeGenerationOptionsBinder(Option<string> language, Option<string> clientFrameworkPath, Option<string> serverProjectPath, Option<string> clientProjectPath, Option<string> clientRootNamespace, Option<string> serverRootNamespace, Option<bool> isApplicationContextGenerationEnabled, Option<bool> useFullTypeNames)
{
_language = language;
_clientFrameworkPath = clientFrameworkPath;
Expand All @@ -30,7 +29,6 @@ public ClientCodeGenerationOptionsBinder(Option<string> language, Option<string>
_clientRootNamespace = clientRootNamespace;
_serverRootNamespace = serverRootNamespace;
_isApplicationContextGenerationEnabled = isApplicationContextGenerationEnabled;
_clientProjectTargetPlatform = clientProjectTargetPlatform;
_useFullTypeNames = useFullTypeNames;
}

Expand All @@ -48,7 +46,6 @@ protected override ClientCodeGenerationOptions GetBoundValue(BindingContext bind
ClientRootNamespace = bindingContext.ParseResult.GetValueForOption(_clientRootNamespace),
ServerRootNamespace = bindingContext.ParseResult.GetValueForOption(_serverRootNamespace),
IsApplicationContextGenerationEnabled = bindingContext.ParseResult.GetValueForOption(_isApplicationContextGenerationEnabled),
ClientProjectTargetPlatform = bindingContext.ParseResult.GetValueForOption(_clientProjectTargetPlatform),
UseFullTypeNames = bindingContext.ParseResult.GetValueForOption(_useFullTypeNames),
};
}
Expand Down
4 changes: 1 addition & 3 deletions src/OpenRiaServices.Tools.CodeGenTask/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ static int Main(string[] args)
var clientRootNamespaceOption = new Option<string>("--clientRootNamespace");
var serverRootNamespaceOption = new Option<string>("--serverRootNamespace");
var isApplicationContextGenerationEnabledOption = new Option<bool>("--isApplicationContextGenerationEnabled");
var clientProjectTargetPlatformsOption = new Option<TargetPlatform>("--clientProjectTargetPlatform");
var useFullTypeNamesOption = new Option<bool>("--useFullTypeNames");

var sharedSourceFilesOption = new Option<IEnumerable<string>>("--sharedSourceFiles") { AllowMultipleArgumentsPerToken = true };
Expand All @@ -51,7 +50,6 @@ static int Main(string[] args)
clientRootNamespaceOption,
serverRootNamespaceOption,
isApplicationContextGenerationEnabledOption,
clientProjectTargetPlatformsOption,
useFullTypeNamesOption,
sharedSourceFilesOption,
symbolSearchPathsOption,
Expand All @@ -69,7 +67,7 @@ static int Main(string[] args)
=> success = RunCodeGenForNet6(clientCodeGenerationOptionValue, sharedCodeServiceParametersValue, codeGeneratorName, generatedFileName, pipeName),
new ClientCodeGenerationOptionsBinder(
languageOption, clientFrameworkOption, serverProjectPathOption, clientProjectPathOption, clientRootNamespaceOption, serverRootNamespaceOption,
isApplicationContextGenerationEnabledOption, clientProjectTargetPlatformsOption, useFullTypeNamesOption),
isApplicationContextGenerationEnabledOption, useFullTypeNamesOption),
new SharedCodeServiceParametersBinder(sharedSourceFilesOption, symbolSearchPathsOption, serverAssembliesOption, clientAssembliesOption, clientAssemblyPathsNormalizedOption),
codeGeneratorName,
generatedFileName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,26 +384,6 @@ internal bool UseFullTypeNamesAsBool
}
}

internal TargetPlatform ClientTargetPlatform
{
get
{
if (string.IsNullOrEmpty(ClientFrameworkPath))
return TargetPlatform.Unknown;

if (ClientFrameworkPath.IndexOf("Silverlight", StringComparison.InvariantCultureIgnoreCase) != -1)
return TargetPlatform.Silverlight;
if (ClientFrameworkPath.IndexOf(".NETPortable", StringComparison.InvariantCultureIgnoreCase) != -1)
return TargetPlatform.Portable;
if (ClientFrameworkPath.IndexOf(".NETFramework", StringComparison.InvariantCultureIgnoreCase) != -1)
return TargetPlatform.Desktop;
if (ClientFrameworkPath.IndexOf(".NETCore", StringComparison.InvariantCultureIgnoreCase) != -1)
return TargetPlatform.Win8;

return TargetPlatform.Unknown;
}
}

/// <summary>
/// Gets a value indicating whether the server project file has been specified
/// and exists on disk.
Expand Down Expand Up @@ -705,8 +685,7 @@ internal void GenerateClientProxies()
ClientProjectPath = this.ClientProjectPath,
ServerProjectPath = this.ServerProjectPath,
IsApplicationContextGenerationEnabled = this.IsClientApplicationAsBool,
UseFullTypeNames = this.UseFullTypeNamesAsBool,
ClientProjectTargetPlatform = this.ClientTargetPlatform,
UseFullTypeNames = this.UseFullTypeNamesAsBool
};

// Compose the parameters we will pass to the other AppDomain to create the SharedCodeService
Expand Down Expand Up @@ -1591,7 +1570,6 @@ static void AddParameter(List<string> list, string parameter, string value)
AddParameter(arguments, "--clientRootNamespace", options.ClientRootNamespace);
AddParameter(arguments, "--serverRootNamespace", options.ServerRootNamespace);
AddParameter(arguments, "--isApplicationContextGenerationEnabled", options.IsApplicationContextGenerationEnabled.ToString());
AddParameter(arguments, "--clientProjectTargetPlatform", options.ClientProjectTargetPlatform.ToString());
AddParameter(arguments, "--useFullTypeNames", options.UseFullTypeNames.ToString());

//Arguments for SharedCodeServiceParameters
Expand Down
5 changes: 4 additions & 1 deletion src/OpenRiaServices.Tools/Framework/TargetPlatform.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace OpenRiaServices.Tools
using System;

namespace OpenRiaServices.Tools
{
/// <summary>
/// Target platform
/// </summary>
[Obsolete("This enum is not used and will be removed in a future version")]
public enum TargetPlatform
{
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/OpenRiaServices.Tools/Test/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ internal static string ValidateLanguageCodeGen(CodeGenValidationOptions codeGenO
ClientRootNamespace = codeGenOptions.RootNamespace,
ClientProjectPath = "MockProject.proj",
IsApplicationContextGenerationEnabled = codeGenOptions.GenerateApplicationContexts,
UseFullTypeNames = codeGenOptions.UseFullTypeNames,
ClientProjectTargetPlatform = TargetPlatform.Silverlight
UseFullTypeNames = codeGenOptions.UseFullTypeNames
};

MockCodeGenerationHost host = TestHelper.CreateMockCodeGenerationHost(codeGenOptions.Logger, codeGenOptions.SharedCodeService);
Expand Down

0 comments on commit 172316c

Please sign in to comment.