Skip to content

Commit 2b0c348

Browse files
gfraiteurclaude
andcommitted
Remove DebugBuild dependency from UpstreamMerge build
UpstreamMerge now only depends on cascading UpstreamMerge builds from dependent repos. Claude resolves conflicts without building - the PR build handles compilation. Also added rm/mv tools for file operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ede7788 commit 2b0c348

File tree

2 files changed

+15
-40
lines changed

2 files changed

+15
-40
lines changed

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/TeamCity/Generation/TeamCitySettingsFile.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,24 +208,18 @@ private static TeamCityBuildConfiguration CreateUpstreamMergeConfiguration( Prod
208208
// Use Claude Dockerfile for upstream merge to enable AI-assisted conflict resolution
209209
var claudeDockerSpec = product.DockerSpec?.WithClaudeDockerfile();
210210

211-
// Get the same build dependencies as DebugBuild (artifact dependencies from upstream repos)
212-
var debugConfigurationProperties = new ConfigurationProperties( product, BuildConfiguration.Debug );
213-
214-
// Also add dependencies on UpstreamMerge of dependent repos (for cascading merge)
215-
var upstreamMergeDependencies =
211+
// Dependencies on UpstreamMerge of dependent repos (for cascading merge order)
212+
// No DebugBuild dependencies - Claude only does git merge and conflict resolution,
213+
// it doesn't compile. The PR build will handle compilation with appropriate artifacts.
214+
var snapshotDependencies =
216215
product.ParametrizedDependencies
217216
.Where( d => d.Definition.GenerateSnapshotDependency && d.Definition.ProductFamily.UpstreamProductFamily != null )
218217
.Select( d => d.Definition )
219218
.Select( d => new TeamCitySnapshotDependency(
220219
d.CiConfiguration.UpstreamMergeBuildType,
221220
true,
222-
FailureAction: FailureAction.AddProblem ) );
223-
224-
// Combine: DebugBuild dependencies (for artifacts) + UpstreamMerge dependencies (for cascading)
225-
var snapshotDependencies = debugConfigurationProperties.SnapshotDependenciesForBuildConfiguration
226-
.Concat( upstreamMergeDependencies )
227-
.DistinctBy( d => d.ObjectId )
228-
.OrderBy( d => d.ObjectId );
221+
FailureAction: FailureAction.AddProblem ) )
222+
.OrderBy( d => d.ObjectId );
229223

230224
var upstreamMergeConfiguration = new TeamCityBuildConfiguration(
231225
"UpstreamMerge",

src/PostSharp.Engineering.BuildTools/Utilities/ClaudeCodeHelper.cs

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public static bool TryResolveMergeConflicts(
8484
// --output-format stream-json: Stream JSON events in real-time
8585
// --verbose: Show full turn-by-turn output
8686
// --allowedTools: Tools Claude can use, with Bash patterns specified inline
87-
// Bash patterns: git commands and ./build.sh commands are allowed (NO dotnet - must use build.sh)
87+
// Bash patterns: git commands (including rm for file removal) and mv for moving files
8888
// The prompt is sent via stdin to avoid command line length limits
8989
var claudeArgs = "-p --output-format stream-json --verbose --model opus " +
90-
"--allowedTools \"Edit\" \"Read\" \"Bash(cd *)\" \"Bash(git *)\" \"Bash(./build.sh *)\" \"Grep\" \"Glob\"";
90+
"--allowedTools \"Edit\" \"Read\" \"Write\" \"Bash(cd *)\" \"Bash(git *)\" \"Bash(rm *)\" \"Bash(mv *)\" \"Grep\" \"Glob\"";
9191

9292
console.WriteMessage( $"Invoking Claude Code with args: {claudeArgs}" );
9393
console.WriteMessage( $"Working directory: {workingDirectory}" );
@@ -440,11 +440,11 @@ private static string BuildMergeConflictPrompt( string sourceBranch, string targ
440440
This is a NON-INTERACTIVE session - you must complete the task without asking questions.
441441
442442
## Your Goal
443-
Resolve all merge conflicts so the code builds successfully.
443+
Resolve all merge conflicts so the merge can proceed. You do NOT need to build - the PR build will verify compilation.
444444
445445
## Generated Files (can be ignored)
446446
The following files are auto-generated. If they have conflicts, you can resolve them by keeping EITHER version
447-
(preferably the current/HEAD version), then they will be regenerated in step 3.
447+
(preferably the current/HEAD version). They will be regenerated when the PR build runs.
448448
- Build.ps1
449449
- DockerBuild.ps1
450450
- Dockerfile
@@ -472,42 +472,25 @@ Resolve all merge conflicts so the code builds successfully.
472472
d) Edit the file to remove ALL conflict markers and leave only the resolved code
473473
e) Run `git add <file>` to mark it as resolved
474474
475-
### 3. Regenerate scripts
476-
After resolving all conflicts semantically, run `./build.sh generate-scripts` to regenerate the generated files.
477-
Then run `git add .` to stage the regenerated files.
478-
479-
### 4. Build and verify (conditional)
480-
**SKIP THIS STEP** if the ONLY files with conflicts were:
481-
- Generated files (listed above) - they will be regenerated by `generate-scripts`
482-
- Version files (`*.version.props`, `Directory.Packages.props`, `global.json`)
483-
- Files containing only version number changes
484-
485-
In these cases, `generate-scripts` is sufficient - no build needed.
486-
487-
**OTHERWISE**, if any source code files (*.cs, *.csproj, etc.) had conflicts, run `./build.sh build` to ensure the code compiles.
488-
If there are build errors or warnings, fix them and rebuild.
489-
490-
### 5. Final check
475+
### 3. Final check
491476
Run `git status` to confirm all conflicts are resolved and files are staged.
492477
493478
## Conflict Resolution Rules
494479
- **Package versions**: When there's a conflict in package/dependency versions (in Directory.Packages.props, .csproj, etc.), always choose the HIGHER version number
495480
- **Code conflicts**: Analyze the intent of both changes and merge them logically
496-
- **Generated files**: Keep HEAD version, they will be regenerated
481+
- **Generated files**: Keep HEAD version, they will be regenerated by the PR build
497482
498483
## Important Constraints
499484
- Do NOT run `git commit` - leave that to the calling process
500485
- Do NOT run `git push`
501-
- Do NOT run `dotnet build` for the first build - it will FAIL. Always use `./build.sh build` as the first build.
502-
When a specific project fails, you can iterate with `dotnet build` for this specific project. To continue with other projects, do `./build.sh build`.
503-
- Do NOT modify files that don't have conflicts unless needed to fix build errors
486+
- Do NOT build the code - the PR build will handle compilation
487+
- Do NOT modify files that don't have conflicts
504488
- If you encounter a conflict you cannot resolve confidently, resolve it to the best of your ability and note it in your output
505489
506490
## Success Criteria
507491
- All conflict markers removed from all files
508492
- All previously conflicting files staged with `git add`
509-
- `./build.sh generate-scripts` completed successfully
510-
- If code changes were involved: `./build.sh build` completes successfully with no errors or warnings
493+
- `git status` shows no unmerged files
511494
512495
## Output Format
513496
At the very end of your work, write a conclusion block in this exact format:
@@ -519,8 +502,6 @@ Then run `git add .` to stage the regenerated files.
519502
Files resolved:
520503
- file1.cs: [brief description of resolution]
521504
- file2.csproj: [brief description of resolution]
522-
523-
Build status: [PASSED/SKIPPED (version-only changes)/FAILED with brief note]
524505
===END_CONCLUSION===
525506
```
526507

0 commit comments

Comments
 (0)