Skip to content

Commit 514e24c

Browse files
committed
Kotlin: bring back lazy LFS dependencies
This reverts commit d7ecaae. Problems with lazy LFS rules were solved by github#16393 and github#16434.
1 parent 239b6d8 commit 514e24c

Some content is hidden

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

41 files changed

+135
-90
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
/java/ql/test/stubs/**/*.java linguist-generated=true
5454
/java/ql/test/experimental/stubs/**/*.java linguist-generated=true
55+
/java/kotlin-extractor/deps/*.jar filter=lfs diff=lfs merge=lfs -text
5556

5657
# Force git not to modify line endings for go or html files under the go/ql directory
5758
/go/ql/**/*.go -text

java/kotlin-extractor/deps.bzl

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("//java/kotlin-extractor:versions.bzl", "VERSIONS", "version_less")
2+
load("//misc/bazel:lfs.bzl", "lfs_smudge")
23

34
_kotlin_dep_build = """
45
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import")
@@ -12,28 +13,12 @@ kt_jvm_import(
1213

1314
_empty_zip = "PK\005\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
1415

15-
_local_path = "{root}/resources/kotlin-dependencies/kotlin-{kind}-{version}.jar"
16-
_maven_url = "https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-{kind}/{version}/kotlin-{kind}-{version}.jar"
16+
def _get_dep(repository_ctx, name):
17+
return repository_ctx.path(Label("//java/kotlin-extractor/deps:%s" % name))
1718

1819
def _kotlin_dep_impl(repository_ctx):
1920
_, _, name = repository_ctx.name.rpartition("~")
20-
kind = repository_ctx.attr.kind
21-
version = repository_ctx.attr.version
22-
filename = "kotlin-%s-%s.jar" % (kind, version)
23-
local_path = _local_path.format(root = repository_ctx.workspace_root, kind = kind, version = version)
24-
if repository_ctx.path(local_path).exists:
25-
url = "file://%s" % local_path
26-
else:
27-
url = _maven_url.format(kind = kind, version = version)
28-
29-
sha256 = VERSIONS[version].get(kind, "")
30-
res = repository_ctx.download(url, output = filename, sha256 = sha256)
31-
if not sha256:
32-
fail('\nPlease add\n "%s": "%s",\nto VERSIONS["%s"] in java/kotlin-extractor/versions.bzl' % (
33-
kind,
34-
res.sha256,
35-
version,
36-
))
21+
lfs_smudge(repository_ctx, [_get_dep(repository_ctx, name + ".jar")])
3722

3823
# for some reason rules_kotlin warns about these jars missing, this is to silence those warnings
3924
repository_ctx.file("empty.zip", _empty_zip)
@@ -49,10 +34,6 @@ def _kotlin_dep_impl(repository_ctx):
4934

5035
_kotlin_dep = repository_rule(
5136
implementation = _kotlin_dep_impl,
52-
attrs = {
53-
"kind": attr.string(),
54-
"version": attr.string(),
55-
},
5637
)
5738

5839
def _walk(dir):
@@ -140,7 +121,7 @@ _defaults = repository_rule(implementation = _defaults_impl)
140121
def _kotlin_deps_impl(module_ctx):
141122
for v in VERSIONS:
142123
for lib in ("compiler", "compiler-embeddable", "stdlib"):
143-
_kotlin_dep(name = "kotlin-%s-%s" % (lib, v), kind = lib, version = v)
124+
_kotlin_dep(name = "kotlin-%s-%s" % (lib, v))
144125
_embeddable_source(name = "codeql_kotlin_embeddable")
145126
_defaults(name = "codeql_kotlin_defaults")
146127
return module_ctx.extension_metadata(

java/kotlin-extractor/deps/BUILD.bazel

Whitespace-only changes.

java/kotlin-extractor/deps/LICENSE.md

Lines changed: 7 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:f6e4a2c4394e77f937fcffda0036531604f25cc7c8de8daea098e1aa31f1d248
3+
size 47816554
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:dfefb1aa8bec81256617c8ceb577373e44078b7e21024625da50e376037e9ae5
3+
size 47822093
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:a0ae437d1b670a5ba6da7893b7023df649c4ab2e6c19d5e9b4eee5332e1cde1f
3+
size 49012794
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:487d8ff9766a6ba570cd15c5225c1600654e7cf1b6ef2b92ed6905528a3e838a
3+
size 49509580
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:4bd7a92568fd89c23b7f9f36d4380886beed18d3d54ea6adf49bebae627db805
3+
size 51408858
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:90567c5cf297985d028fa39aa3a7904dc8096173e1c7f3d3f35fe7074581098e
3+
size 53370229

0 commit comments

Comments
 (0)