Skip to content

Adds Generators solution to build #448

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

Merged
merged 1 commit into from
Oct 3, 2017

Conversation

jakauppila
Copy link
Contributor

Added the Generators solution to build.cake. Includes downloading Nuget.exe to build.ps1.

The only thing I'm not sure of at this point is how to to perform the NuGetRestore on Linux for Travis; I assume this will involve utilizing Mono.

Fixes #441

build.cake Outdated
.IsDependentOn("CopyGenerators")
.Does(() => {
var generatorsProject = GetFiles(generatorsBuildDir + "/*.csproj");
Parallel.ForEach(generatorsProject, parallelOptions, (project) => NuGetRestore(project.FullPath));
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to call NuGetResore() explicitly since DotNetCoreBuild() will do an implicit restore for us.

build.cake Outdated
.Does(() => {
var generatorsProject = GetFiles(generatorsBuildDir + "/*.csproj");
Parallel.ForEach(generatorsProject, parallelOptions, (project) => NuGetRestore(project.FullPath));
Parallel.ForEach(generatorsProject, parallelOptions, (project) => DotNetBuild(project.FullPath));
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be DotNetCoreBuild as this is a .NET Core 2 project.

Copy link
Contributor

Choose a reason for hiding this comment

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

The generators solution contains one project, so we shouldn't need to run this build step in parallel.

build.cake Outdated
.Does(() => {
CopyDirectory($"{generatorsSourceDir}/", $"{generatorsBuildDir}");
});

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't perform any file replacements in the generators project like we do in the exercises (replacing the example with the stub). There shouldn't be any need to copy the generators directory.

build.ps1 Outdated

(New-Object System.Net.WebClient).DownloadFile($NuGetExeUri, $NuGetExePath);

###########################################################################
Copy link
Contributor

Choose a reason for hiding this comment

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

Travis already has NuGet on the CI server, so we shouldn't need to download it.

build.ps1 Outdated

(New-Object System.Net.WebClient).DownloadFile($NuGetExeUri, $NuGetExePath);

###########################################################################
Copy link
Contributor

Choose a reason for hiding this comment

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

Travis already has NuGet, so we shouldn't need to install it.

@jpreese
Copy link
Contributor

jpreese commented Oct 1, 2017

Thanks for working on this, @jakauppila ! I've requested some changes for your PR. If you have any questions, please do not hesitate to ask.

@jakauppila
Copy link
Contributor Author

@jpreese Made the requested changes, Travis is now green!

@jpreese
Copy link
Contributor

jpreese commented Oct 2, 2017

Excellent, thanks!

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Great work! I've requested a couple of small changes. Once those are in, this will be ready to merge!

build.cake Outdated
var exercisesSourceDir = "./exercises";
var exercisesBuildDir = "./build/exercises";

var generatorsSourceDir = "./generators";
Copy link
Member

Choose a reason for hiding this comment

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

This variable is only ever used in a single place, so I think it would be better to remove this variable and just use "./generators/Generators.csproj" in the BuildGeneratorsSolution step.

build.cake Outdated
@@ -5,7 +5,11 @@ using System.Threading.Tasks;
var target = Argument("target", "Default");
var exercise = Argument<string>("exercise", null);

var sourceDir = "./exercises";
var exercisesSourceDir = "./exercises";
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need both an exercisesSourceDir and buildDir variable, as the only thing that is built there are the exercises. I think we could just revert to the old situation here, where the exercise directory are directly placed and built in the ./build directory. I do think I like your naming better, so I would like to see something like this:

var exercisesSourceDir = "./exercises";
var exercisesBuildDir = "./build";

And then you could drop the buildDir parameter and replace it with exercisesBuildDir wherever it is used.

build.cake Outdated
Parallel.ForEach(allProjects, parallelOptions, (project) => DotNetCoreTest(project.FullPath));
});

Task("BuildGeneratorsSolution")
Copy link
Member

Choose a reason for hiding this comment

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

Could you change this to BuildGenerators? The solution part is just an implementation detail.

@jakauppila
Copy link
Contributor Author

@ErikSchierboom Requested changes have been made.

@ErikSchierboom ErikSchierboom merged commit 3db8306 into exercism:master Oct 3, 2017
@ErikSchierboom
Copy link
Member

@jakauppila Looking great! Merged. Thanks a lot. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants