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

[Refactor] Changed stanza.proj tree structure #42

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

callendorph
Copy link
Collaborator

Closes JITX-7191

This commit changes the way that the stanza.proj files are created for projects.

In the old way, the .slm/stanza.proj was effectively the root stanza project file. This meant that to build, slm had to change directories to .slm and then run the stanza build there.

This caused a lot of complexity. It meant that I couldn't just run stanza build at the root directory. It also broke dependency resolution in vscode via the stanza language server.

This commit creates the root stanza.proj at the root of the project and then has the root stanza.proj import .slm/stanza.proj. The .slm/stanza.proj still manages all of the resolved dependencies of the project and abstracts that away from the end user. With this setup:

  1. The user can run stanza build from the root
  2. VSCode language server continues to work as expected.
  3. The structure of the project is a lot more clear.
  4. We can more easily define configuration options that affect the build without hiding them inside the slm executable. Specifically - I moved the -pkg pkgs command line option and put it in the stanza.proj file for the main target. This means stanza build will just work.

Notes

  1. We will need to update the dependent projects to match this new paradigm (stanza-toml, semver, maybe-utils, etc). This should not require a major lift - it should be just adding two lines to the stanza.proj file.
  2. With this setup, I can use cmd-click in vscode on dependencies in my project and they resolve to .slm/deps/<project>/.... That all seems to be working well.

Closes JITX-7191

This commit changes the way that the `stanza.proj` files are created for
projects.

In the old way, the `.slm/stanza.proj` was effectively the `root` stanza
project file. This meant that to build, slm had to change directories to `.slm`
and then run the `stanza build` there.

This caused a lot of complexity. It meant that I couldn't just run
`stanza build` at the root directory. It also broke dependency resolution
in vscode via the stanza language server.

This commit creates the root `stanza.proj` at the root of the project
and then has the root `stanza.proj` import `.slm/stanza.proj`. The
`.slm/stanza.proj` still manages all of the resolved dependencies of
the project and abstracts that away from the end user. With this setup:

1.  The user can run `stanza build` from the root
2.  VSCode language server continues to work as expected.
3.  The structure of the project is a lot more clear.
4.  We can more easily define configuration options that affect the build
    without hiding them inside the `slm` executable. Specifically - I
    moved the `-pkg pkgs` command line option and put it  in the `stanza.proj`
    file for the `main` target. This means `stanza build` will just work.
@callendorph callendorph requested a review from tjknoth November 23, 2023 20:17
@@ -76,13 +77,15 @@ public defn init (cmd-args:CommandArgs) -> False:
val main-package = to-string("%_/main" % [project-name])
val stanza-proj-path = to-string("%_/stanza.proj" % [project-dir])
if not file-exists?(stanza-proj-path):
spit(stanza-proj-path, \<>include "src/stanza.proj"
spit(stanza-proj-path, \<>include ".slm/stanza.proj" ; Dependencies
include "src/stanza.proj" ; Project Sources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some point it might be nice to parameterize the src directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya - I'm not a fan of all the string literals that are bandied about in this project. I'll add a ticket in linear.

@callendorph callendorph merged commit fc18768 into master Nov 29, 2023
1 check passed
@callendorph callendorph deleted the JITX-7191/change_build_setup branch November 29, 2023 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants