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

Move /src to /subprojects #10839

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
.github/CODEOWNERS @edolstra

# Documentation of built-in functions
src/libexpr/primops.cc @roberth @fricklerhandwerk
subprojects/libexpr/primops.cc @roberth @fricklerhandwerk

# Documentation of settings
src/libexpr/eval-settings.hh @fricklerhandwerk
src/libstore/globals.hh @fricklerhandwerk
subprojects/libexpr/eval-settings.hh @fricklerhandwerk
subprojects/libstore/globals.hh @fricklerhandwerk

# Documentation
doc/manual @fricklerhandwerk
maintainers/*.md @fricklerhandwerk
src/**/*.md @fricklerhandwerk
subprojects/**/*.md @fricklerhandwerk

# Libstore layer
/src/libstore @ericson2314
/subprojects/libstore @ericson2314
18 changes: 9 additions & 9 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"c api":
- changed-files:
- any-glob-to-any-file: "src/lib*-c/**/*"
- any-glob-to-any-file: "subprojects/lib*-c/**/*"
- any-glob-to-any-file: "test/unit/**/nix_api_*"
- any-glob-to-any-file: "doc/external-api/**/*"

Expand All @@ -14,30 +14,30 @@
"documentation":
- changed-files:
- any-glob-to-any-file: "doc/manual/**/*"
- any-glob-to-any-file: "src/nix/**/*.md"
- any-glob-to-any-file: "subprojects/nix/**/*.md"

"store":
- changed-files:
- any-glob-to-any-file: "src/libstore/store-api.*"
- any-glob-to-any-file: "src/libstore/*-store.*"
- any-glob-to-any-file: "subprojects/libstore/store-api.*"
- any-glob-to-any-file: "subprojects/libstore/*-store.*"

"fetching":
- changed-files:
- any-glob-to-any-file: "src/libfetchers/**/*"
- any-glob-to-any-file: "subprojects/libfetchers/**/*"

"repl":
- changed-files:
- any-glob-to-any-file: "src/libcmd/repl.*"
- any-glob-to-any-file: "src/nix/repl.*"
- any-glob-to-any-file: "subprojects/libcmd/repl.*"
- any-glob-to-any-file: "subprojects/nix/repl.*"

"new-cli":
- changed-files:
- any-glob-to-any-file: "src/nix/**/*"
- any-glob-to-any-file: "subprojects/nix/**/*"

"with-tests":
- changed-files:
# Unit tests
- any-glob-to-any-file: "src/*/tests/**/*"
- any-glob-to-any-file: "subprojects/*/tests/**/*"
# Functional and integration tests
- any-glob-to-any-file: "tests/functional/**/*"

62 changes: 31 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,59 +41,59 @@ perl/Makefile.config
/scripts/nix-profile.fish
/scripts/nix-profile-daemon.fish

# /src/libexpr/
/src/libexpr/lexer-tab.cc
/src/libexpr/lexer-tab.hh
/src/libexpr/parser-tab.cc
/src/libexpr/parser-tab.hh
/src/libexpr/parser-tab.output
/src/libexpr/nix.tbl
/src/libexpr/tests
# /subprojects/libexpr/
/subprojects/libexpr/lexer-tab.cc
/subprojects/libexpr/lexer-tab.hh
/subprojects/libexpr/parser-tab.cc
/subprojects/libexpr/parser-tab.hh
/subprojects/libexpr/parser-tab.output
/subprojects/libexpr/nix.tbl
/subprojects/libexpr/tests
/tests/unit/libexpr/libnixexpr-tests

# /src/libfetchers
# /subprojects/libfetchers
/tests/unit/libfetchers/libnixfetchers-tests

# /src/libflake
# /subprojects/libflake
/tests/unit/libflake/libnixflake-tests

# /src/libstore/
# /subprojects/libstore/
*.gen.*
/src/libstore/tests
/subprojects/libstore/tests
/tests/unit/libstore/libnixstore-tests

# /src/libutil/
/src/libutil/tests
# /subprojects/libutil/
/subprojects/libutil/tests
/tests/unit/libutil/libnixutil-tests

/src/nix/nix
/subprojects/nix/nix

/src/nix/generated-doc
/subprojects/nix/generated-doc

# /src/nix-env/
/src/nix-env/nix-env
# /subprojects/nix-env/
/subprojects/nix-env/nix-env

# /src/nix-instantiate/
/src/nix-instantiate/nix-instantiate
# /subprojects/nix-instantiate/
/subprojects/nix-instantiate/nix-instantiate

# /src/nix-store/
/src/nix-store/nix-store
# /subprojects/nix-store/
/subprojects/nix-store/nix-store

/src/nix-prefetch-url/nix-prefetch-url
/subprojects/nix-prefetch-url/nix-prefetch-url

/src/nix-collect-garbage/nix-collect-garbage
/subprojects/nix-collect-garbage/nix-collect-garbage

# /src/nix-channel/
/src/nix-channel/nix-channel
# /subprojects/nix-channel/
/subprojects/nix-channel/nix-channel

# /src/nix-build/
/src/nix-build/nix-build
# /subprojects/nix-build/
/subprojects/nix-build/nix-build

/src/nix-copy-closure/nix-copy-closure
/subprojects/nix-copy-closure/nix-copy-closure

/src/error-demo/error-demo
/subprojects/error-demo/error-demo

/src/build-remote/build-remote
/subprojects/build-remote/build-remote

# /tests/functional/
/tests/functional/test-tmp
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Check out the [security policy](https://github.com/NixOS/nix/security/policy).
- [ ] Fixes an [idea approved](https://github.com/NixOS/nix/labels/idea%20approved) issue
- [ ] Tests, as appropriate:
- Functional tests – [`tests/functional/**.sh`](./tests/functional)
- Unit tests – [`src/*/tests`](./src/)
- Unit tests – [`tests/unit/*`](./tests/unit)
- Integration tests – [`tests/nixos/*`](./tests/nixos)
- [ ] User documentation in the [manual](./doc/manual/src)
- [ ] API documentation in header files
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ ifeq ($(ENABLE_BUILD), yes)
makefiles = \
mk/precompiled-headers.mk \
local.mk \
src/libutil/local.mk \
src/libstore/local.mk \
src/libfetchers/local.mk \
src/libmain/local.mk \
src/libexpr/local.mk \
src/libflake/local.mk \
src/libcmd/local.mk \
src/nix/local.mk \
src/libutil-c/local.mk \
src/libstore-c/local.mk \
src/libexpr-c/local.mk
subprojects/libutil/local.mk \
subprojects/libstore/local.mk \
subprojects/libfetchers/local.mk \
subprojects/libmain/local.mk \
subprojects/libexpr/local.mk \
subprojects/libflake/local.mk \
subprojects/libcmd/local.mk \
subprojects/nix/local.mk \
subprojects/libutil-c/local.mk \
subprojects/libstore-c/local.mk \
subprojects/libexpr-c/local.mk

ifdef HOST_UNIX
makefiles += \
Expand Down Expand Up @@ -93,15 +93,15 @@ ifdef HOST_WINDOWS
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
endif

GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -Werror=suggest-override -include $(buildprefix)config.h -std=c++2a -I src
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -Werror=suggest-override -include $(buildprefix)config.h -std=c++2a -I subprojects

# Include the main lib, causing rules to be defined

include mk/lib.mk

# Fallback stub rules for better UX when things are disabled
#
# These must be defined after `mk/lib.mk`. Otherwise the first rule
# These must be defined after Otherwise the first rule
# incorrectly becomes the default target.

ifneq ($(ENABLE_UNIT_TESTS), yes)
Expand Down
10 changes: 5 additions & 5 deletions doc/manual/src/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> An example of some files, demonstrating much of what is described below
>
> ```
> src
> subprojects
> ├── libexpr
> │ ├── local.mk
> │ ├── value/context.hh
Expand Down Expand Up @@ -59,12 +59,12 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> …
> ```

The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`.
Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/nix-expr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/nix-expr-test-support/tests/value/context.{hh,cc}`.
The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `subprojects/${library_name_without-nix}-test`.
Given an interface (header) and implementation pair in the original library, say, `subprojects/libexpr/value/context.{hh,cc}`, we write tests for it in `subprojects/nix-expr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `subprojects/nix-expr-test-support/tests/value/context.{hh,cc}`.

Data for unit tests is stored in a `data` subdir of the directory for each unit test executable.
For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/nix-store-tests/data`.
The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`.
For example, `libnixstore` code is in `subprojects/libstore`, and its test data is in `subprojects/nix-store-tests/data`.
The path to the `subprojects/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`.
Note that each executable only gets the data for its tests.

The unit test libraries are in `src/${library_name_without-nix}-test-support`.
Expand Down
6 changes: 3 additions & 3 deletions local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ GLOBAL_CXXFLAGS += -Wno-deprecated-declarations -Werror=switch
# Allow switch-enum to be overridden for files that do not support it, usually because of dependency headers.
ERROR_SWITCH_ENUM = -Werror=switch-enum

$(foreach i, config.h $(wildcard src/lib*/*.hh) $(filter-out %_internal.h, $(wildcard src/lib*c/*.h)), \
$(foreach i, config.h $(wildcard subprojects/lib*/*.hh) $(filter-out %_internal.h, $(wildcard subprojects/lib*c/*.h)), \
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))

ifdef HOST_UNIX
$(foreach i, $(wildcard src/lib*/unix/*.hh), \
$(foreach i, $(wildcard subprojects/lib*/unix/*.hh), \
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
endif

$(GCH): src/libutil/util.hh config.h
$(GCH): subprojects/libutil/util.hh config.h

GCH_CXXFLAGS = $(INCLUDE_libutil)
Loading
Loading