forked from cgruber/rules_kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor the testbench mocks so they are more composeable (bazelbuild…
…#148) * refactor the testbench mocks so they are more composeable. * Add sources and output jar normalization tests
- Loading branch information
Showing
13 changed files
with
279 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/kotlin/io/bazel/kotlin/builder/DirectoryType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.bazel.kotlin.builder; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.EnumSet; | ||
|
||
public enum DirectoryType { | ||
SOURCES("sources", Paths.get("sources")), | ||
CLASSES("compiled classes", Paths.get("classes")), | ||
GENERATED_CLASSES("generated classes", Paths.get("generated_classes")), | ||
TEMP("temp directory", Paths.get("temp")), | ||
SOURCE_GEN("generated sources directory", Paths.get("generated_sources")); | ||
|
||
final String name; | ||
final Path relativePath; | ||
|
||
DirectoryType(String name, Path relativePath) { | ||
this.name = name; | ||
this.relativePath = relativePath; | ||
} | ||
|
||
Path resolve(Path root) { | ||
return root.resolve(relativePath); | ||
} | ||
|
||
static void createAll(Path root, EnumSet<DirectoryType> types) { | ||
for (DirectoryType instanceType : types) { | ||
try { | ||
Files.createDirectory(instanceType.resolve(root)); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(instanceType.name, e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.