|
| 1 | +load( |
| 2 | + "//scala:scala_cross_version.bzl", |
| 3 | + _default_scala_version = "default_scala_version", |
| 4 | + _extract_major_version = "extract_major_version", |
| 5 | + _scala_mvn_artifact = "scala_mvn_artifact", |
| 6 | +) |
| 7 | +load( |
| 8 | + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", |
| 9 | + _scala_maven_import_external = "scala_maven_import_external", |
| 10 | +) |
| 11 | + |
| 12 | +def scalafmt_default_config(path = ".scalafmt.conf"): |
| 13 | + build = [] |
| 14 | + build.append("filegroup(") |
| 15 | + build.append(" name = \"config\",") |
| 16 | + build.append(" srcs = [\"{}\"],".format(path)) |
| 17 | + build.append(" visibility = [\"//visibility:public\"],") |
| 18 | + build.append(")") |
| 19 | + native.new_local_repository(name = "scalafmt_default", build_file_content = "\n".join(build), path = "") |
| 20 | + |
| 21 | +def scalafmt_repositories( |
| 22 | + scala_version = _default_scala_version(), |
| 23 | + maven_servers = ["http://central.maven.org/maven2"]): |
| 24 | + major_version = _extract_major_version(scala_version) |
| 25 | + |
| 26 | + scala_jar_shas = { |
| 27 | + "2.11": { |
| 28 | + "scalafmt_parsers": "acde4faa648c61f1d76f7a1152116738c0b0b80ae2fab8ceae83c061c29aadf1", |
| 29 | + "metaconfig_core": "8abb4e48507486d0b323b440bb021bddd56366e502002025fdaf10025d2650c2", |
| 30 | + "scalafmt_core": "84bac5ed8c85e61851ef427f045b7bfd149d857cb543b41c85b8353fb8c47aff", |
| 31 | + }, |
| 32 | + "2.12": { |
| 33 | + "scalafmt_parsers": "9dc726dab95870b193dee3ed4d11985fa38ca09640768a7c86d8f80c715c5567", |
| 34 | + "metaconfig_core": "495817d90ecb4c432ee0afa7e79b4d005e6a6f90a270e113e15fe7d2d5559dfd", |
| 35 | + "scalafmt_core": "02562f176a7d070230ef2da6192f2d15afd62ea173eaf8ca02a7afb89262d233", |
| 36 | + }, |
| 37 | + } |
| 38 | + |
| 39 | + scala_version_jar_shas = scala_jar_shas[major_version] |
| 40 | + |
| 41 | + _scala_maven_import_external( |
| 42 | + name = "scalafmt_parsers", |
| 43 | + artifact = _scala_mvn_artifact( |
| 44 | + "org.scalameta:parsers:4.2.0", |
| 45 | + major_version, |
| 46 | + ), |
| 47 | + artifact_sha256 = scala_version_jar_shas["scalafmt_parsers"], |
| 48 | + licenses = ["notice"], |
| 49 | + server_urls = maven_servers, |
| 50 | + ) |
| 51 | + |
| 52 | + native.bind( |
| 53 | + name = "io_bazel_rules_scala/scalafmt/scalafmt_parsers", |
| 54 | + actual = "@scalafmt_parsers", |
| 55 | + ) |
| 56 | + |
| 57 | + _scala_maven_import_external( |
| 58 | + name = "geirsson_metaconfig_core", |
| 59 | + artifact = _scala_mvn_artifact( |
| 60 | + "com.geirsson:metaconfig-core:0.8.3", |
| 61 | + major_version, |
| 62 | + ), |
| 63 | + artifact_sha256 = scala_version_jar_shas["metaconfig_core"], |
| 64 | + licenses = ["notice"], |
| 65 | + server_urls = maven_servers, |
| 66 | + ) |
| 67 | + |
| 68 | + native.bind( |
| 69 | + name = "io_bazel_rules_scala/scalafmt/geirsson_metaconfig_core", |
| 70 | + actual = "@geirsson_metaconfig_core", |
| 71 | + ) |
| 72 | + |
| 73 | + _scala_maven_import_external( |
| 74 | + name = "scalafmt_core", |
| 75 | + artifact = _scala_mvn_artifact( |
| 76 | + "org.scalameta:scalafmt-core:2.0.0", |
| 77 | + major_version, |
| 78 | + ), |
| 79 | + artifact_sha256 = scala_version_jar_shas["scalafmt_core"], |
| 80 | + licenses = ["notice"], |
| 81 | + server_urls = maven_servers, |
| 82 | + ) |
| 83 | + |
| 84 | + native.bind( |
| 85 | + name = "io_bazel_rules_scala/scalafmt/scalafmt_core", |
| 86 | + actual = "@scalafmt_core", |
| 87 | + ) |
| 88 | + |
| 89 | + _scala_maven_import_external( |
| 90 | + name = "argparse4j", |
| 91 | + artifact = "net.sourceforge.argparse4j:argparse4j:0.8.1", |
| 92 | + artifact_sha256 = "98cb5468cac609f3bc07856f2e34088f50dc114181237c48d20ca69c3265d044", |
| 93 | + licenses = ["notice"], |
| 94 | + server_urls = maven_servers, |
| 95 | + ) |
| 96 | + |
| 97 | + native.bind( |
| 98 | + name = "io_bazel_rules_scala/scalafmt/argparse4j", |
| 99 | + actual = "@argparse4j", |
| 100 | + ) |
0 commit comments