Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

#1655: Change to ICompileModule #1678

Merged
merged 1 commit into from
Apr 28, 2015
Merged

#1655: Change to ICompileModule #1678

merged 1 commit into from
Apr 28, 2015

Conversation

troydai
Copy link
Contributor

@troydai troydai commented Apr 20, 2015

#1655

Please review the product code change first. In the process of adding tests.

@ghost ghost added the cla-already-signed label Apr 20, 2015
@troydai
Copy link
Contributor Author

troydai commented Apr 20, 2015

/cc @davidfowl

@troydai
Copy link
Contributor Author

troydai commented Apr 21, 2015

Ping /cc @victorhurdugaci @BrennanConroy @muratg


public IList<Diagnostic> Diagnostics { get; set; }

public IList<ICompileModule> Modules { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

This isn't right. This list is only for the invocation itself.

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 remove.

@victorhurdugaci
Copy link
Contributor

Will this break other repo? I think MVC uses ICompileModule for view precompilation

};

foreach (var m in CompilationContext.Modules)
foreach (var diagnostic in diagnostics)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you just do Diagnostics = new List<Diagnostic>(diagnostics) in the object initializer?

@troydai
Copy link
Contributor Author

troydai commented Apr 21, 2015

I'm updating MVC in the mean time

@troydai
Copy link
Contributor Author

troydai commented Apr 21, 2015

And, why is precompile code in HelloWorld sample commented?

@@ -197,14 +197,22 @@ public IDiagnosticResult EmitAssembly(string outputPath)

Logger.TraceInformation("[{0}]: Emitted {1} in {2}ms", GetType().Name, Name, sw.ElapsedMilliseconds);

var afterCompileContext = new AfterCompileContext(CompilationContext, emitResult.Diagnostics)
var afterCompileContext = new AfterCompileContext()
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@troydai
Copy link
Contributor Author

troydai commented Apr 21, 2015

/cc @davidfowl
So I update the PR introducing following changes:

  1. Remove the constructors from BeforeCompileContext and AfterCompileContext
  2. Introduce a LazyList to support loading resource. Comparing to its alternative, which makes the Resource property on BeforeCompileContext virtual I found this solution allow cleaner code. A POCO object without virtual member is more pure and clean.

@@ -12,7 +12,8 @@
},
"dnxcore50": {
"dependencies": {
"System.Runtime": "4.0.20-beta-*"
"System.Runtime": "4.0.20-beta-*",
"System.Collections": "4.0.10-beta-*"
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'll remove this.

@@ -21,30 +21,20 @@ public class RoslynProjectReference : IRoslynMetadataReference, IMetadataProject
public RoslynProjectReference(CompilationContext compilationContext)
Copy link
Member

Choose a reason for hiding this comment

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

Try to avoid random formatting changes in pull requests. It distracts from the actual change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so for these already changed, do you suggest to change them back?

@troydai
Copy link
Contributor Author

troydai commented Apr 22, 2015

Build verified, and also verified on MVC. I'll send out PR for MVC soon.

@troydai troydai changed the title #1655: Change to ICompileModel #1655: Change to ICompileModule Apr 22, 2015
@troydai troydai force-pushed the trdai/1655 branch 2 times, most recently from bc89677 to 819d82b Compare April 22, 2015 22:58
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove dnxcore50 since Moq is not supported there. For unit test, the framework doesn't matter.

Copy link
Member

Choose a reason for hiding this comment

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

Troy understands: Re-add, Linux and Darwin matter too!

@troydai
Copy link
Contributor Author

troydai commented Apr 22, 2015

Added tests.

Ping @davidfowl

@troydai troydai force-pushed the trdai/1655 branch 3 times, most recently from c0e3642 to 57aaf4f Compare April 28, 2015 05:32
{
public class AfterCompileContext
{
public IProjectContext ProjectContext { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Change IProjectContext to be a Poco as well.

new List<IMetadataReference>(),
() =>
{
flag = true;
Copy link
Member

Choose a reason for hiding this comment

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

flag?

Replace IBeforeCompileContext, IAfterCompileContext and IProjectContext with POCO class
@davidfowl
Copy link
Member

After the ci passes :shipit: /cc @pranavkm

@troydai troydai merged commit 46fa4af into dev Apr 28, 2015
@troydai troydai deleted the trdai/1655 branch April 28, 2015 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants