Skip to content
Open
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
44 changes: 28 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.indoorvivants.detective.Platform

resolvers += Resolver.mavenLocal


scalaVersion := "3.8.4"
scalafmtOnCompile := true
organization := "io.cloud4s.cli"
Expand Down Expand Up @@ -40,8 +39,8 @@ lazy val root = project
name := "cloud4s",

libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.6.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.7.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.7.0",
"org.typelevel" %%% "cats-effect" % "3.7.0",
"com.monovore" %%% "decline" % "2.6.2",
"com.monovore" %%% "decline-effect" % "2.6.2",
Expand All @@ -50,10 +49,10 @@ lazy val root = project
"org.scalameta" %%% "munit" % "1.3.5" % Test
),


// 2. Modos e caminhos de saída do Bindgen
bindgenMode := BindgenMode.Manual(
scalaDir = (Compile / sourceDirectory).value / "scala" / "io" / "cloud4s" / "cli" / "bindings",
scalaDir =
(Compile / sourceDirectory).value / "scala" / "io" / "cloud4s" / "cli" / "bindings",
cDir = (Compile / resourceDirectory).value / "scala-native" / "ssh"
),

Expand All @@ -75,7 +74,13 @@ lazy val root = project
// Validação de plataforma para Apple Silicon (macOS arm64)
conf
.withLinkingOptions(
conf.linkingOptions ++ Seq("-lcurl", "-lssh", "-lssl", "-lcrypto", "-lstdc++")
conf.linkingOptions ++ Seq(
"-lcurl",
"-lssh",
"-lssl",
"-lcrypto",
"-lstdc++"
)
)
.withLTO(LTO.none)
.withMode(Mode.debug)
Expand All @@ -92,17 +97,24 @@ commands += Command.command("release") { state =>
println("Iniciando build de produção (Release)...")

// 1. Modifica a configuração para produção temporariamente
val stateWithConfig = Project.extract(state).appendWithoutSession(Seq(
Compile / nativeConfig ~= { _
.withMode(scala.scalanative.build.Mode.releaseFast)
.withLTO(scala.scalanative.build.LTO.thin)
.withGC(scala.scalanative.build.GC.commix)
.withOptimize(true)
}
), state)
val stateWithConfig = Project
.extract(state)
.appendWithoutSession(
Seq(
Compile / nativeConfig ~= {
_.withMode(scala.scalanative.build.Mode.releaseFast)
.withLTO(scala.scalanative.build.LTO.thin)
.withGC(scala.scalanative.build.GC.commix)
.withOptimize(true)
}
),
state
)

// 2. Executa o build e pega o caminho do binário gerado
val (nextState, artifactFile) = Project.extract(stateWithConfig).runTask(Compile / nativeLink, stateWithConfig)
val (nextState, artifactFile) = Project
.extract(stateWithConfig)
.runTask(Compile / nativeLink, stateWithConfig)

// 3. Define a pasta de destino (dist/) e o nome do arquivo final
val destFile = baseDirectory.value / "dist" / artifactFile.getName
Expand All @@ -112,4 +124,4 @@ commands += Command.command("release") { state =>

println("Build de produção concluído com sucesso!")
nextState
}
}