Skip to content

Commit cdd4e80

Browse files
committed
Move swift/codegen to misc/codegen
1 parent 6d192cd commit cdd4e80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+116
-86
lines changed

.github/workflows/swift.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- "swift/**"
77
- "misc/bazel/**"
8+
- "misc/codegen/**"
89
- "*.bazel*"
910
- .github/workflows/swift.yml
1011
- .github/actions/**
@@ -19,6 +20,7 @@ on:
1920
paths:
2021
- "swift/**"
2122
- "misc/bazel/**"
23+
- "misc/codegen/**"
2224
- "*.bazel*"
2325
- .github/workflows/swift.yml
2426
- .github/actions/**

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ repos:
5353
name: Run Swift code generation unit tests
5454
files: ^swift/codegen/.*\.py$
5555
language: system
56-
entry: bazel test //swift/codegen/test
56+
entry: bazel test //misc/codegen/test
5757
pass_filenames: false

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/python/ @github/codeql-dynamic
77
/ruby/ @github/codeql-dynamic
88
/swift/ @github/codeql-swift
9+
/misc/codegen/ @github/codeql-swift
910
/java/kotlin-extractor/ @github/codeql-kotlin
1011
/java/kotlin-explorer/ @github/codeql-kotlin
1112

misc/bazel/workspace.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ def codeql_workspace(repository_name = "codeql"):
3333
"https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.1.tar.gz",
3434
],
3535
)
36+
37+
maybe(
38+
repo_rule = http_archive,
39+
name = "bazel_skylib",
40+
sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
41+
urls = [
42+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
43+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
44+
],
45+
)

misc/bazel/workspace_deps.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
22
load("@rules_python//python:pip.bzl", "pip_install")
3+
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
34

45
def codeql_workspace_deps(repository_name = "codeql"):
56
pip_install(
6-
name = "swift_codegen_deps",
7-
requirements = "@%s//swift/codegen:requirements.txt" % repository_name,
7+
name = "codegen_deps",
8+
requirements = "@%s//misc/codegen:requirements.txt" % repository_name,
89
)
10+
bazel_skylib_workspace()
911
rules_pkg_dependencies()
File renamed without changes.

misc/codegen/BUILD.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@codegen_deps//:requirements.bzl", "requirement")
2+
3+
py_binary(
4+
name = "codegen",
5+
srcs = ["codegen.py"],
6+
data = [
7+
"//misc/codegen/templates:cpp",
8+
"//misc/codegen/templates:trap",
9+
],
10+
visibility = ["//visibility:public"],
11+
deps = [
12+
"//misc/codegen/generators",
13+
],
14+
)

swift/codegen/README.md renamed to misc/codegen/README.md

Lines changed: 4 additions & 4 deletions

swift/codegen/codegen.py renamed to misc/codegen/codegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
_repo_root = pathlib.Path(__file__).resolve().parents[2]
1515
sys.path.append(str(_repo_root))
1616

17-
from swift.codegen.lib import render, paths
18-
from swift.codegen.generators import generate
17+
from misc.codegen.lib import render, paths
18+
from misc.codegen.generators import generate
1919

2020

2121
def _parse_args() -> argparse.Namespace:

misc/codegen/generators/BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load("@codegen_deps//:requirements.bzl", "requirement")
2+
3+
py_library(
4+
name = "generators",
5+
srcs = glob(["*.py"]),
6+
visibility = ["//misc/codegen:__subpackages__"],
7+
deps = [
8+
"//misc/codegen/lib",
9+
"//misc/codegen/loaders",
10+
],
11+
)

0 commit comments

Comments
 (0)