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

Use a standard configuration format that other tools can reuse #58

Closed
jvican opened this issue Nov 23, 2017 · 4 comments
Closed

Use a standard configuration format that other tools can reuse #58

jvican opened this issue Nov 23, 2017 · 4 comments
Assignees

Comments

@jvican
Copy link
Contributor

jvican commented Nov 23, 2017

This is a ticket to keep track of collaboration with other tools in the Scala commuinty. Bloop should settle on a configuration format that can be read by any tool (from LSP servers, scalafix to other build tools).

As this format doesn't exist, we should probably pioneer one. Another possibility is to reuse .eclipse configuration files -- that are widely supported by Eclipse, Intellij and vscode (not natively, but some plugin extensions do) -- or directly generate .idea configuration files. However, we may want to encode more information in the file and it's not clear yet whether eclipse configuration files allow it.

Supporting all this configuration files is easy, so we may also consider understanding all of these so that people that heavily use Intellij and rely on sbt-idea to import their projects do not need to run install in the build. This would mean there's a standard, preferred configuration file but bloop can also understand others. This is a nitpick and it's only UX work, so this won't happen anytime soon. But it's a thing to keep an eye on.

My ideal format is json because it can be edited and it's readable (unlike protobuf). This json format should have also a library that provides bincompat readers and writers so that other tools that want to read/write from it only need to depend on the library and use it.

When bloop is public, I'll start summoning people up in this ticket so that we converge to one solution and explore how useful this file would be, and how it could help make better tooling.

@jvican jvican added this to the Bloop 0.2 milestone Nov 23, 2017
@olafurpg
Copy link
Contributor

My 2c, nothing novel just some thoughts

  • if you go with JSON, I recommend defining a JSON schema http://json-schema.org/ (for example. Buckescript build system does that https://bucklescript.github.io/bucklescript/Manual.html#_bucklescript_build_system_code_bsb_code. JSON schema has great IDE support in out of the box in IntelliJ + vscode without any plugins.
  • if you define your own schema, I suspect it will be a challenge to come up with a widely accepted model for defining projects/targets/modules and their attributes.
  • I would consider looking into adding build related extensions to LSP, similar to what they're doing in sbt. I think this could be hugely valuable for IDE integration, esp. when once bloop supports running tests

@ShaneDelmore
Copy link

2 more cents, no more novelty. The Clang community has settled on a format and quite a lot of tooling has sprung up around it. I would love if we could do the same in the scala community. It may make sense to re-use the same keys they use for our shared bits of information and then just enrich the file with additional information we need to help us interoperate with existing tooling.

https://sarcasm.github.io/notes/dev/compilation-database.html

My other thought, I would like for this file to contain enough information to be able to determine if artifacts built with these settings are still valid or if they need to be rebuilt. I don't know all of the variables besides the scala source code, maybe it is just classpath, compiler flags, and scalac version?

@jvican jvican removed this from the Bloop 0.1 milestone Dec 12, 2017
@propensive
Copy link
Contributor

propensive commented Jan 28, 2018

I know I brought this up in another ticket, but I'll reiterate here, as it's more relevant.

If the file format needs to be read by other tools, JSON is too heavyweight a dependency to require, as it becomes largely inaccessible to shell scripting (which is a particular use-case for Bloop). JSON can be read with jq, but it's not standard.

The existing key/value format works very well for shell scripting, as grep, cut and tr provide most of the functionality required for manipulating keys, even if they're rather blunt tools for the task.

To throw another idea into the pot, but one I'm by no means wedded to, the git file format seems like a reasonably good compromise between human-readability, developer familiarity, and computer-readability. Any git config file can be read with git config --file <file> --get <key>, and it's more reasonable to expect git to be available than jq.

I have no idea about HOCON, but anything which requires complex parsing immediately makes the format less useful. Even changing from a single = delimeter to a space-padded = makes the parsing harder, for example. Needing to remove quotes, or do escaping just introduces opportunities for errors and fragility, as programmers build tools which work adequately for their own common use-cases, and break for some other users with slightly different needs.

In summary, please don't introduce complexity you don't need!

@ShaneDelmore
Copy link

ShaneDelmore commented Jan 29, 2018

HOCON desugars to JSON so any JSON is valid HOCON, and a HOCON parser can read HOCON and emit JSON. Not sure if that helps related to the above points, just trying to fill in some of the blanks regarding HOCON, not an argument for or against.

@jvican jvican self-assigned this Mar 8, 2018
jvican added a commit that referenced this issue Apr 5, 2018
This commit is quite big.

The reason it's so big is because in order to ditch java properties and
use the json configuration file format, I had to redesign some of the
parts of bloop's configuration handling that left me unsatisfied.

This includes ditching parallel collections to load the configuration
files, and reusing as much as possible the configuration classes within
the `Project` definition.

It also includes moving unnecessary loggers to the test project, and
removing how elapsed time and `verbose` loggers are handled (given the
use of `Task`, neither implementation was viable).

Lastly, it changes `Interpreter.execute` to use `Task`, so that we only
use `Await` once in the program: at the end, once we've captured the
control flow within a task.

Fixes #58.
jvican added a commit that referenced this issue Apr 5, 2018
This commit is quite big.

The reason it's so big is because in order to ditch java properties and
use the json configuration file format, I had to redesign some of the
parts of bloop's configuration handling that left me unsatisfied.

This includes ditching parallel collections to load the configuration
files, and reusing as much as possible the configuration classes within
the `Project` definition.

It also includes moving unnecessary loggers to the test project, and
removing how elapsed time and `verbose` loggers are handled (given the
use of `Task`, neither implementation was viable).

Lastly, it changes `Interpreter.execute` to use `Task`, so that we only
use `Await` once in the program: at the end, once we've captured the
control flow within a task.

Fixes #58.
jvican added a commit that referenced this issue Apr 5, 2018
This commit is quite big.

The reason it's so big is because in order to ditch java properties and
use the json configuration file format, I had to redesign some of the
parts of bloop's configuration handling that left me unsatisfied.

This includes ditching parallel collections to load the configuration
files, and reusing as much as possible the configuration classes within
the `Project` definition.

It also includes moving unnecessary loggers to the test project, and
removing how elapsed time and `verbose` loggers are handled (given the
use of `Task`, neither implementation was viable).

Lastly, it changes `Interpreter.execute` to use `Task`, so that we only
use `Await` once in the program: at the end, once we've captured the
control flow within a task.

Fixes #58.
ckipp01 pushed a commit to ckipp01/bloop-maven-plugin that referenced this issue Dec 7, 2022
This commit is quite big.

The reason it's so big is because in order to ditch java properties and
use the json configuration file format, I had to redesign some of the
parts of bloop's configuration handling that left me unsatisfied.

This includes ditching parallel collections to load the configuration
files, and reusing as much as possible the configuration classes within
the `Project` definition.

It also includes moving unnecessary loggers to the test project, and
removing how elapsed time and `verbose` loggers are handled (given the
use of `Task`, neither implementation was viable).

Lastly, it changes `Interpreter.execute` to use `Task`, so that we only
use `Await` once in the program: at the end, once we've captured the
control flow within a task.

Fixes scalacenter/bloop#58.
tgodzik pushed a commit to tgodzik/bloop that referenced this issue Jul 5, 2023
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants