Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildifier as the only lint #826

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ env:
# Linting is broken. Disable until fixed.
# See https://github.com/bazelbuild/rules_scala/pull/622
# we want to test the last release
#- TEST_SCRIPT=test_lint.sh
- TEST_SCRIPT=test_lint.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid running the lint on all platforms? Is that easy?

Copy link
Contributor Author

@andyscott andyscott Aug 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! I'm going to rework travis so we use the more configurable job pipelines instead of the strict square matrix. Expect another PR (after this is merged, if it's 👍).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- TEST_SCRIPT=test_rules_scala
#- TEST_SCRIPT=test_intellij_aspect.sh
- TEST_SCRIPT=test_reproducibility
Expand Down
51 changes: 38 additions & 13 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
workspace(name = "io_bazel_rules_scala")


load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("//scala:scala.bzl", "scala_repositories")

scala_repositories()

load("//scala:scala_maven_import_external.bzl", "scala_maven_import_external")
load("//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library")
load("//twitter_scrooge:twitter_scrooge.bzl", "scrooge_scala_library", "twitter_scrooge")

twitter_scrooge()

Expand All @@ -28,7 +27,7 @@ load("//specs2:specs2_junit.bzl", "specs2_junit_repositories")

specs2_junit_repositories()

load("//scala:scala_cross_version.bzl", "scala_mvn_artifact", "default_scala_major_version")
load("//scala:scala_cross_version.bzl", "default_scala_major_version", "scala_mvn_artifact")

# test adding a scala jar:
maven_jar(
Expand Down Expand Up @@ -76,8 +75,8 @@ maven_jar(
scala_maven_import_external(
name = "com_github_jnr_jffi_native",
artifact = "com.github.jnr:jffi:jar:native:1.2.17",
fetch_sources = True,
artifact_sha256 = "4eb582bc99d96c8df92fc6f0f608fd123d278223982555ba16219bf8be9f75a9",
fetch_sources = True,
licenses = ["notice"],
server_urls = [
"https://repo.maven.apache.org/maven2/",
Expand Down Expand Up @@ -108,23 +107,21 @@ load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_unused_deps_

scala_register_unused_deps_toolchains()


register_toolchains("@io_bazel_rules_scala//test/proto:scalapb_toolchain")


load("//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external")
load("//scala:scala_maven_import_external.bzl", "java_import_external", "scala_maven_import_external")

scala_maven_import_external(
name = "com_google_guava_guava_21_0",
artifact = "com.google.guava:guava:21.0",
artifact_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480",
srcjar_sha256 = "b186965c9af0a714632fe49b33378c9670f8f074797ab466f49a67e918e116ea",
fetch_sources = True,
licenses = ["notice"], # Apache 2.0
server_urls = [
"https://repo1.maven.org/maven2/",
"https://mirror.bazel.build/repo1.maven.org/maven2",
],
],
srcjar_sha256 = "b186965c9af0a714632fe49b33378c9670f8f074797ab466f49a67e918e116ea",
)

# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external
Expand All @@ -148,6 +145,33 @@ load("//private:format.bzl", "format_repositories")

format_repositories()

http_archive(
name = "io_bazel_rules_go",
sha256 = "45409e6c4f748baa9e05f8f6ab6efaa05739aa064e3ab94e5a1a09849c51806a",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.7/rules_go-0.18.7.tar.gz",
)

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "cdaac537b56375f658179ee2f27813cac19542443f4722b6730d84e4125355e6",
strip_prefix = "buildtools-f27d1753c8b3210d9e87cdc9c45bc2739ae2c2db",
url = "https://github.com/bazelbuild/buildtools/archive/f27d1753c8b3210d9e87cdc9c45bc2739ae2c2db.zip",
)

load(
"@io_bazel_rules_go//go:deps.bzl",
"go_register_toolchains",
"go_rules_dependencies",
)

go_rules_dependencies()

go_register_toolchains()

load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")

buildifier_dependencies()

http_archive(
name = "bazel_toolchains",
sha256 = "5962fe677a43226c409316fcb321d668fc4b7fa97cb1f9ef45e7dc2676097b26",
Expand All @@ -173,6 +197,7 @@ git_repository(
)

## deps for tests of limited deps support

scala_maven_import_external(
name = "org_springframework_spring_core",
artifact = "org.springframework:spring-core:5.1.5.RELEASE",
Expand All @@ -181,7 +206,7 @@ scala_maven_import_external(
server_urls = [
"https://repo1.maven.org/maven2/",
"https://mirror.bazel.build/repo1.maven.org/maven2",
],
],
)

scala_maven_import_external(
Expand All @@ -192,10 +217,10 @@ scala_maven_import_external(
server_urls = [
"https://repo1.maven.org/maven2/",
"https://mirror.bazel.build/repo1.maven.org/maven2",
],
],
deps = [
"@org_springframework_spring_core"
]
"@org_springframework_spring_core",
],
)

## deps for tests of compiler plugin
Expand Down
2 changes: 2 additions & 0 deletions jmh/jmh.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ def jmh_repositories(maven_servers = ["http://central.maven.org/maven2"]):
def _scala_generate_benchmark(ctx):
# we use required providers to ensure JavaInfo exists
info = ctx.attr.src[JavaInfo]

# TODO, if we emit more than one jar, which scala_library does not,
# this might fail. We could possibly extend the BenchmarkGenerator
# to accept more than one jar to scan, and then allow multiple labels
# in ctx.attr.src
outs = info.outputs.jars
if len(outs) != 1:
print("expected exactly 1 output jar in: " + ctx.label)

# just try to take the first one and see if that works
class_jar = outs[0].class_jar
classpath = info.transitive_runtime_deps
Expand Down
Loading