Skip to content

Conversation

@andreiborodin
Copy link
Contributor

The purpose of this change is to do a small piecewise update to how we do exporting. This focuses on just the Common props file, but the approach will be added for other parts as well.

@andreiborodin andreiborodin added the enhancement New feature or request label Jan 17, 2020
@andreiborodin andreiborodin added this to the 0.9.0 Release milestone Jan 17, 2020
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
Copy link
Contributor

@chrisfromwork chrisfromwork Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: wrong header #Pending

Copy link
Contributor

@chrisfromwork chrisfromwork Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on all the new files throughout #Pending

return Path.Combine(Utilities.AssetPath, $"{unityProjectInfo.UnityProjectName}.{MSBuildFileSuffix}.sln");
}

public void GenerateTopLevelDependenciesProject(UnityProjectInfo unityProjectInfo)
Copy link
Contributor

@chrisfromwork chrisfromwork Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenerateTopLevelDependenciesProject [](start = 20, length = 35)

nit: remove #Pending

string UnityMajorVersion { get; set; }

/// <summary>
/// Gets or sets the Unity minir version.
Copy link
Contributor

@chrisfromwork chrisfromwork Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minir [](start = 35, length = 5)

nit: minor #Pending

string UnityMinorVersion { get; set; }

/// <summary>
/// Gets or sets the current unity platform selected in the editor.
Copy link
Contributor

@chrisfromwork chrisfromwork Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unity [](start = 37, length = 5)

nit: Unity should be capitalized #Pending

/// Writes out the data.
/// </summary>
void Write();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a somewhat vague function definition. Are multiple files written here? Would it be feasible to return more information on what was written here like a file path? Is it possible that a write could fail and we would want a TryWrite definition here returning a bool to signal success?


/// <summary>
/// Generates the Directory.Build.props file that is expected to be used by both generated and non-generated projects alike.
/// Creates an exporter for the commom MSBuild file that is expected to be used by both generated and non-generated projects alike.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commom MSBuild [](start = 40, length = 14)

nit: it might make more sense to actually call out the file name here if its the same across projects


/// <summary>
/// Generates the Directory.Build.props file that is expected to be used by both generated and non-generated projects alike.
/// Creates an exporter for the commom MSBuild file that is expected to be used by both generated and non-generated projects alike.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is expected to be used by both generated and non-generated projects alike [](start = 65, length = 73)

nit: I don't know what this description means. I do not know what a generated vs non-generated project is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating.


protected TemplatedExporterBase(FileTemplate templateFile, string exportPath)
: base(templateFile.Root, templateFile.Root.CreateReplacementSet())
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we want to check whether templateFile or templateFile.Root is null? Or do we just want the NullPointerException to throw here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessarily public facing code, so no, just throw nullreferenceexception.

{
field = value;
template.Tokens[token].AssignValue(replacementSet, toStringFunc(value));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should asses whether the token exists in this Tokens collection before calling AssignValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but since this exporter is tied to the templates, we assume otherwise it's a bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be easier to debug a logged error with the token that was missing compared to an exception


In reply to: 368175853 [](ancestors = 368175853)

/// <param name="dependenciesTargetsTemplatePath">Path to the dependencies targets template file.</param>
public TemplatedProjectExporter(DirectoryInfo generatedOutputFolder, FileInfo solutionFileTemplatePath, FileInfo projectFileTemplatePath, FileInfo generatedProjectFileTemplatePath, FileInfo projectPropsFileTemplatePath, FileInfo projectTargetsFileTemplatePath, FileInfo msbuildForUnityCommonTemplatePath, FileInfo dependenciesProjectTemplatePath, FileInfo dependenciesPropsTemplatePath, FileInfo dependenciesTargetsTemplatePath)
public TemplatedUnityProjectExporter(DirectoryInfo generatedOutputFolder, FileInfo solutionFileTemplatePath, FileInfo projectFileTemplatePath, FileInfo generatedProjectFileTemplatePath, FileInfo projectPropsFileTemplatePath, FileInfo projectTargetsFileTemplatePath, FileInfo msbuildForUnityCommonTemplatePath, FileInfo dependenciesProjectTemplatePath, FileInfo dependenciesPropsTemplatePath, FileInfo dependenciesTargetsTemplatePath)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is really hard to read in an editor, I'd prefer if each argument had its own line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may update this, but in a later change.

Copy link
Contributor

@chrisfromwork chrisfromwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@andreiborodin andreiborodin merged commit 2513338 into master Jan 17, 2020
@andreiborodin andreiborodin deleted the features/updateCommonPropsGeneration branch January 17, 2020 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants