Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
bf5ca040
Commit
bf5ca040
authored
Sep 30, 2016
by
Jens Korinth
Browse files
Add support for post-build actions
parent
2ae7b74d
Changes
2
Hide whitespace changes
Inline
Side-by-side
packaging/CoreDefinition.scala
View file @
bf5ca040
...
...
@@ -2,11 +2,13 @@ package chisel.packaging
import
scala.io.Source
import
play.api.libs.json._
import
play.api.libs.functional.syntax._
import
Chisel.Module
/**
* Basic definition of a core for IP-XACT packaging.
**/
case
class
CoreDefinition
(
name
:
String
,
vendor
:
String
,
library
:
String
,
version
:
String
,
root
:
String
)
{
class
CoreDefinition
(
val
name
:
String
,
val
vendor
:
String
,
val
library
:
String
,
val
version
:
String
,
val
root
:
String
,
val
postBuildActions
:
Seq
[
Module
=>
Unit
]
=
Seq
())
{
import
CoreDefinition._
def
write
(
filename
:
String
)
:
Boolean
=
try
{
val
fw
=
new
java
.
io
.
FileWriter
(
filename
)
...
...
@@ -21,6 +23,16 @@ case class CoreDefinition(name: String, vendor: String, library: String, version
* Contains methods for reading a core definition from Json.
**/
object
CoreDefinition
{
def
apply
(
name
:
String
,
vendor
:
String
,
library
:
String
,
version
:
String
,
root
:
String
)
:
CoreDefinition
=
new
CoreDefinition
(
name
,
vendor
,
library
,
version
,
root
)
def
withActions
(
name
:
String
,
vendor
:
String
,
library
:
String
,
version
:
String
,
root
:
String
,
postBuildActions
:
Seq
[
Module
=>
Unit
])
:
CoreDefinition
=
new
CoreDefinition
(
name
,
vendor
,
library
,
version
,
root
,
postBuildActions
)
def
unapply
(
cd
:
CoreDefinition
)
:
Option
[
Tuple5
[
String
,
String
,
String
,
String
,
String
]]
=
Some
((
cd
.
name
,
cd
.
vendor
,
cd
.
library
,
cd
.
version
,
cd
.
root
))
/** Provide automatic IP directory for given name. **/
def
root
(
name
:
String
)
:
String
=
java
.
nio
.
file
.
Paths
.
get
(
"."
).
toAbsolutePath
.
resolveSibling
(
"ip"
).
resolve
(
name
).
toString
...
...
packaging/ModuleBuilder.scala
View file @
bf5ca040
...
...
@@ -20,6 +20,7 @@ abstract class ModuleBuilder(packagingDir: String = "packaging") {
assert
(
fm
.
length
>
0
,
"no matching cores found for: "
+
args
.
mkString
(
", "
))
fm
foreach
{
m
=>
chiselMain
(
chiselArgs
++
Array
(
"--targetDir"
,
m
.
_2
.
root
),
m
.
_1
)
m
.
_2
.
postBuildActions
map
(
fn
=>
fn
.
apply
(
m
.
_1
()))
val
json
=
"%s/%s.json"
.
format
(
m
.
_2
.
root
,
m
.
_2
.
name
)
m
.
_2
.
write
(
json
)
"%s/package.py %s"
.
format
(
packagingDir
,
json
)
!
...
...
Jens Korinth
@jk
mentioned in commit
17f0d672
·
Mar 05, 2018
mentioned in commit
17f0d672
mentioned in commit 17f0d67240ebf5d7e1d0be9162d272b04256c47d
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment