Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Add Windows build #176

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- name: Disable Git's autocrlf
run: git config --global core.autocrlf false
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
fetch-depth: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public SporkPrettyPrinter(Environment env) {
// instead of just String, it will print java.lang.String. Which isn't great.
setIgnoreImplicit(false);

// TODO detect these values instead of setting unconditionally
printerHelper.setLineSeparator("\n");

globalContentConflicts = DEFAULT_CONFLICT_MAP;
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/se/kth/spork/spoon/Parser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import spoon.reflect.declaration.CtType
import spoon.support.compiler.FileSystemFile
import spoon.support.compiler.VirtualFile
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Path

Expand Down Expand Up @@ -60,6 +61,7 @@ object Parser {
env.useTabulations(useTabs)
env.setPrettyPrinterCreator { SporkPrettyPrinter(env) }
env.noClasspath = true
env.encoding = StandardCharsets.UTF_8 // TODO detect instead of setting unconditionally
}

private fun parse(configureLauncher: (Launcher) -> Unit): CtModule {
Expand Down Expand Up @@ -115,7 +117,7 @@ object Parser {
*/
fun read(path: Path): String {
return try {
java.lang.String.join("\n", Files.readAllLines(path))
java.lang.String.join("\n", Files.readAllLines(path, StandardCharsets.UTF_8))
} catch (e: IOException) {
e.printStackTrace()
throw RuntimeException("Error reading from $path")
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/se/kth/spork/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import gumtree.spoon.builder.SpoonGumTreeBuilder;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -50,7 +51,7 @@ private static Stream<? extends Arguments> getArgumentSourcesStream(
}

public static String read(Path path) throws IOException {
return String.join("\n", Files.readAllLines(path));
return String.join("\n", Files.readAllLines(path, StandardCharsets.UTF_8));
}

public static ITree toGumTree(String clazz) {
Expand Down