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

Introduce MSBuild tasks programability #12364

Closed
wants to merge 22 commits into from
Closed

Introduce MSBuild tasks programability #12364

wants to merge 22 commits into from

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Sep 10, 2022

Fixes #4991

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@Piedone
Copy link
Member

Piedone commented Mar 24, 2024

Is this something you'd like to revisit any time soon @hishamco or should we close?

@hishamco
Copy link
Member Author

I tried this PR last week but there's an issue to discover the task, I will try one more time if all goes well I will update the PR otherwise I will close it

@hishamco hishamco marked this pull request as ready for review April 14, 2024 00:55
@hishamco
Copy link
Member Author

I'm wondering why the assembly file path doesn't resolved properly @MikeAlhayek @Piedone any idea?

@hishamco
Copy link
Member Author

Finally, seems I forgot to generalize the build configuration instead of using Debug :) time to finalize the PR

@hishamco hishamco requested a review from Piedone April 14, 2024 03:05
@hishamco
Copy link
Member Author

Can we wright unit tests? Why not!!

@hishamco
Copy link
Member Author

It's good to demo it this week

@Piedone
Copy link
Member

Piedone commented Apr 14, 2024

Before I deep dive into reviewing this, please answer me here: #4991 (comment) I'd like to first understand what your goal is, and what issue you're trying to solve, and why with the implementation you choose and not the alternatives I asked about. I'm wholly unclear about all of these.

@hishamco
Copy link
Member Author

Hope this help

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

I don't really see the advantages mentioned under #4991 (comment). Now instead of MSBuild one-liners we have classes and a test project, while OrchardCore.Application.Cms.Core.Targets.targets didn't become less complex, just different. Maybe it's faster, but we're talking about creating two folders and three files, so there can't be a significant different.

Probably it would make more sense to use C# tasks for indeed complex MSBuild logic.


<PropertyGroup>
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Copy link
Member

Choose a reason for hiding this comment

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

This won't be needed if #15764 is merged first.

Copy link
Member

Choose a reason for hiding this comment

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

Move this under the test solution folder.

Copy link
Member Author

Choose a reason for hiding this comment

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

It was there, but I'd like to separate them into another project to make it clear that's not related to the actual OC tests project

Copy link
Member

Choose a reason for hiding this comment

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

All tests and even benchmarks are there, so this is suitable (and it's already in the same file system folder).

Copy link
Member Author

Choose a reason for hiding this comment

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

Benchmarks in a separated project, right?

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 understand, sorry.

Copy link
Member Author

Choose a reason for hiding this comment

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

The benchmarks in a separate project OrchardCore.Benchmarks too, so we don't want not mixed things

Copy link
Member

Choose a reason for hiding this comment

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

I'm talking about moving this project to the test solution folder. Not move it into a different project.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just noticed that while I was preparing a demo

Copy link
Member

Choose a reason for hiding this comment

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

I get this when trying to build the solution locally:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Try to use CLI, I think there's an issue in some VS versions, but I investigate on that

Copy link
Member

Choose a reason for hiding this comment

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

It should just work in VS too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I rebase to the main and then try again ..

FYI sometimes VS makes me crazy I notice that in this & sources generator PRs :)

Copy link
Member

Choose a reason for hiding this comment

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

That's unfortunately the case indeed. Same happened for Lombiq/Helpful-Libraries#238.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it is


public abstract class CreateWebFolderTask : MSBuildTask
{
public abstract string FolderName { get; }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public abstract string FolderName { get; }
public abstract string FolderPath { get; }

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a folder name, not a path, such as wwwroot

Copy link
Member

Choose a reason for hiding this comment

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

How it's used is a path. Passing wwwroot/some/sub/folder to it would work too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it could be

@@ -1,4 +1,12 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_OrchardCoreBuildTasksAssembly>$(ProjectDir)..\..\OrchardCore.Build.Tasks\bin\$(Configuration)\$(CommonTargetFrameworks)\OrchardCore.Build.Tasks.dll</_OrchardCoreBuildTasksAssembly>
Copy link
Member

Choose a reason for hiding this comment

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

This will only work if the DLL already exists but if you build the solution for the first time, it won't. Won't this cause issues?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be there during the build, if it's not there the GitHub Workflow will not pass

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but this line will be executed even when one just opens the solution and anything else that MSBuild does, not just during a build.

Copy link
Member Author

Choose a reason for hiding this comment

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

This will only work if the DLL already exists but if you build the solution for the first time, it won't. Won't this cause issues?>

This is weird, could you please try the following:

  1. Add this reference <ProjectReference Include="..\OrchardCore.Build.Tasks\OrchardCore.Build.Tasks.csproj" /> to OC.Cms.Web
  2. Open CMD and locate the web project
  3. Run dotnet clean
  4. Run dotnet build

Copy link
Member

Choose a reason for hiding this comment

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

Can you please make sure you test all of such scenarios? And in VS, the solution should still work with F5.

src/OrchardCore.Build.Tasks/CopyTranslationFilesTask.cs Outdated Show resolved Hide resolved
src/OrchardCore.Build.Tasks/CopyTranslationFilesTask.cs Outdated Show resolved Hide resolved
Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

Copy link
Contributor

github-actions bot commented Jun 9, 2024

This pull request has merge conflicts. Please resolve those before requesting a review.

Copy link
Contributor

github-actions bot commented Aug 8, 2024

It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.

@github-actions github-actions bot added the stale label Aug 8, 2024
@MikeAlhayek
Copy link
Member

for instructions on how to resolve the merge conflicts due to #16572 please follow the step listed in this comment.

@github-actions github-actions bot removed the stale label Aug 15, 2024
Copy link
Contributor

It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.

@github-actions github-actions bot added the stale label Oct 15, 2024
Copy link
Contributor

Closing this pull request because it has been stale for very long. If you think this is still relevant, feel free to reopen it.

@github-actions github-actions bot closed this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create programmable MSBuild Tasks
3 participants