diff --git a/Rewrite/Rewrite.Sources.sln b/Rewrite/Rewrite.Sources.sln index 06af622..29f5c45 100644 --- a/Rewrite/Rewrite.Sources.sln +++ b/Rewrite/Rewrite.Sources.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.CSharp.Tests", "tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test", "src\Rewrite.Test\Rewrite.Test.csproj", "{D3F48947-C702-4D1A-B6EE-96B89D13953D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Server", "src\Rewrite.Server\Rewrite.Server.csproj", "{D3F48947-C702-4D1A-B6EE-96B89D13953E}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C7A4A8F9-0343-4A3E-AB77-101C458C23B5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7B268266-B9CD-4D85-ABC5-3B2C4611FD74}" @@ -93,6 +95,10 @@ Global {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.Build.0 = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Release|Any CPU.Build.0 = Release|Any CPU {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E364862-1ACA-4C94-8EA0-23724FF67AA2}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -130,6 +136,7 @@ Global {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {C7E280C5-E841-4690-8AA3-653ECBC7C78B} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {D3F48947-C702-4D1A-B6EE-96B89D13953D} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {D3F48947-C702-4D1A-B6EE-96B89D13953E} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {D38BB305-3276-4AE1-87B1-C19C7A9F3840} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {0E364862-1ACA-4C94-8EA0-23724FF67AA2} = {45B6292D-DC7E-46A7-A86E-7455BBEAED70} diff --git a/Rewrite/Rewrite.sln b/Rewrite/Rewrite.sln index 427a91f..0e394a9 100644 --- a/Rewrite/Rewrite.sln +++ b/Rewrite/Rewrite.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.CSharp.Tests", "tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test", "src\Rewrite.Test\Rewrite.Test.csproj", "{D3F48947-C702-4D1A-B6EE-96B89D13953D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Server", "src\Rewrite.Server\Rewrite.Server.csproj", "{D3F48947-C702-4D1A-B6EE-96B89D13953E}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test.CSharp", "src\Rewrite.Test.CSharp\Rewrite.Test.CSharp.csproj", "{3D70D4FA-3BA2-4230-B474-5A70DB23B8CE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rewrite.Test.Engine.Remote", "src\Rewrite.Test.Engine.Remote\Rewrite.Test.Engine.Remote.csproj", "{6EC419CB-E60B-4F06-A710-B02EA6B9AAAC}" @@ -85,6 +87,10 @@ Global {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3F48947-C702-4D1A-B6EE-96B89D13953D}.Release|Any CPU.Build.0 = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3F48947-C702-4D1A-B6EE-96B89D13953E}.Release|Any CPU.Build.0 = Release|Any CPU {3D70D4FA-3BA2-4230-B474-5A70DB23B8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D70D4FA-3BA2-4230-B474-5A70DB23B8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D70D4FA-3BA2-4230-B474-5A70DB23B8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -109,6 +115,7 @@ Global {5DD7D88A-5A10-457D-B1A2-30F7CF67AD9F} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {C7E280C5-E841-4690-8AA3-653ECBC7C78B} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {D3F48947-C702-4D1A-B6EE-96B89D13953D} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} + {D3F48947-C702-4D1A-B6EE-96B89D13953E} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {D38BB305-3276-4AE1-87B1-C19C7A9F3840} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {F7F4F27F-2CAE-422B-B6CE-25A88C3603A1} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} {8623AABC-D198-4D56-B26B-14A503B226E1} = {C7A4A8F9-0343-4A3E-AB77-101C458C23B5} diff --git a/Rewrite/src/Rewrite.Server/Program.cs b/Rewrite/src/Rewrite.Server/Program.cs new file mode 100644 index 0000000..c5cd229 --- /dev/null +++ b/Rewrite/src/Rewrite.Server/Program.cs @@ -0,0 +1,32 @@ +using Microsoft.CodeAnalysis; +using Parser = CommandLine.Parser; + +namespace Rewrite.Server; + +public class Program +{ + public static void Main(string[] args) + { + var result = new Parser(ps => + { + ps.AllowMultiInstance = true; + }) + .ParseArguments(args); + + if (result.Errors.Any()) + { + foreach (var resultError in result.Errors) + { + + Console.WriteLine(resultError); + } + throw new AggregateException(result.Errors.Select(e => new ArgumentException(e.ToString()))); + } + + var options = result.Value; + + var server = new Server(options); + + server.Listen().Wait(); + } +} diff --git a/Rewrite/src/Rewrite.Server/Rewrite.Server.csproj b/Rewrite/src/Rewrite.Server/Rewrite.Server.csproj new file mode 100644 index 0000000..af0db18 --- /dev/null +++ b/Rewrite/src/Rewrite.Server/Rewrite.Server.csproj @@ -0,0 +1,38 @@ + + + + Exe + net8.0 + enable + moderne.png + enable + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rewrite-csharp-remote-server/.gitignore b/rewrite-csharp-remote-server/.gitignore new file mode 100644 index 0000000..0fe28f9 --- /dev/null +++ b/rewrite-csharp-remote-server/.gitignore @@ -0,0 +1,7 @@ +build/ +target/ +.gradle/ +.idea/ +out/ +bin/ +src/main/generated/ diff --git a/rewrite-csharp-remote-server/build.gradle.kts b/rewrite-csharp-remote-server/build.gradle.kts new file mode 100644 index 0000000..f108c4e --- /dev/null +++ b/rewrite-csharp-remote-server/build.gradle.kts @@ -0,0 +1,81 @@ +plugins { + id("org.openrewrite.build.language-library") +} + +tasks.register("zipDotnetServer") { + archiveFileName.set("DotnetServer.zip") + destinationDirectory.set(layout.buildDirectory.dir("tmp")) + from(rootProject.file("Rewrite/src/Rewrite.Server/bin/Release/net8.0/publish")) + include("*") + include("*/*") //to include contents of a folder present inside Reports directory +} + +tasks.processResources { + dependsOn("zipDotnetServer") + from(layout.buildDirectory.file("tmp/DotnetServer.zip")) +} + +tasks.compileJava { + options.release = 8 +} + +// We don't care about publishing javadocs anywhere, so don't waste time building them +tasks.withType().configureEach { + enabled = false +} + +tasks.named("sourcesJar") { + enabled = false +} + +tasks.named("javadocJar") { + enabled = false +} + +val emptySourceJar = tasks.create("emptySourceJar") { + file("README.md") + archiveClassifier.set("sources") +} + +val emptyJavadocJar = tasks.create("emptyJavadocJar") { + file("README.md") + archiveClassifier.set("javadoc") +} + +publishing { + publications.named("nebula") { + artifactId = project.name + description = project.description + + artifacts.clear() // remove the regular JAR + // Empty JARs are OK: https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources + artifact(tasks.named("jar")) + artifact(emptySourceJar) + artifact(emptyJavadocJar) + + pom { + name.set(project.name) + description.set(project.description) + url.set("https://moderne.io") + licenses { + license { + name.set("Moderne, Inc. Commercial License") + url.set("https://docs.moderne.io/administrator-documentation/references/licensing") + } + } + developers { + developer { + name.set("Team Moderne") + email.set("support@moderne.io") + organization.set("Moderne, Inc.") + organizationUrl.set("https://moderne.io") + } + } + scm { + connection.set("scm:git:git://github.com/moderneinc/rewrite-remote.git") + developerConnection.set("scm:git:ssh://github.com:moderneinc/rewrite-remote.git") + url.set("https://github.com/moderneinc/rewrite-remote/tree/main") + } + } + } +} diff --git a/rewrite-csharp-remote-server/src/main/resources/logback.xml b/rewrite-csharp-remote-server/src/main/resources/logback.xml new file mode 100644 index 0000000..0bdae2b --- /dev/null +++ b/rewrite-csharp-remote-server/src/main/resources/logback.xml @@ -0,0 +1,30 @@ + + + + + + + %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file diff --git a/rewrite-csharp-remote-server/src/test/java/.editorconfig b/rewrite-csharp-remote-server/src/test/java/.editorconfig new file mode 100644 index 0000000..42a5c01 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/java/.editorconfig @@ -0,0 +1,6 @@ +root = true + +# Limit continuation indent to 2 spaces for Java files, as we heavily use continuations around our text blocks. +[*.java] +indent_size = 4 +ij_continuation_indent_size = 2 diff --git a/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/ProjectParsingTest.java b/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/ProjectParsingTest.java new file mode 100644 index 0000000..c89006a --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/ProjectParsingTest.java @@ -0,0 +1,91 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openrewrite.remote.csharp; + +import java.io.IOException; +import java.net.Socket; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.ThreadLocalRandom; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.openrewrite.Cursor; +import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.remote.RemotingProjectParser; +import org.openrewrite.scheduling.WatchableExecutionContext; + +public class ProjectParsingTest { + + @Test + public void testParse() { + WatchableExecutionContext ctx = + new WatchableExecutionContext(new InMemoryExecutionContext()); + + int port = ThreadLocalRandom.current().nextInt(50000, 65535); + try (DotNetRemotingServerEngine server = DotNetRemotingServerEngine.create(DotNetRemotingServerEngine.Config.builder() + .extractedDotnetBinaryDir(Paths.get(System.getProperty("java.io.tmpdir"))) + .port(port) + .logFilePath(Paths.get("./build/test.log").toAbsolutePath().toString()) + .build())) { + + server.start(); + var client = new RemotingProjectParser(server); + + Path pathToSolution = Path.of(Thread.currentThread() + .getContextClassLoader() + .getResource( + "ModerneHelloWorld/ModerneHelloWorld.sln") + .getPath()); + client.findAllProjects(pathToSolution, ctx) + .forEach(proj -> client.parseProjectSources(proj, + pathToSolution, + pathToSolution.getParent(), + ctx) + .forEach(sf -> { + System.out.println(sf.print(new Cursor(new Cursor( + null, + Cursor.ROOT_VALUE), sf))); + })); + } + } + + @Test + public void testThrowExceptionOnIncorrectDotnetPath() { + int port = ThreadLocalRandom.current().nextInt(50000, 65535); + try (DotNetRemotingServerEngine server = DotNetRemotingServerEngine.create(DotNetRemotingServerEngine.Config.builder().dotnetExecutable("dotnet1").extractedDotnetBinaryDir( + Paths.get(System.getProperty("java.io.tmpdir"))).port(port).build())) { + assertThatThrownBy(server::start) + .isInstanceOf(IOException.class); + } + } + + @Test + public void testThrowExceptionOnIncorrectRunnable() { + int port = ThreadLocalRandom.current().nextInt(50000, 65535); + try (DotNetRemotingServerEngine server = DotNetRemotingServerEngine.create(DotNetRemotingServerEngine.Config.builder() + .extractedDotnetBinaryDir(Paths.get(System.getProperty("java.io.tmpdir"))) + .dotnetServerDllName("Rewrite.Server1.dll") + .port(port) + .build())) { + assertThatThrownBy(server::start) + .isInstanceOf(IllegalStateException.class); + } + } +} diff --git a/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/RemotingRecipeRunTest.java b/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/RemotingRecipeRunTest.java new file mode 100644 index 0000000..f6d6a36 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/java/org/openrewrite/remote/csharp/RemotingRecipeRunTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openrewrite.remote.csharp; + +import lombok.extern.java.Log; +import org.junit.jupiter.api.Test; +import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.RecipeRun; +import org.openrewrite.SourceFile; +import org.openrewrite.config.RecipeDescriptor; +import org.openrewrite.internal.InMemoryLargeSourceSet; +import org.openrewrite.java.JavaParser; +import org.openrewrite.remote.*; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Collections; +import java.util.logging.Level; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +@Log +public class RemotingRecipeRunTest { + + @Test +// @Disabled("This test fails randomly because the socket is being closed prematurely without any clear reasons") + public void testRemotingRecipeInstallAndRun() throws IOException { + File nuPkgLocation = new File("./build/nupkgs"); + nuPkgLocation.mkdir(); + int port = TcpUtils.findAvailableTcpPortInternal(); + Path extractedDotnetBinaryDir = Paths.get("./build/dotnet-servet-archive"); + extractedDotnetBinaryDir.toFile().mkdirs(); + DotNetRemotingServerEngine server = DotNetRemotingServerEngine.create( + DotNetRemotingServerEngine.Config.builder() + .extractedDotnetBinaryDir(extractedDotnetBinaryDir) + .logFilePath(Paths.get("./build/test.log").toAbsolutePath().toString()) + .nugetPackagesFolder(nuPkgLocation.toPath().toAbsolutePath().normalize().toString()) + .port(54321) + .build() + ); + try { + server.start(); + + InMemoryExecutionContext ctx = new InMemoryExecutionContext((e) -> log.log(Level.WARNING, e.toString())); + + RemotingExecutionContextView view = RemotingExecutionContextView.view(ctx); + view.setRemotingContext(new RemotingContext(this.getClass().getClassLoader(), false)); + + RemotingRecipeManager manager = new RemotingRecipeManager(server, () -> server); + InstallableRemotingRecipe recipes = manager.install( + "Rewrite.Recipes", + "0.3.3", + Arrays.asList( + new PackageSource(Paths.get("~/.nuget/packages/").toAbsolutePath().toFile().toURI().toURL(), null, null, true) + ), + true, + ctx + ); + + RemotingRecipe remotingRecipe = new RemotingRecipe(new RecipeDescriptor( + recipes.getRecipes().get(0).getDescriptor().getName(), + recipes.getRecipes().get(0).getDescriptor().getDisplayName(), + recipes.getRecipes().get(0).getDescriptor().getDescription(), + recipes.getRecipes().get(0).getDescriptor().getTags(), + recipes.getRecipes().get(0).getDescriptor().getEstimatedEffortPerOccurrence(), + Collections.emptyList(), + Collections.emptyList(), + Collections.emptyList(), + Collections.emptyList(), + Collections.emptyList(), + Collections.emptyList(), + recipes.getRecipes().get(0).getDescriptor().getSource() // recipe://testlibnamepackageid/1.0.1 + ), () -> server, DotNetRemotingServerEngine.class); + + SourceFile tree = JavaParser.fromJavaVersion().build().parse("class Foo {}") + .findFirst() + .orElseThrow(); + + RecipeRun run = remotingRecipe.run(new InMemoryLargeSourceSet(Collections.singletonList(tree)), ctx); + assertThat(run.getChangeset().getAllResults()).hasSize(1); + run.getChangeset().getAllResults().forEach(r -> System.out.println(r.diff())); + } catch (Exception e) { + server.close(); + fail(e); + } + + server.close(); + } +} diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/ConsoleApp1.csproj b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/Program.cs b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/Program.cs new file mode 100644 index 0000000..1e84012 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ConsoleApp1/Program.cs @@ -0,0 +1,22 @@ +/** + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +public static class Program +{ + public static void Main(string[] args) + { + Console.WriteLine("Hello, World2!"); + } +} \ No newline at end of file diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld.sln b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld.sln new file mode 100644 index 0000000..77b7fd3 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModerneHelloWorld", "ModerneHelloWorld\ModerneHelloWorld.csproj", "{F863BE90-C9B9-4269-8110-B1892375B18B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{73E1FF0F-5CB2-4A66-A4D4-1C822E9B7D0D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F863BE90-C9B9-4269-8110-B1892375B18B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F863BE90-C9B9-4269-8110-B1892375B18B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F863BE90-C9B9-4269-8110-B1892375B18B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F863BE90-C9B9-4269-8110-B1892375B18B}.Release|Any CPU.Build.0 = Release|Any CPU + {73E1FF0F-5CB2-4A66-A4D4-1C822E9B7D0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73E1FF0F-5CB2-4A66-A4D4-1C822E9B7D0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73E1FF0F-5CB2-4A66-A4D4-1C822E9B7D0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73E1FF0F-5CB2-4A66-A4D4-1C822E9B7D0D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/ModerneHelloWorld.csproj b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/ModerneHelloWorld.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/ModerneHelloWorld.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/Program.cs b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/Program.cs new file mode 100644 index 0000000..62fb126 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/ModerneHelloWorld/Program.cs @@ -0,0 +1,25 @@ +/** + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace ModerneHelloWorld; + +public static class Program +{ + public static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } +} \ No newline at end of file diff --git a/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/global.json b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/global.json new file mode 100644 index 0000000..7b6bb11 --- /dev/null +++ b/rewrite-csharp-remote-server/src/test/resources/ModerneHelloWorld/global.json @@ -0,0 +1,22 @@ +/** + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index c04bf3b..27e8e25 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,6 +9,7 @@ rootProject.name = "rewrite-csharp" val allProjects = listOf( "rewrite-csharp", "rewrite-csharp-remote", + "rewrite-csharp-remote-server", "rewrite-test-engine-remote", ) @@ -24,4 +25,4 @@ val includedProjects = file("IDE.properties").let { } }.toSet() -include(*allProjects.toTypedArray()) \ No newline at end of file +include(*allProjects.toTypedArray())