-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
After looking at the machine generated accelerator.yaml file in a bit more detail, I think the following recipes could be used to make it more "natural" (and concise):
- All of the preprocessor
#if x #endifdirectives could be replaced by aReplaceTextwithregex, e.g. like so:
- include:
- src/MyProjectGroup.Common/MyProjectGroup.Common.csproj
chain:
- type: ReplaceText
substitutions:
- text: |2-
<!--#if configserver -->
<PackageReference Include="Steeltoe.Extensions.Configuration.ConfigServerCore" Version="3.1.3" />
<!--#endif -->
with: "''"
condition: '!(#configserver)'
- type: ReplaceText
substitutions:
- text: |2-
<!--#if configserver -->
<PackageReference Include="Steeltoe.Extensions.Configuration.ConfigServerCore" Version="3.1.3" />
<!--#endif -->
with: "' <PackageReference Include=\"Steeltoe.Extensions.Configuration.ConfigServerCore\" Version=\"3.1.3\" />'"
condition: '#configserver'becomes
- include:
- src/MyProjectGroup.Common/MyProjectGroup.Common.csproj
chain:
- type: ReplaceText
regex:
pattern: '(?s)<!--#if configserver -->(.*?)<!--#endif -->'
with: "#configserver ? '$1' : ''"but then of course, there is no need to have this snippet per file, so the include can become
- include: ['**/*.csproj', '**/*.xml']and handle all files in one swoop.
You're then left with one snippet per option + comment format (xml-like, C-like, etc.)
I believe this can apply to lines 70 to 800 and scale with the number of options instead of the number of files to touch.
If you're adventurous, this could be reduced to one snippet per option if you make the regex cope with all comment styles.
- Then, all the
RewritePathof the form
- type: RewritePath
regex: config/DotnetAccelerator-Development.yaml
rewriteTo: "'config/' + #artifactId + '-Development.yaml'"
- type: RewritePath
regex: config/DotnetAccelerator-LocalMySQL.yaml
rewriteTo: "'config/' + #artifactId + '-LocalMySQL.yaml'"
etc...can be rewritten to a couple of RewritePath using capturing groups:
- type: RewritePath
regex: (config/)DotnetAccelerator(-Development\\.yaml)
rewriteTo: "#g1 + #artifactId + #g2"
etc...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels