|
| 1 | +load("@bazel_sonarqube//:defs.bzl", "sonarqube") |
| 2 | + |
| 3 | +# Generating Sonar coverage report |
| 4 | +filegroup( |
| 5 | + name = "test_reports", |
| 6 | + srcs = glob(["bazel-testlogs/**/test.xml"], allow_empty = True), |
| 7 | + tags = ["manual"], |
| 8 | +) |
| 9 | + |
| 10 | +filegroup( |
| 11 | + name = "coverage_report", |
| 12 | + srcs = ["bazel-out/_coverage/_coverage_report.dat"], |
| 13 | + tags = ["manual"], |
| 14 | +) |
| 15 | + |
| 16 | +filegroup( |
| 17 | + name = "git", |
| 18 | + srcs = glob([".git/**"], exclude = [".git/**/*[*]"]), |
| 19 | + tags = ["manial"], |
| 20 | +) |
| 21 | + |
| 22 | +sonarqube( |
| 23 | + name = "sq", |
| 24 | + srcs = ["//modules/API:sources"], |
| 25 | + project_key = "your_sonar_project_key", |
| 26 | + project_name = "Bazel-SwiftUI-template", |
| 27 | + test_srcs = ["//modules/API:testSources"], |
| 28 | + test_targets = ["//modules/API:APITestsLib"], |
| 29 | + sq_properties_template = "sonar-project.properties.tpl", |
| 30 | + test_reports = [":test_reports"], |
| 31 | + coverage_report = ":coverage_report", |
| 32 | + scm_info = [":git"], |
| 33 | + testonly = True, |
| 34 | +) |
| 35 | + |
| 36 | +load( |
| 37 | + "@rules_xcodeproj//xcodeproj:defs.bzl", |
| 38 | + "top_level_target", |
| 39 | + "xcodeproj", |
| 40 | +) |
| 41 | + |
| 42 | +# Xcode |
| 43 | + |
| 44 | +xcodeproj( |
| 45 | + name = "xcodeproj", |
| 46 | + project_name = "App", |
| 47 | + top_level_targets = [ |
| 48 | + top_level_target( |
| 49 | + "//app", |
| 50 | + target_environments = ["simulator"], |
| 51 | + ), |
| 52 | + top_level_target( |
| 53 | + "//modules/API:APITests", |
| 54 | + target_environments = ["simulator"], |
| 55 | + ), |
| 56 | + top_level_target( |
| 57 | + "//modules/Models:ModelsTests", |
| 58 | + target_environments = ["simulator"], |
| 59 | + ), |
| 60 | + ], |
| 61 | +) |
| 62 | + |
| 63 | +# tools |
| 64 | + |
| 65 | +genrule( |
| 66 | + name = "lint", |
| 67 | + srcs = [], |
| 68 | + outs = ["lint.sh"], |
| 69 | + cmd = """ |
| 70 | +echo "set -e" > "$@" |
| 71 | +echo "./$(location @buildifier_prebuilt//:buildifier) -lint fix -mode fix -r \\$$BUILD_WORKSPACE_DIRECTORY" >> "$@" |
| 72 | +echo "./$(location @SwiftLint//:swiftlint) --fix \\$$BUILD_WORKSPACE_DIRECTORY" >> "$@" |
| 73 | +""", |
| 74 | + executable = True, |
| 75 | + tools = [ |
| 76 | + "@SwiftLint//:swiftlint", |
| 77 | + "@buildifier_prebuilt//:buildifier", |
| 78 | + ], |
| 79 | +) |
0 commit comments