-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] bump to mill 0.12.5 and refactor build scripts
Signed-off-by: unlsycn <unlsycn@unlsycn.com>
- Loading branch information
Showing
12 changed files
with
160 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2024 Jiuyang Liu <liu@jiuyang.me> | ||
package build | ||
|
||
import mill._ | ||
import mill.scalalib._ | ||
import mill.define.{Command, TaskModule} | ||
import mill.scalalib.publish._ | ||
import mill.scalalib.scalafmt._ | ||
import mill.scalalib.TestModule.Utest | ||
import mill.util.Jvm | ||
import coursier.maven.MavenRepository | ||
|
||
object deps { | ||
val scalaVer = "2.13.15" | ||
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0" | ||
val oslib = ivy"com.lihaoyi::os-lib:0.9.1" | ||
val upickle = ivy"com.lihaoyi::upickle:3.3.1" | ||
val chisel = ivy"org.chipsalliance::chisel::0.0.0+0-no-vcs-SNAPSHOT" | ||
val chiselPlugin = ivy"org.chipsalliance:chisel-plugin_${scalaVer}:0.0.0+0-no-vcs-SNAPSHOT" | ||
} | ||
|
||
object gcd extends GCD | ||
trait GCD extends common.HasChisel with ScalafmtModule { | ||
def scalaVersion = Task(deps.scalaVer) | ||
|
||
def chiselModule = None | ||
def chiselPluginJar = Task(None) | ||
def chiselPluginIvy = Some(deps.chiselPlugin) | ||
def chiselIvy = Some(deps.chisel) | ||
} | ||
|
||
object elaborator extends Elaborator | ||
trait Elaborator extends common.ElaboratorModule with ScalafmtModule { | ||
def scalaVersion = Task(deps.scalaVer) | ||
|
||
def circtInstallPath = | ||
Task.Input(PathRef(os.Path(T.ctx().env("CIRCT_INSTALL_PATH")))) | ||
|
||
def generators = Seq(gcd) | ||
|
||
def mainargsIvy = deps.mainargs | ||
|
||
def chiselModule = None | ||
def chiselPluginJar = Task(None) | ||
def chiselPluginIvy = Some(deps.chiselPlugin) | ||
def chiselIvy = Some(deps.chisel) | ||
} |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ pkgs | ||
, stdenv | ||
, mill | ||
, ... | ||
}: | ||
{ name | ||
, version | ||
, outputHash | ||
, publishPhase | ||
, ... | ||
}@args: | ||
let | ||
dependencies = pkgs.callPackage ./_sources/generated.nix { }; | ||
in | ||
stdenv.mkDerivation { | ||
pname = name; | ||
src = dependencies.${name}.src; | ||
|
||
inherit version outputHash; | ||
|
||
outputHashAlgo = "sha256"; | ||
outputHashMode = "recursive"; | ||
|
||
nativeBuildInputs = [ mill ] ++ (args.nativeBuildInputs or [ ]); | ||
|
||
impureEnvVars = [ "JAVA_OPTS" ]; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
echo "-Duser.home=$TMPDIR -Divy.home=$TMPDIR/ivy $JAVA_OPTS" | tr ' ' '\n' > mill-java-opts | ||
export MILL_JVM_OPTS_PATH=$PWD/mill-java-opts | ||
# Use "https://repo1.maven.org/maven2/" only to keep dependencies integrity | ||
export COURSIER_REPOSITORIES="ivy2Local|central" | ||
${publishPhase} | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/.ivy2 | ||
mv $TMPDIR/ivy/local $out/.ivy2/local | ||
runHook postInstall | ||
''; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[chisel] | ||
src.git = "https://github.com/chipsalliance/chisel" | ||
src.branch = "main" | ||
fetch.github = "chipsalliance/chisel" | ||
src.git = "https://github.com/unlsycn/chisel" | ||
src.branch = "mill-bump" | ||
fetch.github = "unlsycn/chisel" |
Oops, something went wrong.