Skip to content

Commit

Permalink
fix(core): normalize paths in Directory.Build.targets
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Nov 11, 2022
1 parent 3870b55 commit e8bf1bc
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ Thumbs.db
.cache-loader/

**/bin
**/obj
**/obj

.vs
17 changes: 17 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
This file is imported early in the build order.
Use it to set default property values that can be overridden in specific projects.
-->
<Project>
<PropertyGroup>
<!-- Output path configuration -->
<RepoRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</RepoRoot>
<ProjectRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</ProjectRelativePath>
<BaseOutputPath>$(RepoRoot)dist/$(ProjectRelativePath)</BaseOutputPath>
<OutputPath>$(BaseOutputPath)</OutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup>
<RestorePackagesWithLockFile>false</RestorePackagesWithLockFile>
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
This file is imported late in the build order.
Use it to override properties and define dependent properties.
-->
<Project>
<PropertyGroup>
<MSBuildProjectDirRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</MSBuildProjectDirRelativePath>
<NodeModulesRelativePath>$([MSBuild]::MakeRelative($(MSBuildProjectDirectory), $(RepoRoot)))</NodeModulesRelativePath>
</PropertyGroup>
<Target Name="CheckNxModuleBoundaries" BeforeTargets="Build">
<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;"
/>
</Target>
</Project>
6 changes: 3 additions & 3 deletions packages/core/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
generateFiles,
GeneratorCallback,
logger,
normalizePath,
NxJsonConfiguration,
readJson,
readWorkspaceConfiguration,
Expand All @@ -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,
Expand Down Expand Up @@ -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'),
),
Expand Down

0 comments on commit e8bf1bc

Please sign in to comment.