Skip to content

Commit

Permalink
Generate 3rdparty for scala_proto & scalafmt (#46)
Browse files Browse the repository at this point in the history
* generate deps for scalafmt

* generate deps for scalafmt

* generate deps for scala_proto

* extra dependencies removed from 3rdparty

---------

Co-authored-by: anna-skrodzka <annaskrod@h=gmail.com>
  • Loading branch information
anna-skrodzka and anna-skrodzka authored Oct 22, 2024
1 parent 2f5461a commit 7cc5b41
Show file tree
Hide file tree
Showing 27 changed files with 502 additions and 45 deletions.
19 changes: 4 additions & 15 deletions 3rdparty/jvm/org/scala_lang/BUILD
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")

scala_import(
name = "scala3_library",
visibility = [
"//3rdparty/jvm:__subpackages__",
],
exports = [
"@scala3_library//jar",
"@scala3_library//jar"
],
)

scala_import(
name = "scala_library",
visibility = [
"//3rdparty/jvm:__subpackages__",
],
exports = [
"@scala_library_2_13//jar",
],
)
"//3rdparty/jvm:__subpackages__"
]
)
7 changes: 0 additions & 7 deletions 3rdparty/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,13 @@ def jar_artifact_callback(hash):
def list_dependencies():
return [
{"artifact":"com.github.scopt:scopt_3:4.1.0","url":"https://repo1.maven.org/maven2/com/github/scopt/scopt_3/4.1.0/scopt_3-4.1.0.jar","name":"com_github_scopt_scopt_3","actual":"@com_github_scopt_scopt_3//jar","bind": "jar/com/github/scopt/scopt_3"},
{"artifact":"com.google.protobuf:protobuf-java:4.28.2","url":"https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/4.28.2/protobuf-java-4.28.2.jar","name":"com_google_protobuf_protobuf_java","actual":"@com_google_protobuf_protobuf_java//jar","bind": "jar/com/google/protobuf/protobuf_java"},
{"artifact":"com.thesamet.scalapb:compilerplugin_3:1.0.0-alpha.1","url":"https://repo1.maven.org/maven2/com/thesamet/scalapb/compilerplugin_3/1.0.0-alpha.1/compilerplugin_3-1.0.0-alpha.1.jar","name":"com_thesamet_scalapb_compilerplugin_3","actual":"@com_thesamet_scalapb_compilerplugin_3//jar","bind": "jar/com/thesamet/scalapb/compilerplugin_3"},
{"artifact":"com.thesamet.scalapb.grpcweb:scalapb-grpcweb-code-gen_3:0.7.0","url":"https://repo1.maven.org/maven2/com/thesamet/scalapb/grpcweb/scalapb-grpcweb-code-gen_3/0.7.0/scalapb-grpcweb-code-gen_3-0.7.0.jar","name":"com_thesamet_scalapb_grpcweb_scalapb_grpcweb_code_gen_3","actual":"@com_thesamet_scalapb_grpcweb_scalapb_grpcweb_code_gen_3//jar","bind": "jar/com/thesamet/scalapb/grpcweb/scalapb_grpcweb_code_gen_3"},
{"artifact":"com.thesamet.scalapb:protoc-bridge_2.13:0.9.7","url":"https://repo1.maven.org/maven2/com/thesamet/scalapb/protoc-bridge_2.13/0.9.7/protoc-bridge_2.13-0.9.7.jar","name":"com_thesamet_scalapb_protoc_bridge_2_13","actual":"@com_thesamet_scalapb_protoc_bridge_2_13//jar","bind": "jar/com/thesamet/scalapb/protoc_bridge_2_13"},
{"artifact":"com.thesamet.scalapb:protoc-gen_2.13:0.9.7","url":"https://repo1.maven.org/maven2/com/thesamet/scalapb/protoc-gen_2.13/0.9.7/protoc-gen_2.13-0.9.7.jar","name":"com_thesamet_scalapb_protoc_gen_2_13","actual":"@com_thesamet_scalapb_protoc_gen_2_13//jar","bind": "jar/com/thesamet/scalapb/protoc_gen_2_13"},
{"artifact":"dev.dirs:directories:26","url":"https://repo1.maven.org/maven2/dev/dirs/directories/26/directories-26.jar","name":"dev_dirs_directories","actual":"@dev_dirs_directories//jar","bind": "jar/dev/dirs/directories"},
{"artifact":"net.sf.jopt-simple:jopt-simple:5.0.4","url":"https://repo1.maven.org/maven2/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar","name":"net_sf_jopt_simple_jopt_simple","actual":"@net_sf_jopt_simple_jopt_simple//jar","bind": "jar/net/sf/jopt_simple/jopt_simple"},
{"artifact":"org.apache.commons:commons-math3:3.6.1","url":"https://repo1.maven.org/maven2/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar","name":"org_apache_commons_commons_math3","actual":"@org_apache_commons_commons_math3//jar","bind": "jar/org/apache/commons/commons_math3"},
{"artifact":"org.openjdk.jmh:jmh-core:1.37","url":"https://repo1.maven.org/maven2/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar","name":"org_openjdk_jmh_jmh_core","actual":"@org_openjdk_jmh_jmh_core//jar","bind": "jar/org/openjdk/jmh/jmh_core"},
{"artifact":"org.openjdk.jmh:jmh-generator-asm:1.37","url":"https://repo1.maven.org/maven2/org/openjdk/jmh/jmh-generator-asm/1.37/jmh-generator-asm-1.37.jar","name":"org_openjdk_jmh_jmh_generator_asm","actual":"@org_openjdk_jmh_jmh_generator_asm//jar","bind": "jar/org/openjdk/jmh/jmh_generator_asm"},
{"artifact":"org.openjdk.jmh:jmh-generator-bytecode:1.37","url":"https://repo1.maven.org/maven2/org/openjdk/jmh/jmh-generator-bytecode/1.37/jmh-generator-bytecode-1.37.jar","name":"org_openjdk_jmh_jmh_generator_bytecode","actual":"@org_openjdk_jmh_jmh_generator_bytecode//jar","bind": "jar/org/openjdk/jmh/jmh_generator_bytecode"},
{"artifact":"org.openjdk.jmh:jmh-generator-reflection:1.37","url":"https://repo1.maven.org/maven2/org/openjdk/jmh/jmh-generator-reflection/1.37/jmh-generator-reflection-1.37.jar","name":"org_openjdk_jmh_jmh_generator_reflection","actual":"@org_openjdk_jmh_jmh_generator_reflection//jar","bind": "jar/org/openjdk/jmh/jmh_generator_reflection"},
{"artifact":"org.ow2.asm:asm:9.0","url":"https://repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar","name":"org_ow2_asm_asm","actual":"@org_ow2_asm_asm//jar","bind": "jar/org/ow2/asm/asm"},
{"artifact":"org.scala-lang.modules:scala-collection-compat_3:2.12.0","url":"https://repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.12.0/scala-collection-compat_3-2.12.0.jar","name":"org_scala_lang_modules_scala_collection_compat_3","actual":"@org_scala_lang_modules_scala_collection_compat_3//jar","bind": "jar/org/scala_lang/modules/scala_collection_compat_3"},
]

def maven_dependencies(callback = jar_artifact_callback):
Expand Down
8 changes: 8 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ load("//scala/3rdparty:workspace.bzl", "maven_dependencies")

maven_dependencies()

load("//rules/scalafmt/3rdparty:workspace.bzl", "maven_dependencies")

maven_dependencies()

load("//rules/scala_proto/3rdparty:workspace.bzl", "maven_dependencies")

maven_dependencies()

load("//mezel_compatibility:repositories.bzl", "mezel_compatibility_repository")

mezel_compatibility_repository(
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ java_import(
"//external:jar/com/google/protobuf/protobuf_java"
],
visibility = [
"//3rdparty/jvm:__subpackages__"
"//rules/scala_proto/3rdparty/jvm:__subpackages__"
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ scala_import(
"//external:jar/com/thesamet/scalapb/compilerplugin_3"
],
runtime_deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scala_lang/modules:scala_collection_compat",
"//3rdparty/jvm/org/scala_lang:scala3_library",
"//rules/scala_proto/3rdparty/jvm/com/google/protobuf:protobuf_java",
"//rules/scala_proto/3rdparty/jvm/org/scala_lang/modules:scala_collection_compat",
"//rules/scala_proto/3rdparty/jvm/org/scala_lang:scala3_library",
":protoc_gen"
],
visibility = [
Expand All @@ -21,8 +21,8 @@ scala_import(
"//external:jar/com/thesamet/scalapb/protoc_bridge_2_13"
],
runtime_deps = [
"//3rdparty/jvm/dev/dirs:directories",
"//3rdparty/jvm/org/scala_lang:scala_library"
"//rules/scala_proto/3rdparty/jvm/dev/dirs:directories",
"//rules/scala_proto/3rdparty/jvm/org/scala_lang:scala_library"
],
visibility = [
"//visibility:public"
Expand All @@ -35,7 +35,7 @@ scala_import(
"//external:jar/com/thesamet/scalapb/protoc_gen_2_13"
],
runtime_deps = [
"//3rdparty/jvm/org/scala_lang:scala_library",
"//rules/scala_proto/3rdparty/jvm/org/scala_lang:scala_library",
":protoc_bridge"
],
visibility = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ scala_import(
"//external:jar/com/thesamet/scalapb/grpcweb/scalapb_grpcweb_code_gen_3"
],
runtime_deps = [
"//3rdparty/jvm/com/thesamet/scalapb:compilerplugin",
"//3rdparty/jvm/org/scala_lang:scala3_library"
"//rules/scala_proto/3rdparty/jvm/com/thesamet/scalapb:compilerplugin",
"//rules/scala_proto/3rdparty/jvm/org/scala_lang:scala3_library"
],
visibility = [
"//visibility:public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ java_import(
"//external:jar/dev/dirs/directories"
],
visibility = [
"//3rdparty/jvm:__subpackages__"
"//rules/scala_proto/3rdparty/jvm:__subpackages__"
]
)
20 changes: 20 additions & 0 deletions rules/scala_proto/3rdparty/jvm/org/scala_lang/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
scala_import(
name = "scala3_library",
exports = [
"@scala3_library//jar"
],
visibility = [
"//rules/scala_proto/3rdparty/jvm:__subpackages__"
]
)

scala_import(
name = "scala_library",
exports = [
"@scala_library_2_13//jar"
],
visibility = [
"//rules/scala_proto/3rdparty/jvm:__subpackages__"
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ scala_import(
"//external:jar/org/scala_lang/modules/scala_collection_compat_3"
],
runtime_deps = [
"//3rdparty/jvm/org/scala_lang:scala3_library"
"//rules/scala_proto/3rdparty/jvm/org/scala_lang:scala3_library"
],
visibility = [
"//3rdparty/jvm:__subpackages__"
"//rules/scala_proto/3rdparty/jvm:__subpackages__"
]
)
54 changes: 54 additions & 0 deletions rules/scala_proto/3rdparty/workspace.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Do not edit. rules_scala3 autogenerates this file
def _jar_artifact_impl(ctx):
jar_name = "%s.jar" % ctx.name
ctx.download(
output = ctx.path("jar/%s" % jar_name),
url = ctx.attr.urls,
executable = False,
)
build_file_contents = """
package(default_visibility = ['//visibility:public'])
filegroup(
name = 'jar',
srcs = ['{jar_name}'],
visibility = ['//visibility:public'],
)
alias(
name = "file",
actual = ":jar",
visibility = ["//visibility:public"],
)\n""".format(artifact = ctx.attr.artifact, jar_name = jar_name)
ctx.file(ctx.path("jar/BUILD"), build_file_contents, False)
return None

jar_artifact = repository_rule(
attrs = {
"artifact": attr.string(mandatory = True),
"urls": attr.string_list(mandatory = True),
},
implementation = _jar_artifact_impl,
)

def jar_artifact_callback(hash):
jar_artifact(
artifact = hash["artifact"],
name = hash["name"],
urls = [hash["url"]],
)
native.bind(name = hash["bind"], actual = hash["actual"])


def list_dependencies():
return [
{"artifact":"com.google.protobuf:protobuf-java:4.28.2","url":"https://oss.sonatype.org/service/local/repositories/releases/content/com/google/protobuf/protobuf-java/4.28.2/protobuf-java-4.28.2.jar","name":"com_google_protobuf_protobuf_java","actual":"@com_google_protobuf_protobuf_java//jar","bind": "jar/com/google/protobuf/protobuf_java"},
{"artifact":"com.thesamet.scalapb:compilerplugin_3:1.0.0-alpha.1","url":"https://oss.sonatype.org/service/local/repositories/releases/content/com/thesamet/scalapb/compilerplugin_3/1.0.0-alpha.1/compilerplugin_3-1.0.0-alpha.1.jar","name":"com_thesamet_scalapb_compilerplugin_3","actual":"@com_thesamet_scalapb_compilerplugin_3//jar","bind": "jar/com/thesamet/scalapb/compilerplugin_3"},
{"artifact":"com.thesamet.scalapb.grpcweb:scalapb-grpcweb-code-gen_3:0.7.0","url":"https://oss.sonatype.org/service/local/repositories/releases/content/com/thesamet/scalapb/grpcweb/scalapb-grpcweb-code-gen_3/0.7.0/scalapb-grpcweb-code-gen_3-0.7.0.jar","name":"com_thesamet_scalapb_grpcweb_scalapb_grpcweb_code_gen_3","actual":"@com_thesamet_scalapb_grpcweb_scalapb_grpcweb_code_gen_3//jar","bind": "jar/com/thesamet/scalapb/grpcweb/scalapb_grpcweb_code_gen_3"},
{"artifact":"com.thesamet.scalapb:protoc-bridge_2.13:0.9.7","url":"https://oss.sonatype.org/service/local/repositories/releases/content/com/thesamet/scalapb/protoc-bridge_2.13/0.9.7/protoc-bridge_2.13-0.9.7.jar","name":"com_thesamet_scalapb_protoc_bridge_2_13","actual":"@com_thesamet_scalapb_protoc_bridge_2_13//jar","bind": "jar/com/thesamet/scalapb/protoc_bridge_2_13"},
{"artifact":"com.thesamet.scalapb:protoc-gen_2.13:0.9.7","url":"https://oss.sonatype.org/service/local/repositories/releases/content/com/thesamet/scalapb/protoc-gen_2.13/0.9.7/protoc-gen_2.13-0.9.7.jar","name":"com_thesamet_scalapb_protoc_gen_2_13","actual":"@com_thesamet_scalapb_protoc_gen_2_13//jar","bind": "jar/com/thesamet/scalapb/protoc_gen_2_13"},
{"artifact":"dev.dirs:directories:26","url":"https://oss.sonatype.org/service/local/repositories/releases/content/dev/dirs/directories/26/directories-26.jar","name":"dev_dirs_directories","actual":"@dev_dirs_directories//jar","bind": "jar/dev/dirs/directories"},
{"artifact":"org.scala-lang.modules:scala-collection-compat_3:2.12.0","url":"https://oss.sonatype.org/service/local/repositories/releases/content/org/scala-lang/modules/scala-collection-compat_3/2.12.0/scala-collection-compat_3-2.12.0.jar","name":"org_scala_lang_modules_scala_collection_compat_3","actual":"@org_scala_lang_modules_scala_collection_compat_3//jar","bind": "jar/org/scala_lang/modules/scala_collection_compat_3"},
]

def maven_dependencies(callback = jar_artifact_callback):
for hash in list_dependencies():
callback(hash)
8 changes: 4 additions & 4 deletions rules/scala_proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ scala_binary(
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/github/scopt",
"//3rdparty/jvm/com/thesamet/scalapb:compilerplugin",
"//3rdparty/jvm/com/thesamet/scalapb:protoc_bridge",
"//3rdparty/jvm/com/thesamet/scalapb:protoc_gen",
"//3rdparty/jvm/com/thesamet/scalapb/grpcweb:scalapb_grpcweb_code_gen",
"//rules/scala_proto/3rdparty/jvm/com/thesamet/scalapb:compilerplugin",
"//rules/scala_proto/3rdparty/jvm/com/thesamet/scalapb:protoc_bridge",
"//rules/scala_proto/3rdparty/jvm/com/thesamet/scalapb:protoc_gen",
"//rules/scala_proto/3rdparty/jvm/com/thesamet/scalapb/grpcweb:scalapb_grpcweb_code_gen",
"//scala/common/worker",
"//scala/workers/common",
],
Expand Down
4 changes: 2 additions & 2 deletions rules/scala_proto/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Dependencies:
)
val dependencies: Seq[ModuleID] = Vector(
"com.thesamet.scalapb" %% "compilerplugin" % scalapbV,
"com.thesamet.scalapb" %% "protoc-bridge_2.13" % protocBridgeV,
"com.thesamet.scalapb" %% "protoc-gen_2.13" % protocBridgeV,
"com.thesamet.scalapb" % "protoc-bridge_2.13" % protocBridgeV,
"com.thesamet.scalapb" % "protoc-gen_2.13" % protocBridgeV,
"com.thesamet.scalapb.grpcweb" %% "scalapb-grpcweb-code-gen" % grpcwebV
)
Empty file added rules/scalafmt/3rdparty/BUILD
Empty file.
49 changes: 49 additions & 0 deletions rules/scalafmt/3rdparty/jvm/com/geirsson/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")

scala_import(
name = "metaconfig_core",
jars = [
"//external:jar/com/geirsson/metaconfig_core_2_13",
],
visibility = [
"//visibility:public",
],
runtime_deps = [
":metaconfig_pprint",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_library",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_reflect",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang/modules:scala_collection_compat",
"//rules/scalafmt/3rdparty/jvm/org/typelevel:paiges_core",
],
)

scala_import(
name = "metaconfig_pprint",
jars = [
"//external:jar/com/geirsson/metaconfig_pprint_2_13",
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__",
],
runtime_deps = [
"//rules/scalafmt/3rdparty/jvm/com/lihaoyi:fansi",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_compiler",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_library",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_reflect",
],
)

scala_import(
name = "metaconfig_typesafe_config",
jars = [
"//external:jar/com/geirsson/metaconfig_typesafe_config_2_13",
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__",
],
runtime_deps = [
":metaconfig_core",
"//rules/scalafmt/3rdparty/jvm/com/typesafe:config",
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_library",
],
)
27 changes: 27 additions & 0 deletions rules/scalafmt/3rdparty/jvm/com/lihaoyi/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
scala_import(
name = "fansi",
jars = [
"//external:jar/com/lihaoyi/fansi_2_13"
],
runtime_deps = [
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_library",
":sourcecode"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)

scala_import(
name = "sourcecode",
jars = [
"//external:jar/com/lihaoyi/sourcecode_2_13"
],
runtime_deps = [
"//rules/scalafmt/3rdparty/jvm/org/scala_lang:scala_library"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)
10 changes: 10 additions & 0 deletions rules/scalafmt/3rdparty/jvm/com/typesafe/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
java_import(
name = "config",
jars = [
"//external:jar/com/typesafe/config"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)
10 changes: 10 additions & 0 deletions rules/scalafmt/3rdparty/jvm/io/github/java_diff_utils/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
java_import(
name = "java_diff_utils",
jars = [
"//external:jar/io/github/java_diff_utils/java_diff_utils"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)
10 changes: 10 additions & 0 deletions rules/scalafmt/3rdparty/jvm/net/java/dev/jna/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
java_import(
name = "jna",
jars = [
"//external:jar/net/java/dev/jna/jna"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)
10 changes: 10 additions & 0 deletions rules/scalafmt/3rdparty/jvm/org/jline/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@rules_scala3//rules:scala.bzl", "scala_import")
java_import(
name = "jline",
jars = [
"//external:jar/org/jline/jline"
],
visibility = [
"//rules/scalafmt/3rdparty/jvm:__subpackages__"
]
)
Loading

0 comments on commit 7cc5b41

Please sign in to comment.