Skip to content

Commit b1509f2

Browse files
committed
refactor: Rename files in better accordance with their phase steps
1 parent c5c00ff commit b1509f2

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

docs/internals/package-installation.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ The installation of packages is split into four phases. Each of these phases cor
77
1. Package download
88
2. Package extraction
99
3. Package global integration
10-
4. Package local integration
10+
4. Package local integration (recursive)
11+
5. Package local integration (non-recursive)
1112

1213
## 1. Package download
1314

@@ -29,9 +30,9 @@ For each package in `$BASALT_GLOBAL_DATA_DIR/store/packages`, modifications are
2930
- Creating a local `./.basalt` directory (local integration)
3031
- Converting the runtime essence of the `./basalt.toml` file into other files that are either sourcable or easier to parse
3132

32-
### 4. Local integration
33+
### 4. Local integration (recursive)
3334

34-
The final step involves creating a `.basalt` directory so the functionality of all dependencies can be properly exposed. The directory is located at `./.basalt` for local dependencies and at `BASALT_GLOBAL_DATA_DIR/global/.basalt` for global dependencies
35+
This step involves creating a `.basalt` directory so the functionality of all dependencies can be properly exposed. The directory is located at `$BASALT_LOCAL_PROJECT_DIR/.basalt` for local dependencies and at `$BASALT_GLOBAL_DATA_DIR/global/.basalt` for global dependencies
3536

3637
```txt
3738
- .basalt/
@@ -45,3 +46,7 @@ The final step involves creating a `.basalt` directory so the functionality of a
4546
- man/
4647
- packages/
4748
```
49+
50+
### 5. Local integration (non-recursive)
51+
52+
This is similar to the previous step, except it performs functionalities that are inherently non recursive. This includes creating the `./basalt/generated` subdirectory and the files within it

pkg/lib/util/pkg.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ pkg.install_package() {
3131
fi
3232
fi
3333

34-
# Only after all the dependencies are installed do we muck with the package
34+
# Only after all the dependencies are installed do we muck with the global packages
3535
pkg.phase_global_integration "$package_id"
3636
done; unset pkg
3737

3838
# TODO: make this happen only once (recursion)
39-
4039
# Only if all the previous modifications to the global package store has been successfull
4140
# do we muck with the current local project
42-
pkg.phase_local_integration "$project_dir" 'yes' "$symlink_mode" "$@"
43-
pkg.phase_local_generate-scripts "$project_dir"
41+
pkg.phase_local_integration_recursive "$project_dir" 'yes' "$symlink_mode" "$@"
42+
pkg.phase_local_integration_nonrecursive "$project_dir"
4443
}
4544

4645
# @description Downloads package tarballs from the internet to the global store. If a git revision is specified, it
@@ -154,16 +153,16 @@ pkg.phase_global_integration() {
154153
if [ -f "$project_dir/basalt.toml" ]; then
155154
# Install dependencies
156155
if util.get_toml_array "$project_dir/basalt.toml" 'dependencies'; then
157-
pkg.phase_local_integration "$project_dir" 'yes' 'strict' "${REPLIES[@]}"
158-
pkg.phase_local_generate-scripts "$project_dir"
156+
pkg.phase_local_integration_recursive "$project_dir" 'yes' 'strict' "${REPLIES[@]}"
157+
pkg.phase_local_integration_nonrecursive "$project_dir"
159158
fi
160159
fi
161160

162161
print.indent-green "Transformed" "$package_id"
163162
}
164163

165164
# Create a './.basalt' directory for a particular project directory
166-
pkg.phase_local_integration() {
165+
pkg.phase_local_integration_recursive() {
167166
unset REPLY; REPLY=
168167
local original_package_dir="$1"
169168
local is_direct="$2" # Whether the "$package_dir" dependency is a direct or transitive dependency of "$original_package_dir"
@@ -213,15 +212,15 @@ pkg.phase_local_integration() {
213212
ensure.dir "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id"
214213
if [ -f "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id/basalt.toml" ]; then
215214
if util.get_toml_array "$BASALT_GLOBAL_DATA_DIR/store/packages/$package_id/basalt.toml" 'dependencies'; then
216-
pkg.phase_local_integration "$original_package_dir" 'no' 'strict' "${REPLIES[@]}"
215+
pkg.phase_local_integration_recursive "$original_package_dir" 'no' 'strict' "${REPLIES[@]}"
217216
fi
218217
fi
219218
done
220219
unset pkg
221220
}
222221

223222
# @description Generate scripts for './.basalt/generated' directory
224-
pkg.phase_local_generate-scripts() {
223+
pkg.phase_local_integration_nonrecursive() {
225224
local project_dir="$1"
226225
local mode="$2"
227226

0 commit comments

Comments
 (0)