Skip to content

Commit

Permalink
Fix issues I managed to just push to main
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource committed Aug 6, 2024
1 parent 5b675e4 commit 6f083e0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/prepare_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ func (b *workerBuilder) buildDotNet(ctx context.Context, baseDir string) (sdkbui
length := strings.Index(csproj[beginIndex:], `"`)
version = csproj[beginIndex : beginIndex+length]
}
omesProjPath := "../Temporalio.Omes.csproj"

// Delete any existing temp csproj
tempCsProjPath := filepath.Join(baseDir, "Temporalio.Omes.temp.csproj")
if err := os.Remove(tempCsProjPath); err != nil && !os.IsNotExist(err) {
return nil, fmt.Errorf("failed removing temp csproj: %w", err)
}

// Prepare replaced csproj if using path-dependency
if strings.ContainsAny(version, `/\`) {
Expand All @@ -241,11 +248,12 @@ func (b *workerBuilder) buildDotNet(ctx context.Context, baseDir string) (sdkbui
csproj = csproj[:beginIndex] + depLine + csproj[endIndex+len(packageRefStr):]

// Write new csproj
if err := os.WriteFile(filepath.Join(baseDir, "Temporalio.Omes.temp.csproj"), []byte(csproj), 0644); err != nil {
if err := os.WriteFile(tempCsProjPath, []byte(csproj), 0644); err != nil {
if err != nil {
return nil, fmt.Errorf("failed writing temp csproj: %w", err)
}
}
omesProjPath = "../Temporalio.Omes.temp.csproj"
}

prog, err := sdkbuild.BuildDotNetProgram(ctx, sdkbuild.BuildDotNetProgramOptions{
Expand All @@ -259,7 +267,7 @@ func (b *workerBuilder) buildDotNet(ctx context.Context, baseDir string) (sdkbui
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Temporalio.Omes.temp.csproj" />
<ProjectReference Include="` + omesProjPath + `" />
</ItemGroup>
</Project>`,
})
Expand Down

0 comments on commit 6f083e0

Please sign in to comment.