Skip to content

Commit dec8783

Browse files
committed
Driver: rename Name.swiftmodule/Private directory to Name.swiftmodule/Project
This directory should be excluded during installation since the content is only used for local development. swiftsourceinfo file is currently emitted to this directory.
1 parent dd33540 commit dec8783

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

cmake/modules/SwiftSource.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ function(_compile_swift_files
310310
set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}")
311311
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
312312
set(specific_module_dir "${module_base}.swiftmodule")
313-
set(specific_module_private_dir "${specific_module_dir}/Private")
314-
set(source_info_file "${specific_module_private_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
313+
set(specific_module_project_dir "${specific_module_dir}/Project")
314+
set(source_info_file "${specific_module_project_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
315315
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
316316
else()
317317
set(specific_module_dir)
318-
set(specific_module_private_dir)
318+
set(specific_module_project_dir)
319319
set(source_info_file "${module_base}.swiftsourceinfo")
320320
endif()
321321
set(module_file "${module_base}.swiftmodule")
@@ -354,7 +354,7 @@ function(_compile_swift_files
354354
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
355355
COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}"
356356
OPTIONAL
357-
PATTERN "Private" EXCLUDE)
357+
PATTERN "Project" EXCLUDE)
358358
else()
359359
swift_install_in_component(FILES ${module_outputs}
360360
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
@@ -495,7 +495,7 @@ function(_compile_swift_files
495495
COMMAND
496496
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
497497
${specific_module_dir}
498-
${specific_module_private_dir}
498+
${specific_module_project_dir}
499499
COMMAND
500500
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
501501
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"

lib/Driver/Driver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ static void chooseModuleAuxiliaryOutputFilePath(Compilation &C,
27932793
StringRef workingDirectory,
27942794
CommandOutput *Output,
27952795
file_types::ID fileID,
2796-
bool isPrivate,
2796+
bool isProject = false,
27972797
Optional<options::ID> optId = llvm::None) {
27982798
if (hasExistingAdditionalOutput(*Output, fileID))
27992799
return;
@@ -2819,9 +2819,9 @@ static void chooseModuleAuxiliaryOutputFilePath(Compilation &C,
28192819
bool isTempFile = C.isTemporaryFile(ModulePath);
28202820
auto ModuleName = llvm::sys::path::filename(ModulePath);
28212821
llvm::SmallString<128> Path(llvm::sys::path::parent_path(ModulePath));
2822-
if (isPrivate) {
2823-
llvm::sys::path::append(Path, "Private");
2824-
// If the build system has created a Private dir for us to include the file, use it.
2822+
if (isProject) {
2823+
llvm::sys::path::append(Path, "Project");
2824+
// If the build system has created a Project dir for us to include the file, use it.
28252825
if (!llvm::sys::fs::exists(Path)) {
28262826
llvm::sys::path::remove_filename(Path);
28272827
}
@@ -2840,15 +2840,15 @@ void Driver::chooseSwiftSourceInfoOutputPath(Compilation &C,
28402840
CommandOutput *Output) const {
28412841
chooseModuleAuxiliaryOutputFilePath(C, OutputMap, workingDirectory, Output,
28422842
file_types::TY_SwiftSourceInfoFile,
2843-
/*isPrivate*/true, options::OPT_emit_module_source_info_path);
2843+
/*isProject*/true, options::OPT_emit_module_source_info_path);
28442844
}
28452845

28462846
void Driver::chooseSwiftModuleDocOutputPath(Compilation &C,
28472847
const TypeToPathMap *OutputMap,
28482848
StringRef workingDirectory,
28492849
CommandOutput *Output) const {
28502850
chooseModuleAuxiliaryOutputFilePath(C, OutputMap, workingDirectory, Output,
2851-
file_types::TY_SwiftModuleDocFile, /*isPrivate*/false);
2851+
file_types::TY_SwiftModuleDocFile);
28522852
}
28532853

28542854
void Driver::chooseRemappingOutputPath(Compilation &C,

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ CompilerInstance::openModuleSourceInfo(const InputFile &input) {
526526
std::string NonPrivatePath = moduleSourceInfoFilePath.str().str();
527527
StringRef fileName = llvm::sys::path::filename(NonPrivatePath);
528528
llvm::sys::path::remove_filename(moduleSourceInfoFilePath);
529-
llvm::sys::path::append(moduleSourceInfoFilePath, "Private");
529+
llvm::sys::path::append(moduleSourceInfoFilePath, "Project");
530530
llvm::sys::path::append(moduleSourceInfoFilePath, fileName);
531531
if (auto sourceInfoFileOrErr = swift::vfs::getFileOrSTDIN(getFileSystem(),
532532
moduleSourceInfoFilePath))

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,27 +273,27 @@ SerializedModuleLoaderBase::openModuleSourceInfoFile(AccessPathElem ModuleID,
273273

274274
llvm::vfs::FileSystem &FS = *Ctx.SourceMgr.getFileSystem();
275275
{
276-
llvm::SmallString<128> PrivatePath(ModulePath);
277-
llvm::sys::path::remove_filename(PrivatePath);
278-
llvm::sys::path::append(PrivatePath, "Private");
279-
llvm::sys::path::append(PrivatePath, ModuleSourceInfoFilename);
276+
llvm::SmallString<128> ProjectPath(ModulePath);
277+
llvm::sys::path::remove_filename(ProjectPath);
278+
llvm::sys::path::append(ProjectPath, "Project");
279+
llvm::sys::path::append(ProjectPath, ModuleSourceInfoFilename);
280280

281281
// Try to open the module source info file. If it does not exist, ignore
282282
// the error. However, pass though all other errors.
283283
if (llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ModuleSourceInfoOrErr =
284-
FS.getBufferForFile(PrivatePath)) {
284+
FS.getBufferForFile(ProjectPath)) {
285285
*ModuleSourceInfoBuffer = std::move(*ModuleSourceInfoOrErr);
286286
return std::error_code();
287287
}
288288
}
289289
{
290-
llvm::SmallString<128> NonPrivatePath(ModulePath);
291-
llvm::sys::path::remove_filename(NonPrivatePath);
292-
llvm::sys::path::append(NonPrivatePath, ModuleSourceInfoFilename);
290+
llvm::SmallString<128> NonProjectPath(ModulePath);
291+
llvm::sys::path::remove_filename(NonProjectPath);
292+
llvm::sys::path::append(NonProjectPath, ModuleSourceInfoFilename);
293293

294294
// Try to open the module source info file adjacent to the .swiftmodule file.
295295
if (llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ModuleSourceInfoOrErr =
296-
FS.getBufferForFile(NonPrivatePath)) {
296+
FS.getBufferForFile(NonProjectPath)) {
297297
*ModuleSourceInfoBuffer = std::move(*ModuleSourceInfoOrErr);
298298
return std::error_code();
299299
}

test/Driver/sourceinfo_file.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: mkdir -p %t/build/Private
3-
// RUN: %swiftc_driver -driver-print-jobs -emit-module %s -emit-module-path %t/build/sourceinfo_file.swiftmodule -module-name sourceinfo_file | %FileCheck %s -check-prefix CHECK-PRIVATE
2+
// RUN: mkdir -p %t/build/Project
3+
// RUN: %swiftc_driver -driver-print-jobs -emit-module %s -emit-module-path %t/build/sourceinfo_file.swiftmodule -module-name sourceinfo_file | %FileCheck %s -check-prefix CHECK-PROJECT
44

5-
// CHECK-PRIVATE: build{{/|\\\\}}Private{{/|\\\\}}sourceinfo_file.swiftsourceinfo
5+
// CHECK-PROJECT: build{{/|\\\\}}Project{{/|\\\\}}sourceinfo_file.swiftsourceinfo
66

77
// RUN: %empty-directory(%t/build)
8-
// RUN: %swiftc_driver -driver-print-jobs -emit-module %s -emit-module-path %t/build/sourceinfo_file.swiftmodule -module-name sourceinfo_file | %FileCheck %s -check-prefix CHECK-NOPRIVATE
8+
// RUN: %swiftc_driver -driver-print-jobs -emit-module %s -emit-module-path %t/build/sourceinfo_file.swiftmodule -module-name sourceinfo_file | %FileCheck %s -check-prefix CHECK-NOPROJECT
99

10-
// CHECK-NOPRIVATE-NOT: Private/sourceinfo_file.swiftsourceinfo
11-
// CHECK-NOPRIVATE: build{{/|\\\\}}sourceinfo_file.swiftsourceinfo
10+
// CHECK-NOPROJECT-NOT: Project/sourceinfo_file.swiftsourceinfo
11+
// CHECK-NOPROJECT: build{{/|\\\\}}sourceinfo_file.swiftsourceinfo
1212

1313
// RUN: %empty-directory(%t/build)
1414
// RUN: %swiftc_driver -driver-print-jobs -emit-module %s -emit-module-path %t/build/sourceinfo_file.swiftmodule -module-name sourceinfo_file -emit-module-source-info-path %t/build/DriverPath.swiftsourceinfo | %FileCheck %s -check-prefix CHECK-DRIVER-OPT

test/Serialization/comments-framework.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %empty-directory(%t/comments.framework/Modules/comments.swiftmodule)
3-
// RUN: %empty-directory(%t/comments.framework/Modules/comments.swiftmodule/Private)
3+
// RUN: %empty-directory(%t/comments.framework/Modules/comments.swiftmodule/Project)
44

5-
// RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftmodule-name -emit-module-doc-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftdoc-name -emit-module-source-info-path %t/comments.framework/Modules/comments.swiftmodule/Private/%target-swiftsourceinfo-name %s
5+
// RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftmodule-name -emit-module-doc-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftdoc-name -emit-module-source-info-path %t/comments.framework/Modules/comments.swiftmodule/Project/%target-swiftsourceinfo-name %s
66
// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -F %t | %FileCheck %s
77

88
// RUN: cp -r %t/comments.framework/Modules/comments.swiftmodule %t/comments.swiftmodule

0 commit comments

Comments
 (0)