|
22 | 22 |
|
23 | 23 | import java.io.IOException;
|
24 | 24 | import java.nio.file.FileVisitResult;
|
| 25 | +import java.nio.file.Files; |
25 | 26 | import java.nio.file.Path;
|
26 | 27 | import java.nio.file.Paths;
|
27 | 28 | import java.util.Arrays;
|
@@ -54,6 +55,7 @@ public final class Main {
|
54 | 55 | + " Commands:\n"
|
55 | 56 | + " checkstyle --exercisePath --outputPath --locale"
|
56 | 57 | + " Run checkstyle or similar plugin to project if applicable.\n"
|
| 58 | + + " compress-project --exercisePath --outputPath\n" |
57 | 59 | + " help"
|
58 | 60 | + " Display help information.\n"
|
59 | 61 | + " prepare-solutions --exercisePath --outputPath"
|
@@ -118,6 +120,9 @@ private static void run(String command) {
|
118 | 120 | case "checkstyle":
|
119 | 121 | runCheckCodeStyle();
|
120 | 122 | break;
|
| 123 | + case "compress-project": |
| 124 | + runCompressProject(); |
| 125 | + break; |
121 | 126 | case "scan-exercise":
|
122 | 127 | runScanExercise();
|
123 | 128 | break;
|
@@ -166,6 +171,17 @@ private static Path getOutputPathFromArgs() {
|
166 | 171 | throw new IllegalStateException("No " + OUTPUT_PATH + " provided");
|
167 | 172 | }
|
168 | 173 |
|
| 174 | + private static void runCompressProject() { |
| 175 | + Path exercisePath = getExercisePathFromArgs(); |
| 176 | + Path outputPath = getOutputPathFromArgs(); |
| 177 | + try { |
| 178 | + byte[] compressed = executor.compressProject(exercisePath); |
| 179 | + Files.write(outputPath, compressed); |
| 180 | + } catch (IOException | NoLanguagePluginFoundException e) { |
| 181 | + e.printStackTrace(); |
| 182 | + } |
| 183 | + } |
| 184 | + |
169 | 185 | private static void runCheckCodeStyle() {
|
170 | 186 | ValidationResult validationResult = null;
|
171 | 187 | try {
|
|
0 commit comments