Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Use makefile.proj if available #158

Closed
wants to merge 2 commits into from

Conversation

pranavkm
Copy link
Contributor

No description provided.

@natemcmaster
Copy link
Contributor

makefile.proj will break all shorthand dotnet commands since it matches the *.*proj pattern. This would require you to explicitly call dotnet build Repo.sln now and dotnet restore Repo.sln.

As an alternative, consider adding a msbuild project into KoreBuild that conditionally imports makefile.targets from the repo folder if it exists. This has the added benefit of allowing us to start moving the Sake lifecycle into an MSBuild project.

Concept:
in KoreBuild

<Project>
    <Target Name="Build" />
    <Import Project="$(RepoDir)\makefile.targets" Condition="Exists('$(RepoDir)\makefile.targets')" />
</Project>

in repo

<Project>
   <Target Name="AfterBuild" AfterTargets="Build" />
</Project>

@pranavkm
Copy link
Contributor Author

build/makefile.proj if the file in the root affects builds? Presumably that solves and moves more build related files to the build dir.

@pranavkm pranavkm force-pushed the prkrishn/run-makefile branch from 2d680b8 to 1dc95a7 Compare January 31, 2017 00:43
@natemcmaster
Copy link
Contributor

I like the idea of putting it in the build/ folder. How about build/repo.targets ?

@pranavkm pranavkm force-pushed the prkrishn/run-makefile branch from 1dc95a7 to f1eeadd Compare January 31, 2017 19:11
@pranavkm
Copy link
Contributor Author

🆙 📅 with corresponding changes to https://github.com/aspnet/CoreCLR/pull/149/

Copy link
Contributor

@natemcmaster natemcmaster left a comment

Choose a reason for hiding this comment

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

👏 I like where this is going. A few changes suggested.

@@ -0,0 +1,17 @@
<Project>
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 set to DefaultTargets="Default"?

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 gets included by makefile.proj which has the DefaultTarget. Would we need one here?

Copy link
Contributor

Choose a reason for hiding this comment

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

nope, you're right. I just didn't see that

</PropertyGroup>

<Exec
Command="$(SakeExecutable) -I $(KoreBuildDirectory)shade -f $(MakeFilePath) $(ShadeTarget)"
Copy link
Contributor

Choose a reason for hiding this comment

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

I did this exact same work a few weeks ago (bu never finished it) and ran into issues with relative vs absolute paths. Sake.exe didn't recognize absolute paths for the -f argument. Have you run into this issue 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.

KoreBuildDirectory is root relative - notice I had to concat the path on Line 145 with RepositoryRoot to make it absolute. Btw, this brought up an interesting issue with using back slashes in our code - the things we invoke on xplat don't like back slashes (for instance mono build\sake.exe). Calling Path.GetFullPath helps, but it'd be much better to standardize on forward slashes in our targets.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha. was just checking :)

if ($allparams) {
$targets = '/t:' + $allparams.Replace(' ', ';')
}
dotnet msbuild $makeFileProj /p:KoreBuildDirectory="$koreBuildFolder\" /p:RepositoryRoot="$repoFolder\" $targets
Copy link
Contributor

Choose a reason for hiding this comment

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

$targets needs to be surrounded with double quotes so multiple targets doesn't terminate the line.

Suggested adding these parameters:
/maxcpucount /fileLogger /fileloggerparameters:LogFile=artifacts/msbuild.log /detailedsummary

Also, consider making an rsp file (artifacts/msbuild.rsp) and executing "dotnet msbuild @artifacts/msbuild.rsp" instead.

Nit: add newline at end of file.

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 actually tried multiple targets and it works fine - primarily because the $targets is a variable and not code in the file with semicolons.

Copy link
Contributor

Choose a reason for hiding this comment

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

glad this PowerShell quirk works in our favor.

@pranavkm pranavkm force-pushed the prkrishn/run-makefile branch 4 times, most recently from e20171a to fb71594 Compare February 1, 2017 21:08
@pranavkm pranavkm force-pushed the prkrishn/run-makefile branch from fb71594 to 0e9f203 Compare February 1, 2017 21:09
@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 1, 2017

🆙 📅

$targets
ENDMSBUILDARGS

dotnet msbuild @"$msbuildResponseFile"
Copy link
Contributor

@natemcmaster natemcmaster Feb 1, 2017

Choose a reason for hiding this comment

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

One more thought. Right now this converts $@ to a list of targets. How would we go about flowing through properties? e.g. /p:Configuration=Release.

@natemcmaster
Copy link
Contributor

🔔 can we get this in soon? I want to rebase #159 off of this work.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 3, 2017

Merged. Let's see how this goes.

@pranavkm pranavkm closed this Feb 3, 2017
@pranavkm pranavkm deleted the prkrishn/run-makefile branch February 3, 2017 18:07
@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 3, 2017

Ok - need to tweak this so that it allows calling targets that aren't declared in KoreBuild (for instance Universe has different targets). I'll play around with this and resend.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 3, 2017

I'll send an update to this later.

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.

3 participants