Buck: Bump java default source and target level to 7
Buck lacks a feature to set java source level and target level per project base, i. e. in .buckconfig file under java section. The only method that currently is supported and described in the documentation is to pass custom levels to java_library and java_test methods. That would work, but that approach would require to touch dozens of files. Second approach could be to just patch system wide Buck with this patch[1]. However that is not really an option because in this case the increased java source and target level applies on all projects and branches. Particularly it is undesirable to build Gerrit 2.8 stable branch or other projects that were migrated to Buck (e. g. JGit) with increased java source and target level. This change redefines the standard definitions of java_test() and java_library() methods and increases the java source and target level in the new defined functions. With the combination of "include = default.defs" construct in .buildconfig file it is garanteed that all BUCK files first "see" the redefined methods. Disadvantage of the approach is that every time the original method definitions are changed in upstream Buck (i. e. new paramters are introduced) this patch must be changed too. The best approach would be to extend Buck and enable definition of source and target level per project base (in .buckconfig file). [1] https://github.com/facebook/buck/pull/67 Change-Id: Ifaba1eb41e9ac2f033e704a75723f3595e1c1ee5
This commit is contained in:
parent
1f9affd0f3
commit
b4b30cb937
65
tools/buck.defs
Normal file
65
tools/buck.defs
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright (C) 2013 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
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=vm_args,
|
||||
source_under_test=source_under_test,
|
||||
contacts=contacts,
|
||||
deps=deps,
|
||||
visibility=visibility,
|
||||
)
|
@ -14,6 +14,7 @@
|
||||
|
||||
# Rule definitions loaded by default into every BUCK file.
|
||||
|
||||
include_defs('//tools/buck.defs')
|
||||
include_defs('//tools/gwt-constants.defs')
|
||||
|
||||
def genantlr(
|
||||
|
Loading…
Reference in New Issue
Block a user