Skip to content

Commit e8bf1bc

Browse files
committed
fix(core): normalize paths in Directory.Build.targets
1 parent 3870b55 commit e8bf1bc

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ Thumbs.db
4444
.cache-loader/
4545

4646
**/bin
47-
**/obj
47+
**/obj
48+
49+
.vs

Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
This file is imported early in the build order.
3+
Use it to set default property values that can be overridden in specific projects.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<!-- Output path configuration -->
8+
<RepoRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</RepoRoot>
9+
<ProjectRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</ProjectRelativePath>
10+
<BaseOutputPath>$(RepoRoot)dist/$(ProjectRelativePath)</BaseOutputPath>
11+
<OutputPath>$(BaseOutputPath)</OutputPath>
12+
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
16+
</PropertyGroup>
17+
</Project>

Directory.Build.targets

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!--
2+
This file is imported late in the build order.
3+
Use it to override properties and define dependent properties.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<MSBuildProjectDirRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</MSBuildProjectDirRelativePath>
8+
<NodeModulesRelativePath>$([MSBuild]::MakeRelative($(MSBuildProjectDirectory), $(RepoRoot)))</NodeModulesRelativePath>
9+
</PropertyGroup>
10+
<Target Name="CheckNxModuleBoundaries" BeforeTargets="Build">
11+
<Exec Command="npx ts-node -r tsconfig-paths/register --project $(NodeModulesRelativePath)/packages/core/tsconfig.lib.json $(NodeModulesRelativePath)/packages/core/src/tasks/check-module-boundaries.ts --project-root &quot;$(MSBuildProjectDirRelativePath)&quot;"
12+
/>
13+
</Target>
14+
</Project>

packages/core/src/generators/init/generator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
generateFiles,
44
GeneratorCallback,
55
logger,
6+
normalizePath,
67
NxJsonConfiguration,
78
readJson,
89
readWorkspaceConfiguration,
@@ -20,7 +21,6 @@ import {
2021
} from '@nx-dotnet/utils';
2122
import type { PackageJson } from 'nx/src/utils/package-json';
2223
import * as path from 'path';
23-
import { normalize, relative } from 'path';
2424

2525
export async function initGenerator(
2626
host: Tree,
@@ -133,8 +133,8 @@ function addPrepareScript(host: Tree) {
133133
function initBuildCustomization(host: Tree) {
134134
const initialized = host.exists('Directory.Build.props');
135135
if (!initialized) {
136-
const checkModuleBoundariesScriptPath = normalize(
137-
relative(
136+
const checkModuleBoundariesScriptPath = normalizePath(
137+
path.relative(
138138
host.root,
139139
resolve('@nx-dotnet/core/src/tasks/check-module-boundaries'),
140140
),

0 commit comments

Comments
 (0)