Skip to content

Commit

Permalink
revert few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
psoujany committed Oct 3, 2024
1 parent 18cbb1b commit f72613c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/org/testKitGen/MkGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ public MkGen(Arguments arg, TestTarget tt, PlaylistInfo pli, String makeFile, Li
this.pli = pli;
}

public void start() throws IOException {
public void start() {
writeVars();
if (pli.containsTest()) {
writeTargets();
}
System.out.println("Generated " + makeFile + "\n");
}

private void writeVars() throws IOException {
if (arg.getSpec().toLowerCase().contains("zos") && (arg.getJdkVersion().equals("21"))) {
writer = new OutputStreamWriter(new FileOutputStream(makeFile), Charset.forName("IBM-1047"));
} else {
writer = new FileWriter(makeFile);
}
try (Writer f = writer) {
private void writeVars() {
try (Writer f = getWriterObject(makeFile)) {
String realtiveRoot = "";
int subdirlevel = dirList.size();
if (subdirlevel == 0) {
Expand Down Expand Up @@ -236,13 +231,8 @@ private void writeSingleTest(List<String> testsInPlaylist, TestInfo testInfo, Wr
}
}

private void writeTargets() throws IOException {
if (arg.getSpec().toLowerCase().contains("zos") && arg.getJdkVersion().equals("21")) {
writer = new OutputStreamWriter(new FileOutputStream(makeFile, true), Charset.forName("IBM-1047"));
} else {
writer = new FileWriter(makeFile, true);
}
try (Writer f = writer) {
private void writeTargets() {
try (Writer f = getWriterObject(makeFile)) {
if (!pli.getIncludeList().isEmpty()) {
for (String include : pli.getIncludeList()) {
f.write("-include " + include + "\n\n");
Expand All @@ -266,4 +256,18 @@ private void writeTargets() throws IOException {
System.exit(1);
}
}

private Writer getWriterObject(String filetype) {
try {
if (arg.getSpec().toLowerCase().contains("zos") && (arg.getJdkVersion().equals("21"))) {
writer = new OutputStreamWriter(new FileOutputStream(filetype, true), Charset.forName("IBM-1047"));
} else {
writer = new FileWriter(filetype, true);
}
} catch(IOException e) {
e.printStackTrace();
System.exit(1);
}
return writer;
}
}
1 change: 1 addition & 0 deletions src/org/testKitGen/TestGenVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.testKitGen;

import java.io.File;
import java.io.IOException;
import java.util.List;

public class TestGenVisitor implements DirectoryVisitor {
Expand Down

0 comments on commit f72613c

Please sign in to comment.