This repository has been archived by the owner on Jun 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.wake
82 lines (65 loc) · 3.13 KB
/
build.wake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from wake import _
from api_firrtl_sifive import scalaModuleGenBuildInfo
def buildDir = mkdir "build/chisel3"
def scalacOpts = "-deprecation", "-feature", Nil
def chisel3Root = findGitRepositoryWithFallback "chisel3"
def readIvyDep regex =
require Pass ivyDepsJSON = readIvyDepsJSON here
require Some depString = ivyDepsJSON // regex // `dependencies` | getJString
else Fail (makeError "{regex.regExpToString} ivy dependency not found in {here}/ivydependencies.json!")
require Some dep = stringToIvyDep depString
else Fail (makeError "Invalid {regex.regExpToString} dependency string: '{depString}'")
Pass dep
# We ignore scalaVersion because it comes from ScalaModule
# The scalaVersion in ivydependencies.json is purely for fetching
def macrosParadiseIvyDep = readIvyDep `macrosParadise`
# Adds an a compiler plugin dependency on macros paradise
# If module is already broken, keeps old error
global def addMacrosParadiseCompilerPlugin module =
match macrosParadiseIvyDep
Pass dep = module | editScalaModuleCompilerPlugins (dep, _)
Fail err = module | editScalaModuleError (orElse (Some err))
# TODO This should be default behavior in api-scala-sifive
def scalaModuleAddScalaVersionSourceDirs module =
def major = module.getScalaModuleScalaVersion.scalaVersionMajorString
def dir = "src/main/scala-{major}"
module
| editScalaModuleSourceDirs (dir, _)
# NOTE, currently unused, see addChisel3CompilerPlugin
global def chisel3Plugin =
makeScalaModuleFromJSON here "chisel3Plugin"
| setScalaModuleRootDir "{chisel3Root}/plugin"
| scalaModuleAddScalaVersionSourceDirs
# We ignore scalaVersion because it comes from ScalaModule
# The scalaVersion in ivydependencies.json is purely for fetching
def chisel3PluginIvyDep = readIvyDep `chisel3PluginIvyDep`
# NOTE, this uses the published plugin because passing a path in the scalac options is sketchy -
# we shouldn't use absolute paths but we don't know what to make the path relative to
# The rocket-chip SBT flow does the same thing (for different reasons)
global def addChisel3CompilerPlugin module =
match chisel3PluginIvyDep
Pass dep = module | editScalaModuleCompilerPlugins (dep, _)
Fail err = module | editScalaModuleError (orElse (Some err))
global def chisel3CoreMacros =
makeScalaModuleFromJSON here "chisel3Macros"
| setScalaModuleRootDir "{chisel3Root}/macros"
| setScalaModuleScalacOptions scalacOpts
| addMacrosParadiseCompilerPlugin
global def chisel3Version = "3.4.0-RC3"
global def chisel3Frontend =
def base =
makeScalaModuleFromJSON here "chisel3Core"
| setScalaModuleRootDir "{chisel3Root}/core"
| setScalaModuleDeps (chisel3CoreMacros, firrtlScalaModule, Nil)
| setScalaModuleScalacOptions scalacOpts
| addMacrosParadiseCompilerPlugin
def genSrcs Unit = scalaModuleGenBuildInfo base "chisel3" chisel3Version buildDir, Nil
base
| setScalaModuleFnGeneratedSources genSrcs
global def chisel3ScalaModule =
makeScalaModuleFromJSON here "chisel3"
| setScalaModuleRootDir chisel3Root
| setScalaModuleDeps (chisel3Frontend, Nil)
| setScalaModuleScalacOptions scalacOpts
| addMacrosParadiseCompilerPlugin
| addChisel3CompilerPlugin