Skip to content

Commit

Permalink
Fix BuildInfo static Java file generator
Browse files Browse the repository at this point in the history
Fix #3073
  • Loading branch information
lefou committed Mar 10, 2024
1 parent 8b46150 commit 98a61ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ object BuildInfo {
|public class $buildInfoObjectName {
| $bindingsCode
|
| public static java.util.Map<String, String> toMap() {
| Map<String, String> map = new HashMap<String, String>();
| public static java.util.Map<java.lang.String, java.lang.String> toMap() {
| java.util.Map<java.lang.String, java.lang.String> map = new java.util.HashMap<java.lang.String, java.lang.String>();
| $mapEntries
| return map;
| }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ object BuildInfoTests extends TestSuite {
)
}

"java-static" - workspaceTest(BuildInfoJavaStatic, "java") { eval =>
val runResult = eval.outPath / "hello-mill"
val generatedSrc = eval.outPath / "buildInfoSources.dest" / "foo" / "BuildInfo.java"
val Right((result, evalCount)) =
eval.apply(BuildInfoJavaStatic.run(T.task(Args(runResult.toString))))

assert(
os.exists(runResult),
os.exists(generatedSrc),
os.read(runResult) == "not-provided-for-java-modules"
)
}

"generatedSources must be a folder" - workspaceTest(BuildInfoPlain, "scala") { eval =>
val buildInfoGeneratedSourcesFolder = eval.outPath / "buildInfoSources.dest"
val Right((result, evalCount)) = eval.apply(BuildInfoPlain.generatedSources)
Expand Down

0 comments on commit 98a61ee

Please sign in to comment.