Skip to content

Commit

Permalink
Reorganize the directory structure under 'stdlib'
Browse files Browse the repository at this point in the history
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
  • Loading branch information
gribozavr committed Mar 9, 2015
1 parent da2e6ad commit 350248d
Show file tree
Hide file tree
Showing 233 changed files with 120 additions and 63 deletions.
6 changes: 3 additions & 3 deletions cmake/modules/AddSwift.cmake
Expand Up @@ -785,7 +785,7 @@ function(_add_swift_library_single target name)
${SWIFTLIB_SINGLE_SDK} STREQUAL "OSX")
# HACK: don't build WatchKit API notes for OS X.
else()
if (NOT IS_DIRECTORY "${SWIFT_SOURCE_DIR}/stdlib/objc/${framework_name}")
if (NOT IS_DIRECTORY "${SWIFT_SOURCE_DIR}/stdlib/public/SDK/${framework_name}")
list(APPEND SWIFTLIB_SINGLE_API_NOTES "${framework_name}")
endif()
endif()
Expand Down Expand Up @@ -1198,7 +1198,7 @@ function(add_swift_library name)
if((NOT "${SWIFT_BUILD_STDLIB}") AND
(NOT "${SWIFTLIB_SWIFT_MODULE_DEPENDS}" STREQUAL ""))
list(REMOVE_ITEM SWIFTLIB_SWIFT_MODULE_DEPENDS
Core SwiftUnstable)
Core SwiftPrivate)
endif()

translate_flags(SWIFTLIB "${SWIFTLIB_options}")
Expand Down Expand Up @@ -1565,7 +1565,7 @@ function(add_swift_target_executable name)

if(NOT "${SWIFT_BUILD_STDLIB}")
list(REMOVE_ITEM SWIFTEXE_TARGET_LINK_FAT_LIBRARIES
swiftCore swiftSwiftUnstable)
swiftCore swiftSwiftPrivate)
endif()

foreach(sdk ${SWIFT_SDKS})
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/HeapObject.h
Expand Up @@ -22,7 +22,7 @@
#include "swift/Runtime/Config.h"

// Bring in the definition of HeapObject
#include "../../../stdlib/shims/HeapObject.h"
#include "../../../stdlib/public/SwiftShims/HeapObject.h"

namespace swift {

Expand Down
20 changes: 0 additions & 20 deletions stdlib/darwin_extras/CMakeLists.txt

This file was deleted.

4 changes: 4 additions & 0 deletions stdlib/internal/CMakeLists.txt
@@ -0,0 +1,4 @@
if(SWIFT_BUILD_STDLIB)
add_subdirectory(SwiftExperimental)
endif()

6 changes: 6 additions & 0 deletions stdlib/internal/README.txt
@@ -0,0 +1,6 @@
The modules in the 'stdlib/internal' directory provide APIs that are
under active development and intended to be merged into the appropriate
libraries under 'stdlib/public' in the near future, after API review is
complete and when all other tools that accompany these new APIs are ready.


File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions stdlib/private/CMakeLists.txt
@@ -0,0 +1,21 @@
if(SWIFT_BUILD_STDLIB)
add_subdirectory(SwiftPrivate)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(SWIFT_BUILD_SDK_OVERLAY)
# FIXME: there is nothing Darwin-specific in StdlibUnittest, but to use
# POSIX APIs it imports the Darwin module on Apple platforms, so it can't
# be built separately from the SDK overlay.
add_subdirectory(StdlibUnittest)
add_subdirectory(SwiftPrivateDarwinExtras)
add_subdirectory(SwiftPrivatePthreadExtras)
endif()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_subdirectory(Glibc)
add_subdirectory(StdlibUnittest)
add_subdirectory(SwiftPrivateDarwinExtras)
add_subdirectory(SwiftPrivatePthreadExtras)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions stdlib/private/README.txt
@@ -0,0 +1,11 @@
The modules in the 'stdlib/private' directory contain APIs that are
considered private to the Swift project. Don't use them outside of the
repositories related to the Swift project.

These APIs are used for building Swift build and test automation tools,
represent early prototypes of APIs that are not intended to be included
in the standard library soon, modules to support ports to other platforms,
and other similar needs that are private to the Swift project and its
development process.


@@ -1,6 +1,6 @@
set(swift_stdlib_unittest_platform_sources)
set(swift_stdlib_unittest_module_depends
SwiftUnstable SwiftUnstablePthreadExtras SwiftUnstableDarwinExtras)
SwiftPrivate SwiftPrivatePthreadExtras SwiftPrivateDarwinExtras)
set(swift_stdlib_unittest_framework_depends)
set(swift_stdlib_unittest_private_link_libraries)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -36,8 +36,8 @@
///
//===----------------------------------------------------------------------===//

import SwiftUnstable
import SwiftUnstablePthreadExtras
import SwiftPrivate
import SwiftPrivatePthreadExtras
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
Expand Down
File renamed without changes.
Expand Up @@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//

import SwiftUnstable
import SwiftUnstableDarwinExtras
import SwiftPrivate
import SwiftPrivateDarwinExtras
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
Expand Down
Expand Up @@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//

import SwiftUnstable
import SwiftUnstablePthreadExtras
import SwiftUnstableDarwinExtras
import SwiftPrivate
import SwiftPrivatePthreadExtras
import SwiftPrivateDarwinExtras

#if os(OSX) || os(iOS)
import Darwin
Expand Down
File renamed without changes.
@@ -1,20 +1,20 @@
set(swift_unstable_private_link_libraries)
set(swift_private_private_link_libraries)
if(SWIFT_HOST_VARIANT STREQUAL "linux")
# Needed for arc4random
find_package(BSD REQUIRED)
list(APPEND swift_unstable_private_link_libraries
list(APPEND swift_private_private_link_libraries
${BSD_LIBRARIES})
endif()

add_swift_library(swiftSwiftUnstable SHARED IS_STDLIB
add_swift_library(swiftSwiftPrivate SHARED IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
SwiftUnstable.swift
SwiftPrivate.swift
IO.swift
PRNG.swift
ShardedAtomicCounter.swift

SWIFT_COMPILE_FLAGS -Xfrontend -sil-serialize-all
PRIVATE_LINK_LIBRARIES ${swift_unstable_private_link_libraries}
PRIVATE_LINK_LIBRARIES ${swift_private_private_link_libraries}
INSTALL_IN_COMPONENT stdlib-experimental)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions stdlib/private/SwiftPrivateDarwinExtras/CMakeLists.txt
@@ -0,0 +1,20 @@
set(swift_private_darwin_extras_module_depends
SwiftPrivate)

if(SWIFT_HOST_VARIANT STREQUAL "macosx")
list(APPEND swift_private_darwin_extras_module_depends
Darwin)
elseif(SWIFT_HOST_VARIANT STREQUAL "linux")
list(APPEND swift_private_darwin_extras_module_depends
Glibc)
endif()

add_swift_library(swiftSwiftPrivateDarwinExtras SHARED IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
SwiftPrivateDarwinExtras.swift
Subprocess.swift

SWIFT_MODULE_DEPENDS ${swift_private_darwin_extras_module_depends}
SWIFT_COMPILE_FLAGS -Xfrontend -sil-serialize-all
INSTALL_IN_COMPONENT stdlib-experimental)
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SwiftUnstable
import SwiftPrivate
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
Expand Down
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

import SwiftUnstable
import SwiftPrivate
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
Expand Down
@@ -1,21 +1,21 @@
set(swift_unstable_pthread_extras_module_depends)
set(swift_private_pthread_extras_module_depends)

if(SWIFT_HOST_VARIANT STREQUAL "macosx")
list(APPEND swift_unstable_pthread_extras_module_depends
list(APPEND swift_private_pthread_extras_module_depends
Darwin)
elseif(SWIFT_HOST_VARIANT STREQUAL "linux")
list(APPEND swift_unstable_pthread_extras_module_depends
list(APPEND swift_private_pthread_extras_module_depends
Glibc)
endif()

add_swift_library(swiftSwiftUnstablePthreadExtras SHARED IS_STDLIB
add_swift_library(swiftSwiftPrivatePthreadExtras SHARED IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
SwiftUnstablePthreadExtras.swift
SwiftPrivatePthreadExtras.swift
PthreadBarriers.swift
SwiftBlockToCFunctionThunks.cpp

SWIFT_MODULE_DEPENDS ${swift_unstable_pthread_extras_module_depends}
SWIFT_MODULE_DEPENDS ${swift_private_pthread_extras_module_depends}
SWIFT_COMPILE_FLAGS -Xfrontend -sil-serialize-all
INSTALL_IN_COMPONENT stdlib-experimental)

File renamed without changes.
@@ -1,4 +1,4 @@
//===--- SwiftUnstablePthreadExtras.swift ---------------------------------===//
//===--- SwiftPrivatePthreadExtras.swift ----------------------------------===//
//
// This source file is part of the Swift.org open source project
//
Expand Down
12 changes: 12 additions & 0 deletions stdlib/public/CMakeLists.txt
@@ -0,0 +1,12 @@
if(SWIFT_BUILD_STDLIB)
add_subdirectory(SwiftShims)
add_subdirectory(core)
add_subdirectory(runtime)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(SWIFT_BUILD_SDK_OVERLAY)
add_subdirectory(SDK)
endif()
endif()

3 changes: 3 additions & 0 deletions stdlib/public/README.txt
@@ -0,0 +1,3 @@
The modules in the 'stdlib/public' directory are shipped publicly
as a part of Apple Swift.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -26,7 +26,7 @@
#include "Debug.h"
#include "ExistentialMetadataImpl.h"
#include "Private.h"
#include "../shims/RuntimeShims.h"
#include "../SwiftShims/RuntimeShims.h"
#include "stddef.h"

#if defined(__APPLE__) && defined(__MACH__)
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions stdlib/public/runtime/Demangle.cpp
@@ -0,0 +1,2 @@
#include "../../../lib/Basic/Demangle.cpp"
#include "../../../lib/Basic/Punycode.cpp"
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -15,7 +15,7 @@
// defined here.
//
//===----------------------------------------------------------------------===//
#include "../shims/GlobalObjects.h"
#include "../SwiftShims/GlobalObjects.h"
#include "swift/Runtime/Metadata.h"

namespace swift {
Expand Down
File renamed without changes.
Expand Up @@ -28,7 +28,7 @@
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include "../shims/RuntimeShims.h"
#include "../SwiftShims/RuntimeShims.h"
#if SWIFT_OBJC_INTEROP
# include <objc/objc-runtime.h>
#endif
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -16,7 +16,7 @@

#include <type_traits>
#include <unistd.h>
#include "../shims/DarwinShims.h"
#include "../SwiftShims/DarwinShims.h"

static_assert(std::is_same<ssize_t, __swift_ssize_t>::value,
"__swift_ssize_t is wrong");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -29,7 +29,7 @@
#include "swift/Runtime/HeapObject.h"
#include "swift/Runtime/Metadata.h"
#include "swift/Runtime/ObjCBridge.h"
#include "../shims/RuntimeShims.h"
#include "../SwiftShims/RuntimeShims.h"
#include "Private.h"
#include "Debug.h"
#include <dlfcn.h>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions stdlib/runtime/Demangle.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion test/1_stdlib/Algorithm.swift
@@ -1,7 +1,7 @@
// RUN: %target-run-simple-swift

import StdlibUnittest
import SwiftUnstable
import SwiftPrivate

var Algorithm = TestSuite("Algorithm")

Expand Down
2 changes: 1 addition & 1 deletion test/1_stdlib/Character.swift
Expand Up @@ -4,7 +4,7 @@

import StdlibUnittest
import Swift
import SwiftUnstable
import SwiftPrivate

//===---
// Utilities.
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/AtomicInt.swift
Expand Up @@ -4,7 +4,7 @@
// RUN: %target-build-swift -module-name a %s -o %t.out -O
// RUN: %target-run %t.out

import SwiftUnstable
import SwiftPrivate
import StdlibUnittest

final class HeapBool {
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/Hashing.swift
@@ -1,7 +1,7 @@
// RUN: %target-run-stdlib-swift

import Swift
import SwiftUnstable
import SwiftPrivate
import StdlibUnittest

var HashingTestSuite = TestSuite("Hashing")
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/HashingAvalanche.swift
@@ -1,7 +1,7 @@
// RUN: %target-build-swift -Xfrontend -disable-access-control -module-name a %s -o %t.out -O
// RUN: %target-run %t.out

import SwiftUnstable
import SwiftPrivate
import StdlibUnittest

var HashingTestSuite = TestSuite("Hashing")
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/StdlibUnittest.swift
@@ -1,6 +1,6 @@
// RUN: %target-run-simple-swift | FileCheck %s

import SwiftUnstable
import SwiftPrivate
import StdlibUnittest

_setOverrideOSVersion(.OSX(major: 10, minor: 9, bugFix: 3))
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/StringSlicesConcurrentAppend.swift
@@ -1,7 +1,7 @@
// RUN: %target-run-simple-swift

import StdlibUnittest
import SwiftUnstablePthreadExtras
import SwiftPrivatePthreadExtras
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/Unicode.swift
Expand Up @@ -3,7 +3,7 @@
// FIXME: rdar://problem/19648117 Needs splitting objc parts out
// XFAIL: linux

import SwiftUnstable
import SwiftPrivate
import StdlibUnittest
import Foundation

Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/UnicodeTrie.swift.gyb
Expand Up @@ -26,7 +26,7 @@ grapheme_cluster_break_property_table = \

}%

import SwiftUnstable
import SwiftPrivate
import StdlibUnittest
import Darwin
import Foundation
Expand Down

0 comments on commit 350248d

Please sign in to comment.