-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BuildTarget: Expose build targets' source paths
- Loading branch information
Showing
7 changed files
with
127 additions
and
10 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
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 |
---|---|---|
|
@@ -32,6 +32,7 @@ object TestProcessHelper { | |
cwd, | ||
cmd, | ||
None, | ||
List(), | ||
None, | ||
Log.urgent, | ||
out => sb.append(out + "\n") | ||
|
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,22 @@ | ||
[project] | ||
scalaVersion = "2.13.0" | ||
|
||
[module.utils.jvm] | ||
sources = ["utils"] | ||
|
||
[module.utils.target.gen-sources] | ||
class = ["utils:jvm", "GenerateSources"] | ||
await = true | ||
|
||
# `template1` and `template2` share the code generator (`utils`) | ||
[module.template1.jvm] | ||
moduleDeps = ["utils"] | ||
sources = ["template1"] | ||
|
||
[module.template2.jvm] | ||
moduleDeps = ["utils"] | ||
sources = ["template2"] | ||
|
||
[module.demo.jvm] | ||
moduleDeps = ["template1", "template2"] | ||
sources = ["demo"] |
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,3 @@ | ||
object Main { | ||
def main(args: Array[String]): Unit = Generated.modulePaths.foreach(println) | ||
} |
16 changes: 16 additions & 0 deletions
16
test/custom-class-target-shared/utils/GenerateSources.scala
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,16 @@ | ||
import java.io.File | ||
import java.nio.file.{Files, Paths, StandardOpenOption} | ||
|
||
object GenerateSources { | ||
def main(args: Array[String]): Unit = { | ||
val modulePath = sys.env("MODULE_PATH") | ||
val moduleSourcePaths = | ||
sys.env("MODULE_SOURCE_PATHS").split(File.pathSeparatorChar) | ||
val generatedPath = | ||
Paths.get(modulePath).resolve("demo").resolve("Generated.scala") | ||
val pathsScala = moduleSourcePaths.mkString("\"", "\", \"", "\"") | ||
val output = s"object Generated { val modulePaths = List($pathsScala) }" | ||
|
||
Files.write(generatedPath, output.getBytes) | ||
} | ||
} |