Skip to content

Commit

Permalink
minimal DocC markdown to order Logger.Levels (#225)
Browse files Browse the repository at this point in the history
* minimal DocC markdown to order Logger.Levels

Motivation:

When viewed in documentation generated by DocC, the enumeration levels
are ordered alphabetically, removintg the implied ordering in the
source. The written overview of the enum relies on that ordering to make
sense.

Modifications:

Adding a single file that provides structure to Logging/Logger/Levels
within DocC generated documentation.

Result:

When imported into a project that leverages Swift 5.6 (such as Vapor),
the generated documentation for the levels provided by
Logging/Logger/Levels are displayed in the order intended/expected by
the documentation.

* Adding a Swift 5.6 version of Package.swift

Motivation:

Per DocC team, an updated version is required for the DocC changes
to be picked up and reflected in generated dcumentation, even for
upstream projects already using swift 5.6 or later.

Modifications:

Adding Package.Swift@5.6 with the swift version updated.

Result:

Hopefully, documentation updates in DocC generated content will be
reflected.

* Updating linuxmain test generation for <swift5.6

Motivation:

To appease CI, added #if statements into generated LinuxMain
content to handle conditional compilation with Swift 5.6 and later.

Modifications:

Added #if statements to test generating script and re-ran the script

Result:

CI will hopefully pass.

* also guard the LinuxMain file

* Force using test discovery on 5.6+ even though tools version is latest
but LinuxMain exists

* cleanup

* simplify docc links

* formatting revert

* ignore Package-swift5.6.swift from soundness license check

Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
  • Loading branch information
heckj and ktoso authored Jul 20, 2022
1 parent f2e8667 commit 8fc79ca
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 5 deletions.
33 changes: 33 additions & 0 deletions Package@swift-5.6.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.6
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Logging API open source project
//
// Copyright (c) 2018-2019 Apple Inc. and the Swift Logging API project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import PackageDescription

let package = Package(
name: "swift-log",
products: [
.library(name: "Logging", targets: ["Logging"]),
],
targets: [
.target(
name: "Logging",
dependencies: []
),
.testTarget(
name: "LoggingTests",
dependencies: ["Logging"]
),
]
)
13 changes: 13 additions & 0 deletions Sources/Logging/Documentation.docc/Logger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ``Logging/Logger/Level``

## Topics

### Log levels

- ``trace``
- ``debug``
- ``info``
- ``notice``
- ``warning``
- ``error``
- ``critical``
3 changes: 2 additions & 1 deletion docker/docker-compose.2004.56.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ services:

test:
image: swift-log:20.04-5.6
environment: []
environment:
- FORCE_TEST_DISCOVERY=--enable-test-discovery
#- SANITIZER_ARG=--sanitize=thread

shell:
Expand Down
3 changes: 2 additions & 1 deletion docker/docker-compose.2004.57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ services:

test:
image: swift-log:20.04-5.7
environment: []
environment:
- FORCE_TEST_DISCOVERY=--enable-test-discovery
#- SANITIZER_ARG=--sanitize=thread

shell:
Expand Down
3 changes: 2 additions & 1 deletion docker/docker-compose.2004.main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ services:

test:
image: swift-log:20.04-main
environment: []
environment:
- FORCE_TEST_DISCOVERY=--enable-test-discovery
#- SANITIZER_ARG=--sanitize=thread

shell:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:

test:
<<: *common
command: /bin/bash -xcl "swift test -Xswiftc -warnings-as-errors $${SANITIZER_ARG-}"
command: /bin/bash -xcl "swift test -Xswiftc -warnings-as-errors $${FORCE_TEST_DISCOVERY-} $${SANITIZER_ARG-}"

# util

Expand Down
2 changes: 1 addition & 1 deletion scripts/soundness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ for language in swift-or-c bash dtrace; do
matching_files=( -name '*' )
case "$language" in
swift-or-c)
exceptions=( -name c_nio_http_parser.c -o -name c_nio_http_parser.h -o -name cpp_magic.h -o -name Package.swift -o -name CNIOSHA1.h -o -name c_nio_sha1.c -o -name ifaddrs-android.c -o -name ifaddrs-android.h)
exceptions=( -name c_nio_http_parser.c -o -name c_nio_http_parser.h -o -name cpp_magic.h -o -name Package.swift -o name Package-swift5.6.swift -o -name CNIOSHA1.h -o -name c_nio_sha1.c -o -name ifaddrs-android.c -o -name ifaddrs-android.h)
matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' )
cat > "$tmp" <<"EOF"
//===----------------------------------------------------------------------===//
Expand Down

0 comments on commit 8fc79ca

Please sign in to comment.