Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/index/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ static auto index_main(const std::string_view &program,
/////////////////////////////////////////////////////////////////////////////

const auto schemas_path{output.path() / "schemas"};
const auto display_schemas_path{
std::filesystem::relative(schemas_path, output.path())};
sourcemeta::one::BuildAdapterFilesystem adapter{output.path()};
// Mainly to not screw up the logs
std::mutex mutex;
Expand Down Expand Up @@ -245,6 +247,8 @@ static auto index_main(const std::string_view &program,
constexpr auto THREAD_STACK_SIZE{8 * 1024 * 1024};

const auto explorer_path{output.path() / "explorer"};
const auto display_explorer_path{
std::filesystem::relative(explorer_path, output.path())};
sourcemeta::core::parallel_for_each(
resolver.begin(), resolver.end(),
[&output, &schemas_path, &explorer_path, &resolver, &mutex, &adapter,
Expand Down Expand Up @@ -328,7 +332,8 @@ static auto index_main(const std::string_view &program,
// This is a pretty fast step that will be useful for us to properly declare
// dependencies for HTML and navigational targets

print_progress(mutex, concurrency, "Reviewing", schemas_path.string(), 1, 2);
print_progress(mutex, concurrency, "Reviewing", display_schemas_path.string(),
1, 2);
std::vector<std::filesystem::path> directories;
// The top-level is itself a directory
directories.emplace_back(schemas_path);
Expand Down Expand Up @@ -377,10 +382,12 @@ static auto index_main(const std::string_view &program,
});
}

print_progress(mutex, concurrency, "Reviewing", schemas_path.string(), 2, 2);
print_progress(mutex, concurrency, "Reviewing", display_schemas_path.string(),
2, 2);
DISPATCH<sourcemeta::one::GENERATE_DEPENDENCY_TREE>(
output.path() / "dependency-tree.metapack", dependencies, resolver, mutex,
"Reviewing", schemas_path.string(), "dependencies", adapter, output);
"Reviewing", display_schemas_path.string(), "dependencies", adapter,
output);

/////////////////////////////////////////////////////////////////////////////
// (10) A further pass on the schemas after review
Expand All @@ -405,11 +412,11 @@ static auto index_main(const std::string_view &program,
// (11) Generate the JSON-based explorer
/////////////////////////////////////////////////////////////////////////////

print_progress(mutex, concurrency, "Producing", explorer_path.string(), 0,
100);
print_progress(mutex, concurrency, "Producing",
display_explorer_path.string(), 0, 100);
DISPATCH<sourcemeta::one::GENERATE_EXPLORER_SEARCH_INDEX>(
explorer_path / SENTINEL / "search.metapack", summaries, nullptr, mutex,
"Producing", explorer_path.string(), "search", adapter, output);
"Producing", display_explorer_path.string(), "search", adapter, output);

// Directory generation depends on the configuration for metadata
summaries.emplace_back(mark_configuration_path);
Expand Down Expand Up @@ -549,9 +556,11 @@ static auto index_main(const std::string_view &program,
}

const auto routes_path{output.path() / "routes.bin"};
const auto display_routes_path{
std::filesystem::relative(routes_path, output.path())};
DISPATCH<sourcemeta::one::GENERATE_URITEMPLATE_ROUTES>(
routes_path, {mark_configuration_path, mark_version_path}, router, mutex,
"Producing", routes_path.string(), "routes", adapter, output);
"Producing", display_routes_path.string(), "routes", adapter, output);

/////////////////////////////////////////////////////////////////////////////
// Finish generation
Expand Down
32 changes: 16 additions & 16 deletions test/cli/index/common/rebuild-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ Using configuration: $(realpath "$TMP")/one.json
Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
(100%) Ingesting: https://sourcemeta.com/example/schemas/foo
(100%) Analysing: https://sourcemeta.com/example/schemas/foo
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
( 0%) Producing: $(realpath "$TMP")/output/explorer
( 0%) Producing: explorer
( 33%) Producing: example/schemas
( 66%) Producing: example
(100%) Producing: .
Expand Down Expand Up @@ -84,13 +84,13 @@ Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
(skip) Analysing: https://sourcemeta.com/example/schemas/foo [blaze-exhaustive]
(skip) Analysing: https://sourcemeta.com/example/schemas/foo [blaze-fast]
(skip) Analysing: https://sourcemeta.com/example/schemas/foo [metadata]
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
(skip) Reviewing: $(realpath "$TMP")/output/schemas [dependencies]
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(skip) Reviewing: schemas [dependencies]
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
(skip) Reworking: https://sourcemeta.com/example/schemas/foo [dependents]
( 0%) Producing: $(realpath "$TMP")/output/explorer
(skip) Producing: $(realpath "$TMP")/output/explorer [search]
( 0%) Producing: explorer
(skip) Producing: explorer [search]
( 33%) Producing: example/schemas
(skip) Producing: example/schemas [directory]
( 66%) Producing: example
Expand All @@ -106,7 +106,7 @@ Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
(skip) Rendering: . [not-found]
(100%) Rendering: example/schemas/foo
(skip) Rendering: example/schemas/foo [schema]
(skip) Producing: $(realpath "$TMP")/output/routes.bin [routes]
(skip) Producing: routes.bin [routes]
EOF
diff "$TMP/output.txt" "$TMP/expected.txt"

Expand All @@ -126,10 +126,10 @@ Using configuration: $(realpath "$TMP")/one.json
Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
(100%) Ingesting: https://sourcemeta.com/example/schemas/foo
(100%) Analysing: https://sourcemeta.com/example/schemas/foo
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
( 0%) Producing: $(realpath "$TMP")/output/explorer
( 0%) Producing: explorer
( 33%) Producing: example/schemas
( 66%) Producing: example
(100%) Producing: .
Expand All @@ -138,7 +138,7 @@ Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
( 75%) Rendering: .
(skip) Rendering: . [not-found]
(100%) Rendering: example/schemas/foo
(skip) Producing: $(realpath "$TMP")/output/routes.bin [routes]
(skip) Producing: routes.bin [routes]
EOF
diff "$TMP/output.txt" "$TMP/expected.txt"

Expand All @@ -152,10 +152,10 @@ Using configuration: $(realpath "$TMP")/one.json
Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
(100%) Ingesting: https://sourcemeta.com/example/schemas/foo
(100%) Analysing: https://sourcemeta.com/example/schemas/foo
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
( 0%) Producing: $(realpath "$TMP")/output/explorer
( 0%) Producing: explorer
( 33%) Producing: example/schemas
( 66%) Producing: example
(100%) Producing: .
Expand Down
6 changes: 3 additions & 3 deletions test/cli/index/common/verbose-long.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
https://example.com/foo => https://sourcemeta.com/example/schemas/foo
(100%) Ingesting: https://sourcemeta.com/example/schemas/foo
(100%) Analysing: https://sourcemeta.com/example/schemas/foo
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
( 0%) Producing: $(realpath "$TMP")/output/explorer
( 0%) Producing: explorer
( 33%) Producing: example/schemas
( 66%) Producing: example
(100%) Producing: .
Expand Down
6 changes: 3 additions & 3 deletions test/cli/index/common/verbose-short.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ Detecting: $(realpath "$TMP")/schemas/foo.json (#1)
https://example.com/foo => https://sourcemeta.com/example/schemas/foo
(100%) Ingesting: https://sourcemeta.com/example/schemas/foo
(100%) Analysing: https://sourcemeta.com/example/schemas/foo
( 50%) Reviewing: $(realpath "$TMP")/output/schemas
(100%) Reviewing: $(realpath "$TMP")/output/schemas
( 50%) Reviewing: schemas
(100%) Reviewing: schemas
(100%) Reworking: https://sourcemeta.com/example/schemas/foo
( 0%) Producing: $(realpath "$TMP")/output/explorer
( 0%) Producing: explorer
( 33%) Producing: example/schemas
( 66%) Producing: example
(100%) Producing: .
Expand Down