Skip to content

[Frontend] Accept the frontend arg -library-level= #64752

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

Merged
merged 1 commit into from
Mar 30, 2023
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
4 changes: 4 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ def library_level : Separate<["-"], "library-level">,
MetaVarName<"<level>">,
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
HelpText<"Library distribution level 'api', 'spi' or 'other' (the default)">;
def library_level_EQ : Joined<["-"], "library-level=">,
MetaVarName<"<level>">,
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
Alias<library_level>;

def module_name : Separate<["-"], "module-name">,
Flags<[FrontendOption, ModuleInterfaceOption, SwiftAPIExtractOption,
Expand Down
10 changes: 9 additions & 1 deletion test/Sema/implementation-only-import-suggestion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
// RUN: -library-level api -verify -module-name MainLib
// RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
// RUN: -library-level=api -verify -module-name MainLib

/// Expect no errors when building an SPI client.
// RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
Expand Down Expand Up @@ -71,9 +74,14 @@ import LocalClang // expected-error{{private module 'LocalClang' is imported pub
@_spiOnly import LocalClang

/// Test error message on an unknown library level name.
// RUN: not %target-swift-frontend -typecheck %s -library-level ThatsNotALibraryLevel 2>&1 \
// RUN: not %target-swift-frontend -typecheck %t/Empty.swift \
// RUN: -library-level ThatsNotALibraryLevel 2>&1 \
// RUN: | %FileCheck %s --check-prefix CHECK-ARG
// RUN: not %target-swift-frontend -typecheck %t/Empty.swift \
// RUN: -library-level=ThatsNotALibraryLevel 2>&1 \
// RUN: | %FileCheck %s --check-prefix CHECK-ARG
// CHECK-ARG: error: unknown library level 'ThatsNotALibraryLevel', expected one of 'api', 'spi', 'ipi', or 'other'
//--- Empty.swift

/// Expect no errors in swiftinterfaces.
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) \
Expand Down