Merge changes I21f258f1,I1240d25c,I34285466,I3ab30565

* changes:
  Bazel: Split deps and provided_deps in gerrit_plugin rule
  Bazel: Expose neverlink artifact in maven_jar rule
  Bazel: Expose PLUGIN_DEPS and PLUGIN_TEST_DEPS variables
  Format .bzl files with Bazel Buildifier
This commit is contained in:
Hugo Arès 2016-12-13 18:14:55 +00:00 committed by Gerrit Code Review
commit 53c423ccb9
18 changed files with 522 additions and 493 deletions

View File

@ -1,8 +1,8 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
load("//tools/bzl:junit.bzl", "junit_tests")
BOUNCYCASTLE = [
'//lib/bouncycastle:bcpkix-without-neverlink',
'//lib/bouncycastle:bcpg-without-neverlink',
"//lib/bouncycastle:bcpkix-without-neverlink",
"//lib/bouncycastle:bcpg-without-neverlink",
]
def acceptance_tests(

View File

@ -1,88 +1,88 @@
load('//tools/bzl:genrule2.bzl', 'genrule2')
load("//tools/bzl:genrule2.bzl", "genrule2")
CM_CSS = [
'lib/codemirror.css',
'addon/dialog/dialog.css',
'addon/merge/merge.css',
'addon/scroll/simplescrollbars.css',
'addon/search/matchesonscrollbar.css',
'addon/lint/lint.css',
"lib/codemirror.css",
"addon/dialog/dialog.css",
"addon/merge/merge.css",
"addon/scroll/simplescrollbars.css",
"addon/search/matchesonscrollbar.css",
"addon/lint/lint.css",
]
CM_JS = [
'lib/codemirror.js',
'mode/meta.js',
'keymap/emacs.js',
'keymap/sublime.js',
'keymap/vim.js',
"lib/codemirror.js",
"mode/meta.js",
"keymap/emacs.js",
"keymap/sublime.js",
"keymap/vim.js",
]
CM_ADDONS = [
'dialog/dialog.js',
'edit/closebrackets.js',
'edit/matchbrackets.js',
'edit/trailingspace.js',
'scroll/annotatescrollbar.js',
'scroll/simplescrollbars.js',
'search/jump-to-line.js',
'search/matchesonscrollbar.js',
'search/searchcursor.js',
'search/search.js',
'selection/mark-selection.js',
'mode/multiplex.js',
'mode/overlay.js',
'mode/simple.js',
'lint/lint.js',
"dialog/dialog.js",
"edit/closebrackets.js",
"edit/matchbrackets.js",
"edit/trailingspace.js",
"scroll/annotatescrollbar.js",
"scroll/simplescrollbars.js",
"search/jump-to-line.js",
"search/matchesonscrollbar.js",
"search/searchcursor.js",
"search/search.js",
"selection/mark-selection.js",
"mode/multiplex.js",
"mode/overlay.js",
"mode/simple.js",
"lint/lint.js",
]
# Available themes must be enumerated here,
# in gerrit-extension-api/src/main/java/com/google/gerrit/extensions/common/Theme.java,
# in gerrit-gwtui/src/main/java/net/codemirror/theme/Themes.java
CM_THEMES = [
'3024-day',
'3024-night',
'abcdef',
'ambiance',
'base16-dark',
'base16-light',
'bespin',
'blackboard',
'cobalt',
'colorforth',
'dracula',
'eclipse',
'elegant',
'erlang-dark',
'hopscotch',
'icecoder',
'isotope',
'lesser-dark',
'liquibyte',
'material',
'mbo',
'mdn-like',
'midnight',
'monokai',
'neat',
'neo',
'night',
'paraiso-dark',
'paraiso-light',
'pastel-on-dark',
'railscasts',
'rubyblue',
'seti',
'solarized',
'the-matrix',
'tomorrow-night-bright',
'tomorrow-night-eighties',
'ttcn',
'twilight',
'vibrant-ink',
'xq-dark',
'xq-light',
'yeti',
'zenburn',
"3024-day",
"3024-night",
"abcdef",
"ambiance",
"base16-dark",
"base16-light",
"bespin",
"blackboard",
"cobalt",
"colorforth",
"dracula",
"eclipse",
"elegant",
"erlang-dark",
"hopscotch",
"icecoder",
"isotope",
"lesser-dark",
"liquibyte",
"material",
"mbo",
"mdn-like",
"midnight",
"monokai",
"neat",
"neo",
"night",
"paraiso-dark",
"paraiso-light",
"pastel-on-dark",
"railscasts",
"rubyblue",
"seti",
"solarized",
"the-matrix",
"tomorrow-night-bright",
"tomorrow-night-eighties",
"ttcn",
"twilight",
"vibrant-ink",
"xq-dark",
"xq-light",
"yeti",
"zenburn",
]
# Available modes must be enumerated here,
@ -90,137 +90,142 @@ CM_THEMES = [
# gerrit-gwtui/src/main/java/net/codemirror/mode/ModeInfo.java,
# and in CodeMirror's own mode/meta.js script.
CM_MODES = [
'apl',
'asciiarmor',
'asn.1',
'asterisk',
'brainfuck',
'clike',
'clojure',
'cmake',
'cobol',
'coffeescript',
'commonlisp',
'crystal',
'css',
'cypher',
'd',
'dart',
'diff',
'django',
'dockerfile',
'dtd',
'dylan',
'ebnf',
'ecl',
'eiffel',
'elm',
'erlang',
'factor',
'fcl',
'forth',
'fortran',
'gas',
'gfm',
'gherkin',
'go',
'groovy',
'haml',
'handlebars',
'haskell-literate',
'haskell',
'haxe',
'htmlembedded',
'htmlmixed',
'http',
'idl',
'javascript',
'jinja2',
'jsx',
'julia',
'livescript',
'lua',
'markdown',
'mathematica',
'mbox',
'mirc',
'mllike',
'modelica',
'mscgen',
'mumps',
'nginx',
'nsis',
'ntriples',
'octave',
'oz',
'pascal',
'pegjs',
'perl',
'php',
'pig',
'powershell',
'properties',
'protobuf',
'pug',
'puppet',
'python',
'q',
'r',
'rpm',
'rst',
'ruby',
'rust',
'sas',
'sass',
'scheme',
'shell',
'sieve',
'slim',
'smalltalk',
'smarty',
'solr',
'soy',
'sparql',
'spreadsheet',
'sql',
'stex',
'stylus',
'swift',
'tcl',
'textile',
'tiddlywiki',
'tiki',
'toml',
'tornado',
'troff',
'ttcn-cfg',
'ttcn',
'turtle',
'twig',
'vb',
'vbscript',
'velocity',
'verilog',
'vhdl',
'vue',
'webidl',
'xml',
'xquery',
'yacas',
'yaml-frontmatter',
'yaml',
'z80',
"apl",
"asciiarmor",
"asn.1",
"asterisk",
"brainfuck",
"clike",
"clojure",
"cmake",
"cobol",
"coffeescript",
"commonlisp",
"crystal",
"css",
"cypher",
"d",
"dart",
"diff",
"django",
"dockerfile",
"dtd",
"dylan",
"ebnf",
"ecl",
"eiffel",
"elm",
"erlang",
"factor",
"fcl",
"forth",
"fortran",
"gas",
"gfm",
"gherkin",
"go",
"groovy",
"haml",
"handlebars",
"haskell-literate",
"haskell",
"haxe",
"htmlembedded",
"htmlmixed",
"http",
"idl",
"javascript",
"jinja2",
"jsx",
"julia",
"livescript",
"lua",
"markdown",
"mathematica",
"mbox",
"mirc",
"mllike",
"modelica",
"mscgen",
"mumps",
"nginx",
"nsis",
"ntriples",
"octave",
"oz",
"pascal",
"pegjs",
"perl",
"php",
"pig",
"powershell",
"properties",
"protobuf",
"pug",
"puppet",
"python",
"q",
"r",
"rpm",
"rst",
"ruby",
"rust",
"sas",
"sass",
"scheme",
"shell",
"sieve",
"slim",
"smalltalk",
"smarty",
"solr",
"soy",
"sparql",
"spreadsheet",
"sql",
"stex",
"stylus",
"swift",
"tcl",
"textile",
"tiddlywiki",
"tiki",
"toml",
"tornado",
"troff",
"ttcn-cfg",
"ttcn",
"turtle",
"twig",
"vb",
"vbscript",
"velocity",
"verilog",
"vhdl",
"vue",
"webidl",
"xml",
"xquery",
"yacas",
"yaml-frontmatter",
"yaml",
"z80",
]
VERSION = '5.19.0'
TOP = 'META-INF/resources/webjars/codemirror/%s' % VERSION
TOP_MINIFIED = 'META-INF/resources/webjars/codemirror-minified/%s' % VERSION
LICENSE = '//lib:LICENSE-codemirror-original'
LICENSE_MINIFIED = '//lib:LICENSE-codemirror-minified'
VERSION = "5.19.0"
DIFF_MATCH_PATCH_VERSION = '20121119-1'
DIFF_MATCH_PATCH_TOP = ('META-INF/resources/webjars/google-diff-match-patch/%s'
% DIFF_MATCH_PATCH_VERSION)
TOP = "META-INF/resources/webjars/codemirror/%s" % VERSION
TOP_MINIFIED = "META-INF/resources/webjars/codemirror-minified/%s" % VERSION
LICENSE = "//lib:LICENSE-codemirror-original"
LICENSE_MINIFIED = "//lib:LICENSE-codemirror-minified"
DIFF_MATCH_PATCH_VERSION = "20121119-1"
DIFF_MATCH_PATCH_TOP = ("META-INF/resources/webjars/google-diff-match-patch/%s" %
DIFF_MATCH_PATCH_VERSION)
def pkg_cm():
for archive, suffix, top, license in [

View File

@ -1,3 +1,5 @@
GUAVA_VERSION = '20.0'
GUAVA_BIN_SHA1 = '89507701249388e1ed5ddcf8c41f4ce1be7831ef'
GUAVA_DOC_URL = 'https://google.github.io/guava/releases/' + GUAVA_VERSION + '/api/docs/'
GUAVA_VERSION = "20.0"
GUAVA_BIN_SHA1 = "89507701249388e1ed5ddcf8c41f4ce1be7831ef"
GUAVA_DOC_URL = "https://google.github.io/guava/releases/" + GUAVA_VERSION + "/api/docs/"

View File

@ -1,4 +1,6 @@
JGIT_VERS = '4.5.0.201609210915-r.115-g81f9c1843'
DOC_VERS = '4.5.0.201609210915-r'
JGIT_VERS = "4.5.0.201609210915-r.115-g81f9c1843"
DOC_VERS = "4.5.0.201609210915-r"
#DOC_VERS = JGIT_VERS # Set to VERS unless using a snapshot
JGIT_DOC_URL="http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs"
JGIT_DOC_URL = "http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs"

View File

@ -5,6 +5,7 @@
#
load("//tools/bzl:js.bzl", "bower_archive")
def load_bower_archives():
bower_archive(
name = "accessibility-developer-tools",

View File

@ -5,6 +5,7 @@
#
load("//tools/bzl:js.bzl", "bower_component")
def define_bower_components():
bower_component(
name = "accessibility-developer-tools",

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load('//tools/bzl:genrule2.bzl', 'genrule2')
load("//tools/bzl:genrule2.bzl", "genrule2")
def prolog_cafe_library(
name,

View File

@ -17,7 +17,6 @@ def documentation_attributes():
"revnumber=%s",
]
def release_notes_attributes():
return [
'toc',
@ -33,7 +32,6 @@ def release_notes_attributes():
'linkcss=true',
]
def _replace_macros_impl(ctx):
cmd = [
ctx.file._exe.path,
@ -53,23 +51,22 @@ def _replace_macros_impl(ctx):
)
_replace_macros = rule(
implementation = _replace_macros_impl,
attrs = {
"_exe": attr.label(
default = Label("//Documentation:replace_macros.py"),
allow_single_file = True,
),
"src": attr.label(
mandatory = True,
allow_single_file = [".txt"],
),
"suffix": attr.string(mandatory = True),
"searchbox": attr.bool(default = True),
"out": attr.output(mandatory = True),
},
attrs = {
"_exe": attr.label(
default = Label("//Documentation:replace_macros.py"),
allow_single_file = True,
),
"src": attr.label(
mandatory = True,
allow_single_file = [".txt"],
),
"suffix": attr.string(mandatory = True),
"searchbox": attr.bool(default = True),
"out": attr.output(mandatory = True),
},
implementation = _replace_macros_impl,
)
def _generate_asciidoc_args(ctx):
args = []
if ctx.attr.backend:
@ -88,7 +85,6 @@ def _generate_asciidoc_args(ctx):
args.append(src.path)
return args
def _invoke_replace_macros(name, src, suffix, searchbox):
fn = src
if fn.startswith(":"):
@ -104,7 +100,6 @@ def _invoke_replace_macros(name, src, suffix, searchbox):
return ":" + fn + suffix, fn.replace(".txt", ".html")
def _asciidoc_impl(ctx):
args = [
"--bazel",
@ -121,30 +116,32 @@ def _asciidoc_impl(ctx):
)
_asciidoc_attrs = {
"_exe": attr.label(
default = Label("//lib/asciidoctor:asciidoc"),
cfg = "host",
allow_files = True,
executable = True,
),
"srcs": attr.label_list(mandatory = True, allow_files = True),
"version": attr.label(
default = Label("//:version.txt"),
allow_single_file = True,
),
"suffix": attr.string(mandatory = True),
"backend": attr.string(),
"attributes": attr.string_list(),
"_exe": attr.label(
default = Label("//lib/asciidoctor:asciidoc"),
cfg = "host",
allow_files = True,
executable = True,
),
"srcs": attr.label_list(
mandatory = True,
allow_files = True,
),
"version": attr.label(
default = Label("//:version.txt"),
allow_single_file = True,
),
"suffix": attr.string(mandatory = True),
"backend": attr.string(),
"attributes": attr.string_list(),
}
_asciidoc = rule(
implementation = _asciidoc_impl,
attrs = _asciidoc_attrs + {
"outs": attr.output_list(mandatory = True),
},
attrs = _asciidoc_attrs + {
"outs": attr.output_list(mandatory = True),
},
implementation = _asciidoc_impl,
)
def _genasciidoc_htmlonly(
name,
srcs = [],
@ -176,7 +173,6 @@ def _genasciidoc_htmlonly(
**kwargs
)
def genasciidoc(
name,
srcs = [],
@ -207,7 +203,6 @@ def genasciidoc(
**kwargs
)
def _asciidoc_html_zip_impl(ctx):
args = [
"--mktmp",
@ -225,14 +220,13 @@ def _asciidoc_html_zip_impl(ctx):
)
_asciidoc_html_zip = rule(
implementation = _asciidoc_html_zip_impl,
attrs = _asciidoc_attrs,
outputs = {
"out": "%{name}.zip",
}
attrs = _asciidoc_attrs,
outputs = {
"out": "%{name}.zip",
},
implementation = _asciidoc_html_zip_impl,
)
def _genasciidoc_htmlonly_zip(
name,
srcs = [],
@ -255,7 +249,6 @@ def _genasciidoc_htmlonly_zip(
attributes = attributes,
)
def _asciidoc_zip_impl(ctx):
tmpdir = ctx.outputs.out.path + "_tmpdir"
cmd = [
@ -284,21 +277,23 @@ def _asciidoc_zip_impl(ctx):
)
_asciidoc_zip = rule(
implementation = _asciidoc_zip_impl,
attrs = {
"src": attr.label(
mandatory = True,
allow_single_file = [".zip"],
),
"resources": attr.label_list(mandatory = True, allow_files = True),
"directory": attr.string(mandatory = True),
},
outputs = {
"out": "%{name}.zip",
}
attrs = {
"src": attr.label(
mandatory = True,
allow_single_file = [".zip"],
),
"resources": attr.label_list(
mandatory = True,
allow_files = True,
),
"directory": attr.string(mandatory = True),
},
outputs = {
"out": "%{name}.zip",
},
implementation = _asciidoc_zip_impl,
)
def genasciidoc_zip(
name,
srcs = [],

View File

@ -1,4 +1,3 @@
def _classpath_collector(ctx):
all = set()
for d in ctx.attr.deps:
@ -13,10 +12,11 @@ def _classpath_collector(ctx):
content="\n".join(sorted(as_strs)))
classpath_collector = rule(
implementation = _classpath_collector,
attrs = {
"deps": attr.label_list(),
},
outputs={
"runtime": "%{name}.runtime_classpath"
})
outputs = {
"runtime": "%{name}.runtime_classpath",
},
implementation = _classpath_collector,
)

View File

@ -14,74 +14,78 @@
# Port of Buck native gwt_binary() rule. See discussion in context of
# https://github.com/facebook/buck/issues/109
load('//tools/bzl:genrule2.bzl', 'genrule2')
load('//tools/bzl:java.bzl', 'java_library2')
load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:java.bzl", "java_library2")
jar_filetype = FileType(['.jar'])
jar_filetype = FileType([".jar"])
BROWSERS = [
'chrome',
'firefox',
'gecko1_8',
'safari',
'msie', 'ie8', 'ie9', 'ie10',
'edge',
"chrome",
"firefox",
"gecko1_8",
"safari",
"msie",
"ie8",
"ie9",
"ie10",
"edge",
]
ALIASES = {
'chrome': 'safari',
'firefox': 'gecko1_8',
'msie': 'ie10',
'edge': 'gecko1_8',
"chrome": "safari",
"firefox": "gecko1_8",
"msie": "ie10",
"edge": "gecko1_8",
}
MODULE = 'com.google.gerrit.GerritGwtUI'
MODULE = "com.google.gerrit.GerritGwtUI"
GWT_COMPILER = "com.google.gwt.dev.Compiler"
GWT_JVM_ARGS = ['-Xmx512m']
GWT_JVM_ARGS = ["-Xmx512m"]
GWT_COMPILER_ARGS = [
'-XdisableClassMetadata',
"-XdisableClassMetadata",
]
GWT_COMPILER_ARGS_RELEASE_MODE = GWT_COMPILER_ARGS + [
'-XdisableCastChecking',
"-XdisableCastChecking",
]
PLUGIN_DEPS_NEVERLINK = [
'//gerrit-plugin-api:lib-neverlink',
"//gerrit-plugin-api:lib-neverlink",
]
GWT_PLUGIN_DEPS_NEVERLINK = [
'//gerrit-plugin-gwtui:gwtui-api-lib-neverlink',
'//lib/gwt:user-neverlink',
"//gerrit-plugin-gwtui:gwtui-api-lib-neverlink",
"//lib/gwt:user-neverlink",
]
GWT_PLUGIN_DEPS = [
'//gerrit-plugin-gwtui:gwtui-api-lib',
"//gerrit-plugin-gwtui:gwtui-api-lib",
]
GWT_TRANSITIVE_DEPS = [
'//lib/gwt:ant',
'//lib/gwt:colt',
'//lib/gwt:javax-validation',
'//lib/gwt:javax-validation_src',
'//lib/gwt:jsinterop-annotations',
'//lib/gwt:jsinterop-annotations_src',
'//lib/gwt:tapestry',
'//lib/gwt:w3c-css-sac',
'//lib/ow2:ow2-asm',
'//lib/ow2:ow2-asm-analysis',
'//lib/ow2:ow2-asm-commons',
'//lib/ow2:ow2-asm-tree',
'//lib/ow2:ow2-asm-util',
"//lib/gwt:ant",
"//lib/gwt:colt",
"//lib/gwt:javax-validation",
"//lib/gwt:javax-validation_src",
"//lib/gwt:jsinterop-annotations",
"//lib/gwt:jsinterop-annotations_src",
"//lib/gwt:tapestry",
"//lib/gwt:w3c-css-sac",
"//lib/ow2:ow2-asm",
"//lib/ow2:ow2-asm-analysis",
"//lib/ow2:ow2-asm-commons",
"//lib/ow2:ow2-asm-tree",
"//lib/ow2:ow2-asm-util",
]
DEPS = GWT_TRANSITIVE_DEPS + [
'//gerrit-gwtexpui:CSS',
'//lib:gwtjsonrpc',
'//lib/gwt:dev',
'@jgit//jar:src',
"//gerrit-gwtexpui:CSS",
"//lib:gwtjsonrpc",
"//lib/gwt:dev",
"@jgit//jar:src",
]
USER_AGENT_XML = """<module rename-to='gerrit_ui'>
@ -202,27 +206,29 @@ def _get_transitive_closure(ctx):
return deps
gwt_binary = rule(
implementation = _gwt_binary_impl,
attrs = {
"user_agent": attr.string(),
"style": attr.string(default = "OBF"),
"optimize": attr.string(default = "9"),
"deps": attr.label_list(allow_files=jar_filetype),
"module": attr.string_list(default = [MODULE]),
"module_deps": attr.label_list(allow_files=jar_filetype),
"compiler_args": attr.string_list(),
"jvm_args": attr.string_list(),
"_jdk": attr.label(
default=Label("//tools/defaults:jdk")),
"_zip": attr.label(
default=Label("@bazel_tools//tools/zip:zipper"),
cfg = "host",
executable=True,
single_file=True),
},
outputs = {
"output": "%{name}.zip",
},
attrs = {
"user_agent": attr.string(),
"style": attr.string(default = "OBF"),
"optimize": attr.string(default = "9"),
"deps": attr.label_list(allow_files = jar_filetype),
"module": attr.string_list(default = [MODULE]),
"module_deps": attr.label_list(allow_files = jar_filetype),
"compiler_args": attr.string_list(),
"jvm_args": attr.string_list(),
"_jdk": attr.label(
default = Label("//tools/defaults:jdk"),
),
"_zip": attr.label(
default = Label("@bazel_tools//tools/zip:zipper"),
cfg = "host",
executable = True,
single_file = True,
),
},
outputs = {
"output": "%{name}.zip",
},
implementation = _gwt_binary_impl,
)
def gwt_genrule(suffix = ""):

View File

@ -59,18 +59,20 @@ def _impl(ctx):
java_doc = rule(
attrs = {
"libs": attr.label_list(allow_files = False),
"pkgs": attr.string_list(),
"title": attr.string(),
"external_docs": attr.string_list(),
"_javadoc": attr.label(
default = Label("@local_jdk//:bin/javadoc"),
single_file = True,
allow_files = True),
"_jdk": attr.label(
default = Label("@local_jdk//:jdk-default"),
allow_files = True),
"libs": attr.label_list(allow_files = False),
"pkgs": attr.string_list(),
"title": attr.string(),
"external_docs": attr.string_list(),
"_javadoc": attr.label(
default = Label("@local_jdk//:bin/javadoc"),
single_file = True,
allow_files = True,
),
"_jdk": attr.label(
default = Label("@local_jdk//:jdk-default"),
allow_files = True,
),
},
outputs = {"zip": "%{name}.zip"},
implementation = _impl,
outputs = {"zip" : "%{name}.zip"},
)

View File

@ -1,23 +1,22 @@
NPMJS = "NPMJS"
GERRIT = "GERRIT:"
NPM_VERSIONS = {
"bower": '1.7.9',
'crisper': '2.0.2',
'vulcanize': '1.14.8',
"bower": "1.7.9",
"crisper": "2.0.2",
"vulcanize": "1.14.8",
}
NPM_SHA1S = {
"bower": 'b7296c2393e0d75edaa6ca39648132dd255812b0',
"crisper": '7183c58cea33632fb036c91cefd1b43e390d22a2',
'vulcanize': '679107f251c19ab7539529b1e3fdd40829e6fc63',
"bower": "b7296c2393e0d75edaa6ca39648132dd255812b0",
"crisper": "7183c58cea33632fb036c91cefd1b43e390d22a2",
"vulcanize": "679107f251c19ab7539529b1e3fdd40829e6fc63",
}
def _npm_tarball(name):
return "%s@%s.npm_binary.tgz" % (name, NPM_VERSIONS[name])
def _npm_binary_impl(ctx):
"""rule to download a NPM archive."""
name = ctx.name
@ -47,14 +46,14 @@ def _npm_binary_impl(ctx):
ctx.file("BUILD", "package(default_visibility=['//visibility:public'])\nfilegroup(name='tarball', srcs=['%s'])" % base, False)
npm_binary = repository_rule(
implementation=_npm_binary_impl,
local=True,
attrs={
# Label resolves within repo of the .bzl file.
"_download_script": attr.label(default=Label("//tools:download_file.py")),
"repository": attr.string(default=NPMJS),
})
attrs = {
# Label resolves within repo of the .bzl file.
"_download_script": attr.label(default = Label("//tools:download_file.py")),
"repository": attr.string(default = NPMJS),
},
local = True,
implementation = _npm_binary_impl,
)
# for use in repo rules.
def _run_npm_binary_str(ctx, tarball, args):
@ -64,7 +63,6 @@ def _run_npm_binary_str(ctx, tarball, args):
ctx.path(ctx.attr._run_npm),
ctx.path(tarball)] + args)
def _bower_archive(ctx):
"""Download a bower package."""
download_name = '%s__download_bower.zip' % ctx.name
@ -106,26 +104,24 @@ def _bower_archive(ctx):
"filegroup(name = 'version_json', srcs = ['%s'], visibility=['//visibility:public'])" % version_name,
]), False)
def _bash(ctx, cmd):
cmd_list = ["/bin/bash", "-c", cmd]
out = ctx.execute(cmd_list)
if out.return_code:
fail("failed %s: %s" % (" ".join(cmd_list), out.stderr))
bower_archive=repository_rule(
_bower_archive,
attrs={
"_bower_archive": attr.label(default=Label("@bower//:%s" % _npm_tarball("bower"))),
"_run_npm": attr.label(default=Label("//tools/js:run_npm_binary.py")),
"_download_bower": attr.label(default=Label("//tools/js:download_bower.py")),
"sha1": attr.string(mandatory=True),
"version": attr.string(mandatory=True),
"package": attr.string(mandatory=True),
"semver": attr.string(),
})
bower_archive = repository_rule(
_bower_archive,
attrs = {
"_bower_archive": attr.label(default = Label("@bower//:%s" % _npm_tarball("bower"))),
"_run_npm": attr.label(default = Label("//tools/js:run_npm_binary.py")),
"_download_bower": attr.label(default = Label("//tools/js:download_bower.py")),
"sha1": attr.string(mandatory = True),
"version": attr.string(mandatory = True),
"package": attr.string(mandatory = True),
"semver": attr.string(),
},
)
def _bower_component_impl(ctx):
transitive_zipfiles = set([ctx.file.zipfile])
@ -149,15 +145,13 @@ def _bower_component_impl(ctx):
transitive_licenses=transitive_licenses,
)
_common_attrs = {
"deps": attr.label_list(providers=[
"transitive_zipfiles",
"transitive_versions",
"transitive_licenses",
])
}
"deps": attr.label_list(providers = [
"transitive_zipfiles",
"transitive_versions",
"transitive_licenses",
]),
}
def _js_component(ctx):
dir = ctx.outputs.zip.path + ".dir"
@ -188,31 +182,28 @@ def _js_component(ctx):
transitive_versions=set([]),
transitive_licenses=licenses)
js_component = rule(
_js_component,
attrs=_common_attrs + {
"srcs": attr.label_list(allow_files=[".js"]),
"license": attr.label(allow_single_file=True),
},
outputs={
"zip": "%{name}.zip",
}
_js_component,
attrs = _common_attrs + {
"srcs": attr.label_list(allow_files = [".js"]),
"license": attr.label(allow_single_file = True),
},
outputs = {
"zip": "%{name}.zip",
},
)
_bower_component = rule(
_bower_component_impl,
attrs=_common_attrs + {
"zipfile": attr.label(allow_single_file=[".zip"]),
"license": attr.label(allow_single_file=True),
"version_json": attr.label(allow_files=[".json"]),
# If set, define by hand, and don't regenerate this entry in bower2bazel.
"seed": attr.bool(default=False)
})
_bower_component_impl,
attrs = _common_attrs + {
"zipfile": attr.label(allow_single_file = [".zip"]),
"license": attr.label(allow_single_file = True),
"version_json": attr.label(allow_files = [".json"]),
# If set, define by hand, and don't regenerate this entry in bower2bazel.
"seed": attr.bool(default = False),
},
)
# TODO(hanwen): make license mandatory.
def bower_component(name, license=None, **kwargs):
@ -226,7 +217,6 @@ def bower_component(name, license=None, **kwargs):
version_json="@%s//:version_json" % name,
**kwargs)
def _bower_component_bundle_impl(ctx):
"""A bunch of bower components zipped up."""
zips = set([])
@ -270,14 +260,13 @@ def _bower_component_bundle_impl(ctx):
transitive_versions=versions,
transitive_licenses=licenses)
bower_component_bundle = rule(
_bower_component_bundle_impl,
attrs=_common_attrs,
outputs={
"zip": "%{name}.zip",
"version_json": "%{name}-versions.json",
}
_bower_component_bundle_impl,
attrs = _common_attrs,
outputs = {
"zip": "%{name}.zip",
"version_json": "%{name}-versions.json",
},
)
def _vulcanize_impl(ctx):
@ -345,33 +334,39 @@ def _vulcanize_impl(ctx):
command = hermetic_npm_command,
**node_tweaks)
_vulcanize_rule = rule(
_vulcanize_impl,
attrs = {
"deps": attr.label_list(providers=["transitive_zipfiles"]),
"app": attr.label(mandatory=True, allow_single_file=True),
"srcs": attr.label_list(allow_files=[".js", ".html", ".txt", ".css", ".ico"]),
"pkg": attr.string(mandatory=True),
"_run_npm": attr.label(
default=Label("//tools/js:run_npm_binary.py"),
allow_single_file=True
),
"_vulcanize_archive": attr.label(
default=Label("@vulcanize//:%s" % _npm_tarball("vulcanize")),
allow_single_file=True
),
"_crisper_archive": attr.label(
default=Label("@crisper//:%s" % _npm_tarball("crisper")),
allow_single_file=True
),
},
outputs = {
"html": "%{name}.html",
"js": "%{name}.js",
}
_vulcanize_impl,
attrs = {
"deps": attr.label_list(providers = ["transitive_zipfiles"]),
"app": attr.label(
mandatory = True,
allow_single_file = True,
),
"srcs": attr.label_list(allow_files = [
".js",
".html",
".txt",
".css",
".ico",
]),
"pkg": attr.string(mandatory = True),
"_run_npm": attr.label(
default = Label("//tools/js:run_npm_binary.py"),
allow_single_file = True,
),
"_vulcanize_archive": attr.label(
default = Label("@vulcanize//:%s" % _npm_tarball("vulcanize")),
allow_single_file = True,
),
"_crisper_archive": attr.label(
default = Label("@crisper//:%s" % _npm_tarball("crisper")),
allow_single_file = True,
),
},
outputs = {
"html": "%{name}.html",
"js": "%{name}.js",
},
)
def vulcanize(*args, **kwargs):

View File

@ -1,4 +1,3 @@
def normalize_target_name(target):
return target.replace("//", "").replace("/", "__").replace(":", "___")

View File

@ -1,7 +1,10 @@
GERRIT = 'GERRIT:'
GERRIT_API = 'GERRIT_API:'
MAVEN_CENTRAL = 'MAVEN_CENTRAL:'
MAVEN_LOCAL = 'MAVEN_LOCAL:'
GERRIT = "GERRIT:"
GERRIT_API = "GERRIT_API:"
MAVEN_CENTRAL = "MAVEN_CENTRAL:"
MAVEN_LOCAL = "MAVEN_LOCAL:"
def _maven_release(ctx, parts):
"""induce jar and url name from maven coordinates."""
@ -54,13 +57,18 @@ def _generate_build_file(ctx, binjar, srcjar):
if srcjar:
srcjar_attr = 'srcjar = "%s",' % srcjar
contents = """
# DO NOT EDIT: automatically generated BUILD file for maven_archive rule {rule_name}
# DO NOT EDIT: automatically generated BUILD file for maven_jar rule {rule_name}
package(default_visibility = ['//visibility:public'])
java_import(
name = 'jar',
{srcjar_attr}
jars = ['{binjar}'],
)
java_import(
name = 'neverlink',
jars = ['{binjar}'],
neverlink = 1,
)
\n""".format(srcjar_attr = srcjar_attr,
rule_name = ctx.name,
binjar = binjar)
@ -116,16 +124,17 @@ def _maven_jar_impl(ctx):
_generate_build_file(ctx, binjar, srcjar)
maven_jar=repository_rule(
implementation=_maven_jar_impl,
local=True,
attrs={
"artifact": attr.string(mandatory=True),
"sha1": attr.string(mandatory=True),
"src_sha1": attr.string(),
"_download_script": attr.label(default=Label("//tools:download_file.py")),
"repository": attr.string(default=MAVEN_CENTRAL),
"attach_source": attr.bool(default=True),
"unsign": attr.bool(default=False),
"exclude": attr.string_list(),
})
maven_jar = repository_rule(
attrs = {
"artifact": attr.string(mandatory = True),
"sha1": attr.string(mandatory = True),
"src_sha1": attr.string(),
"_download_script": attr.label(default = Label("//tools:download_file.py")),
"repository": attr.string(default = MAVEN_CENTRAL),
"attach_source": attr.bool(default = True),
"unsign": attr.bool(default = False),
"exclude": attr.string_list(),
},
local = True,
implementation = _maven_jar_impl,
)

View File

@ -14,18 +14,18 @@
# War packaging.
jar_filetype = FileType(['.jar'])
jar_filetype = FileType([".jar"])
LIBS = [
'//gerrit-war:init',
'//gerrit-war:log4j-config',
'//gerrit-war:version',
'//lib:postgresql',
'//lib/log:impl_log4j',
"//gerrit-war:init",
"//gerrit-war:log4j-config",
"//gerrit-war:version",
"//lib:postgresql",
"//lib/log:impl_log4j",
]
PGMLIBS = [
'//gerrit-pgm:pgm'
"//gerrit-pgm:pgm",
]
def _add_context(in_file, output):
@ -122,13 +122,13 @@ def _war_impl(ctx):
# libs: go to the WEB-INF/lib directory
# pgmlibs: go to the WEB-INF/pgm-lib directory
_pkg_war = rule(
attrs = {
'context': attr.label_list(allow_files = True),
'libs': attr.label_list(allow_files = jar_filetype),
'pgmlibs': attr.label_list(allow_files = False),
},
implementation = _war_impl,
outputs = {'war' : '%{name}.war'},
attrs = {
"context": attr.label_list(allow_files = True),
"libs": attr.label_list(allow_files = jar_filetype),
"pgmlibs": attr.label_list(allow_files = False),
},
outputs = {"war": "%{name}.war"},
implementation = _war_impl,
)
def pkg_war(name, ui = 'ui_optdbg', context = [], doc = False, **kwargs):

View File

@ -1,12 +1,23 @@
load('//tools/bzl:genrule2.bzl', 'genrule2')
load('//tools/bzl:gwt.bzl', 'GWT_PLUGIN_DEPS',
'GWT_PLUGIN_DEPS_NEVERLINK', 'GWT_TRANSITIVE_DEPS',
'GWT_COMPILER_ARGS', 'PLUGIN_DEPS_NEVERLINK',
'GWT_JVM_ARGS', 'gwt_binary')
load("//tools/bzl:genrule2.bzl", "genrule2")
load(
"//tools/bzl:gwt.bzl",
"GWT_PLUGIN_DEPS",
"GWT_PLUGIN_DEPS_NEVERLINK",
"GWT_TRANSITIVE_DEPS",
"GWT_COMPILER_ARGS",
"PLUGIN_DEPS_NEVERLINK",
"GWT_JVM_ARGS",
"gwt_binary",
)
PLUGIN_DEPS = ["//gerrit-plugin-api:lib"]
PLUGIN_TEST_DEPS = ["//gerrit-acceptance-framework:lib"]
def gerrit_plugin(
name,
deps = [],
provided_deps = [],
srcs = [],
gwt_module = [],
resources = [],
@ -16,7 +27,7 @@ def gerrit_plugin(
name = name + '__plugin',
srcs = srcs,
resources = resources,
deps = deps + GWT_PLUGIN_DEPS_NEVERLINK + PLUGIN_DEPS_NEVERLINK,
deps = provided_deps + deps + GWT_PLUGIN_DEPS_NEVERLINK + PLUGIN_DEPS_NEVERLINK,
visibility = ['//visibility:public'],
)

View File

@ -1,12 +1,12 @@
CORE_PLUGINS = [
'commit-message-length-validator',
'download-commands',
'hooks',
'replication',
'reviewnotes',
'singleusergroup',
"commit-message-length-validator",
"download-commands",
"hooks",
"replication",
"reviewnotes",
"singleusergroup",
]
CUSTOM_PLUGINS = [
'cookbook-plugin',
"cookbook-plugin",
]

View File

@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
sh_bang_template = (' && '.join([
"echo '#!/bin/bash -e' > $@",
'echo "# this script should run from the root of your workspace." >> $@',
'echo "" >> $@',
"echo 'if [[ \"$$VERBOSE\" ]]; then set -x ; fi' >> $@",
'echo "" >> $@',
'echo %s >> $@',
'echo "" >> $@',
'echo %s >> $@']))
sh_bang_template = (" && ".join([
"echo '#!/bin/bash -e' > $@",
"echo \"# this script should run from the root of your workspace.\" >> $@",
"echo \"\" >> $@",
"echo 'if [[ \"$$VERBOSE\" ]]; then set -x ; fi' >> $@",
"echo \"\" >> $@",
"echo %s >> $@",
"echo \"\" >> $@",
"echo %s >> $@",
]))
def maven_package(
version,