Search code examples
scalasbtchisel

How to publish Chisel package?


I made some chisel projects published on my github repositories. All projects are initialized with chisel-template official example.

For the moment to use these as packages I have to «publish it local». But I want to publish it «officially» on the web to avoid cloning the github project.

Is there a tutorial that explain how to publish chisel-template projects as official package ?


Solution

  • I found a solution with github publish system following Manuel Rodriguez tutorial.

    In short :

    • Make a github token on your github account
    • set shell environment GITHUB_TOKEN with the token :
    export GITHUB_TOKEN=gxb_xxxTENRSTyourToken
    
    • Add following lines in your build.sbt:
    //...
    githubOwner := "GITHUB_USERNAME"
    githubRepository := "GITHUB_PROJECT"
    //...
    
    • Add following line in your project/plugin.sbt file (create directory and file if not exists):
    addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
    
    • Launch sbt then publish :
    $ sbt
    sbt:project> publish
    

    Your project is published. I done it for chisel project fpgamacro as an example.

    To use fpgamacro on another project I added this lines to build.sbt project :

    ...
        externalResolvers += "fpgamacro packages" at "https://maven.pkg.github.com/Martoni/fpgamacro",
    ...
          "Martoni" %% "fpgamacro" % "0.2.0",
    

    I'm using fpgamacro in chisNesPad project for example.