Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use custom maven repo in Scala CLI #196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/build-project/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ runs:
uses: addnab/docker-run-action@v3
if: steps.check-history.outputs.can-skip-build != 'true'
with:
image: "virtuslab/scala-community-build-project-builder:jdk${{ env.java-version }}-v0.2.5"
image: "virtuslab/scala-community-build-project-builder:jdk${{ env.java-version }}-v0.2.6"
options: -v ${{ github.workspace }}:/opencb/ -v ${{ github.workspace }}/github_rsa:/root/.ssh/id_rsa:ro
run: |
DefaultConfig='{"memoryRequestMb":4096}'
Expand Down Expand Up @@ -168,7 +168,7 @@ runs:
uses: addnab/docker-run-action@v3
if: steps.check-history.outputs.can-skip-build != 'true'
with:
image: "virtuslab/scala-community-build-project-builder:jdk${{ env.java-version }}-v0.2.5"
image: "virtuslab/scala-community-build-project-builder:jdk${{ env.java-version }}-latest"
options: -v ${{ github.workspace }}:/opencb/ -e ELASTIC_USERNAME=${{ inputs.elastic-user }} -e ELASTIC_PASSWORD=${{ inputs.elastic-password }}
run: |
ConfigFile="/opencb/.github/workflows/buildConfig.json"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ runs:
uses: addnab/docker-run-action@v3
if: steps.check-published.outputs.is-compiler-published == 'false'
with:
image: "virtuslab/scala-community-build-compiler-builder:v0.2.5"
image: "virtuslab/scala-community-build-compiler-builder:v0.2.6"
options: -v ${{ github.workspace }}/compiler:/compiler/
run: |
Version="${{ steps.calc-version.outputs.effective-scala-version }}"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ eval $(minikube -p minikube docker-env)
Most likely you'll need to build the base image only once (it doesn't get modified too often but building it takes quite a lot of time), e.g.:

```shell
scripts/build-builder-base.sh v0.2.5
scripts/build-builder-base.sh version
```

Build all the remaining images

```shell
scripts/build-quick.sh v0.2.5
scripts/build-quick.sh version
```

or (re)build each image separately e.g.

```shell
scripts/build-mvn-repo.sh v0.2.5
scripts/build-mvn-repo.sh version
```

### Deploying and debugging in k8s
Expand Down
2 changes: 1 addition & 1 deletion cli/scb-cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FailedProjectException(msg: String)
with NoStackTrace

val communityBuildVersion =
sys.props.getOrElse("communitybuild.version", "v0.2.5")
sys.props.getOrElse("communitybuild.version", "v0.2.6")
private val CBRepoName = "VirtusLab/community-build3"
val projectBuilderUrl =
s"https://raw.githubusercontent.com/$CBRepoName/master/project-builder"
Expand Down
2 changes: 1 addition & 1 deletion project-builder/build-revision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ else
ls -l repo/
scala-cli clean $scriptDir/scala-cli/
scala-cli clean repo
scala-cli $scriptDir/scala-cli/build.scala -- repo "$scalaVersion" "$projectConfig"
scala-cli $scriptDir/scala-cli/build.scala -- repo "$scalaVersion" "$projectConfig" "$mvnRepoUrl"
fi
17 changes: 12 additions & 5 deletions project-builder/scala-cli/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ import os.CommandResult
@main def buildScalaCliProject(
repositoryDir: String,
scalaVersion: String,
configJson: String
configJson: String,
mavenRepoURL: String
): Unit = {
println(s"Build config: ${configJson}")
val config =
if (configJson.isEmpty()) ProjectBuildConfig()
else read[ProjectBuildConfig](configJson)
println(s"Parsed config: ${config}")

val evaluator = CliTaskEvaluator(scalaVersion, repositoryDir)
val evaluator = CliTaskEvaluator(
scalaVersion = scalaVersion,
repositoryDir = repositoryDir,
mavenRepoURL = Option(mavenRepoURL).filterNot(_.isEmpty)
)
import evaluator.{eval, evalAsDependencyOf, evalWhen}

val compileResult = eval[Unit](cmd("compile"))
Expand Down Expand Up @@ -99,7 +104,7 @@ case class CliCommand[T](
errHandler: (CommandResult, EvalResult.Failure) => EvalResult[T]
)
def cmd(args: String*) = CliCommand[Unit](args, (_, failure) => failure)
class CliTaskEvaluator(scalaVersion: String, repositoryDir: String)
class CliTaskEvaluator(scalaVersion: String, repositoryDir: String, mavenRepoURL: Option[String])
extends TaskEvaluator[CliCommand] {
import TaskEvaluator.*

Expand All @@ -124,9 +129,11 @@ class CliTaskEvaluator(scalaVersion: String, repositoryDir: String)
repositoryDir,
s"--server=false",
s"--scala-version=${scalaVersion}",
"--scalac-option=-J-Xss8M",
"--scalac-option=-J-Xss10M",
"--scalac-option=-J-Xmx=7G",
"--scalac-option=-J-Xms=4G"
"--scalac-option=-J-Xms=4G",
mavenRepoURL.map(s"--repository=" + _).getOrElse(""),
"-v"
)
.call(check = false, stderr = os.Pipe)
val result = proc.exitCode
Expand Down
2 changes: 1 addition & 1 deletion scripts/bisect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.nio.file.attribute.PosixFilePermissions
import java.nio.charset.StandardCharsets
import java.nio.file._

val communityBuildVersion = "v0.2.5"
val communityBuildVersion = "v0.2.6"

@main def run(args: String*): Unit =
val config = scopt.OParser
Expand Down