aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/bazel/bazel_java_test.sh
Commit message (Collapse)AuthorAge
* Merge outputs in java_common.merge.Gravatar elenairina2018-07-06
| | | | | RELNOTES: [JavaInfo] Outputs are merged in java_common.merge(). PiperOrigin-RevId: 203474741
* Add new-style JavaInfo provider constructor.Gravatar tomlu2018-04-24
| | | | | | | | | | | | Design: https://docs.google.com/document/d/1ubah6phuvWnugShtVgSQnaopQ1BtKtNxQASVwGZA7k0/ * Moves action construction out into java_common.run_ijar, java_common.pack_sources * Deprecates corresponding arguments in JavaInfo An incompatible flag will be added in another CL since it is not possible to add incompatible flags at the same time as new functionality is added. RELNOTES: Adds new-style JavaInfo provider constructor. PiperOrigin-RevId: 194111925
* Implement support for sourceFiles parameter in JavaInfo constructor.Gravatar dbabkin2018-03-06
| | | | | RELNOTES:none PiperOrigin-RevId: 188026038
* Create function createJavaInfo with new API. Implement ↵Gravatar dbabkin2018-01-10
| | | | | | | | | | JavaCompilationArgsProvider. Added tests for checking JavaCompilationArgsProvider state. All other providers will be implemented in next CLs. RELNOTES:none PiperOrigin-RevId: 181451235
* Remove code that used to support --javabase=<absolute path>.Gravatar lberki2018-01-08
| | | | | | | | | This is the first step in removing package loading from JvmConfigurationLoader (I didn't want to add the rest into this change because it's technically possible to access ctx.fragments.jvm even though it contains no fields, so removing that is an incompatible change) and it's also possible that removing error reporting from JvmConfigurationLoader causes some subtle changes in behavior. Baby steps. Now that the hard part is done, there is no need to rush. RELNOTES: None. PiperOrigin-RevId: 181143978
* Automated rollback of commit a7a9d56539a467ef095d3003a16d33922d9505a5.Gravatar ajmichael2017-11-30
| | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks lots of web_test targets (b/69963706) *** Original change description *** Implemented fix for case when 'use_testrunner' attribute works interconnected with 'main_class' in java_test rule. for manual testing I used BUILD file: java_test( name = "mytest", srcs = glob(["*.java"]), main_class = "com.test.Test", use_testrunner = 1, ) RELNOTES: java_tests no complain when use_testrunner is explicitly set to 1 and main_class is set. PiperOrigin-RevId: 177517757
* Implemented fix for case when 'use_testrunner' attribute works ↵Gravatar dbabkin2017-11-29
| | | | | | | | | | | | | | | | interconnected with 'main_class' in java_test rule. for manual testing I used BUILD file: java_test( name = "mytest", srcs = glob(["*.java"]), main_class = "com.test.Test", use_testrunner = 1, ) RELNOTES: java_tests no complain when use_testrunner is explicitly set to 1 and main_class is set. PiperOrigin-RevId: 177291746
* Remove java_toolchain using remote targets.Gravatar xingao2017-11-21
| | | | PiperOrigin-RevId: 176521744
* Tweak java runfiles resolution.Gravatar Benjamin Peterson2017-11-06
| | | | | | | | | | | | | | | | | | | Building a binary rule does not generally ensure that the runfiles trees of its transitive data dependencies are up-to-date, so it's generally a bad idea to use a dependency's runfiles tree from the primary target. See https://github.com/bazelbuild/bazel/issues/3919 for an example of the problems this can cause. This CL ensures that we pick the primary target's runfiles tree when executing a java_binary from a runfiles tree. This makes the Java runfiles path resolution similar to that of the Python rules. (See commit [1].) [1] 58ee85afcab07374dabc5493c780cbe3369b644f ("Don't follow symlink when looking for python module space") Change-Id: I412ede5cf02ab2c407e45a2b262442ca67df9ba6 PiperOrigin-RevId: 174501597
* Add java_toolchain which compiles singlejar and ijar from source.Gravatar xingao2017-10-24
| | | | PiperOrigin-RevId: 173178028
* Add a simple java test using singlejar and ijar's cc_binary targets.Gravatar xingao2017-10-24
| | | | PiperOrigin-RevId: 173162773
* Remove the status xml attribute from AntXmlResultWriterGravatar elenairina2017-09-26
| | | | | | | | | as it was not part of a valid junit xml schema. To cherry-pick for #3286. RELNOTES: None. PiperOrigin-RevId: 170022796
* Add a global failure when a test is interrupted/cancelled.Gravatar elenairina2017-09-22
| | | | | | | | | | | When a timeout occurred, the current test case is interrupted and the others are cancelled. This was not reflected in any way and all tests were reported as success, even if there was a timeout and the tests were cancelled/interrupted. Also add a status xml attribute to mark if the test was completed, cancelled or interrupted. Fixes #3763 RELNOTES: None. PiperOrigin-RevId: 169665622
* Expose full compile time jars in SkylarkGravatar elenairina2017-09-19
| | | | | | | | | | | There are several use cases for using full compile time jars instead of ijars (scala macros cannot use ijar, kotlin dependencies, etc). This change allows creating a provider with or without creating interface jars for compile time, exposing the right full/interface jars on target[JavaInfo].compile_jars and target[JavaInfo].full_compile_jars. For more details see https://github.com/bazelbuild/bazel/issues/3528. Fixes #3528 RELNOTES: java_common.create_provider is now supported with creating ijars by default. This introduces incompatibilities for existing users. Please set use_ijar=False if you don't want to use ijars. PiperOrigin-RevId: 169222793
* Add java_common.build_ijar.Gravatar elenairina2017-09-06
| | | | PiperOrigin-RevId: 167699728
* Support warn/default strict deps in java_common.compile.Gravatar elenairina2017-09-06
| | | | | | Fixes #3626. PiperOrigin-RevId: 167687039
* Replace deprecated `set` constructor and its order names in integration testsGravatar vladmos2017-08-24
| | | | | | | The name `set` and order names "stable", "compile", "naive_link", and "link" are deprecated and will soon be removed from Blaze. PiperOrigin-RevId: 166341984
* Remove support for -extra_checks:offGravatar cushon2017-07-07
| | | | | | | | | | it has been replaced by -XepDisableAllChecks, which disables all Error Prone checks instead of disabling the plugin. Disabling the plugin entirely breaks handling of other -Xep flags. RELNOTES[INC]: -extra_checks:off is no longer supported; use -XepDisableAllChecks instead PiperOrigin-RevId: 161127522
* Add exports param to java_common.compile.Gravatar elenairina2017-06-29
| | | | | | | | This is a step forward to having the same semantics for java_library and custom Skylark rules that use java_common.compile, facilitating the migration from native Java rules to Skylark. Progress on #2614 PiperOrigin-RevId: 160513771
* Add 'ctx.actions' and implement 'ctx.action.declare_file'.Gravatar dslomov2017-06-27
| | | | | RELNOTES: None. PiperOrigin-RevId: 160264501
* Loosen java_library.exports and java_import.*Gravatar Stephen Twigg2017-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | java_library.exports and java_import.runtime_deps|exports|deps will now accept any label from a rule that has a JavaProvider declared provider. Note that java_library.deps|runtime_deps already had this feature and this simply extends that privilege. This relies on the fact that both those targets (via JavaCommon) are simply searching for jars via JavaProvider anyway. Added test for passing a custom Skylark rule (that provides a JavaProvider) can successfully be added to the deps, runtime_deps, and exports of java_library, java_import, and java_binary (where appropriate). Added integration tests for java_library.exports|runtime_deps (the basic sandwich already tests deps) and java_import.exports|runtime_deps. Note that custom Skylark rules are still unable to provide or propagate a JavaNativeLibraryProvider, which results from a cc dependency. Also, the deps argument for java_import is somewhat odd. Change-Id: I7b2c19c6b99516ce524e8c82193d0c73e2d66530 PiperOrigin-RevId: 156740729
* Add resources to java_common.compile.Gravatar elenairina2017-05-12
| | | | | | Progress on the java sandwich #2614 in an effort to make the Java compilation exposed to Skylark as similar as possible to java_library's API. PiperOrigin-RevId: 155861145
* Re-enabling passing -sourcepath via javacopts.Gravatar elenairina2017-05-11
| | | | | | | This is needed until java_common.compile will be strong enough to replace java_library, exposing all its features. PiperOrigin-RevId: 155773169
* Change the tag experimental_testrunner into a couple of flags.Gravatar kush2017-03-31
| | | | | | | | | | | | | | | Note 1) Explanation of the flags: --explicit_java_test_deps: This is a flag independent of the others, and forces users to specify the JUnit deps. We should try to make this flag default to true in a future release, irrespective of the work around persistent java tests. --experimental_testrunner: Bazel-only flag affecting switching from the BazelTestRunner to the ExperimentalTestRunner which will run the tests in a separate classloader. --explicit_java_test_deps is desired for this to ensure once we split the classpaths of the TestRunner and the TestTarget, the TestTarget does not hit a ClassNotFoundException, due to missing JUnit deps. --test_strategy=experimental_worker: This is the existing flag, which in turn depends on --experimental_testrunner flag, since only the ExperimentalTestRunner is capable to running java tests persistently. Note 2) There was no clean way to check for the flags defined in JavaOptions within TestActionBuilder (as I was checking the "tag=experimental_testrunner" before), without making TeasActionBuilder's build rules depend on java rules (yikes!). Hence, I created a new method compatibleWithStrategy() within each fragment, so I could check if WorkerTestStrategy could be compatible with the user specified flags. Thanks to Greg for suggesting this approach! RELNOTES: None PiperOrigin-RevId: 151729869
* Stop adding the TestRunner's JAR as part of the compile time classpath, when ↵Gravatar Kush Chakraborty2017-03-23
| | | | | | | | | | | | experimental_testrunner is invoked. This has the unintended side effect of accidentally supplying dependencies such as JUnit and hamcrest, when bazel should enforce the target to specify those dependencies explicitly. We should eventually make this the default behaviour of bazel instead of hiding it behind the experimental_testrunner flag. This is another partial rollforward of commit 786cfa2ed980e278c42ee474408844f7e3720385 -- PiperOrigin-RevId: 151022781 MOS_MIGRATED_REVID=151022781
* Adding -implict:none by default to java compilation.Gravatar Irina Iancu2017-03-23
| | | | | | | | Fixes #2606. -- PiperOrigin-RevId: 150892448 MOS_MIGRATED_REVID=150892448
* Disable sourcepath test for JDK7.Gravatar Irina Iancu2017-03-22
| | | | | | | | Fixes #2717. -- PiperOrigin-RevId: 150862069 MOS_MIGRATED_REVID=150862069
* Add sourcepath to java_common.compileGravatar Irina Iancu2017-03-20
| | | | | | | | | | | | and remove support for -sourcepath through javacopts. Progress on #2606. Supporting -implicit:none by default will be done in an upcoming change. -- PiperOrigin-RevId: 150445185 MOS_MIGRATED_REVID=150445185
* Remove unnecessary dependency on TestRunner_deploy.jar as it's an implicit ↵Gravatar Kush Chakraborty2017-03-09
| | | | | | | | dependency in java_test. -- PiperOrigin-RevId: 149638505 MOS_MIGRATED_REVID=149638505
* Pass through -sourcepath to the JavaBuilderGravatar Damien Martin-Guillerez2017-03-06
| | | | | | | | Fix #2606. -- PiperOrigin-RevId: 149096656 MOS_MIGRATED_REVID=149096656
* Rollback of commit 786cfa2ed980e278c42ee474408844f7e3720385.Gravatar Kush Chakraborty2017-02-24
| | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks dagger []: [] *** Original change description *** Separate the classpaths of the TestRunner with the test target, and use a separate Classloader to load the test target's classes. This enables a clean separation of the classes of the TestRunner with the target under test. This is achieved with the following steps: 1. Start the test runner with only the bare bones classpaths to the Test Runner's classes which are used by the system ClassLoader. 2. Have all the classpaths required to load the test target's classes in a TEST_TARGET_CLASSPATH envi... *** -- PiperOrigin-RevId: 148405598 MOS_MIGRATED_REVID=148405598
* Separate the classpaths of the TestRunner with the test target, and use a ↵Gravatar Kush Chakraborty2017-02-23
| | | | | | | | | | | | | | | | | | | | | | separate Classloader to load the test target's classes. This enables a clean separation of the classes of the TestRunner with the target under test. This is achieved with the following steps: 1. Start the test runner with only the bare bones classpaths to the Test Runner's classes which are used by the system ClassLoader. 2. Have all the classpaths required to load the test target's classes in a TEST_TARGET_CLASSPATH environment variable exported by the stub script. 3. Use a new classloader to load all the test target's classes using the paths in TEST_TARGET_CLASSPATH. This additionally enables the persistent test runner (currently experimental), to reload all the target's classes for every subsequent test run, so it can pick up any changes to the classes in between runs. The persistent test runner can be used by adding the argument --test_strategy=experimental_worker to the bazel test command. Tested this against: 1. gerrit/gerrit-common:client_tests: Dismal avg. improvement of 580ms to 557ms (just 23ms) 2. intellij/intellij/base:unit_tests: Somewhat modest avg. improvement 1661ms to 913ms (748 ms) RELNOTES: 1) Java tests and suites will now have to explicitly declare JUnit dependency 2) All non-legacy java_tests will now be run in a -- PiperOrigin-RevId: 148309979 MOS_MIGRATED_REVID=148309979
* Disable tests on JDK7 that are not supported by a new JavaBuilder.Gravatar Dmitry Lomov2017-02-14
| | | | | | -- PiperOrigin-RevId: 147464014 MOS_MIGRATED_REVID=147464014
* Fixed java_stub_template substitution: %runfiles_manifest_only% was not ↵Gravatar Yun Peng2017-02-10
| | | | | | | | | | substituted when runfiles is enabled. This caused wrong rlocation function being defined on Linux and Mac. -- PiperOrigin-RevId: 147154028 MOS_MIGRATED_REVID=147154028
* Enable Java sandwich for all Java rules.Gravatar Irina Iancu2017-01-25
| | | | | | | | Added tests for Java sandwich using java_binary, java_test and java_import. -- PiperOrigin-RevId: 145538765 MOS_MIGRATED_REVID=145538765
* Rollback of commit d9a7d3a789be559bd6972208af21adae871d7a44.Gravatar Yun Peng2017-01-25
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Change is abandoned because it's a wrong solution See https://github.com/bazelbuild/bazel/issues/2242 *** Original change description *** java_binary now supports long classpath that exceeds command line argment length limit When classpath length exceeds the command line length limit, we create an empty classpath jar whose manifest contaning the whole classpath value. See: https://github.com/bazelbuild/bazel/issues/2242 Fixed: https://github.com/bazelbuild/bazel/issues/1780 -- PiperOrigin-RevId: 145534282 MOS_MIGRATED_REVID=145534282
* java_binary now supports long classpath that exceeds command line argment ↵Gravatar Yun Peng2017-01-25
| | | | | | | | | | | | | | | | | length limit When classpath length exceeds the command line length limit, we create an empty classpath jar whose manifest contaning the whole classpath value. See: https://github.com/bazelbuild/bazel/issues/2242 Fixed: https://github.com/bazelbuild/bazel/issues/1780 -- Change-Id: Id6dd503c17f7f17e4a4c37fa01da24e2a1ea2155 Reviewed-on: https://cr.bazel.build/8353 PiperOrigin-RevId: 145521892 MOS_MIGRATED_REVID=145521892
* Completing the Java sandwich and testing it.Gravatar Irina Iancu2017-01-20
| | | | | | | | | | | | | | | | * Unwrapping JavaCompilationArgsProvider from JavaProvider when collecting compile time dependencies artifacts (in addition to JavaCompilationArgsProvider), so that java_library could depend on Skylark rules that return java_common.provider. (this makes java sandwich complete \o/) * Added a new param (source_files) to java_common.compile to allow compilation of source files in addition to source jars. * Added a new sourceFiles field to JavaLibraryHelper in order to pass them to JavaCompilationHelper. * Added a new method (java_common.default_javac_opts) for default Java compilation. * Added a test for a basic java sandwich. -- PiperOrigin-RevId: 145064700 MOS_MIGRATED_REVID=145064700
* Use main_class as specified in java_test even if use_testrunner is true.Gravatar Dmitry Lomov2016-11-04
| | | | | -- MOS_MIGRATED_REVID=138180229
* Create a proper wrapper script for executing "bazel" in the integration tests.Gravatar Luis Fernando Pino Duque2016-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently a call to "bazel" in an integration test means calling a (quite hidden) function in test-setup.sh which actually calls "$bazel" defined in "shell/bazel/testenv.sh" which is equal to "$(rlocation io_bazel/src/bazel)". This is extremely confusing and error prone. The new mechanism is to add a wrapper script to shell/bin called bazel and export this directory to the PATH. Moreover, not every test loads the same test environment, for instance consider how bazel_query_test loads the test environment: - Load shell/integration/testenv.sh which loads, - shell/bazel/test-setup.sh which loads, - shell/bazel/testenv.sh which loads, - shell/unittest.bash which loads, - shell/testenv.sh Again this is error prone and specially hard to understand, in fact each test writer needs to decide which of these testenv to load. This change fixes all of this by having only one testenv.sh and summarizing the test setup in integration_test_setup.sh. Namely, for any new integration test, the developer needs to load integration_test_setup to get the environment set up including the unittest framework (also it helps to attract contributions). This change also allows to open sourcing client_sigint_test: Since bazel was a function client_sigint_test was using a wrong process id to interrupt the build. The problem is that $! returns bash's id instead of the id of the process running in the background when using a function instead of an executable. A few tests needed to be adapted to the new infrastructure. -- MOS_MIGRATED_REVID=136470360
* JavaBuilder: Reintroduce the -extra_checks flag.Gravatar Philipp Wollermann2016-07-28
Fixes #1570. -- MOS_MIGRATED_REVID=128585415