Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add projects capability in CodeGenerator #5002

Merged

Conversation

LittleLittleCloud
Copy link
Contributor

if generated by ModelBuilder, will add
<ProjectCapability Include="ModelBuilderGenerated" />
else
<ProjectCapability Include="MLNETCLIGenerated" />
to .Model and .Console project

@LittleLittleCloud LittleLittleCloud requested a review from a team as a code owner April 6, 2020 18:31
<ProjectCapability Include="MLNETCLIGenerated" />
<#}else{#>
<ProjectCapability Include="ModelBuilderGenerated" />
<#}#>
Copy link
Contributor

Choose a reason for hiding this comment

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

What's diverging between CLI and MB that we need MLNETCLIGenerated vs ModelBuilderGenerated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's from our PM, we want to differentiate ModelBuilder-Generated from MLNet CLI Generated in telemetry data

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good.

this.Write(" <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n");
}else{
this.Write(" <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should modify the upstream .tt so the .cs is formatted properly here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same w/ ModelProject.tt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What you mean

Copy link
Contributor

Choose a reason for hiding this comment

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

@LittleLittleCloud aren't these files generated from TT files?

Copy link
Contributor

Choose a reason for hiding this comment

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

In this PR it looks like the CS files were modified directly instead of changing the TT files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind I see them now :)

Copy link
Contributor

@justinormont justinormont Apr 6, 2020

Choose a reason for hiding this comment

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

The newly added code is currently being formatted as:

this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
this.Write(".Model.csproj\" />\r\n </ItemGroup>\r\n\r\n <ItemGroup>\r\n");
if (Target==CSharp.GenerateTarget.Cli) {
this.Write(" <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n");
}else{
this.Write(" <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n");
}
this.Write(" </ItemGroup>\r\n</Project>\r\n");
return this.GenerationEnvironment.ToString();
}

It should be:

            this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
            this.Write(".Model.csproj\" />\r\n  </ItemGroup>\r\n\r\n  <ItemGroup>\r\n");
            if (Target==CSharp.GenerateTarget.Cli) {
                this.Write("    <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n");
            }
            else {
                this.Write("    <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n");
            }
            this.Write("  </ItemGroup>\r\n</Project>\r\n");
            return this.GenerationEnvironment.ToString();
        }

The generated .cs files are created from their corresponding .tt T4 template files. The change would occur there. I left a comment on the .cs as it shows the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JakeRadMSFT it's auto-gen, I didn't modify those cs file a bit :)

@@ -54,4 +62,5 @@ public bool IncludeResNet18Package {get; set;}
public bool IncludeRecommenderPackage {get;set;}
public string StablePackageVersion {get;set;}
public string UnstablePackageVersion {get;set;}
internal CSharp.GenerateTarget Target {get;set;}
Copy link
Contributor

@JakeRadMSFT JakeRadMSFT Apr 6, 2020

Choose a reason for hiding this comment

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

NIT: I would think of CLI vs ModelBuilder as the Source instead of Target. It's the thing causing the projects to get generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

Copy link
Contributor

@justinormont justinormont left a comment

Choose a reason for hiding this comment

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

LGTM; I'd recommend improving the code formatting: #5002 (review)

@justinormont
Copy link
Contributor

justinormont commented Apr 7, 2020

Current CI error on one Centos and one Ubuntu run is:

- ##[error]Unhandled exception. System.IO.IOException: No space left on device

@harishsk: Thoughts on how to resolve?

@harishsk
Copy link
Contributor

harishsk commented Apr 7, 2020

@harishsk: Thoughts on how to resolve?

@frank-dong-ms I believe you are already looking at this, aren't you?

@JakeRadMSFT JakeRadMSFT changed the title add projects capacities in CodeGenerator add projects capability in CodeGenerator Apr 7, 2020
@harishsk harishsk merged commit e451c80 into dotnet:master Apr 7, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants