Hi all, I'm trying to setup new scala project. I a...
# general
m
Hi all, I'm trying to setup new scala project. I added
pants.toml
with scala backend to empty directory. When I run
pants tailor ::
nothing happens. I use Macbook M1. Tell me what I'm missing here.
Copy code
[GLOBAL]
pants_version = "2.15.1"
backend_packages = [
  "pants.backend.experimental.scala",
  "pants.backend.experimental.scala.lint.scalafmt",
]

[source]
# Pants supports many layouts of sources: from Maven/SBT style project-centric layouts, to
# monorepo layouts. In this case, we have a monorepo layout, with all sources under a `src`
# directory, organized by type.
#
# See <https://www.pantsbuild.org/docs/source-roots> for more information.
root_patterns = [
  "/src/*",
  "/tests/*",
]

# Configure the specific Scala version to use for a resolve. This version must match the version used for the
# `jvm_artifact` target providing the scala-library runtime jar.
[scala.version_for_resolve]
jvm-default = "2.13.8"

[scalac]
args = [
  "-deprecation",
  "-encoding UTF-8",
  # An option for the compiler plugin enabled below.
  "-P:acyclic:force",
]

[scalac.plugins_for_resolve]
# Resolve-global `scalac` plugins, which are defined as `scalac_plugin` targets.
jvm-default = "acyclic"

[scala-infer]
# Opt in to future change to Scala dependency inference which will become to the default in Pants v2.14+:
#   We have made several improvements to Pants's Scala dependency inference, where we no longer think
#   it's necessary to adding dependencies on sibling targets. If you have compilation failures after
#   disabling this option, please consider opening an issue at
#   <https://github.com/pantsbuild/pants/issues/new> so that we can continue to improve Pants's
#   dependency inference.
force_add_siblings_as_dependencies = false

[jvm]
# Configure remote debugging options that will be used with `test --debug`.
debug_args = [
  "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005",
]
[anonymous-telemetry]
enabled=false
f
So there is no Scala code yet in the repository?
tailor
detects existing code and then writes BUILD files for that code. If there is no code, there is nothing for
tailor
to do.
m
oh I see. my bad I thought i would be able to create structure too. I completely new to pants 🙂
f
You could just start writing your first file with code and run
tailor
then to create the
BUILD
file.
(and as you add new directories with code, continue to use
tailor
to update the
BUILD
files)
m
I could do that but it would be a little bit counter intuitive. Most of my workflow uses Intellij so I would need to create scala file in Intellij then run
pants tailor ::
to get
BUILD
file which is just one line
scala_sources()
. It will be easier to just create
BUILD
file in Intellij in the first place and refresh BSP and start adding scala files.
f
You are correct;
tailor
does not add much value in this case.
It is designed to react to existing sources, but not for adding new sources itself.
m
it would be cool to have command that generates skeleton for structures like microservice or library/utility.