Skip to content

Commit

Permalink
Strict deps java cmd line flag (#320)
Browse files Browse the repository at this point in the history
strict_java_deps for java can be configured via command line
removed bazel versions 0.5.3 and 0.5.4 from travis supported versions since above feature mandates 0.6.0 onwards
  • Loading branch information
ittaiz authored Oct 23, 2017
1 parent af6db2d commit 0ad89f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ os:

env:
# we want to test the most recent few releases
- V=0.5.3
- V=0.5.4
- V=0.6.0

before_install:
Expand Down
1 change: 1 addition & 0 deletions scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def try_to_compile_java_jar(ctx,
exports = [],
java_toolchain = ctx.attr._java_toolchain,
host_javabase = ctx.attr._host_javabase,
strict_deps = ctx.fragments.java.strict_java_deps,
)
return struct(jar = full_java_jar, ijar = provider.compile_jars.to_list().pop())

Expand Down
10 changes: 10 additions & 0 deletions test_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ test_scala_library_expect_failure_on_missing_direct_java() {
test_expect_failure_or_warning_on_missing_direct_deps_with_expected_message "${expected_message}" $test_target "--strict_java_deps=error"
}

test_scala_library_expect_failure_on_missing_direct_deps_warn_mode_java() {
dependency_target='//test_expect_failure/missing_direct_deps/internal_deps:transitive_dependency'
test_target='//test_expect_failure/missing_direct_deps/internal_deps:transitive_dependency_java_user'

local expected_message="buildozer 'add deps $dependency_target ' $test_target"

test_expect_failure_or_warning_on_missing_direct_deps_with_expected_message "${expected_message}" ${test_target} "--strict_java_deps=warn" "ne"
}

test_scala_library_expect_failure_on_missing_direct_deps_off_mode() {
expected_message="test_expect_failure/missing_direct_deps/internal_deps/A.scala:[0-9+]: error: not found: value C"
test_target='test_expect_failure/missing_direct_deps/internal_deps:transitive_dependency_user'
Expand Down Expand Up @@ -583,3 +592,4 @@ $runner test_scala_library_expect_no_recompilation_on_internal_change_of_java_de
$runner test_scala_library_expect_no_java_recompilation_on_internal_change_of_scala_sibling
$runner test_scala_library_expect_failure_on_missing_direct_java
$runner bazel run test:test_scala_proto_server
$runner test_scala_library_expect_failure_on_missing_direct_deps_warn_mode_java

0 comments on commit 0ad89f6

Please sign in to comment.