Skip to content

Conversation

VeryEarly
Copy link
Collaborator

@VeryEarly VeryEarly commented Jul 5, 2025

Description

  • Linux file system is case sensitive
  • there are 2 sources of name while building, one is from path src/root/nameData.Autorest, the other is from src/root/nameData.Autorest\README.md = namedata
  • for folder name under generated, we need name 1
  • for generated files like psd1/psm1/format.ps1xml/csproj, we need the name 2
  • PowerShell has odd behavior: say we have file 'src/Az.Namedata.psd1', and do cp src/Az.NameData.psd1 generated, you end up get src/Az.NameData.psd1 not src/Az.Namedata.psd1
    Polish scripts to satisfy linux

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings July 5, 2025 09:20
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Update-GeneratedSubModule script to correctly handle case-sensitive Linux file systems by dynamically detecting module filenames (psd1, psm1, format, csproj) instead of using hard-coded names.

  • Replaces static PSD1 lookup with Get-ChildItem pattern matching
  • Builds fileToUpdate array dynamically from source folder contents
  • Adjusts csproj generation to use the detected project filename and preserve GUID
Comments suppressed due to low confidence (3)

tools/BuildScripts/BuildScripts.psm1:177

  • [nitpick] The variable name $cSubModuleNameTrimmed is not immediately clear; consider renaming it to something like $csprojSubModuleName for better readability.
    $cSubModuleNameTrimmed = $subModuleNameTrimmed

tools/BuildScripts/BuildScripts.psm1:135

  • Using Get-ChildItem without restricting to a single result may return multiple matches; consider selecting Select-Object -First 1 or validating that exactly one file is found to avoid unintended behavior.
    $psd1Name = Get-ChildItem $GeneratedDirectory | Where-Object { $_.Name -match "Az\.${subModuleNameTrimmed}\.psd1" } | Foreach-Object {$_.Name}

tools/BuildScripts/BuildScripts.psm1:169

  • Include a filter to remove any null or empty entries from $fileToUpdate (e.g., @(... ) | Where-Object { $_ }) to prevent errors when a file name variable didn't match any items.
    $fileToUpdate = @('generated', 'resources', $psd1Name, $psm1Name, $formatName, 'exports', 'internal', 'test-module.ps1', 'check-dependencies.ps1')

@wyunchi-ms wyunchi-ms merged commit c9aeca5 into main Jul 6, 2025
12 checks passed
@VeryEarly VeryEarly deleted the yabo/fix-suffix branch July 6, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants