Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Reorganize and rename package targets #15

Merged
merged 4 commits into from
Mar 29, 2021
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
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Changed renderer to use `libgraphviz` instead of spawning separate processes.
#13 by @mattt.
- Changed package to produce a single library named `GraphViz` so that
`Dot`, `Tools`, and `GraphVizBuilder` need not be imported separately anymore.
#15 by @mattt.

## [0.2.0] - 2020-11-17

Expand Down
23 changes: 10 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ let package = Package(
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "GraphViz",
targets: ["GraphViz", "DOT", "Tools"]),
.library(
name: "GraphVizBuilder",
targets: ["GraphVizBuilder"]),
targets: ["GraphViz"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand All @@ -25,21 +22,21 @@ let package = Package(
]),
.target(
name: "GraphViz",
dependencies: ["Core", "DOT", "Builder", "Tools"]),
.target(
name: "Core",
dependencies: []),
.target(
name: "DOT",
dependencies: ["GraphViz"]),
dependencies: ["Core"]),
.target(
name: "Tools",
dependencies: ["GraphViz", "DOT", "Clibgraphviz"]),
name: "Builder",
dependencies: ["Core"]),
.target(
name: "GraphVizBuilder",
dependencies: ["GraphViz"]),
name: "Tools",
dependencies: ["Core", "DOT", "Clibgraphviz"]),
.testTarget(
name: "GraphVizTests",
dependencies: ["GraphViz", "DOT", "Tools"]),
.testTarget(
name: "GraphVizBuilderTests",
dependencies: ["GraphViz", "DOT", "GraphVizBuilder"]),
dependencies: ["Core", "DOT", "Builder", "Tools"]),
]
)
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ A Swift package for working with [GraphViz][graphviz].

```swift
import GraphViz
import DOT

var graph = Graph(directed: true)

Expand Down Expand Up @@ -49,12 +48,8 @@ digraph {

### Using Function Builders, Custom Operators, and Fluent Attribute Setters

To use the following interface,
add "GraphVizBuilder" to your package's dependencies
and replace `import GraphViz` with `import GraphVizBuilder` as needed.

```swift
import GraphVizBuilder
import GraphViz

let graph = Graph(directed: true) {
"a" --> "b"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

extension Edge {
public subscript<T>(dynamicMember member: WritableKeyPath<Attributes, T>) -> (T) -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

extension Graph {
typealias Fragment = GraphBuilder.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

extension Node {
public subscript<T>(dynamicMember member: WritableKeyPath<Attributes, T>) -> (T) -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

extension Subgraph {
typealias Fragment = SubgraphBuilder.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

public protocol GraphMember {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

infix operator <-- : AdditionPrecedence

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

infix operator <-> : AdditionPrecedence

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

infix operator --> : AdditionPrecedence

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

infix operator --- : AdditionPrecedence

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GraphViz
import Core

public protocol SubgraphMember {}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Sources/DOT/DOTEncoder.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@_exported import GraphViz
import Core

/// Creates DOT language representations of GraphViz graphs.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/DOT/DOTRepresentable.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GraphViz
import Foundation
import Core

protocol DOTRepresentable {
func representation(in graph: Graph) -> String?
Expand Down
4 changes: 4 additions & 0 deletions Sources/GraphViz/Graphviz.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@_exported import Core
@_exported import DOT
@_exported import Builder
@_exported import Tools
2 changes: 1 addition & 1 deletion Sources/Tools/Extensions/Graph+Rendering.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import GraphViz
import Core

extension Graph {
/**
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tools/Renderer.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import GraphViz
import Core
import DOT
import Clibgraphviz

Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/AttributesTest.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import GraphViz
@testable import Core

final class AttributesTests: XCTestCase {
func testGraphAttributesCompleteness() {
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/EdgeTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
import GraphViz
import Core
@testable import DOT

final class EdgeTests: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
import GraphViz
import Core
import DOT
@testable import GraphVizBuilder
@testable import Builder

// Workaround for "error: ambiguous reference to member '-->'" on Swift 5.1
#if swift(>=5.2)
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/GraphTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
import GraphViz
import Core
import DOT

final class GraphTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/NodeTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
import GraphViz
import Core
@testable import DOT

final class NodeTests: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/RenderingTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import GraphViz
@testable import Core
@testable import DOT
@testable import Tools

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
import GraphViz
import Core
@testable import DOT
@testable import GraphVizBuilder
@testable import Builder

// Workaround for "error: ambiguous reference to member '-->'" on Swift 5.1
#if swift(>=5.2)
Expand Down
2 changes: 1 addition & 1 deletion Tests/GraphVizTests/SubgraphTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
import GraphViz
import Core
@testable import DOT

final class SubgraphTests: XCTestCase {
Expand Down