| # This is a quick hack to make it so that all Java rules build using Java 7. |
| # TODO(mbolin): Find a less hacky way to do this, likely something in .buckconfig. |
| |
| original_java_library = java_library |
| def java_library( |
| name, |
| srcs=[], |
| resources=[], |
| export_deps=False, |
| source='7', |
| target='7', |
| proguard_config=None, |
| deps=[], |
| visibility=[], |
| ): |
| original_java_library( |
| name=name, |
| srcs=srcs, |
| resources=resources, |
| export_deps=export_deps, |
| source=source, |
| target=target, |
| proguard_config=proguard_config, |
| deps=deps, |
| visibility=visibility, |
| ) |
| |
| original_java_test = java_test |
| def java_test( |
| name, |
| srcs=[], |
| labels=[], |
| resources=[], |
| source='7', |
| target='7', |
| vm_args=[], |
| source_under_test=[], |
| contacts=[], |
| deps=[], |
| visibility=[], |
| ): |
| original_java_test( |
| name=name, |
| srcs=srcs, |
| labels=labels, |
| resources=resources, |
| source=source, |
| target=target, |
| vm_args=[ |
| # Add -XX:-UseSplitVerifier by default to work around: |
| # http://arihantwin.blogspot.com/2012/08/getting-error-illegal-local-variable.html |
| '-XX:-UseSplitVerifier', |
| |
| # Add -Dsun.zip.disableMemoryMapping=true to work around a JDK issue |
| # related to modifying JAR/ZIP files that have been loaded into memory: |
| # |
| # http://bugs.sun.com/view_bug.do?bug_id=7129299 |
| # |
| # This has been observed to cause a problem in integration tests such as |
| # CachedTestIntegrationTest where `buck build //:test` is run repeatedly |
| # such that a corresponding `test.jar` file is overwritten several times. |
| # The CompiledClassFileFinder in JavaTestRule creates a java.util.zip.ZipFile |
| # to enumerate the zip entries in order to find the set of .class files |
| # in `test.jar`. This interleaving of reads and writes appears to match |
| # the conditions to trigger the issue reported on bugs.sun.com. |
| # |
| # Currently, we do not set this flag in bin/buck_common, as Buck does not |
| # normally modify the contents of buck-out after they are loaded into |
| # memory. However, we may need to use this flag when running buckd where |
| # references to zip files may be long-lived. |
| # |
| # Finally, note that when you specify this flag, |
| # `System.getProperty("sun.zip.disableMemoryMapping")` will return `null` |
| # even though you have specified the flag correctly. Apparently sun.misc.VM |
| # (http://www.docjar.com/html/api/sun/misc/VM.java.html) saves the property |
| # internally, but removes it from the set of system properties that are |
| # publicly accessible. |
| '-Dsun.zip.disableMemoryMapping=true', |
| ] + vm_args, |
| source_under_test=source_under_test, |
| contacts=contacts, |
| deps=deps, |
| visibility=visibility, |
| ) |