Skip to content

Commit bfbcdf3

Browse files
committed
Move zipping of rewrite server into .net build
1 parent 07dd035 commit bfbcdf3

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

_build/Build.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ IEnumerable<AbsolutePath> GetSubDirectories(params string[] patterns)
118118

119119
Target Pack => _ => _
120120
.Description("Creates nuget packages inside artifacts directory")
121-
.DependsOn(Restore)
121+
.DependsOn(Restore, PublishServer)
122122
.Executes(() =>
123123
{
124124
DotNetPack(x => x
@@ -135,6 +135,8 @@ IEnumerable<AbsolutePath> GetSubDirectories(params string[] patterns)
135135
.SetVersion("0.0.1")
136136
.SetAssemblyVersion(Version.AssemblyVersion)
137137
.SetOutputDirectory(ArtifactsDirectory / "test"));
138+
139+
138140
});
139141

140142
Target PublishServer => _ => _
@@ -146,6 +148,9 @@ IEnumerable<AbsolutePath> GetSubDirectories(params string[] patterns)
146148
DotNetPublish(c => c
147149
.SetProject(Solution.src.Rewrite_Server)
148150
.SetVersion(Version.NuGetPackageVersion));
151+
152+
var publishDir = Solution.src.Rewrite_Server.Directory / "bin" / "Release" / "net8.0" / "publish";
153+
publishDir.ZipTo(ArtifactsDirectory / "DotnetServer.zip");
149154
});
150155

151156
Target StopServer => _ => _

rewrite-csharp-remote-server/build.gradle.kts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ dependencies {
3636
}
3737

3838

39-
tasks.register<Zip>("zipDotnetServer") {
40-
archiveFileName.set("DotnetServer.zip")
41-
destinationDirectory.set(layout.buildDirectory.dir("tmp"))
42-
from(rootProject.file("Rewrite/src/Rewrite.Server/bin/Release/net8.0/publish"))
43-
include("*")
44-
include("*/*") //to include contents of a folder present inside Reports directory
45-
}
39+
//tasks.register<Zip>("zipDotnetServer") {
40+
// archiveFileName.set("DotnetServer.zip")
41+
// destinationDirectory.set(layout.buildDirectory.dir("tmp"))
42+
// from(rootProject.file("Rewrite/src/Rewrite.Server/bin/Release/net8.0/publish"))
43+
// include("*")
44+
// include("*/*") //to include contents of a folder present inside Reports directory
45+
//}
4646

4747
tasks.processResources {
48-
dependsOn("zipDotnetServer")
49-
from(layout.buildDirectory.file("tmp/DotnetServer.zip"))
48+
// dependsOn("zipDotnetServer")
49+
// from(layout.buildDirectory.file("tmp/DotnetServer.zip"))
50+
from(layout.buildDirectory.file(rootProject.file("artifacts/DotnetServer.zip").absolutePath))
5051
}
5152

5253
tasks.compileJava {

rewrite-csharp-remote-server/src/test/java/org/openrewrite/csharp/remote/RemotingRecipeRunTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import java.io.File;
3838
import java.io.IOException;
39+
import java.net.URL;
3940
import java.nio.file.Path;
4041
import java.nio.file.Paths;
4142
import java.util.ArrayList;
@@ -58,9 +59,13 @@ public void testRemotingRecipeInstallAndRun() throws IOException {
5859
port = 54321;
5960
Path extractedDotnetBinaryDir = Paths.get("./build/dotnet-servet-archive");
6061
extractedDotnetBinaryDir.toFile().mkdirs();
62+
Path artifactsFolder = GitRootFinder.getGitRoot().resolve("artifacts").toAbsolutePath();
63+
URL test = Thread.currentThread()
64+
.getContextClassLoader()
65+
.getResource("DotnetServer.zip");
6166
var serverConfig = DotNetRemotingServerEngine.Config.builder()
6267
.extractedDotnetBinaryDir(extractedDotnetBinaryDir)
63-
.logFilePath(Paths.get("./build/test.log").toAbsolutePath().toString())
68+
.logFilePath(artifactsFolder.resolve( "test-results").resolve("csharp-server.log").toAbsolutePath().toString())
6469
.nugetPackagesFolder(nuPkgLocation.toPath().toAbsolutePath().normalize().toString())
6570
.port(port)
6671
.build();
@@ -76,7 +81,6 @@ public void testRemotingRecipeInstallAndRun() throws IOException {
7681

7782
RemotingRecipeManager manager = new RemotingRecipeManager(server, () -> server);
7883

79-
Path artifactsFolder = GitRootFinder.getGitRoot().resolve("artifacts");
8084

8185
InstallableRemotingRecipe recipes = manager.install(
8286
"Rewrite.Recipes",

0 commit comments

Comments
 (0)