Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Fix excluded files and folder deletion triggers #112

Merged
merged 1 commit into from
May 26, 2016

Conversation

victorhurdugaci
Copy link
Contributor

Fixes #90, https://github.com/aspnet/dotnet-watch/issues/93

  • Bugfix: Trigger on new project.json file structure
  • Bugfix: Trigger on folder deletion
  • Add test for folder deletion

Please review @moozzyk @kichalla @ajaybhargavb

{
filesToWatch.AddRange(compilerOptions.CompileInclude.ResolveFiles());

if (compilerOptions.EmbedInclude != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be nested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question, maybe you have an answer. So this new project model has two sets of properties: the old ones and the new ones.

  1. Can you have both of them set at the same time?
  2. Does having one set mean ignore the other one?
  3. Which one takes priority because I see that the new properties are null by default if not set but the old ones have default values if not set

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you have both of them set at the same time? Does having one set mean ignore the other one?

Yes. The new ones will take priority.

Which one takes priority because I see that the new properties are null by default if not set but the old ones have default values if not set

When nothing is set, the default of old schema is used.

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 case, if CompileInclude is not set but EmbedInclude is set it will be ignored.
This should probably be refactored to something like this.

if (compilerOptions.CompileInclude != null)
{
    filesToWatch.AddRange(compilerOptions.CompileInclude.ResolveFiles());
}
else
{
    filesToWatch.AddRange(runtimeProject.Files.SourceFiles);
}

if (compilerOptions.EmbedInclude != null)
{
    filesToWatch.AddRange(compilerOptions.EmbedInclude.ResolveFiles());
}
else
{
    filesToWatch.AddRange(runtimeProject.Files.ResourceFiles.Values);
}

filesToWatch.AddRange(runtimeProject.Files.PreprocessSourceFiles);
filesToWatch.AddRange(runtimeProject.Files.SharedFiles);

@kichalla
Copy link
Member

runtimeProject.Files.SharedFiles))).Concat(
new string[] { runtimeProject.ProjectFilePath })
.ToList();
var compilerOptions = runtimeProject.GetCompilerOptions(targetFramework: null, configurationName: null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you have files included/excluded per configuration/framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ajaybhargavb this is a question for you

Copy link
Contributor

Choose a reason for hiding this comment

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

compile and embed are part of buildOptions which can be framework/configuration specific. So yes the schema supports it. But I am not sure if it makes sense to include/exclude files for specific framework/configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think there are rare scenarios like that but I am not sure if we need to proactively address them now.

@victorhurdugaci
Copy link
Contributor Author

Updated

@kichalla
Copy link
Member

:shipit: from me

var compilerOptions = runtimeProject.GetCompilerOptions(targetFramework: null, configurationName: null);

var filesToWatch = new List<string>() { runtimeProject.ProjectFilePath };
if (compilerOptions?.CompileInclude != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry if my reply was confusing before, I meant that compilerOptions will never be null.

@ajaybhargavb
Copy link
Contributor

:shipit:

- Bugfix: Trigger on folder deletion
- Add test for folder deletion
@victorhurdugaci victorhurdugaci merged commit 2cf772b into dev May 26, 2016
@victorhurdugaci victorhurdugaci deleted the victorhu/trigger-fix branch May 26, 2016 23:06
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.

5 participants