Skip to content

Commit

Permalink
See issue #77: Starting to create some files - but hard to download f…
Browse files Browse the repository at this point in the history
…rom Homebrew

- Need to have a Swift compilation working, so we can build locally
  • Loading branch information
sureshjoshi committed Aug 6, 2022
1 parent bdcdeca commit 0d0a9f1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pants-plugins/experimental/swift/lint/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources()
Empty file.
9 changes: 9 additions & 0 deletions pants-plugins/experimental/swift/lint/swiftformat/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_tests(
name="tests",
overrides={
"rules_integration_test.py": {"timeout": 240},
},
)
Empty file.
24 changes: 24 additions & 0 deletions pants-plugins/experimental/swift/lint/swiftformat/skip_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import annotations

from typing import Iterable

from experimental.swift.target_types import SwiftSourcesGeneratorTarget, SwiftSourceTarget
from pants.engine.rules import Rule
from pants.engine.target import BoolField
from pants.engine.unions import UnionRule


class SkipSwiftFormatField(BoolField):
alias = "skip_swift_format"
default = False
help = "If true, don't run swift-format on this target's code."


def rules() -> Iterable[Rule | UnionRule]:
return (
SwiftSourcesGeneratorTarget.register_plugin_field(SkipSwiftFormatField),
SwiftSourceTarget.register_plugin_field(SkipSwiftFormatField),
)

0 comments on commit 0d0a9f1

Please sign in to comment.