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

Remove phase scala provider #913

Merged
merged 4 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ jobs:
env: TEST_SCRIPT=test_lint
# Test
- <<: *linux
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=0.28.1
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=1.1.0
- <<: *linux
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=2.0.0
- <<: *linux
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=0.28.1
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=1.1.0
- <<: *linux
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=2.0.0
- <<: *osx
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=0.28.1
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=1.1.0
- <<: *osx
env: TEST_SCRIPT=test_rules_scala BAZEL_VERSION=2.0.0
- <<: *osx
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=0.28.1
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=1.1.0
- <<: *osx
env: TEST_SCRIPT=test_reproducibility BAZEL_VERSION=2.0.0

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ for an example workspace using another scala version.
| bazel | rules_scala gitsha |
|--------|--------------------|
| 2.0.0 | HEAD |
| 0.28.1 | HEAD |
| 0.23.x | ca655e5a330cbf1d66ce1d9baa63522752ec6011 | |
| 1.1.0 | HEAD |
| 0.28.1 | bd0c388125e12f4f173648fc4474f73160a5c628 |
| 0.23.x | ca655e5a330cbf1d66ce1d9baa63522752ec6011 |
| 0.22.x | f3113fb6e9e35cb8f441d2305542026d98afc0a2 |
| 0.16.x | f3113fb6e9e35cb8f441d2305542026d98afc0a2 |
| 0.15.x | 3b9ab9be31ac217d3337c709cb6bfeb89c8dcbb1 |
Expand Down
3 changes: 0 additions & 3 deletions scala/private/phases/phase_final.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def phase_binary_final(ctx, p):
instrumented_files = p.compile.coverage.instrumented_files,
providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers,
runfiles = p.runfiles.runfiles,
scala = p.scala_provider,
transitive_rjars = p.compile.rjars, #calling rules need this for the classpath in the launcher
)

Expand All @@ -22,7 +21,6 @@ def phase_library_final(ctx, p):
jars_to_labels = p.collect_jars.jars2labels,
providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers,
runfiles = p.runfiles.runfiles,
scala = p.scala_provider,
)

def phase_scalatest_final(ctx, p):
Expand All @@ -34,5 +32,4 @@ def phase_scalatest_final(ctx, p):
instrumented_files = p.compile.coverage.instrumented_files,
providers = [p.compile.merged_provider, p.collect_jars.jars2labels] + p.compile.coverage.providers,
runfiles = ctx.runfiles(coverage_runfiles, transitive_files = p.runfiles.runfiles.files),
scala = p.scala_provider,
)
2 changes: 1 addition & 1 deletion scala/private/phases/phase_jvm_flags.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def phase_jvm_flags(ctx, p):
if ctx.attr.tests_from:
archives = _get_test_archive_jars(ctx, ctx.attr.tests_from)
else:
archives = [archive.class_jar for archive in p.scala_provider.outputs.jars]
archives = p.compile.merged_provider.runtime_output_jars

serialized_archives = _serialize_archives_short_path(archives)
test_suite = _gen_test_suite_flags_based_on_prefixes_and_suffixes(
Expand Down
51 changes: 0 additions & 51 deletions scala/private/phases/phase_scala_provider.bzl

This file was deleted.

9 changes: 0 additions & 9 deletions scala/private/phases/phases.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ load(
_phase_repl_compile = "phase_repl_compile",
_phase_scalatest_compile = "phase_scalatest_compile",
)
load(
"@io_bazel_rules_scala//scala/private:phases/phase_scala_provider.bzl",
_phase_common_scala_provider = "phase_common_scala_provider",
_phase_library_scala_provider = "phase_library_scala_provider",
)
load(
"@io_bazel_rules_scala//scala/private:phases/phase_runfiles.bzl",
_phase_common_runfiles = "phase_common_runfiles",
Expand Down Expand Up @@ -125,10 +120,6 @@ phase_repl_compile = _phase_repl_compile
phase_scalatest_compile = _phase_scalatest_compile
phase_common_compile = _phase_common_compile

# scala_provider
phase_library_scala_provider = _phase_library_scala_provider
phase_common_scala_provider = _phase_common_scala_provider

# runfiles
phase_library_runfiles = _phase_library_runfiles
phase_scalatest_runfiles = _phase_scalatest_runfiles
Expand Down
1 change: 0 additions & 1 deletion scala/private/rule_impls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

load(
"@io_bazel_rules_scala//scala:providers.bzl",
"create_scala_provider",
_ScalacProvider = "ScalacProvider",
)
load(
Expand Down
2 changes: 0 additions & 2 deletions scala/private/rules/scala_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ load(
"phase_common_collect_jars",
"phase_common_java_wrapper",
"phase_common_runfiles",
"phase_common_scala_provider",
"phase_common_write_executable",
"phase_declare_executable",
"phase_merge_jars",
Expand All @@ -42,7 +41,6 @@ def _scala_binary_impl(ctx):
("compile", phase_binary_compile),
("merge_jars", phase_merge_jars),
("runfiles", phase_common_runfiles),
("scala_provider", phase_common_scala_provider),
("write_executable", phase_common_write_executable),
],
# fixed phase
Expand Down
2 changes: 0 additions & 2 deletions scala/private/rules/scala_junit_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ load(
"phase_binary_final",
"phase_common_java_wrapper",
"phase_common_runfiles",
"phase_common_scala_provider",
"phase_declare_executable",
"phase_junit_test_collect_jars",
"phase_junit_test_compile",
Expand Down Expand Up @@ -46,7 +45,6 @@ def _scala_junit_test_impl(ctx):
("compile", phase_junit_test_compile),
("merge_jars", phase_merge_jars),
("runfiles", phase_common_runfiles),
("scala_provider", phase_common_scala_provider),
("jvm_flags", phase_jvm_flags),
("write_executable", phase_junit_test_write_executable),
],
Expand Down
4 changes: 0 additions & 4 deletions scala/private/rules/scala_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ load(
"phase_library_for_plugin_bootstrapping_collect_jars",
"phase_library_for_plugin_bootstrapping_compile",
"phase_library_runfiles",
"phase_library_scala_provider",
"phase_macro_library_collect_jars",
"phase_macro_library_compile",
"phase_merge_jars",
Expand Down Expand Up @@ -67,7 +66,6 @@ def _scala_library_impl(ctx):
("merge_jars", phase_merge_jars),
("runfiles", phase_library_runfiles),
("collect_exports_jars", phase_collect_exports_jars),
("scala_provider", phase_library_scala_provider),
],
# fixed phase
("final", phase_library_final),
Expand Down Expand Up @@ -145,7 +143,6 @@ def _scala_library_for_plugin_bootstrapping_impl(ctx):
("merge_jars", phase_merge_jars),
("runfiles", phase_library_runfiles),
("collect_exports_jars", phase_collect_exports_jars),
("scala_provider", phase_library_scala_provider),
],
# fixed phase
("final", phase_library_final),
Expand Down Expand Up @@ -202,7 +199,6 @@ def _scala_macro_library_impl(ctx):
("merge_jars", phase_merge_jars),
("runfiles", phase_library_runfiles),
("collect_exports_jars", phase_collect_exports_jars),
("scala_provider", phase_library_scala_provider),
],
# fixed phase
("final", phase_library_final),
Expand Down
2 changes: 0 additions & 2 deletions scala/private/rules/scala_repl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ load(
"extras_phases",
"phase_binary_final",
"phase_common_runfiles",
"phase_common_scala_provider",
"phase_declare_executable",
"phase_merge_jars",
"phase_repl_collect_jars",
Expand Down Expand Up @@ -43,7 +42,6 @@ def _scala_repl_impl(ctx):
("compile", phase_repl_compile),
("merge_jars", phase_merge_jars),
("runfiles", phase_common_runfiles),
("scala_provider", phase_common_scala_provider),
("write_executable", phase_repl_write_executable),
],
# fixed phase
Expand Down
2 changes: 0 additions & 2 deletions scala/private/rules/scala_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ load(
"@io_bazel_rules_scala//scala/private:phases/phases.bzl",
"extras_phases",
"phase_common_java_wrapper",
"phase_common_scala_provider",
"phase_coverage_runfiles",
"phase_declare_executable",
"phase_merge_jars",
Expand Down Expand Up @@ -43,7 +42,6 @@ def _scala_test_impl(ctx):
("compile", phase_scalatest_compile),
("merge_jars", phase_merge_jars),
("runfiles", phase_scalatest_runfiles),
("scala_provider", phase_common_scala_provider),
("coverage_runfiles", phase_coverage_runfiles),
("write_executable", phase_scalatest_write_executable),
],
Expand Down
33 changes: 0 additions & 33 deletions scala/providers.bzl
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
# TODO: this should really be a bazel provider, but we are using old-style rule outputs
# we need to document better what the intellij dependencies on this code actually are
def create_scala_provider(
ijar,
class_jar,
compile_jars,
transitive_runtime_jars,
deploy_jar,
full_jars,
source_jars,
statsfile):
formatted_for_intellij = [
struct(class_jar = jar, ijar = None, source_jar = None, source_jars = source_jars)
for jar in full_jars
]

rule_outputs = struct(
ijar = ijar,
class_jar = class_jar,
deploy_jar = deploy_jar,
jars = formatted_for_intellij,
statsfile = statsfile,
)

# Note that, internally, rules only care about compile_jars and transitive_runtime_jars
# in a similar manner as the java_library and JavaProvider
return struct(
outputs = rule_outputs,
compile_jars = compile_jars,
transitive_runtime_jars = transitive_runtime_jars,
transitive_exports = [], #needed by intellij plugin
)

ScalacProvider = provider(
doc = "ScalacProvider",
fields = [
Expand Down
8 changes: 4 additions & 4 deletions tools/bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

default_bazel_version='0.28.1'
default_bazel_version='1.1.0'

if [ "$BUILDKITE" = true ]; then
bazel_version='host'
Expand All @@ -27,9 +27,9 @@ case "$bazel_version" in
bazel_version=$("$BAZEL_REAL" version | awk '/Build label/ {print $3}' | cut -d '-' -f 1)
bazel="$BAZEL_REAL"
;;
'0.28.1')
darwin_sha='5d50ae13ba01a224ddf54cfd818289bee5b38e551cca22bffc79b89f377d2095'
linux_sha='a2a7e4cb38d7bc774a5bbfab4d45293f5f2158eb6caf0128792cc1148732a4e6'
'1.1.0')
darwin_sha='1a552f4ce194860fbbd50eeb319f81788ddf50a849e92378eec72231cc64ef65'
linux_sha='14301099c87568db302d59a5d3585f5eb8a6250ac2c6bb0367c56e623ff6e65f'
;;
'2.0.0')
darwin_sha='c675fa27d99a3114d681db10eb03ded547c40f702b2048c99b8f4ea8e89b9356'
Expand Down