From e8bf1bc44adc144e16173085d42c4b5aefe41a81 Mon Sep 17 00:00:00 2001 From: AgentEnder Date: Fri, 11 Nov 2022 14:41:43 -0500 Subject: [PATCH] fix(core): normalize paths in Directory.Build.targets --- .gitignore | 4 +++- Directory.Build.props | 17 +++++++++++++++++ Directory.Build.targets | 14 ++++++++++++++ packages/core/src/generators/init/generator.ts | 6 +++--- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets diff --git a/.gitignore b/.gitignore index c70004ef..a9e94579 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,6 @@ Thumbs.db .cache-loader/ **/bin -**/obj \ No newline at end of file +**/obj + +.vs \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..47a2f8c2 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,17 @@ + + + + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)')) + $([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory))) + $(RepoRoot)dist/$(ProjectRelativePath) + $(BaseOutputPath) + true + + + false + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..233320a1 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,14 @@ + + + + $([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory))) + $([MSBuild]::MakeRelative($(MSBuildProjectDirectory), $(RepoRoot))) + + + + + \ No newline at end of file diff --git a/packages/core/src/generators/init/generator.ts b/packages/core/src/generators/init/generator.ts index ac09af7c..d8e85bbd 100644 --- a/packages/core/src/generators/init/generator.ts +++ b/packages/core/src/generators/init/generator.ts @@ -3,6 +3,7 @@ import { generateFiles, GeneratorCallback, logger, + normalizePath, NxJsonConfiguration, readJson, readWorkspaceConfiguration, @@ -20,7 +21,6 @@ import { } from '@nx-dotnet/utils'; import type { PackageJson } from 'nx/src/utils/package-json'; import * as path from 'path'; -import { normalize, relative } from 'path'; export async function initGenerator( host: Tree, @@ -133,8 +133,8 @@ function addPrepareScript(host: Tree) { function initBuildCustomization(host: Tree) { const initialized = host.exists('Directory.Build.props'); if (!initialized) { - const checkModuleBoundariesScriptPath = normalize( - relative( + const checkModuleBoundariesScriptPath = normalizePath( + path.relative( host.root, resolve('@nx-dotnet/core/src/tasks/check-module-boundaries'), ),