Skip to content

Commit

Permalink
Deprecate Solution.PerforceRootPath and Project.PerforceRootPath, scc…
Browse files Browse the repository at this point in the history
… info shouldn't be stored in project or solution files
  • Loading branch information
belkiss committed Jan 20, 2022
1 parent b061d7e commit a7335d2
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 138 deletions.
5 changes: 1 addition & 4 deletions Sharpmake.Generators/VisualStudio/Csproj.Template.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,9 +47,6 @@ public static class Project
<AssemblyName>[assemblyName]</AssemblyName>
<SignAssembly>[options.SignAssembly]</SignAssembly>
<AssemblyOriginatorKeyFile>[options.AssemblyOriginatorKeyFile]</AssemblyOriginatorKeyFile>
<SccProjectName>[sccProjectName]</SccProjectName>
<SccLocalPath>[sccLocalPath]</SccLocalPath>
<SccProvider>[sccProvider]</SccProvider>
<[targetFrameworkVersionString]>[targetFramework]</[targetFrameworkVersionString]>
<FileAlignment>[options.FileAlignment]</FileAlignment>
<IsWebBootstrapper>[options.IsWebBootstrapper]</IsWebBootstrapper>
Expand Down
17 changes: 1 addition & 16 deletions Sharpmake.Generators/VisualStudio/Csproj.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1132,18 +1132,6 @@ List<string> skipFiles

var resolver = new Resolver();

// source control

string sccProjectName = RemoveLineTag;
string sccLocalPath = RemoveLineTag;
string sccProvider = RemoveLineTag;
if (project.PerforceRootPath != null)
{
sccProjectName = "Perforce Project";
sccLocalPath = Util.PathGetRelative(projectPath, project.PerforceRootPath);
sccProvider = "MSSCCI:Perforce SCM";
}

_projectPath = projectPath;
_projectPathCapitalized = Util.GetCapitalizedPath(projectPath);
_projectConfigurationList = configurations;
Expand Down Expand Up @@ -1243,9 +1231,6 @@ List<string> skipFiles

using (resolver.NewScopedParameter("project", project))
using (resolver.NewScopedParameter("guid", projectPropertyGuid))
using (resolver.NewScopedParameter("sccProjectName", sccProjectName))
using (resolver.NewScopedParameter("sccLocalPath", sccLocalPath))
using (resolver.NewScopedParameter("sccProvider", sccProvider))
using (resolver.NewScopedParameter("options", options[_projectConfigurationList[0]]))
using (resolver.NewScopedParameter("outputType", outputType))
using (resolver.NewScopedParameter("targetFramework", targetFrameworkString))
Expand Down
23 changes: 7 additions & 16 deletions Sharpmake.Generators/VisualStudio/Sln.Template.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -110,23 +110,14 @@ public static class Solution
EndGlobalSection
";

public static string GlobalSectionSolutionSourceCodeControlBegin =
@" GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = [sccNumberOfProjects]
";
[Obsolete("This property is deprecated, scc info shouldn't be stored in the solution files anymore", error: true)]
public static string GlobalSectionSolutionSourceCodeControlBegin;

public static string GlobalSectionSolutionSourceCodeControlProject =
@" SccProjectUniqueName[i] = [sccProjectUniqueName]
SccProjectTopLevelParentUniqueName[i] = [sccProjectTopLevelParentUniqueName]
SccProjectName[i] = Perforce\u0020Project
SccLocalPath[i] = [sccLocalPath]
SccProvider[i] = MSSCCI:Perforce\u0020SCM
SccProjectFilePathRelativizedFromConnection[i] = [sccProjectFilePathRelativizedFromConnection]\\
";
[Obsolete("This property is deprecated, scc info shouldn't be stored in the solution files anymore", error: true)]
public static string GlobalSectionSolutionSourceCodeControlProject;

public static string GlobalSectionSolutionSourceCodeControlEnd =
@" EndGlobalSection
";
[Obsolete("This property is deprecated, scc info shouldn't be stored in the solution files anymore", error: true)]
public static string GlobalSectionSolutionSourceCodeControlEnd;

public static string GlobalSectionSolutionConfigurationBegin =
@" GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
54 changes: 1 addition & 53 deletions Sharpmake.Generators/VisualStudio/Sln.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -441,58 +441,6 @@ private SolutionFolder GetSolutionFolder(string names)

fileGenerator.Write(Template.Solution.GlobalBegin);

// Write source code control information
if (solution.PerforceRootPath != null)
{
List<Solution.ResolvedProject> sccProjects = new List<Solution.ResolvedProject>();

foreach (Solution.ResolvedProject resolvedProject in solutionProjects)
{
if (resolvedProject.Project.PerforceRootPath != null)
sccProjects.Add(resolvedProject);
else
_builder.LogWriteLine(@"warning: cannot bind solution {0} to perforce, PerforceRootPath for project '{1}' is not set.", solutionFileInfo.Name, resolvedProject.Project.ClassName);
}

if (sccProjects.Count == solutionProjects.Count)
{
using (fileGenerator.Declare("sccNumberOfProjects", sccProjects.Count))
{
fileGenerator.Write(Template.Solution.GlobalSectionSolutionSourceCodeControlBegin);
}

for (int i = 0; i < sccProjects.Count; ++i)
{
Solution.ResolvedProject resolvedProject = sccProjects[i];

FileInfo projectFileInfo = new FileInfo(resolvedProject.ProjectFile);

//SccProjectUniqueName7 = ..\\..\\extern\\techgroup\\framework\\gear\\private\\compilers\\win32\\vc9\\gear_win32_compile.vcproj
string sccProjectUniqueName = Util.PathGetRelative(solutionFileInfo.Directory.FullName, projectFileInfo.FullName).Replace("\\", "\\\\");

//SccProjectTopLevelParentUniqueName7 = guildlib.sln
string sccProjectTopLevelParentUniqueName = solutionFileInfo.Name;

// sln to perforce file
//SccLocalPath7 = ..\\..\\extern\\techgroup\\framework\\gear
string sccLocalPath = Util.PathGetRelative(solutionPath, resolvedProject.Project.PerforceRootPath).Replace("\\", "\\\\");

//SccProjectFilePathRelativizedFromConnection7 = private\\compilers\\win32\\vc9\\
string sccProjectFilePathRelativizedFromConnection = Util.PathGetRelative(resolvedProject.Project.PerforceRootPath, projectFileInfo.DirectoryName).Trim('.', '\\').Replace("\\", "\\\\");

using (fileGenerator.Declare("i", i))
using (fileGenerator.Declare("sccProjectUniqueName", sccProjectUniqueName))
using (fileGenerator.Declare("sccProjectTopLevelParentUniqueName", sccProjectTopLevelParentUniqueName))
using (fileGenerator.Declare("sccLocalPath", sccLocalPath))
using (fileGenerator.Declare("sccProjectFilePathRelativizedFromConnection", sccProjectFilePathRelativizedFromConnection))
{
fileGenerator.Write(Template.Solution.GlobalSectionSolutionSourceCodeControlProject);
}
}
fileGenerator.Write(Template.Solution.GlobalSectionSolutionSourceCodeControlEnd);
}
}

// write solution configurations
string visualStudioExe = GetVisualStudioIdePath(devEnv) + Util.WindowsSeparator + "devenv.com";

Expand Down
5 changes: 1 addition & 4 deletions Sharpmake.Generators/VisualStudio/Vcxproj.Template.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,9 +46,6 @@ public static class Project
<Keyword>[projectKeyword]</Keyword>
<DefaultLanguage>en-US</DefaultLanguage>
<RootNamespace>[projectName]</RootNamespace>
<SccProjectName>[sccProjectName]</SccProjectName>
<SccLocalPath>[sccLocalPath]</SccLocalPath>
<SccProvider>[sccProvider]</SccProvider>
<ProjectName>[projectName]</ProjectName>
";

Expand Down
16 changes: 1 addition & 15 deletions Sharpmake.Generators/VisualStudio/Vcxproj.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -352,17 +352,6 @@ private void GenerateImpl(GenerationContext context, IList<string> generatedFile

GenerateConfOptions(context);

// source control
string sccProjectName = FileGeneratorUtilities.RemoveLineTag;
string sccLocalPath = FileGeneratorUtilities.RemoveLineTag;
string sccProvider = FileGeneratorUtilities.RemoveLineTag;
if (context.Project.PerforceRootPath != null)
{
sccProjectName = "Perforce Project";
sccLocalPath = Util.PathGetRelative(context.ProjectDirectory, context.Project.PerforceRootPath);
sccProvider = "MSSCCI:Perforce SCM";
}

var fileGenerator = new XmlFileGenerator();

// xml begin header
Expand Down Expand Up @@ -404,9 +393,6 @@ private void GenerateImpl(GenerationContext context, IList<string> generatedFile

using (fileGenerator.Declare("projectName", firstConf.ProjectName))
using (fileGenerator.Declare("guid", firstConf.ProjectGuid))
using (fileGenerator.Declare("sccProjectName", sccProjectName))
using (fileGenerator.Declare("sccLocalPath", sccLocalPath))
using (fileGenerator.Declare("sccProvider", sccProvider))
using (fileGenerator.Declare("targetFramework", targetFrameworkString))
using (fileGenerator.Declare("projectKeyword", projectKeyword))
{
Expand Down
13 changes: 3 additions & 10 deletions Sharpmake/Project.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -82,12 +82,8 @@ public string SourceRootPath
set { SetProperty(ref _sourceRootPath, value); }
}

private string _perforceRootPath = null;
public string PerforceRootPath
{
get { return _perforceRootPath; }
set { SetProperty(ref _perforceRootPath, value); }
}
[Obsolete("This property is deprecated, scc info shouldn't be stored in the project files anymore", error: true)]
public string PerforceRootPath;

private string _rootPath = ""; // RootPath used as key to generate ProjectGuid and as a path helper for finding source files
public string RootPath
Expand Down Expand Up @@ -1827,9 +1823,6 @@ internal virtual void Resolve(Builder builder, bool skipInvalidPath)
Util.ResolvePath(SourceRootPath, ref SourceFilesBuildExclude);
Util.ResolvePath(SharpmakeCsPath, ref _blobPath);

if (PerforceRootPath != null)
Util.ResolvePath(SharpmakeCsPath, ref _perforceRootPath);

if (SourceFilesFilters != null)
Util.ResolvePath(SharpmakeCsPath, ref SourceFilesFilters);

Expand Down
13 changes: 3 additions & 10 deletions Sharpmake/Solution.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Ubisoft Entertainment
// Copyright (c) 2017-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,12 +69,8 @@ public bool IsFileNameToLower
/// </summary>
public Dictionary<string, Strings> ExtraItems = new Dictionary<string, Strings>();

private string _perforceRootPath = null;
public string PerforceRootPath
{
get { return _perforceRootPath; }
set { SetProperty(ref _perforceRootPath, value); }
}
[Obsolete("This property is deprecated, scc info shouldn't be stored in the solution files anymore", error: true)]
public string PerforceRootPath;

private bool _mergePlatformConfiguration = false;
public bool MergePlatformConfiguration
Expand Down Expand Up @@ -450,9 +446,6 @@ internal void Resolve()
resolver.SetParameter("solution", this);
resolver.Resolve(this);

if (PerforceRootPath != null)
Util.ResolvePath(SharpmakeCsPath, ref _perforceRootPath);

foreach (Solution.Configuration conf in Configurations)
conf.Resolve(resolver);

Expand Down
6 changes: 1 addition & 5 deletions samples/CSharpHelloWorld/common.sharpmake.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017, 2019-2021 Ubisoft Entertainment
// Copyright (c) 2017, 2019-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,13 +69,9 @@ public ProjectTemplate()
// if set to true, dependencies that the project uses will be copied to the output directory
DependenciesCopyLocal = DependenciesCopyLocalTypes.Default;

// Set to null if you don't want to use Perforce
PerforceRootPath = null;

// Files put in this directory will be added to the project as resources (linked) build Action
ResourcesPath = RootPath + @"\Resources\";


// Files put in this directory will be added to the project as Content build Action
ContentPath = RootPath + @"\Content\";

Expand Down
6 changes: 1 addition & 5 deletions samples/CSharpImports/common.sharpmake.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2021 Ubisoft Entertainment
// Copyright (c) 2020-2022 Ubisoft Entertainment
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,13 +69,9 @@ public ProjectTemplate()
// if set to true, dependencies that the project uses will be copied to the output directory
DependenciesCopyLocal = DependenciesCopyLocalTypes.Default;

// Set to null if you don't want to use Perforce
PerforceRootPath = null;

// Files put in this directory will be added to the project as resources (linked) build Action
ResourcesPath = RootPath + @"\Resources\";


// Files put in this directory will be added to the project as Content build Action
ContentPath = RootPath + @"\Content\";

Expand Down

0 comments on commit a7335d2

Please sign in to comment.