Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: Apply buildifier to .bzl files. Update Bower to 1.8.2 Bump commons-io version to 2.2 Change-Id: Ic90865db76a0e34f0f8fef33b83ec7b2fd75c875
This commit is contained in:
commit
8b3324c69e
@ -4,16 +4,16 @@ def acceptance_tests(
|
|||||||
group,
|
group,
|
||||||
deps = [],
|
deps = [],
|
||||||
labels = [],
|
labels = [],
|
||||||
vm_args = ['-Xmx256m'],
|
vm_args = ["-Xmx256m"],
|
||||||
**kwargs):
|
**kwargs):
|
||||||
junit_tests(
|
junit_tests(
|
||||||
name = group,
|
name = group,
|
||||||
deps = deps + [
|
deps = deps + [
|
||||||
'//gerrit-acceptance-tests:lib',
|
"//gerrit-acceptance-tests:lib",
|
||||||
],
|
],
|
||||||
tags = labels + [
|
tags = labels + [
|
||||||
'acceptance',
|
"acceptance",
|
||||||
'slow',
|
"slow",
|
||||||
],
|
],
|
||||||
size = "large",
|
size = "large",
|
||||||
jvm_flags = vm_args,
|
jvm_flags = vm_args,
|
||||||
|
@ -231,125 +231,141 @@ DIFF_MATCH_PATCH_TOP = ("META-INF/resources/webjars/google-diff-match-patch/%s"
|
|||||||
|
|
||||||
def pkg_cm():
|
def pkg_cm():
|
||||||
for archive, suffix, top, license in [
|
for archive, suffix, top, license in [
|
||||||
('@codemirror-original//jar', '', TOP, LICENSE),
|
("@codemirror-original//jar", "", TOP, LICENSE),
|
||||||
('@codemirror-minified//jar', '_r', TOP_MINIFIED, LICENSE_MINIFIED)
|
("@codemirror-minified//jar", "_r", TOP_MINIFIED, LICENSE_MINIFIED),
|
||||||
]:
|
]:
|
||||||
# Main JavaScript and addons
|
# Main JavaScript and addons
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'cm' + suffix,
|
name = "cm" + suffix,
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join(
|
||||||
|
[
|
||||||
"echo '/** @license' >$@",
|
"echo '/** @license' >$@",
|
||||||
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
|
"unzip -p $(location %s) %s/LICENSE >>$@" % (archive, top),
|
||||||
"echo '*/' >>$@",
|
"echo '*/' >>$@",
|
||||||
] +
|
] +
|
||||||
['unzip -p $(location %s) %s/%s >>$@' % (archive, top, n) for n in CM_JS] +
|
["unzip -p $(location %s) %s/%s >>$@" % (archive, top, n) for n in CM_JS] +
|
||||||
['unzip -p $(location %s) %s/addon/%s >>$@' % (archive, top, n)
|
[
|
||||||
for n in CM_ADDONS]
|
"unzip -p $(location %s) %s/addon/%s >>$@" % (archive, top, n)
|
||||||
|
for n in CM_ADDONS
|
||||||
|
],
|
||||||
),
|
),
|
||||||
tools = [archive],
|
tools = [archive],
|
||||||
outs = ['cm%s.js' % suffix],
|
outs = ["cm%s.js" % suffix],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main CSS
|
# Main CSS
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'css' + suffix,
|
name = "css" + suffix,
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join(
|
||||||
|
[
|
||||||
"echo '/** @license' >$@",
|
"echo '/** @license' >$@",
|
||||||
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
|
"unzip -p $(location %s) %s/LICENSE >>$@" % (archive, top),
|
||||||
"echo '*/' >>$@",
|
"echo '*/' >>$@",
|
||||||
] +
|
] +
|
||||||
['unzip -p $(location %s) %s/%s >>$@' % (archive, top, n)
|
[
|
||||||
for n in CM_CSS]
|
"unzip -p $(location %s) %s/%s >>$@" % (archive, top, n)
|
||||||
|
for n in CM_CSS
|
||||||
|
],
|
||||||
),
|
),
|
||||||
tools = [archive],
|
tools = [archive],
|
||||||
outs = ['cm%s.css' % suffix],
|
outs = ["cm%s.css" % suffix],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Modes
|
# Modes
|
||||||
for n in CM_MODES:
|
for n in CM_MODES:
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'mode_%s%s' % (n, suffix),
|
name = "mode_%s%s" % (n, suffix),
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join(
|
||||||
|
[
|
||||||
"echo '/** @license' >$@",
|
"echo '/** @license' >$@",
|
||||||
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
|
"unzip -p $(location %s) %s/LICENSE >>$@" % (archive, top),
|
||||||
"echo '*/' >>$@",
|
"echo '*/' >>$@",
|
||||||
'unzip -p $(location %s) %s/mode/%s/%s.js >>$@' % (archive, top, n, n),
|
"unzip -p $(location %s) %s/mode/%s/%s.js >>$@" % (archive, top, n, n),
|
||||||
]
|
],
|
||||||
),
|
),
|
||||||
tools = [archive],
|
tools = [archive],
|
||||||
outs = ['mode_%s%s.js' % (n, suffix)],
|
outs = ["mode_%s%s.js" % (n, suffix)],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Themes
|
# Themes
|
||||||
for n in CM_THEMES:
|
for n in CM_THEMES:
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'theme_%s%s' % (n, suffix),
|
name = "theme_%s%s" % (n, suffix),
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join(
|
||||||
|
[
|
||||||
"echo '/** @license' >$@",
|
"echo '/** @license' >$@",
|
||||||
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
|
"unzip -p $(location %s) %s/LICENSE >>$@" % (archive, top),
|
||||||
"echo '*/' >>$@",
|
"echo '*/' >>$@",
|
||||||
'unzip -p $(location %s) %s/theme/%s.css >>$@' % (archive, top, n)
|
"unzip -p $(location %s) %s/theme/%s.css >>$@" % (archive, top, n),
|
||||||
]
|
],
|
||||||
),
|
),
|
||||||
tools = [archive],
|
tools = [archive],
|
||||||
outs = ['theme_%s%s.css' % (n, suffix)],
|
outs = ["theme_%s%s.css" % (n, suffix)],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Merge Addon bundled with diff-match-patch
|
# Merge Addon bundled with diff-match-patch
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'addon_merge_with_diff_match_patch%s' % suffix,
|
name = "addon_merge_with_diff_match_patch%s" % suffix,
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join(
|
||||||
|
[
|
||||||
"echo '/** @license' >$@",
|
"echo '/** @license' >$@",
|
||||||
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
|
"unzip -p $(location %s) %s/LICENSE >>$@" % (archive, top),
|
||||||
"echo '*/\n' >>$@",
|
"echo '*/\n' >>$@",
|
||||||
"echo '// The google-diff-match-patch library is from https://repo1.maven.org/maven2/org/webjars/google-diff-match-patch/%s/google-diff-match-patch-%s.jar\n' >> $@" % (DIFF_MATCH_PATCH_VERSION, DIFF_MATCH_PATCH_VERSION),
|
"echo '// The google-diff-match-patch library is from https://repo1.maven.org/maven2/org/webjars/google-diff-match-patch/%s/google-diff-match-patch-%s.jar\n' >> $@" % (DIFF_MATCH_PATCH_VERSION, DIFF_MATCH_PATCH_VERSION),
|
||||||
"echo '/** @license' >>$@",
|
"echo '/** @license' >>$@",
|
||||||
"echo 'LICENSE-Apache2.0' >>$@",
|
"echo 'LICENSE-Apache2.0' >>$@",
|
||||||
"echo '*/' >>$@",
|
"echo '*/' >>$@",
|
||||||
'unzip -p $(location @diff-match-patch//jar) %s/diff_match_patch.js >>$@' % DIFF_MATCH_PATCH_TOP,
|
"unzip -p $(location @diff-match-patch//jar) %s/diff_match_patch.js >>$@" % DIFF_MATCH_PATCH_TOP,
|
||||||
"echo ';' >> $@",
|
"echo ';' >> $@",
|
||||||
'unzip -p $(location %s) %s/addon/merge/merge.js >>$@' % (archive, top)
|
"unzip -p $(location %s) %s/addon/merge/merge.js >>$@" % (archive, top),
|
||||||
]
|
],
|
||||||
),
|
),
|
||||||
tools = [
|
tools = [
|
||||||
'@diff-match-patch//jar',
|
"@diff-match-patch//jar",
|
||||||
# dependency just for license tracking.
|
# dependency just for license tracking.
|
||||||
':diff-match-patch',
|
":diff-match-patch",
|
||||||
archive,
|
archive,
|
||||||
"//lib:LICENSE-Apache2.0",
|
"//lib:LICENSE-Apache2.0",
|
||||||
],
|
],
|
||||||
outs = ['addon_merge_with_diff_match_patch%s.js' % suffix],
|
outs = ["addon_merge_with_diff_match_patch%s.js" % suffix],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Jar packaging
|
# Jar packaging
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'jar' + suffix,
|
name = "jar" + suffix,
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join([
|
||||||
'cd $$TMP',
|
"cd $$TMP",
|
||||||
'mkdir -p net/codemirror/{addon,lib,mode,theme}',
|
"mkdir -p net/codemirror/{addon,lib,mode,theme}",
|
||||||
'cp $$ROOT/$(location :css%s) net/codemirror/lib/cm.css' % suffix,
|
"cp $$ROOT/$(location :css%s) net/codemirror/lib/cm.css" % suffix,
|
||||||
'cp $$ROOT/$(location :cm%s) net/codemirror/lib/cm.js' % suffix]
|
"cp $$ROOT/$(location :cm%s) net/codemirror/lib/cm.js" % suffix,
|
||||||
+ ['cp $$ROOT/$(location :mode_%s%s) net/codemirror/mode/%s.js' % (n, suffix, n)
|
] +
|
||||||
for n in CM_MODES]
|
[
|
||||||
+ ['cp $$ROOT/$(location :theme_%s%s) net/codemirror/theme/%s.css' % (n, suffix, n)
|
"cp $$ROOT/$(location :mode_%s%s) net/codemirror/mode/%s.js" % (n, suffix, n)
|
||||||
for n in CM_THEMES]
|
for n in CM_MODES
|
||||||
+ ['cp $$ROOT/$(location :addon_merge_with_diff_match_patch%s) net/codemirror/addon/merge_bundled.js' % suffix]
|
] +
|
||||||
+ ['zip -qr $$ROOT/$@ net/codemirror/{addon,lib,mode,theme}']),
|
[
|
||||||
|
"cp $$ROOT/$(location :theme_%s%s) net/codemirror/theme/%s.css" % (n, suffix, n)
|
||||||
|
for n in CM_THEMES
|
||||||
|
] +
|
||||||
|
["cp $$ROOT/$(location :addon_merge_with_diff_match_patch%s) net/codemirror/addon/merge_bundled.js" % suffix] +
|
||||||
|
["zip -qr $$ROOT/$@ net/codemirror/{addon,lib,mode,theme}"]),
|
||||||
tools = [
|
tools = [
|
||||||
':addon_merge_with_diff_match_patch%s' % suffix,
|
":addon_merge_with_diff_match_patch%s" % suffix,
|
||||||
':cm%s' % suffix,
|
":cm%s" % suffix,
|
||||||
':css%s' % suffix,
|
":css%s" % suffix,
|
||||||
] + [
|
] + [
|
||||||
':mode_%s%s' % (n, suffix) for n in CM_MODES
|
":mode_%s%s" % (n, suffix)
|
||||||
|
for n in CM_MODES
|
||||||
] + [
|
] + [
|
||||||
':theme_%s%s' % (n, suffix) for n in CM_THEMES
|
":theme_%s%s" % (n, suffix)
|
||||||
|
for n in CM_THEMES
|
||||||
],
|
],
|
||||||
outs = ['codemirror%s.jar' % suffix],
|
outs = ["codemirror%s.jar" % suffix],
|
||||||
)
|
)
|
||||||
|
|
||||||
native.java_import(
|
native.java_import(
|
||||||
name = 'codemirror' + suffix,
|
name = "codemirror" + suffix,
|
||||||
jars = [':jar%s' % suffix],
|
jars = [":jar%s" % suffix],
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
data = [license],
|
data = [license],
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "MAVEN_CENTRAL", "maven_jar")
|
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar")
|
||||||
|
|
||||||
_JGIT_VERS = "4.9.2.201712150930-r.15-g5fe8e31d4"
|
_JGIT_VERS = "4.9.2.201712150930-r.15-g5fe8e31d4"
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ def jgit_dep(name):
|
|||||||
"@jgit-junit//jar": "@jgit//org.eclipse.jgit.junit:junit",
|
"@jgit-junit//jar": "@jgit//org.eclipse.jgit.junit:junit",
|
||||||
"@jgit-lib//jar:src": "@jgit//org.eclipse.jgit:libjgit-src.jar",
|
"@jgit-lib//jar:src": "@jgit//org.eclipse.jgit:libjgit-src.jar",
|
||||||
"@jgit-lib//jar": "@jgit//org.eclipse.jgit:jgit",
|
"@jgit-lib//jar": "@jgit//org.eclipse.jgit:jgit",
|
||||||
"@jgit-servlet//jar":"@jgit//org.eclipse.jgit.http.server:jgit-servlet",
|
"@jgit-servlet//jar": "@jgit//org.eclipse.jgit.http.server:jgit-servlet",
|
||||||
"@jgit-archive//jar": "@jgit//org.eclipse.jgit.archive:jgit-archive",
|
"@jgit-archive//jar": "@jgit//org.eclipse.jgit.archive:jgit-archive",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,134 +11,161 @@ def load_bower_archives():
|
|||||||
name = "accessibility-developer-tools",
|
name = "accessibility-developer-tools",
|
||||||
package = "accessibility-developer-tools",
|
package = "accessibility-developer-tools",
|
||||||
version = "2.12.0",
|
version = "2.12.0",
|
||||||
sha1 = "88ae82dcdeb6c658f76eff509d0ee425cae14d49")
|
sha1 = "88ae82dcdeb6c658f76eff509d0ee425cae14d49",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "async",
|
name = "async",
|
||||||
package = "async",
|
package = "async",
|
||||||
version = "1.5.2",
|
version = "1.5.2",
|
||||||
sha1 = "1ec975d3b3834646a7e3d4b7e68118b90ed72508")
|
sha1 = "1ec975d3b3834646a7e3d4b7e68118b90ed72508",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "chai",
|
name = "chai",
|
||||||
package = "chai",
|
package = "chai",
|
||||||
version = "3.5.0",
|
version = "3.5.0",
|
||||||
sha1 = "849ad3ee7c77506548b7b5db603a4e150b9431aa")
|
sha1 = "849ad3ee7c77506548b7b5db603a4e150b9431aa",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "font-roboto",
|
name = "font-roboto",
|
||||||
package = "PolymerElements/font-roboto",
|
package = "PolymerElements/font-roboto",
|
||||||
version = "1.0.3",
|
version = "1.0.3",
|
||||||
sha1 = "edf478d20ae2fc0704d7c155e20162caaabdd5ae")
|
sha1 = "edf478d20ae2fc0704d7c155e20162caaabdd5ae",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-a11y-announcer",
|
name = "iron-a11y-announcer",
|
||||||
package = "PolymerElements/iron-a11y-announcer",
|
package = "PolymerElements/iron-a11y-announcer",
|
||||||
version = "1.0.6",
|
version = "1.0.6",
|
||||||
sha1 = "14aed1e1b300ea344e80362e875919ea3d104dcc")
|
sha1 = "14aed1e1b300ea344e80362e875919ea3d104dcc",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-a11y-keys-behavior",
|
name = "iron-a11y-keys-behavior",
|
||||||
package = "PolymerElements/iron-a11y-keys-behavior",
|
package = "PolymerElements/iron-a11y-keys-behavior",
|
||||||
version = "1.1.9",
|
version = "1.1.9",
|
||||||
sha1 = "f58358ee652c67e6e721364ba50fb77a2ece1465")
|
sha1 = "f58358ee652c67e6e721364ba50fb77a2ece1465",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-behaviors",
|
name = "iron-behaviors",
|
||||||
package = "PolymerElements/iron-behaviors",
|
package = "PolymerElements/iron-behaviors",
|
||||||
version = "1.0.18",
|
version = "1.0.18",
|
||||||
sha1 = "e231a1a02b090f5183db917639fdb96cdd0dca18")
|
sha1 = "e231a1a02b090f5183db917639fdb96cdd0dca18",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-checked-element-behavior",
|
name = "iron-checked-element-behavior",
|
||||||
package = "PolymerElements/iron-checked-element-behavior",
|
package = "PolymerElements/iron-checked-element-behavior",
|
||||||
version = "1.0.6",
|
version = "1.0.6",
|
||||||
sha1 = "93ad3554cec119d8c5732d1c722ad113e1866370")
|
sha1 = "93ad3554cec119d8c5732d1c722ad113e1866370",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-fit-behavior",
|
name = "iron-fit-behavior",
|
||||||
package = "PolymerElements/iron-fit-behavior",
|
package = "PolymerElements/iron-fit-behavior",
|
||||||
version = "1.2.7",
|
version = "1.2.7",
|
||||||
sha1 = "01c485fbf898307029bbb72ac7e132db1570a842")
|
sha1 = "01c485fbf898307029bbb72ac7e132db1570a842",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-flex-layout",
|
name = "iron-flex-layout",
|
||||||
package = "PolymerElements/iron-flex-layout",
|
package = "PolymerElements/iron-flex-layout",
|
||||||
version = "1.3.7",
|
version = "1.3.7",
|
||||||
sha1 = "4d4cf3232cf750a17a7df0a37476117f831ac633")
|
sha1 = "4d4cf3232cf750a17a7df0a37476117f831ac633",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-form-element-behavior",
|
name = "iron-form-element-behavior",
|
||||||
package = "PolymerElements/iron-form-element-behavior",
|
package = "PolymerElements/iron-form-element-behavior",
|
||||||
version = "1.0.7",
|
version = "1.0.7",
|
||||||
sha1 = "7b5a79e02cc32f0918725dd26925d0df1e03ed12")
|
sha1 = "7b5a79e02cc32f0918725dd26925d0df1e03ed12",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-menu-behavior",
|
name = "iron-menu-behavior",
|
||||||
package = "PolymerElements/iron-menu-behavior",
|
package = "PolymerElements/iron-menu-behavior",
|
||||||
version = "2.0.1",
|
version = "2.0.1",
|
||||||
sha1 = "139528ee1e8d86257e2aa445de7761b8ec70ae91")
|
sha1 = "139528ee1e8d86257e2aa445de7761b8ec70ae91",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-meta",
|
name = "iron-meta",
|
||||||
package = "PolymerElements/iron-meta",
|
package = "PolymerElements/iron-meta",
|
||||||
version = "1.1.3",
|
version = "1.1.3",
|
||||||
sha1 = "f77eba3f6f6817f10bda33918bde8f963d450041")
|
sha1 = "f77eba3f6f6817f10bda33918bde8f963d450041",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-resizable-behavior",
|
name = "iron-resizable-behavior",
|
||||||
package = "polymerelements/iron-resizable-behavior",
|
package = "polymerelements/iron-resizable-behavior",
|
||||||
version = "1.0.6",
|
version = "1.0.6",
|
||||||
sha1 = "719c2a8a1a784f8aefcdeef41fcc2e5a03518d9e")
|
sha1 = "719c2a8a1a784f8aefcdeef41fcc2e5a03518d9e",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "iron-validatable-behavior",
|
name = "iron-validatable-behavior",
|
||||||
package = "PolymerElements/iron-validatable-behavior",
|
package = "PolymerElements/iron-validatable-behavior",
|
||||||
version = "1.1.2",
|
version = "1.1.2",
|
||||||
sha1 = "7111f34ff32e1510131dfbdb1eaa51bfa291e8be")
|
sha1 = "7111f34ff32e1510131dfbdb1eaa51bfa291e8be",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "lodash",
|
name = "lodash",
|
||||||
package = "lodash",
|
package = "lodash",
|
||||||
version = "3.10.1",
|
version = "3.10.1",
|
||||||
sha1 = "2f207a8293c4c554bf6cf071241f7a00dc513d3a")
|
sha1 = "2f207a8293c4c554bf6cf071241f7a00dc513d3a",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "mocha",
|
name = "mocha",
|
||||||
package = "mocha",
|
package = "mocha",
|
||||||
version = "3.5.3",
|
version = "3.5.3",
|
||||||
sha1 = "c14f149821e4e96241b20f85134aa757b73038f1")
|
sha1 = "c14f149821e4e96241b20f85134aa757b73038f1",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "neon-animation",
|
name = "neon-animation",
|
||||||
package = "polymerelements/neon-animation",
|
package = "polymerelements/neon-animation",
|
||||||
version = "1.2.5",
|
version = "1.2.5",
|
||||||
sha1 = "588d289f779d02b21ce5b676e257bbd6155649e8")
|
sha1 = "588d289f779d02b21ce5b676e257bbd6155649e8",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "paper-behaviors",
|
name = "paper-behaviors",
|
||||||
package = "polymerelements/paper-behaviors",
|
package = "polymerelements/paper-behaviors",
|
||||||
version = "1.0.13",
|
version = "1.0.13",
|
||||||
sha1 = "a81eab28a952e124c208430e17508d9a1aae4ee7")
|
sha1 = "a81eab28a952e124c208430e17508d9a1aae4ee7",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "paper-material",
|
name = "paper-material",
|
||||||
package = "polymerelements/paper-material",
|
package = "polymerelements/paper-material",
|
||||||
version = "1.0.7",
|
version = "1.0.7",
|
||||||
sha1 = "159b7fb6b13b181c4276b25f9c6adbeaacb0d42b")
|
sha1 = "159b7fb6b13b181c4276b25f9c6adbeaacb0d42b",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "paper-ripple",
|
name = "paper-ripple",
|
||||||
package = "polymerelements/paper-ripple",
|
package = "polymerelements/paper-ripple",
|
||||||
version = "1.0.10",
|
version = "1.0.10",
|
||||||
sha1 = "21199db50d02b842da54bd6f4f1d1b10b474e893")
|
sha1 = "21199db50d02b842da54bd6f4f1d1b10b474e893",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "paper-styles",
|
name = "paper-styles",
|
||||||
package = "PolymerElements/paper-styles",
|
package = "PolymerElements/paper-styles",
|
||||||
version = "1.3.1",
|
version = "1.3.1",
|
||||||
sha1 = "4ee9c692366949a754e0e39f8031aa60ce66f24d")
|
sha1 = "4ee9c692366949a754e0e39f8031aa60ce66f24d",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "sinon-chai",
|
name = "sinon-chai",
|
||||||
package = "sinon-chai",
|
package = "sinon-chai",
|
||||||
version = "2.14.0",
|
version = "2.14.0",
|
||||||
sha1 = "78f0dc184efe47012a2b1b9a16a4289acf8300dc")
|
sha1 = "78f0dc184efe47012a2b1b9a16a4289acf8300dc",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "sinonjs",
|
name = "sinonjs",
|
||||||
package = "sinonjs",
|
package = "sinonjs",
|
||||||
version = "1.17.1",
|
version = "1.17.1",
|
||||||
sha1 = "a26a6aab7358807de52ba738770f6ac709afd240")
|
sha1 = "a26a6aab7358807de52ba738770f6ac709afd240",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "stacky",
|
name = "stacky",
|
||||||
package = "stacky",
|
package = "stacky",
|
||||||
version = "1.3.2",
|
version = "1.3.2",
|
||||||
sha1 = "d6c07a0112ab2e9677fe085933744466a89232fb")
|
sha1 = "d6c07a0112ab2e9677fe085933744466a89232fb",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "web-animations-js",
|
name = "web-animations-js",
|
||||||
package = "web-animations/web-animations-js",
|
package = "web-animations/web-animations-js",
|
||||||
version = "2.3.1",
|
version = "2.3.1",
|
||||||
sha1 = "2ba5548d36188fe54555eaad0a576de4b027661e")
|
sha1 = "2ba5548d36188fe54555eaad0a576de4b027661e",
|
||||||
|
)
|
||||||
bower_archive(
|
bower_archive(
|
||||||
name = "webcomponentsjs",
|
name = "webcomponentsjs",
|
||||||
package = "webcomponents/webcomponentsjs",
|
package = "webcomponents/webcomponentsjs",
|
||||||
version = "0.7.24",
|
version = "0.7.24",
|
||||||
sha1 = "559227f8ee9db9bfbd81989f24510cc0c1bfc65c")
|
sha1 = "559227f8ee9db9bfbd81989f24510cc0c1bfc65c",
|
||||||
|
)
|
||||||
|
@ -36,12 +36,12 @@ def define_bower_components():
|
|||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-a11y-announcer",
|
name = "iron-a11y-announcer",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-a11y-keys-behavior",
|
name = "iron-a11y-keys-behavior",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-autogrow-textarea",
|
name = "iron-autogrow-textarea",
|
||||||
@ -86,17 +86,17 @@ def define_bower_components():
|
|||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-fit-behavior",
|
name = "iron-fit-behavior",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-flex-layout",
|
name = "iron-flex-layout",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-form-element-behavior",
|
name = "iron-form-element-behavior",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-icon",
|
name = "iron-icon",
|
||||||
@ -140,7 +140,7 @@ def define_bower_components():
|
|||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-meta",
|
name = "iron-meta",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-overlay-behavior",
|
name = "iron-overlay-behavior",
|
||||||
@ -156,18 +156,18 @@ def define_bower_components():
|
|||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-resizable-behavior",
|
name = "iron-resizable-behavior",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-selector",
|
name = "iron-selector",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
seed = True,
|
seed = True,
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "iron-test-helpers",
|
name = "iron-test-helpers",
|
||||||
license = "//lib:LICENSE-DO_NOT_DISTRIBUTE",
|
license = "//lib:LICENSE-DO_NOT_DISTRIBUTE",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
seed = True,
|
seed = True,
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
@ -302,13 +302,13 @@ def define_bower_components():
|
|||||||
bower_component(
|
bower_component(
|
||||||
name = "polymer",
|
name = "polymer",
|
||||||
license = "//lib:LICENSE-polymer",
|
license = "//lib:LICENSE-polymer",
|
||||||
deps = [ ":webcomponentsjs" ],
|
deps = [":webcomponentsjs"],
|
||||||
seed = True,
|
seed = True,
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
name = "promise-polyfill",
|
name = "promise-polyfill",
|
||||||
license = "//lib:LICENSE-promise-polyfill",
|
license = "//lib:LICENSE-promise-polyfill",
|
||||||
deps = [ ":polymer" ],
|
deps = [":polymer"],
|
||||||
seed = True,
|
seed = True,
|
||||||
)
|
)
|
||||||
bower_component(
|
bower_component(
|
||||||
|
@ -18,17 +18,17 @@ def prolog_cafe_library(
|
|||||||
deps = [],
|
deps = [],
|
||||||
**kwargs):
|
**kwargs):
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = name + '__pl2j',
|
name = name + "__pl2j",
|
||||||
cmd = '$(location //lib/prolog:compiler-bin) ' +
|
cmd = "$(location //lib/prolog:compiler-bin) " +
|
||||||
'$$(dirname $@) $@ ' +
|
"$$(dirname $@) $@ " +
|
||||||
'$(SRCS)',
|
"$(SRCS)",
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
tools = ['//lib/prolog:compiler-bin'],
|
tools = ["//lib/prolog:compiler-bin"],
|
||||||
outs = [ name + '.srcjar' ],
|
outs = [name + ".srcjar"],
|
||||||
)
|
)
|
||||||
native.java_library(
|
native.java_library(
|
||||||
name = name,
|
name = name,
|
||||||
srcs = [':' + name + '__pl2j'],
|
srcs = [":" + name + "__pl2j"],
|
||||||
deps = ['//lib/prolog:runtime-neverlink'] + deps,
|
deps = ["//lib/prolog:runtime-neverlink"] + deps,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
load("//tools/bzl:genrule2.bzl", "genrule2")
|
load("//tools/bzl:genrule2.bzl", "genrule2")
|
||||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library", "closure_js_binary")
|
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library")
|
||||||
load(
|
load(
|
||||||
"//tools/bzl:js.bzl",
|
"//tools/bzl:js.bzl",
|
||||||
"bower_component_bundle",
|
|
||||||
"vulcanize",
|
|
||||||
"bower_component",
|
"bower_component",
|
||||||
|
"bower_component_bundle",
|
||||||
"js_component",
|
"js_component",
|
||||||
|
"vulcanize",
|
||||||
)
|
)
|
||||||
|
|
||||||
def polygerrit_bundle(name, srcs, outs, app):
|
def polygerrit_bundle(name, srcs, outs, app):
|
||||||
@ -80,7 +80,7 @@ def polygerrit_bundle(name, srcs, outs, app):
|
|||||||
"//lib/js:highlightjs_files",
|
"//lib/js:highlightjs_files",
|
||||||
# we extract from the zip, but depend on the component for license checking.
|
# we extract from the zip, but depend on the component for license checking.
|
||||||
"@webcomponentsjs//:zipfile",
|
"@webcomponentsjs//:zipfile",
|
||||||
"//lib/js:webcomponentsjs"
|
"//lib/js:webcomponentsjs",
|
||||||
],
|
],
|
||||||
outs = outs,
|
outs = outs,
|
||||||
cmd = " && ".join([
|
cmd = " && ".join([
|
||||||
@ -88,7 +88,7 @@ def polygerrit_bundle(name, srcs, outs, app):
|
|||||||
"for f in $(locations " + name + "_app_sources); do ext=$${f##*.}; cp -p $$f $$TMP/polygerrit_ui/elements/" + appName + ".$$ext; done",
|
"for f in $(locations " + name + "_app_sources); do ext=$${f##*.}; cp -p $$f $$TMP/polygerrit_ui/elements/" + appName + ".$$ext; done",
|
||||||
"cp $(locations //lib/fonts:robotofonts) $$TMP/polygerrit_ui/fonts/",
|
"cp $(locations //lib/fonts:robotofonts) $$TMP/polygerrit_ui/fonts/",
|
||||||
"for f in $(locations " + name + "_top_sources); do cp $$f $$TMP/polygerrit_ui/; done",
|
"for f in $(locations " + name + "_top_sources); do cp $$f $$TMP/polygerrit_ui/; done",
|
||||||
"for f in $(locations "+ name + "_css_sources); do cp $$f $$TMP/polygerrit_ui/styles; done",
|
"for f in $(locations " + name + "_css_sources); do cp $$f $$TMP/polygerrit_ui/styles; done",
|
||||||
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done",
|
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done",
|
||||||
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
|
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
|
||||||
"cd $$TMP",
|
"cd $$TMP",
|
||||||
|
@ -19,7 +19,7 @@ def documentation_attributes():
|
|||||||
|
|
||||||
def release_notes_attributes():
|
def release_notes_attributes():
|
||||||
return [
|
return [
|
||||||
'toc',
|
"toc",
|
||||||
'newline="\\n"',
|
'newline="\\n"',
|
||||||
'asterisk="*"',
|
'asterisk="*"',
|
||||||
'plus="+"',
|
'plus="+"',
|
||||||
@ -27,22 +27,25 @@ def release_notes_attributes():
|
|||||||
'startsb="["',
|
'startsb="["',
|
||||||
'endsb="]"',
|
'endsb="]"',
|
||||||
'tilde="~"',
|
'tilde="~"',
|
||||||
'last-update-label!',
|
"last-update-label!",
|
||||||
'stylesheet=DEFAULT',
|
"stylesheet=DEFAULT",
|
||||||
'linkcss=true',
|
"linkcss=true",
|
||||||
]
|
]
|
||||||
|
|
||||||
def _replace_macros_impl(ctx):
|
def _replace_macros_impl(ctx):
|
||||||
cmd = [
|
cmd = [
|
||||||
ctx.file._exe.path,
|
ctx.file._exe.path,
|
||||||
'--suffix', ctx.attr.suffix,
|
"--suffix",
|
||||||
"-s", ctx.file.src.path,
|
ctx.attr.suffix,
|
||||||
"-o", ctx.outputs.out.path,
|
"-s",
|
||||||
|
ctx.file.src.path,
|
||||||
|
"-o",
|
||||||
|
ctx.outputs.out.path,
|
||||||
]
|
]
|
||||||
if ctx.attr.searchbox:
|
if ctx.attr.searchbox:
|
||||||
cmd.append('--searchbox')
|
cmd.append("--searchbox")
|
||||||
else:
|
else:
|
||||||
cmd.append('--no-searchbox')
|
cmd.append("--no-searchbox")
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs = [ctx.file._exe, ctx.file.src],
|
inputs = [ctx.file._exe, ctx.file.src],
|
||||||
outputs = [ctx.outputs.out],
|
outputs = [ctx.outputs.out],
|
||||||
@ -80,7 +83,8 @@ def _generate_asciidoc_args(ctx):
|
|||||||
args.extend(["-a", attribute])
|
args.extend(["-a", attribute])
|
||||||
if revnumber:
|
if revnumber:
|
||||||
args.extend([
|
args.extend([
|
||||||
"--revnumber-file", ctx.file.version.path,
|
"--revnumber-file",
|
||||||
|
ctx.file.version.path,
|
||||||
])
|
])
|
||||||
for src in ctx.files.srcs:
|
for src in ctx.files.srcs:
|
||||||
args.append(src.path)
|
args.append(src.path)
|
||||||
@ -104,8 +108,10 @@ def _invoke_replace_macros(name, src, suffix, searchbox):
|
|||||||
def _asciidoc_impl(ctx):
|
def _asciidoc_impl(ctx):
|
||||||
args = [
|
args = [
|
||||||
"--bazel",
|
"--bazel",
|
||||||
"--in-ext", ".txt" + ctx.attr.suffix,
|
"--in-ext",
|
||||||
"--out-ext", ".html",
|
".txt" + ctx.attr.suffix,
|
||||||
|
"--out-ext",
|
||||||
|
".html",
|
||||||
]
|
]
|
||||||
args.extend(_generate_asciidoc_args(ctx))
|
args.extend(_generate_asciidoc_args(ctx))
|
||||||
ctx.actions.run(
|
ctx.actions.run(
|
||||||
@ -207,9 +213,12 @@ def genasciidoc(
|
|||||||
def _asciidoc_html_zip_impl(ctx):
|
def _asciidoc_html_zip_impl(ctx):
|
||||||
args = [
|
args = [
|
||||||
"--mktmp",
|
"--mktmp",
|
||||||
"-z", ctx.outputs.out.path,
|
"-z",
|
||||||
"--in-ext", ".txt" + ctx.attr.suffix,
|
ctx.outputs.out.path,
|
||||||
"--out-ext", ".html",
|
"--in-ext",
|
||||||
|
".txt" + ctx.attr.suffix,
|
||||||
|
"--out-ext",
|
||||||
|
".html",
|
||||||
]
|
]
|
||||||
args.extend(_generate_asciidoc_args(ctx))
|
args.extend(_generate_asciidoc_args(ctx))
|
||||||
ctx.actions.run(
|
ctx.actions.run(
|
||||||
@ -264,7 +273,8 @@ def _asciidoc_zip_impl(ctx):
|
|||||||
else:
|
else:
|
||||||
parent = r.path[:-len(r.short_path)]
|
parent = r.path[:-len(r.short_path)]
|
||||||
cmd.append(
|
cmd.append(
|
||||||
"tar -C %s -cf- %s | tar -C %s -xf-" % (parent, r.short_path, tmpdir))
|
"tar -C %s -cf- %s | tar -C %s -xf-" % (parent, r.short_path, tmpdir),
|
||||||
|
)
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
"cd %s" % tmpdir,
|
"cd %s" % tmpdir,
|
||||||
"zip -qr $p/%s *" % ctx.outputs.out.path,
|
"zip -qr $p/%s *" % ctx.outputs.out.path,
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
def _classpath_collector(ctx):
|
def _classpath_collector(ctx):
|
||||||
all = depset()
|
all = depset()
|
||||||
for d in ctx.attr.deps:
|
for d in ctx.attr.deps:
|
||||||
if hasattr(d, 'java'):
|
if hasattr(d, "java"):
|
||||||
all += d.java.transitive_runtime_deps
|
all += d.java.transitive_runtime_deps
|
||||||
all += d.java.compilation_info.runtime_classpath
|
all += d.java.compilation_info.runtime_classpath
|
||||||
elif hasattr(d, 'files'):
|
elif hasattr(d, "files"):
|
||||||
all += d.files
|
all += d.files
|
||||||
|
|
||||||
as_strs = [c.path for c in all]
|
as_strs = [c.path for c in all]
|
||||||
ctx.file_action(output= ctx.outputs.runtime,
|
ctx.file_action(
|
||||||
content="\n".join(sorted(as_strs)))
|
output = ctx.outputs.runtime,
|
||||||
|
content = "\n".join(sorted(as_strs)),
|
||||||
|
)
|
||||||
|
|
||||||
classpath_collector = rule(
|
classpath_collector = rule(
|
||||||
attrs = {
|
attrs = {
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
# expose TMP shell variable
|
# expose TMP shell variable
|
||||||
|
|
||||||
def genrule2(cmd, **kwargs):
|
def genrule2(cmd, **kwargs):
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join([
|
||||||
'ROOT=$$PWD',
|
"ROOT=$$PWD",
|
||||||
'TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)',
|
"TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)",
|
||||||
'(' + cmd + ')',
|
"(" + cmd + ")",
|
||||||
])
|
])
|
||||||
native.genrule(
|
native.genrule(
|
||||||
cmd = cmd,
|
cmd = cmd,
|
||||||
**kwargs)
|
**kwargs
|
||||||
|
)
|
||||||
|
@ -92,14 +92,15 @@ USER_AGENT_XML = """<module rename-to='gerrit_ui'>
|
|||||||
</module>
|
</module>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def gwt_module(gwt_xml=None, resources=[], srcs=[], **kwargs):
|
def gwt_module(gwt_xml = None, resources = [], srcs = [], **kwargs):
|
||||||
if gwt_xml:
|
if gwt_xml:
|
||||||
resources = resources + [gwt_xml]
|
resources = resources + [gwt_xml]
|
||||||
|
|
||||||
java_library2(
|
java_library2(
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
resources = resources,
|
resources = resources,
|
||||||
**kwargs)
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
def _gwt_user_agent_module(ctx):
|
def _gwt_user_agent_module(ctx):
|
||||||
"""Generate user agent specific GWT module."""
|
"""Generate user agent specific GWT module."""
|
||||||
@ -113,12 +114,14 @@ def _gwt_user_agent_module(ctx):
|
|||||||
|
|
||||||
# intermediate artifact: user agent speific GWT xml file
|
# intermediate artifact: user agent speific GWT xml file
|
||||||
gwt_user_agent_xml = ctx.new_file(ctx.label.name + "_gwt.xml")
|
gwt_user_agent_xml = ctx.new_file(ctx.label.name + "_gwt.xml")
|
||||||
ctx.file_action(output = gwt_user_agent_xml,
|
ctx.file_action(
|
||||||
content=USER_AGENT_XML % (MODULE, impl))
|
output = gwt_user_agent_xml,
|
||||||
|
content = USER_AGENT_XML % (MODULE, impl),
|
||||||
|
)
|
||||||
|
|
||||||
# intermediate artifact: user agent specific zip with GWT module
|
# intermediate artifact: user agent specific zip with GWT module
|
||||||
gwt_user_agent_zip = ctx.new_file(ctx.label.name + "_gwt.zip")
|
gwt_user_agent_zip = ctx.new_file(ctx.label.name + "_gwt.zip")
|
||||||
gwt = '%s_%s.gwt.xml' % (MODULE.replace('.', '/'), ua)
|
gwt = "%s_%s.gwt.xml" % (MODULE.replace(".", "/"), ua)
|
||||||
dir = gwt_user_agent_zip.path + ".dir"
|
dir = gwt_user_agent_zip.path + ".dir"
|
||||||
cmd = " && ".join([
|
cmd = " && ".join([
|
||||||
"p=$PWD",
|
"p=$PWD",
|
||||||
@ -126,24 +129,25 @@ def _gwt_user_agent_module(ctx):
|
|||||||
"cd %s" % dir,
|
"cd %s" % dir,
|
||||||
"mkdir -p $(dirname %s)" % gwt,
|
"mkdir -p $(dirname %s)" % gwt,
|
||||||
"cp $p/%s %s" % (gwt_user_agent_xml.path, gwt),
|
"cp $p/%s %s" % (gwt_user_agent_xml.path, gwt),
|
||||||
"$p/%s cC $p/%s $(find . | sed 's|^./||')" % (ctx.executable._zip.path, gwt_user_agent_zip.path)
|
"$p/%s cC $p/%s $(find . | sed 's|^./||')" % (ctx.executable._zip.path, gwt_user_agent_zip.path),
|
||||||
])
|
])
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs = [gwt_user_agent_xml] + ctx.files._zip,
|
inputs = [gwt_user_agent_xml] + ctx.files._zip,
|
||||||
outputs = [gwt_user_agent_zip],
|
outputs = [gwt_user_agent_zip],
|
||||||
command = cmd,
|
command = cmd,
|
||||||
mnemonic = "GenerateUserAgentGWTModule")
|
mnemonic = "GenerateUserAgentGWTModule",
|
||||||
|
)
|
||||||
|
|
||||||
return struct(
|
return struct(
|
||||||
zip=gwt_user_agent_zip,
|
zip = gwt_user_agent_zip,
|
||||||
module=MODULE + '_' + ua
|
module = MODULE + "_" + ua,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _gwt_binary_impl(ctx):
|
def _gwt_binary_impl(ctx):
|
||||||
module = ctx.attr.module[0]
|
module = ctx.attr.module[0]
|
||||||
output_zip = ctx.outputs.output
|
output_zip = ctx.outputs.output
|
||||||
output_dir = output_zip.path + '.gwt_output'
|
output_dir = output_zip.path + ".gwt_output"
|
||||||
deploy_dir = output_zip.path + '.gwt_deploy'
|
deploy_dir = output_zip.path + ".gwt_deploy"
|
||||||
|
|
||||||
deps = _get_transitive_closure(ctx)
|
deps = _get_transitive_closure(ctx)
|
||||||
|
|
||||||
@ -165,6 +169,7 @@ def _gwt_binary_impl(ctx):
|
|||||||
output_dir,
|
output_dir,
|
||||||
deploy_dir,
|
deploy_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(davido): clean up command concatenation
|
# TODO(davido): clean up command concatenation
|
||||||
cmd += " ".join([
|
cmd += " ".join([
|
||||||
"-style %s" % ctx.attr.style,
|
"-style %s" % ctx.attr.style,
|
||||||
@ -178,7 +183,7 @@ def _gwt_binary_impl(ctx):
|
|||||||
output_dir,
|
output_dir,
|
||||||
ctx.executable._zip.path,
|
ctx.executable._zip.path,
|
||||||
output_zip.basename,
|
output_zip.basename,
|
||||||
)
|
),
|
||||||
])
|
])
|
||||||
|
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
@ -195,9 +200,9 @@ def _get_transitive_closure(ctx):
|
|||||||
deps += dep.java.transitive_runtime_deps
|
deps += dep.java.transitive_runtime_deps
|
||||||
deps += dep.java.transitive_source_jars
|
deps += dep.java.transitive_source_jars
|
||||||
for dep in ctx.attr.deps:
|
for dep in ctx.attr.deps:
|
||||||
if hasattr(dep, 'java'):
|
if hasattr(dep, "java"):
|
||||||
deps += dep.java.transitive_runtime_deps
|
deps += dep.java.transitive_runtime_deps
|
||||||
elif hasattr(dep, 'files'):
|
elif hasattr(dep, "files"):
|
||||||
deps += dep.files
|
deps += dep.files
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
@ -229,27 +234,27 @@ gwt_binary = rule(
|
|||||||
)
|
)
|
||||||
|
|
||||||
def gwt_genrule(suffix = ""):
|
def gwt_genrule(suffix = ""):
|
||||||
dbg = 'ui_dbg' + suffix
|
dbg = "ui_dbg" + suffix
|
||||||
opt = 'ui_opt' + suffix
|
opt = "ui_opt" + suffix
|
||||||
module_dep = ':ui_module' + suffix
|
module_dep = ":ui_module" + suffix
|
||||||
args = GWT_COMPILER_ARGS_RELEASE_MODE if suffix == "_r" else GWT_COMPILER_ARGS
|
args = GWT_COMPILER_ARGS_RELEASE_MODE if suffix == "_r" else GWT_COMPILER_ARGS
|
||||||
|
|
||||||
genrule2(
|
genrule2(
|
||||||
name = 'ui_optdbg' + suffix,
|
name = "ui_optdbg" + suffix,
|
||||||
srcs = [
|
srcs = [
|
||||||
':' + dbg,
|
":" + dbg,
|
||||||
':' + opt,
|
":" + opt,
|
||||||
],
|
],
|
||||||
cmd = 'cd $$TMP;' +
|
cmd = "cd $$TMP;" +
|
||||||
'unzip -q $$ROOT/$(location :%s);' % dbg +
|
"unzip -q $$ROOT/$(location :%s);" % dbg +
|
||||||
'mv' +
|
"mv" +
|
||||||
' gerrit_ui/gerrit_ui.nocache.js' +
|
" gerrit_ui/gerrit_ui.nocache.js" +
|
||||||
' gerrit_ui/dbg_gerrit_ui.nocache.js;' +
|
" gerrit_ui/dbg_gerrit_ui.nocache.js;" +
|
||||||
'unzip -qo $$ROOT/$(location :%s);' % opt +
|
"unzip -qo $$ROOT/$(location :%s);" % opt +
|
||||||
'mkdir -p $$(dirname $@);' +
|
"mkdir -p $$(dirname $@);" +
|
||||||
'zip -qrD $$ROOT/$@ .',
|
"zip -qrD $$ROOT/$@ .",
|
||||||
outs = ['ui_optdbg' + suffix + '.zip'],
|
outs = ["ui_optdbg" + suffix + ".zip"],
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
gwt_binary(
|
gwt_binary(
|
||||||
@ -263,7 +268,7 @@ def gwt_genrule(suffix = ""):
|
|||||||
|
|
||||||
gwt_binary(
|
gwt_binary(
|
||||||
name = dbg,
|
name = dbg,
|
||||||
style = 'PRETTY',
|
style = "PRETTY",
|
||||||
optimize = "0",
|
optimize = "0",
|
||||||
module_deps = [module_dep],
|
module_deps = [module_dep],
|
||||||
deps = DEPS,
|
deps = DEPS,
|
||||||
@ -274,20 +279,21 @@ def gwt_genrule(suffix = ""):
|
|||||||
def gen_ui_module(name, suffix = ""):
|
def gen_ui_module(name, suffix = ""):
|
||||||
gwt_module(
|
gwt_module(
|
||||||
name = name + suffix,
|
name = name + suffix,
|
||||||
srcs = native.glob(['src/main/java/**/*.java']),
|
srcs = native.glob(["src/main/java/**/*.java"]),
|
||||||
gwt_xml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'),
|
gwt_xml = "src/main/java/%s.gwt.xml" % MODULE.replace(".", "/"),
|
||||||
resources = native.glob(
|
resources = native.glob(
|
||||||
['src/main/java/**/*'],
|
["src/main/java/**/*"],
|
||||||
exclude = ['src/main/java/**/*.java'] +
|
exclude = ["src/main/java/**/*.java"] +
|
||||||
['src/main/java/%s.gwt.xml' % MODULE.replace('.', '/')]),
|
["src/main/java/%s.gwt.xml" % MODULE.replace(".", "/")],
|
||||||
|
),
|
||||||
deps = [
|
deps = [
|
||||||
'//gerrit-gwtui-common:diffy_logo',
|
"//gerrit-gwtui-common:diffy_logo",
|
||||||
'//gerrit-gwtui-common:client',
|
"//gerrit-gwtui-common:client",
|
||||||
'//gerrit-gwtexpui:CSS',
|
"//gerrit-gwtexpui:CSS",
|
||||||
'//lib/codemirror:codemirror' + suffix,
|
"//lib/codemirror:codemirror" + suffix,
|
||||||
'//lib/gwt:user',
|
"//lib/gwt:user",
|
||||||
],
|
],
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
def gwt_user_agent_permutations():
|
def gwt_user_agent_permutations():
|
||||||
@ -295,10 +301,10 @@ def gwt_user_agent_permutations():
|
|||||||
gwt_binary(
|
gwt_binary(
|
||||||
name = "ui_%s" % ua,
|
name = "ui_%s" % ua,
|
||||||
user_agent = ua,
|
user_agent = ua,
|
||||||
style = 'PRETTY',
|
style = "PRETTY",
|
||||||
optimize = "0",
|
optimize = "0",
|
||||||
module = [MODULE],
|
module = [MODULE],
|
||||||
module_deps = [':ui_module'],
|
module_deps = [":ui_module"],
|
||||||
deps = DEPS,
|
deps = DEPS,
|
||||||
compiler_args = GWT_COMPILER_ARGS,
|
compiler_args = GWT_COMPILER_ARGS,
|
||||||
jvm_args = GWT_JVM_ARGS,
|
jvm_args = GWT_JVM_ARGS,
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
# Syntactic sugar for native java_library() rule:
|
# Syntactic sugar for native java_library() rule:
|
||||||
# accept exported_deps attributes
|
# accept exported_deps attributes
|
||||||
|
|
||||||
def java_library2(deps=[], exported_deps=[], exports=[], **kwargs):
|
def java_library2(deps = [], exported_deps = [], exports = [], **kwargs):
|
||||||
if exported_deps:
|
if exported_deps:
|
||||||
deps = deps + exported_deps
|
deps = deps + exported_deps
|
||||||
exports = exports + exported_deps
|
exports = exports + exported_deps
|
||||||
native.java_library(
|
native.java_library(
|
||||||
deps = deps,
|
deps = deps,
|
||||||
exports = exports,
|
exports = exports,
|
||||||
**kwargs)
|
**kwargs
|
||||||
|
)
|
||||||
|
@ -44,20 +44,22 @@ def _impl(ctx):
|
|||||||
"-notimestamp",
|
"-notimestamp",
|
||||||
"-quiet",
|
"-quiet",
|
||||||
"-windowtitle '%s'" % ctx.attr.title,
|
"-windowtitle '%s'" % ctx.attr.title,
|
||||||
" ".join(['-link %s' % url for url in external_docs]),
|
" ".join(["-link %s" % url for url in external_docs]),
|
||||||
"-sourcepath %s" % source,
|
"-sourcepath %s" % source,
|
||||||
"-subpackages ",
|
"-subpackages ",
|
||||||
":".join(ctx.attr.pkgs),
|
":".join(ctx.attr.pkgs),
|
||||||
" -classpath ",
|
" -classpath ",
|
||||||
":".join(transitive_jar_paths),
|
":".join(transitive_jar_paths),
|
||||||
"-d %s" % dir]),
|
"-d %s" % dir,
|
||||||
|
]),
|
||||||
"find %s -exec touch -t 198001010000 '{}' ';'" % dir,
|
"find %s -exec touch -t 198001010000 '{}' ';'" % dir,
|
||||||
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
|
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
|
||||||
]
|
]
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk,
|
inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk,
|
||||||
outputs = [zip_output],
|
outputs = [zip_output],
|
||||||
command = " && ".join(cmd))
|
command = " && ".join(cmd),
|
||||||
|
)
|
||||||
|
|
||||||
java_doc = rule(
|
java_doc = rule(
|
||||||
attrs = {
|
attrs = {
|
||||||
|
172
tools/bzl/js.bzl
172
tools/bzl/js.bzl
@ -2,7 +2,7 @@ NPMJS = "NPMJS"
|
|||||||
|
|
||||||
GERRIT = "GERRIT:"
|
GERRIT = "GERRIT:"
|
||||||
|
|
||||||
load("//lib/js:npm.bzl", "NPM_VERSIONS", "NPM_SHA1S")
|
load("//lib/js:npm.bzl", "NPM_SHA1S", "NPM_VERSIONS")
|
||||||
|
|
||||||
def _npm_tarball(name):
|
def _npm_tarball(name):
|
||||||
return "%s@%s.npm_binary.tgz" % (name, NPM_VERSIONS[name])
|
return "%s@%s.npm_binary.tgz" % (name, NPM_VERSIONS[name])
|
||||||
@ -10,20 +10,20 @@ def _npm_tarball(name):
|
|||||||
def _npm_binary_impl(ctx):
|
def _npm_binary_impl(ctx):
|
||||||
"""rule to download a NPM archive."""
|
"""rule to download a NPM archive."""
|
||||||
name = ctx.name
|
name = ctx.name
|
||||||
version= NPM_VERSIONS[name]
|
version = NPM_VERSIONS[name]
|
||||||
sha1 = NPM_SHA1S[name]
|
sha1 = NPM_SHA1S[name]
|
||||||
|
|
||||||
dir = '%s-%s' % (name, version)
|
dir = "%s-%s" % (name, version)
|
||||||
filename = '%s.tgz' % dir
|
filename = "%s.tgz" % dir
|
||||||
base = '%s@%s.npm_binary.tgz' % (name, version)
|
base = "%s@%s.npm_binary.tgz" % (name, version)
|
||||||
dest = ctx.path(base)
|
dest = ctx.path(base)
|
||||||
repository = ctx.attr.repository
|
repository = ctx.attr.repository
|
||||||
if repository == GERRIT:
|
if repository == GERRIT:
|
||||||
url = 'http://gerrit-maven.storage.googleapis.com/npm-packages/%s' % filename
|
url = "http://gerrit-maven.storage.googleapis.com/npm-packages/%s" % filename
|
||||||
elif repository == NPMJS:
|
elif repository == NPMJS:
|
||||||
url = 'http://registry.npmjs.org/%s/-/%s' % (name, filename)
|
url = "http://registry.npmjs.org/%s/-/%s" % (name, filename)
|
||||||
else:
|
else:
|
||||||
fail('repository %s not in {%s,%s}' % (repository, GERRIT, NPMJS))
|
fail("repository %s not in {%s,%s}" % (repository, GERRIT, NPMJS))
|
||||||
|
|
||||||
python = ctx.which("python")
|
python = ctx.which("python")
|
||||||
script = ctx.path(ctx.attr._download_script)
|
script = ctx.path(ctx.attr._download_script)
|
||||||
@ -50,30 +50,37 @@ def _run_npm_binary_str(ctx, tarball, args):
|
|||||||
return " ".join([
|
return " ".join([
|
||||||
python_bin,
|
python_bin,
|
||||||
ctx.path(ctx.attr._run_npm),
|
ctx.path(ctx.attr._run_npm),
|
||||||
ctx.path(tarball)] + args)
|
ctx.path(tarball),
|
||||||
|
] + args)
|
||||||
|
|
||||||
def _bower_archive(ctx):
|
def _bower_archive(ctx):
|
||||||
"""Download a bower package."""
|
"""Download a bower package."""
|
||||||
download_name = '%s__download_bower.zip' % ctx.name
|
download_name = "%s__download_bower.zip" % ctx.name
|
||||||
renamed_name = '%s__renamed.zip' % ctx.name
|
renamed_name = "%s__renamed.zip" % ctx.name
|
||||||
version_name = '%s__version.json' % ctx.name
|
version_name = "%s__version.json" % ctx.name
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
ctx.which("python"),
|
ctx.which("python"),
|
||||||
ctx.path(ctx.attr._download_bower),
|
ctx.path(ctx.attr._download_bower),
|
||||||
'-b', '%s' % _run_npm_binary_str(ctx, ctx.attr._bower_archive, []),
|
"-b",
|
||||||
'-n', ctx.name,
|
"%s" % _run_npm_binary_str(ctx, ctx.attr._bower_archive, []),
|
||||||
'-p', ctx.attr.package,
|
"-n",
|
||||||
'-v', ctx.attr.version,
|
ctx.name,
|
||||||
'-s', ctx.attr.sha1,
|
"-p",
|
||||||
'-o', download_name,
|
ctx.attr.package,
|
||||||
|
"-v",
|
||||||
|
ctx.attr.version,
|
||||||
|
"-s",
|
||||||
|
ctx.attr.sha1,
|
||||||
|
"-o",
|
||||||
|
download_name,
|
||||||
]
|
]
|
||||||
|
|
||||||
out = ctx.execute(cmd)
|
out = ctx.execute(cmd)
|
||||||
if out.return_code:
|
if out.return_code:
|
||||||
fail("failed %s: %s" % (" ".join(cmd), out.stderr))
|
fail("failed %s: %s" % (" ".join(cmd), out.stderr))
|
||||||
|
|
||||||
_bash(ctx, " && " .join([
|
_bash(ctx, " && ".join([
|
||||||
"TMP=$(mktemp -d || mktemp -d -t bazel-tmp)",
|
"TMP=$(mktemp -d || mktemp -d -t bazel-tmp)",
|
||||||
"TZ=UTC",
|
"TZ=UTC",
|
||||||
"export UTC",
|
"export UTC",
|
||||||
@ -89,15 +96,19 @@ def _bower_archive(ctx):
|
|||||||
]))
|
]))
|
||||||
|
|
||||||
dep_version = ctx.attr.semver if ctx.attr.semver else ctx.attr.version
|
dep_version = ctx.attr.semver if ctx.attr.semver else ctx.attr.version
|
||||||
ctx.file(version_name,
|
ctx.file(
|
||||||
'"%s":"%s#%s"' % (ctx.name, ctx.attr.package, dep_version))
|
version_name,
|
||||||
|
'"%s":"%s#%s"' % (ctx.name, ctx.attr.package, dep_version),
|
||||||
|
)
|
||||||
ctx.file(
|
ctx.file(
|
||||||
"BUILD",
|
"BUILD",
|
||||||
"\n".join([
|
"\n".join([
|
||||||
"package(default_visibility=['//visibility:public'])",
|
"package(default_visibility=['//visibility:public'])",
|
||||||
"filegroup(name = 'zipfile', srcs = ['%s'], )" % download_name,
|
"filegroup(name = 'zipfile', srcs = ['%s'], )" % download_name,
|
||||||
"filegroup(name = 'version_json', srcs = ['%s'], visibility=['//visibility:public'])" % version_name,
|
"filegroup(name = 'version_json', srcs = ['%s'], visibility=['//visibility:public'])" % version_name,
|
||||||
]), False)
|
]),
|
||||||
|
False,
|
||||||
|
)
|
||||||
|
|
||||||
def _bash(ctx, cmd):
|
def _bash(ctx, cmd):
|
||||||
cmd_list = ["bash", "-c", cmd]
|
cmd_list = ["bash", "-c", cmd]
|
||||||
@ -135,9 +146,9 @@ def _bower_component_impl(ctx):
|
|||||||
transitive_versions += d.transitive_versions
|
transitive_versions += d.transitive_versions
|
||||||
|
|
||||||
return struct(
|
return struct(
|
||||||
transitive_zipfiles=transitive_zipfiles,
|
transitive_zipfiles = transitive_zipfiles,
|
||||||
transitive_versions=transitive_versions,
|
transitive_versions = transitive_versions,
|
||||||
transitive_licenses=transitive_licenses,
|
transitive_licenses = transitive_licenses,
|
||||||
)
|
)
|
||||||
|
|
||||||
_common_attrs = {
|
_common_attrs = {
|
||||||
@ -158,26 +169,28 @@ def _js_component(ctx):
|
|||||||
"TZ=UTC",
|
"TZ=UTC",
|
||||||
"export TZ",
|
"export TZ",
|
||||||
"mkdir -p %s" % dest,
|
"mkdir -p %s" % dest,
|
||||||
"cp %s %s/" % (' '.join([s.path for s in ctx.files.srcs]), dest),
|
"cp %s %s/" % (" ".join([s.path for s in ctx.files.srcs]), dest),
|
||||||
"cd %s" % dir,
|
"cd %s" % dir,
|
||||||
"find . -exec touch -t 198001010000 '{}' ';'",
|
"find . -exec touch -t 198001010000 '{}' ';'",
|
||||||
"zip -Xqr ../%s *" % ctx.outputs.zip.basename
|
"zip -Xqr ../%s *" % ctx.outputs.zip.basename,
|
||||||
])
|
])
|
||||||
|
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs = ctx.files.srcs,
|
inputs = ctx.files.srcs,
|
||||||
outputs = [ctx.outputs.zip],
|
outputs = [ctx.outputs.zip],
|
||||||
command = cmd,
|
command = cmd,
|
||||||
mnemonic = "GenBowerZip")
|
mnemonic = "GenBowerZip",
|
||||||
|
)
|
||||||
|
|
||||||
licenses = depset()
|
licenses = depset()
|
||||||
if ctx.file.license:
|
if ctx.file.license:
|
||||||
licenses += depset([ctx.file.license])
|
licenses += depset([ctx.file.license])
|
||||||
|
|
||||||
return struct(
|
return struct(
|
||||||
transitive_zipfiles=list([ctx.outputs.zip]),
|
transitive_zipfiles = list([ctx.outputs.zip]),
|
||||||
transitive_versions=depset(),
|
transitive_versions = depset(),
|
||||||
transitive_licenses=licenses)
|
transitive_licenses = licenses,
|
||||||
|
)
|
||||||
|
|
||||||
js_component = rule(
|
js_component = rule(
|
||||||
_js_component,
|
_js_component,
|
||||||
@ -203,16 +216,17 @@ _bower_component = rule(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# TODO(hanwen): make license mandatory.
|
# TODO(hanwen): make license mandatory.
|
||||||
def bower_component(name, license=None, **kwargs):
|
def bower_component(name, license = None, **kwargs):
|
||||||
prefix = "//lib:LICENSE-"
|
prefix = "//lib:LICENSE-"
|
||||||
if license and not license.startswith(prefix):
|
if license and not license.startswith(prefix):
|
||||||
license = prefix + license
|
license = prefix + license
|
||||||
_bower_component(
|
_bower_component(
|
||||||
name=name,
|
name = name,
|
||||||
license=license,
|
license = license,
|
||||||
zipfile="@%s//:zipfile"% name,
|
zipfile = "@%s//:zipfile" % name,
|
||||||
version_json="@%s//:version_json" % name,
|
version_json = "@%s//:version_json" % name,
|
||||||
**kwargs)
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
def _bower_component_bundle_impl(ctx):
|
def _bower_component_bundle_impl(ctx):
|
||||||
"""A bunch of bower components zipped up."""
|
"""A bunch of bower components zipped up."""
|
||||||
@ -232,9 +246,9 @@ def _bower_component_bundle_impl(ctx):
|
|||||||
out_versions = ctx.outputs.version_json
|
out_versions = ctx.outputs.version_json
|
||||||
|
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs=list(zips),
|
inputs = list(zips),
|
||||||
outputs=[out_zip],
|
outputs = [out_zip],
|
||||||
command=" && ".join([
|
command = " && ".join([
|
||||||
"p=$PWD",
|
"p=$PWD",
|
||||||
"TZ=UTC",
|
"TZ=UTC",
|
||||||
"export TZ",
|
"export TZ",
|
||||||
@ -246,18 +260,21 @@ def _bower_component_bundle_impl(ctx):
|
|||||||
"find . -exec touch -t 198001010000 '{}' ';'",
|
"find . -exec touch -t 198001010000 '{}' ';'",
|
||||||
"zip -Xqr $p/%s bower_components/*" % out_zip.path,
|
"zip -Xqr $p/%s bower_components/*" % out_zip.path,
|
||||||
]),
|
]),
|
||||||
mnemonic="BowerCombine")
|
mnemonic = "BowerCombine",
|
||||||
|
)
|
||||||
|
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs=list(versions),
|
inputs = list(versions),
|
||||||
outputs=[out_versions],
|
outputs = [out_versions],
|
||||||
mnemonic="BowerVersions",
|
mnemonic = "BowerVersions",
|
||||||
command="(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions]), out_versions.path))
|
command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions]), out_versions.path),
|
||||||
|
)
|
||||||
|
|
||||||
return struct(
|
return struct(
|
||||||
transitive_zipfiles=zips,
|
transitive_zipfiles = zips,
|
||||||
transitive_versions=versions,
|
transitive_versions = versions,
|
||||||
transitive_licenses=licenses)
|
transitive_licenses = licenses,
|
||||||
|
)
|
||||||
|
|
||||||
bower_component_bundle = rule(
|
bower_component_bundle = rule(
|
||||||
_bower_component_bundle_impl,
|
_bower_component_bundle_impl,
|
||||||
@ -280,19 +297,23 @@ Outputs:
|
|||||||
def _vulcanize_impl(ctx):
|
def _vulcanize_impl(ctx):
|
||||||
# intermediate artifact.
|
# intermediate artifact.
|
||||||
vulcanized = ctx.new_file(
|
vulcanized = ctx.new_file(
|
||||||
ctx.configuration.genfiles_dir, ctx.outputs.html, ".vulcanized.html")
|
ctx.configuration.genfiles_dir,
|
||||||
|
ctx.outputs.html,
|
||||||
|
".vulcanized.html",
|
||||||
|
)
|
||||||
destdir = ctx.outputs.html.path + ".dir"
|
destdir = ctx.outputs.html.path + ".dir"
|
||||||
zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles ]
|
zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles]
|
||||||
|
|
||||||
hermetic_npm_binary = " ".join([
|
hermetic_npm_binary = " ".join([
|
||||||
'python',
|
"python",
|
||||||
"$p/" + ctx.file._run_npm.path,
|
"$p/" + ctx.file._run_npm.path,
|
||||||
"$p/" + ctx.file._vulcanize_archive.path,
|
"$p/" + ctx.file._vulcanize_archive.path,
|
||||||
'--inline-scripts',
|
"--inline-scripts",
|
||||||
'--inline-css',
|
"--inline-css",
|
||||||
'--strip-comments',
|
"--strip-comments",
|
||||||
'--out-html', "$p/" + vulcanized.path,
|
"--out-html",
|
||||||
ctx.file.app.path
|
"$p/" + vulcanized.path,
|
||||||
|
ctx.file.app.path,
|
||||||
])
|
])
|
||||||
|
|
||||||
pkg_dir = ctx.attr.pkg.lstrip("/")
|
pkg_dir = ctx.attr.pkg.lstrip("/")
|
||||||
@ -303,7 +324,10 @@ def _vulcanize_impl(ctx):
|
|||||||
"rm -rf %s" % destdir,
|
"rm -rf %s" % destdir,
|
||||||
"mkdir -p %s/%s/bower_components" % (destdir, pkg_dir),
|
"mkdir -p %s/%s/bower_components" % (destdir, pkg_dir),
|
||||||
"for z in %s; do unzip -qd %s/%s/bower_components/ $z; done" % (
|
"for z in %s; do unzip -qd %s/%s/bower_components/ $z; done" % (
|
||||||
' '.join([z.path for z in zips]), destdir, pkg_dir),
|
" ".join([z.path for z in zips]),
|
||||||
|
destdir,
|
||||||
|
pkg_dir,
|
||||||
|
),
|
||||||
"tar -cf - %s | tar -C %s -xf -" % (" ".join([s.path for s in ctx.files.srcs]), destdir),
|
"tar -cf - %s | tar -C %s -xf -" % (" ".join([s.path for s in ctx.files.srcs]), destdir),
|
||||||
"cd %s" % destdir,
|
"cd %s" % destdir,
|
||||||
hermetic_npm_binary,
|
hermetic_npm_binary,
|
||||||
@ -318,29 +342,41 @@ def _vulcanize_impl(ctx):
|
|||||||
)
|
)
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
mnemonic = "Vulcanize",
|
mnemonic = "Vulcanize",
|
||||||
inputs = [ctx.file._run_npm, ctx.file.app,
|
inputs = [
|
||||||
ctx.file._vulcanize_archive
|
ctx.file._run_npm,
|
||||||
|
ctx.file.app,
|
||||||
|
ctx.file._vulcanize_archive,
|
||||||
] + list(zips) + ctx.files.srcs,
|
] + list(zips) + ctx.files.srcs,
|
||||||
outputs = [vulcanized],
|
outputs = [vulcanized],
|
||||||
command = cmd,
|
command = cmd,
|
||||||
**node_tweaks)
|
**node_tweaks
|
||||||
|
)
|
||||||
|
|
||||||
hermetic_npm_command = "export PATH && " + " ".join([
|
hermetic_npm_command = "export PATH && " + " ".join([
|
||||||
'python',
|
"python",
|
||||||
ctx.file._run_npm.path,
|
ctx.file._run_npm.path,
|
||||||
ctx.file._crisper_archive.path,
|
ctx.file._crisper_archive.path,
|
||||||
"--always-write-script",
|
"--always-write-script",
|
||||||
"--source", vulcanized.path,
|
"--source",
|
||||||
"--html", ctx.outputs.html.path,
|
vulcanized.path,
|
||||||
"--js", ctx.outputs.js.path])
|
"--html",
|
||||||
|
ctx.outputs.html.path,
|
||||||
|
"--js",
|
||||||
|
ctx.outputs.js.path,
|
||||||
|
])
|
||||||
|
|
||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
mnemonic = "Crisper",
|
mnemonic = "Crisper",
|
||||||
inputs = [ctx.file._run_npm, ctx.file.app,
|
inputs = [
|
||||||
ctx.file._crisper_archive, vulcanized],
|
ctx.file._run_npm,
|
||||||
|
ctx.file.app,
|
||||||
|
ctx.file._crisper_archive,
|
||||||
|
vulcanized,
|
||||||
|
],
|
||||||
outputs = [ctx.outputs.js, ctx.outputs.html],
|
outputs = [ctx.outputs.js, ctx.outputs.html],
|
||||||
command = hermetic_npm_command,
|
command = hermetic_npm_command,
|
||||||
**node_tweaks)
|
**node_tweaks
|
||||||
|
)
|
||||||
|
|
||||||
_vulcanize_rule = rule(
|
_vulcanize_rule = rule(
|
||||||
_vulcanize_impl,
|
_vulcanize_impl,
|
||||||
@ -379,4 +415,4 @@ _vulcanize_rule = rule(
|
|||||||
|
|
||||||
def vulcanize(*args, **kwargs):
|
def vulcanize(*args, **kwargs):
|
||||||
"""Vulcanize runs vulcanize and crisper on a set of sources."""
|
"""Vulcanize runs vulcanize and crisper on a set of sources."""
|
||||||
_vulcanize_rule(*args, pkg=PACKAGE_NAME, **kwargs)
|
_vulcanize_rule(*args, pkg = PACKAGE_NAME, **kwargs)
|
||||||
|
@ -43,15 +43,21 @@ def _AsClassName(fname):
|
|||||||
if findex != -1:
|
if findex != -1:
|
||||||
break
|
break
|
||||||
if findex == -1:
|
if findex == -1:
|
||||||
fail("%s does not contain any of %s",
|
fail(
|
||||||
fname, _PREFIXES)
|
"%s does not contain any of %s",
|
||||||
|
fname,
|
||||||
|
_PREFIXES,
|
||||||
|
)
|
||||||
return ".".join(toks[findex:]) + ".class"
|
return ".".join(toks[findex:]) + ".class"
|
||||||
|
|
||||||
def _impl(ctx):
|
def _impl(ctx):
|
||||||
classes = ",".join(
|
classes = ",".join(
|
||||||
[_AsClassName(x) for x in ctx.attr.srcs])
|
[_AsClassName(x) for x in ctx.attr.srcs],
|
||||||
ctx.file_action(output=ctx.outputs.out, content=_OUTPUT % (
|
)
|
||||||
classes, ctx.attr.outname))
|
ctx.file_action(output = ctx.outputs.out, content = _OUTPUT % (
|
||||||
|
classes,
|
||||||
|
ctx.attr.outname,
|
||||||
|
))
|
||||||
|
|
||||||
_GenSuite = rule(
|
_GenSuite = rule(
|
||||||
attrs = {
|
attrs = {
|
||||||
@ -64,10 +70,14 @@ _GenSuite = rule(
|
|||||||
|
|
||||||
def junit_tests(name, srcs, **kwargs):
|
def junit_tests(name, srcs, **kwargs):
|
||||||
s_name = name + "TestSuite"
|
s_name = name + "TestSuite"
|
||||||
_GenSuite(name = s_name,
|
_GenSuite(
|
||||||
|
name = s_name,
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
outname = s_name)
|
outname = s_name,
|
||||||
native.java_test(name = name,
|
)
|
||||||
|
native.java_test(
|
||||||
|
name = name,
|
||||||
test_class = s_name,
|
test_class = s_name,
|
||||||
srcs = srcs + [":"+s_name],
|
srcs = srcs + [":" + s_name],
|
||||||
**kwargs)
|
**kwargs
|
||||||
|
)
|
||||||
|
@ -4,14 +4,14 @@ def normalize_target_name(target):
|
|||||||
def license_map(name, targets = [], opts = [], **kwargs):
|
def license_map(name, targets = [], opts = [], **kwargs):
|
||||||
"""Generate XML for all targets that depend directly on a LICENSE file"""
|
"""Generate XML for all targets that depend directly on a LICENSE file"""
|
||||||
xmls = []
|
xmls = []
|
||||||
tools = [ "//tools/bzl:license-map.py", "//lib:all-licenses" ]
|
tools = ["//tools/bzl:license-map.py", "//lib:all-licenses"]
|
||||||
for target in targets:
|
for target in targets:
|
||||||
subname = name + "_" + normalize_target_name(target) + ".xml"
|
subname = name + "_" + normalize_target_name(target) + ".xml"
|
||||||
xmls.append("$(location :%s)" % subname)
|
xmls.append("$(location :%s)" % subname)
|
||||||
tools.append(subname)
|
tools.append(subname)
|
||||||
native.genquery(
|
native.genquery(
|
||||||
name = subname,
|
name = subname,
|
||||||
scope = [ target ],
|
scope = [target],
|
||||||
|
|
||||||
# Find everything that depends on a license file, but remove
|
# Find everything that depends on a license file, but remove
|
||||||
# the license files themselves from this list.
|
# the license files themselves from this list.
|
||||||
@ -19,14 +19,14 @@ def license_map(name, targets = [], opts = [], **kwargs):
|
|||||||
|
|
||||||
# We are interested in the edges of the graph ({java_library,
|
# We are interested in the edges of the graph ({java_library,
|
||||||
# license-file} tuples). 'query' provides this in the XML output.
|
# license-file} tuples). 'query' provides this in the XML output.
|
||||||
opts = [ "--output=xml", ],
|
opts = ["--output=xml"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# post process the XML into our favorite format.
|
# post process the XML into our favorite format.
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = "gen_license_txt_" + name,
|
name = "gen_license_txt_" + name,
|
||||||
cmd = "python $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
cmd = "python $(location //tools/bzl:license-map.py) %s %s > $@" % (" ".join(opts), " ".join(xmls)),
|
||||||
outs = [ name + ".txt" ],
|
outs = [name + ".txt"],
|
||||||
tools = tools,
|
tools = tools,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
@ -44,14 +44,14 @@ def license_test(name, target):
|
|||||||
forbidden = "//lib:LICENSE-DO_NOT_DISTRIBUTE"
|
forbidden = "//lib:LICENSE-DO_NOT_DISTRIBUTE"
|
||||||
native.genquery(
|
native.genquery(
|
||||||
name = txt,
|
name = txt,
|
||||||
scope = [ target, forbidden ],
|
scope = [target, forbidden],
|
||||||
# Find everything that depends on a license file, but remove
|
# Find everything that depends on a license file, but remove
|
||||||
# the license files themselves from this list.
|
# the license files themselves from this list.
|
||||||
expression = 'rdeps(%s, "%s", 1) - rdeps(%s, "%s", 0)' % (target, forbidden, target, forbidden),
|
expression = 'rdeps(%s, "%s", 1) - rdeps(%s, "%s", 0)' % (target, forbidden, target, forbidden),
|
||||||
)
|
)
|
||||||
native.sh_test(
|
native.sh_test(
|
||||||
name = name,
|
name = name,
|
||||||
srcs = [ "//tools/bzl:test_license.sh" ],
|
srcs = ["//tools/bzl:test_license.sh"],
|
||||||
args = [ "$(location :%s)" % txt ],
|
args = ["$(location :%s)" % txt],
|
||||||
data = [ txt ],
|
data = [txt],
|
||||||
)
|
)
|
||||||
|
@ -15,18 +15,18 @@
|
|||||||
# Merge maven files
|
# Merge maven files
|
||||||
|
|
||||||
def cmd(jars):
|
def cmd(jars):
|
||||||
return ('$(location //tools:merge_jars) $@ '
|
return ("$(location //tools:merge_jars) $@ " +
|
||||||
+ ' '.join(['$(location %s)' % j for j in jars]))
|
" ".join(["$(location %s)" % j for j in jars]))
|
||||||
|
|
||||||
def merge_maven_jars(name, srcs, **kwargs):
|
def merge_maven_jars(name, srcs, **kwargs):
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = '%s__merged_bin' % name,
|
name = "%s__merged_bin" % name,
|
||||||
cmd = cmd(srcs),
|
cmd = cmd(srcs),
|
||||||
tools = srcs + ['//tools:merge_jars'],
|
tools = srcs + ["//tools:merge_jars"],
|
||||||
outs = ['%s__merged.jar' % name],
|
outs = ["%s__merged.jar" % name],
|
||||||
)
|
)
|
||||||
native.java_import(
|
native.java_import(
|
||||||
name = name,
|
name = name,
|
||||||
jars = [':%s__merged_bin' % name],
|
jars = [":%s__merged_bin" % name],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
@ -9,22 +9,23 @@ MAVEN_LOCAL = "MAVEN_LOCAL:"
|
|||||||
def _maven_release(ctx, parts):
|
def _maven_release(ctx, parts):
|
||||||
"""induce jar and url name from maven coordinates."""
|
"""induce jar and url name from maven coordinates."""
|
||||||
if len(parts) not in [3, 4]:
|
if len(parts) not in [3, 4]:
|
||||||
fail('%s:\nexpected id="groupId:artifactId:version[:classifier]"'
|
fail('%s:\nexpected id="groupId:artifactId:version[:classifier]"' %
|
||||||
% ctx.attr.artifact)
|
ctx.attr.artifact)
|
||||||
if len(parts) == 4:
|
if len(parts) == 4:
|
||||||
group, artifact, version, classifier = parts
|
group, artifact, version, classifier = parts
|
||||||
file_version = version + '-' + classifier
|
file_version = version + "-" + classifier
|
||||||
else:
|
else:
|
||||||
group, artifact, version = parts
|
group, artifact, version = parts
|
||||||
file_version = version
|
file_version = version
|
||||||
|
|
||||||
jar = artifact.lower() + '-' + file_version
|
jar = artifact.lower() + "-" + file_version
|
||||||
url = '/'.join([
|
url = "/".join([
|
||||||
ctx.attr.repository,
|
ctx.attr.repository,
|
||||||
group.replace('.', '/'),
|
group.replace(".", "/"),
|
||||||
artifact,
|
artifact,
|
||||||
version,
|
version,
|
||||||
artifact + '-' + file_version])
|
artifact + "-" + file_version,
|
||||||
|
])
|
||||||
|
|
||||||
return jar, url
|
return jar, url
|
||||||
|
|
||||||
@ -86,11 +87,13 @@ java_import(
|
|||||||
{deps}
|
{deps}
|
||||||
{exports}
|
{exports}
|
||||||
)
|
)
|
||||||
\n""".format(srcjar_attr = srcjar_attr,
|
\n""".format(
|
||||||
|
srcjar_attr = srcjar_attr,
|
||||||
header = header,
|
header = header,
|
||||||
binjar = binjar,
|
binjar = binjar,
|
||||||
deps = _format_deps("deps", ctx.attr.deps),
|
deps = _format_deps("deps", ctx.attr.deps),
|
||||||
exports = _format_deps("exports", ctx.attr.exports))
|
exports = _format_deps("exports", ctx.attr.exports),
|
||||||
|
)
|
||||||
if srcjar:
|
if srcjar:
|
||||||
contents += """
|
contents += """
|
||||||
java_import(
|
java_import(
|
||||||
@ -98,7 +101,7 @@ java_import(
|
|||||||
jars = ['{srcjar}'],
|
jars = ['{srcjar}'],
|
||||||
)
|
)
|
||||||
""".format(srcjar = srcjar)
|
""".format(srcjar = srcjar)
|
||||||
ctx.file('%s/BUILD' % ctx.path("jar"), contents, False)
|
ctx.file("%s/BUILD" % ctx.path("jar"), contents, False)
|
||||||
|
|
||||||
# Compatibility layer for java_import_external from rules_closure
|
# Compatibility layer for java_import_external from rules_closure
|
||||||
contents = """
|
contents = """
|
||||||
@ -119,13 +122,14 @@ def _maven_jar_impl(ctx):
|
|||||||
name = ctx.name
|
name = ctx.name
|
||||||
sha1 = ctx.attr.sha1
|
sha1 = ctx.attr.sha1
|
||||||
|
|
||||||
parts = ctx.attr.artifact.split(':')
|
parts = ctx.attr.artifact.split(":")
|
||||||
|
|
||||||
# TODO(davido): Only releases for now, implement handling snapshots
|
# TODO(davido): Only releases for now, implement handling snapshots
|
||||||
jar, url = _maven_release(ctx, parts)
|
jar, url = _maven_release(ctx, parts)
|
||||||
|
|
||||||
binjar = jar + '.jar'
|
binjar = jar + ".jar"
|
||||||
binjar_path = ctx.path('/'.join(['jar', binjar]))
|
binjar_path = ctx.path("/".join(["jar", binjar]))
|
||||||
binurl = url + '.jar'
|
binurl = url + ".jar"
|
||||||
|
|
||||||
python = ctx.which("python")
|
python = ctx.which("python")
|
||||||
script = ctx.path(ctx.attr._download_script)
|
script = ctx.path(ctx.attr._download_script)
|
||||||
@ -134,23 +138,23 @@ def _maven_jar_impl(ctx):
|
|||||||
if ctx.attr.sha1:
|
if ctx.attr.sha1:
|
||||||
args.extend(["-v", sha1])
|
args.extend(["-v", sha1])
|
||||||
if ctx.attr.unsign:
|
if ctx.attr.unsign:
|
||||||
args.append('--unsign')
|
args.append("--unsign")
|
||||||
for x in ctx.attr.exclude:
|
for x in ctx.attr.exclude:
|
||||||
args.extend(['-x', x])
|
args.extend(["-x", x])
|
||||||
|
|
||||||
out = ctx.execute(args)
|
out = ctx.execute(args)
|
||||||
|
|
||||||
if out.return_code:
|
if out.return_code:
|
||||||
fail("failed %s: %s" % (' '.join(args), out.stderr))
|
fail("failed %s: %s" % (" ".join(args), out.stderr))
|
||||||
|
|
||||||
srcjar = None
|
srcjar = None
|
||||||
if ctx.attr.src_sha1 or ctx.attr.attach_source:
|
if ctx.attr.src_sha1 or ctx.attr.attach_source:
|
||||||
srcjar = jar + '-src.jar'
|
srcjar = jar + "-src.jar"
|
||||||
srcurl = url + '-sources.jar'
|
srcurl = url + "-sources.jar"
|
||||||
srcjar_path = ctx.path('jar/' + srcjar)
|
srcjar_path = ctx.path("jar/" + srcjar)
|
||||||
args = [python, script, "-o", srcjar_path, "-u", srcurl]
|
args = [python, script, "-o", srcjar_path, "-u", srcurl]
|
||||||
if ctx.attr.src_sha1:
|
if ctx.attr.src_sha1:
|
||||||
args.extend(['-v', ctx.attr.src_sha1])
|
args.extend(["-v", ctx.attr.src_sha1])
|
||||||
out = ctx.execute(args)
|
out = ctx.execute(args)
|
||||||
if out.return_code:
|
if out.return_code:
|
||||||
fail("failed %s: %s" % (args, out.stderr))
|
fail("failed %s: %s" % (args, out.stderr))
|
||||||
|
@ -34,7 +34,7 @@ PGMLIBS = [
|
|||||||
def _add_context(in_file, output):
|
def _add_context(in_file, output):
|
||||||
input_path = in_file.path
|
input_path = in_file.path
|
||||||
return [
|
return [
|
||||||
'unzip -qd %s %s' % (output, input_path)
|
"unzip -qd %s %s" % (output, input_path),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _add_file(in_file, output):
|
def _add_file(in_file, output):
|
||||||
@ -43,47 +43,47 @@ def _add_file(in_file, output):
|
|||||||
short_path = in_file.short_path
|
short_path = in_file.short_path
|
||||||
n = in_file.basename
|
n = in_file.basename
|
||||||
|
|
||||||
if short_path.startswith('gerrit-'):
|
if short_path.startswith("gerrit-"):
|
||||||
n = short_path.split('/')[0] + '-' + n
|
n = short_path.split("/")[0] + "-" + n
|
||||||
|
|
||||||
output_path += n
|
output_path += n
|
||||||
return [
|
return [
|
||||||
'test -L %s || ln -s $(pwd)/%s %s' % (output_path, input_path, output_path)
|
"test -L %s || ln -s $(pwd)/%s %s" % (output_path, input_path, output_path),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _make_war(input_dir, output):
|
def _make_war(input_dir, output):
|
||||||
return '(%s)' % ' && '.join([
|
return "(%s)" % " && ".join([
|
||||||
'root=$(pwd)',
|
"root=$(pwd)",
|
||||||
'TZ=UTC',
|
"TZ=UTC",
|
||||||
'export TZ',
|
"export TZ",
|
||||||
'cd %s' % input_dir,
|
"cd %s" % input_dir,
|
||||||
"find . -exec touch -t 198001010000 '{}' ';' 2> /dev/null",
|
"find . -exec touch -t 198001010000 '{}' ';' 2> /dev/null",
|
||||||
'zip -X -9qr ${root}/%s .' % (output.path),
|
"zip -X -9qr ${root}/%s ." % (output.path),
|
||||||
])
|
])
|
||||||
|
|
||||||
def _war_impl(ctx):
|
def _war_impl(ctx):
|
||||||
war = ctx.outputs.war
|
war = ctx.outputs.war
|
||||||
build_output = war.path + '.build_output'
|
build_output = war.path + ".build_output"
|
||||||
inputs = []
|
inputs = []
|
||||||
|
|
||||||
# Create war layout
|
# Create war layout
|
||||||
cmd = [
|
cmd = [
|
||||||
'set -e;rm -rf ' + build_output,
|
"set -e;rm -rf " + build_output,
|
||||||
'mkdir -p ' + build_output,
|
"mkdir -p " + build_output,
|
||||||
'mkdir -p %s/WEB-INF/lib' % build_output,
|
"mkdir -p %s/WEB-INF/lib" % build_output,
|
||||||
'mkdir -p %s/WEB-INF/pgm-lib' % build_output,
|
"mkdir -p %s/WEB-INF/pgm-lib" % build_output,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add lib
|
# Add lib
|
||||||
transitive_lib_deps = depset()
|
transitive_lib_deps = depset()
|
||||||
for l in ctx.attr.libs:
|
for l in ctx.attr.libs:
|
||||||
if hasattr(l, 'java'):
|
if hasattr(l, "java"):
|
||||||
transitive_lib_deps += l.java.transitive_runtime_deps
|
transitive_lib_deps += l.java.transitive_runtime_deps
|
||||||
elif hasattr(l, 'files'):
|
elif hasattr(l, "files"):
|
||||||
transitive_lib_deps += l.files
|
transitive_lib_deps += l.files
|
||||||
|
|
||||||
for dep in transitive_lib_deps:
|
for dep in transitive_lib_deps:
|
||||||
cmd += _add_file(dep, build_output + '/WEB-INF/lib/')
|
cmd += _add_file(dep, build_output + "/WEB-INF/lib/")
|
||||||
inputs.append(dep)
|
inputs.append(dep)
|
||||||
|
|
||||||
# Add pgm lib
|
# Add pgm lib
|
||||||
@ -93,16 +93,16 @@ def _war_impl(ctx):
|
|||||||
|
|
||||||
for dep in transitive_pgmlib_deps:
|
for dep in transitive_pgmlib_deps:
|
||||||
if dep not in inputs:
|
if dep not in inputs:
|
||||||
cmd += _add_file(dep, build_output + '/WEB-INF/pgm-lib/')
|
cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/")
|
||||||
inputs.append(dep)
|
inputs.append(dep)
|
||||||
|
|
||||||
# Add context
|
# Add context
|
||||||
transitive_context_deps = depset()
|
transitive_context_deps = depset()
|
||||||
if ctx.attr.context:
|
if ctx.attr.context:
|
||||||
for jar in ctx.attr.context:
|
for jar in ctx.attr.context:
|
||||||
if hasattr(jar, 'java'):
|
if hasattr(jar, "java"):
|
||||||
transitive_context_deps += jar.java.transitive_runtime_deps
|
transitive_context_deps += jar.java.transitive_runtime_deps
|
||||||
elif hasattr(jar, 'files'):
|
elif hasattr(jar, "files"):
|
||||||
transitive_context_deps += jar.files
|
transitive_context_deps += jar.files
|
||||||
for dep in transitive_context_deps:
|
for dep in transitive_context_deps:
|
||||||
cmd += _add_context(dep, build_output)
|
cmd += _add_context(dep, build_output)
|
||||||
@ -114,8 +114,8 @@ def _war_impl(ctx):
|
|||||||
ctx.actions.run_shell(
|
ctx.actions.run_shell(
|
||||||
inputs = inputs,
|
inputs = inputs,
|
||||||
outputs = [war],
|
outputs = [war],
|
||||||
mnemonic = 'WAR',
|
mnemonic = "WAR",
|
||||||
command = '\n'.join(cmd),
|
command = "\n".join(cmd),
|
||||||
use_default_shell_env = True,
|
use_default_shell_env = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -132,25 +132,25 @@ _pkg_war = rule(
|
|||||||
implementation = _war_impl,
|
implementation = _war_impl,
|
||||||
)
|
)
|
||||||
|
|
||||||
def pkg_war(name, ui = 'ui_optdbg', context = [], doc = False, **kwargs):
|
def pkg_war(name, ui = "ui_optdbg", context = [], doc = False, **kwargs):
|
||||||
doc_ctx = []
|
doc_ctx = []
|
||||||
doc_lib = []
|
doc_lib = []
|
||||||
ui_deps = []
|
ui_deps = []
|
||||||
if ui == 'polygerrit' or ui == 'ui_optdbg' or ui == 'ui_optdbg_r':
|
if ui == "polygerrit" or ui == "ui_optdbg" or ui == "ui_optdbg_r":
|
||||||
ui_deps.append('//polygerrit-ui/app:polygerrit_ui')
|
ui_deps.append("//polygerrit-ui/app:polygerrit_ui")
|
||||||
if ui and ui != 'polygerrit':
|
if ui and ui != "polygerrit":
|
||||||
ui_deps.append('//gerrit-gwtui:%s' % ui)
|
ui_deps.append("//gerrit-gwtui:%s" % ui)
|
||||||
if doc:
|
if doc:
|
||||||
doc_ctx.append('//Documentation:html')
|
doc_ctx.append("//Documentation:html")
|
||||||
doc_lib.append('//Documentation:index')
|
doc_lib.append("//Documentation:index")
|
||||||
|
|
||||||
_pkg_war(
|
_pkg_war(
|
||||||
name = name,
|
name = name,
|
||||||
libs = LIBS + doc_lib,
|
libs = LIBS + doc_lib,
|
||||||
pgmlibs = PGMLIBS,
|
pgmlibs = PGMLIBS,
|
||||||
context = doc_ctx + context + ui_deps + [
|
context = doc_ctx + context + ui_deps + [
|
||||||
'//gerrit-main:main_bin_deploy.jar',
|
"//gerrit-main:main_bin_deploy.jar",
|
||||||
'//gerrit-war:webapp_assets',
|
"//gerrit-war:webapp_assets",
|
||||||
],
|
],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
load("//tools/bzl:genrule2.bzl", "genrule2")
|
load("//tools/bzl:genrule2.bzl", "genrule2")
|
||||||
load(
|
load(
|
||||||
"//tools/bzl:gwt.bzl",
|
"//tools/bzl:gwt.bzl",
|
||||||
|
"GWT_COMPILER_ARGS",
|
||||||
|
"GWT_JVM_ARGS",
|
||||||
"GWT_PLUGIN_DEPS",
|
"GWT_PLUGIN_DEPS",
|
||||||
"GWT_PLUGIN_DEPS_NEVERLINK",
|
"GWT_PLUGIN_DEPS_NEVERLINK",
|
||||||
"GWT_TRANSITIVE_DEPS",
|
"GWT_TRANSITIVE_DEPS",
|
||||||
"GWT_COMPILER_ARGS",
|
|
||||||
"GWT_JVM_ARGS",
|
|
||||||
"gwt_binary",
|
"gwt_binary",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,55 +31,56 @@ def gerrit_plugin(
|
|||||||
target_suffix = "",
|
target_suffix = "",
|
||||||
**kwargs):
|
**kwargs):
|
||||||
native.java_library(
|
native.java_library(
|
||||||
name = name + '__plugin',
|
name = name + "__plugin",
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
resources = resources,
|
resources = resources,
|
||||||
deps = provided_deps + deps + GWT_PLUGIN_DEPS_NEVERLINK + PLUGIN_DEPS_NEVERLINK,
|
deps = provided_deps + deps + GWT_PLUGIN_DEPS_NEVERLINK + PLUGIN_DEPS_NEVERLINK,
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
static_jars = []
|
static_jars = []
|
||||||
if gwt_module:
|
if gwt_module:
|
||||||
static_jars = [':%s-static' % name]
|
static_jars = [":%s-static" % name]
|
||||||
|
|
||||||
if not dir_name:
|
if not dir_name:
|
||||||
dir_name = name
|
dir_name = name
|
||||||
|
|
||||||
native.java_binary(
|
native.java_binary(
|
||||||
name = '%s__non_stamped' % name,
|
name = "%s__non_stamped" % name,
|
||||||
deploy_manifest_lines = manifest_entries + ["Gerrit-ApiType: plugin"],
|
deploy_manifest_lines = manifest_entries + ["Gerrit-ApiType: plugin"],
|
||||||
main_class = 'Dummy',
|
main_class = "Dummy",
|
||||||
runtime_deps = [
|
runtime_deps = [
|
||||||
':%s__plugin' % name,
|
":%s__plugin" % name,
|
||||||
] + static_jars,
|
] + static_jars,
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
if gwt_module:
|
if gwt_module:
|
||||||
native.java_library(
|
native.java_library(
|
||||||
name = name + '__gwt_module',
|
name = name + "__gwt_module",
|
||||||
resources = depset(srcs + resources).to_list(),
|
resources = depset(srcs + resources).to_list(),
|
||||||
runtime_deps = deps + GWT_PLUGIN_DEPS,
|
runtime_deps = deps + GWT_PLUGIN_DEPS,
|
||||||
visibility = ['//visibility:public'],
|
visibility = ["//visibility:public"],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
genrule2(
|
genrule2(
|
||||||
name = '%s-static' % name,
|
name = "%s-static" % name,
|
||||||
cmd = ' && '.join([
|
cmd = " && ".join([
|
||||||
'mkdir -p $$TMP/static',
|
"mkdir -p $$TMP/static",
|
||||||
'unzip -qd $$TMP/static $(location %s__gwt_application)' % name,
|
"unzip -qd $$TMP/static $(location %s__gwt_application)" % name,
|
||||||
'cd $$TMP',
|
"cd $$TMP",
|
||||||
'zip -qr $$ROOT/$@ .']),
|
"zip -qr $$ROOT/$@ .",
|
||||||
tools = [':%s__gwt_application' % name],
|
]),
|
||||||
outs = ['%s-static.jar' % name],
|
tools = [":%s__gwt_application" % name],
|
||||||
|
outs = ["%s-static.jar" % name],
|
||||||
)
|
)
|
||||||
gwt_binary(
|
gwt_binary(
|
||||||
name = name + '__gwt_application',
|
name = name + "__gwt_application",
|
||||||
module = [gwt_module],
|
module = [gwt_module],
|
||||||
deps = GWT_PLUGIN_DEPS + GWT_TRANSITIVE_DEPS + ['//lib/gwt:dev'],
|
deps = GWT_PLUGIN_DEPS + GWT_TRANSITIVE_DEPS + ["//lib/gwt:dev"],
|
||||||
module_deps = [':%s__gwt_module' % name],
|
module_deps = [":%s__gwt_module" % name],
|
||||||
compiler_args = GWT_COMPILER_ARGS,
|
compiler_args = GWT_COMPILER_ARGS,
|
||||||
jvm_args = GWT_JVM_ARGS,
|
jvm_args = GWT_JVM_ARGS,
|
||||||
)
|
)
|
||||||
@ -89,13 +90,14 @@ def gerrit_plugin(
|
|||||||
genrule2(
|
genrule2(
|
||||||
name = name + target_suffix,
|
name = name + target_suffix,
|
||||||
stamp = 1,
|
stamp = 1,
|
||||||
srcs = ['%s__non_stamped_deploy.jar' % name],
|
srcs = ["%s__non_stamped_deploy.jar" % name],
|
||||||
cmd = " && ".join([
|
cmd = " && ".join([
|
||||||
"GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_%s_LABEL | cut -d ' ' -f 2)" % dir_name.upper(),
|
"GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_%s_LABEL | cut -d ' ' -f 2)" % dir_name.upper(),
|
||||||
"cd $$TMP",
|
"cd $$TMP",
|
||||||
"unzip -q $$ROOT/$<",
|
"unzip -q $$ROOT/$<",
|
||||||
"echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF",
|
"echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF",
|
||||||
"zip -qr $$ROOT/$@ ."]),
|
"zip -qr $$ROOT/$@ .",
|
||||||
outs = ['%s%s.jar' % (name, target_suffix)],
|
]),
|
||||||
visibility = ['//visibility:public'],
|
outs = ["%s%s.jar" % (name, target_suffix)],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
@ -32,66 +32,79 @@ def maven_package(
|
|||||||
src = {},
|
src = {},
|
||||||
doc = {},
|
doc = {},
|
||||||
war = {}):
|
war = {}):
|
||||||
|
build_cmd = ["bazel", "build"]
|
||||||
build_cmd = ['bazel', 'build']
|
mvn_cmd = ["python", "tools/maven/mvn.py", "-v", version]
|
||||||
mvn_cmd = ['python', 'tools/maven/mvn.py', '-v', version]
|
|
||||||
api_cmd = mvn_cmd[:]
|
api_cmd = mvn_cmd[:]
|
||||||
api_targets = []
|
api_targets = []
|
||||||
for type,d in [('jar', jar), ('java-source', src), ('javadoc', doc)]:
|
for type, d in [("jar", jar), ("java-source", src), ("javadoc", doc)]:
|
||||||
for a,t in sorted(d.items()):
|
for a, t in sorted(d.items()):
|
||||||
api_cmd.append('-s %s:%s:$(location %s)' % (a,type,t))
|
api_cmd.append("-s %s:%s:$(location %s)" % (a, type, t))
|
||||||
api_targets.append(t)
|
api_targets.append(t)
|
||||||
|
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = 'gen_api_install',
|
name = "gen_api_install",
|
||||||
cmd = sh_bang_template % (
|
cmd = sh_bang_template % (
|
||||||
' '.join(build_cmd + api_targets),
|
" ".join(build_cmd + api_targets),
|
||||||
' '.join(api_cmd + ['-a', 'install'])),
|
" ".join(api_cmd + ["-a", "install"]),
|
||||||
|
),
|
||||||
srcs = api_targets,
|
srcs = api_targets,
|
||||||
outs = ['api_install.sh'],
|
outs = ["api_install.sh"],
|
||||||
executable = True,
|
executable = True,
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
if repository and url:
|
if repository and url:
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = 'gen_api_deploy',
|
name = "gen_api_deploy",
|
||||||
cmd = sh_bang_template % (
|
cmd = sh_bang_template % (
|
||||||
' '.join(build_cmd + api_targets),
|
" ".join(build_cmd + api_targets),
|
||||||
' '.join(api_cmd + ['-a', 'deploy',
|
" ".join(api_cmd + [
|
||||||
'--repository', repository,
|
"-a",
|
||||||
'--url', url])),
|
"deploy",
|
||||||
|
"--repository",
|
||||||
|
repository,
|
||||||
|
"--url",
|
||||||
|
url,
|
||||||
|
]),
|
||||||
|
),
|
||||||
srcs = api_targets,
|
srcs = api_targets,
|
||||||
outs = ['api_deploy.sh'],
|
outs = ["api_deploy.sh"],
|
||||||
executable = True,
|
executable = True,
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
war_cmd = mvn_cmd[:]
|
war_cmd = mvn_cmd[:]
|
||||||
war_targets = []
|
war_targets = []
|
||||||
for a,t in sorted(war.items()):
|
for a, t in sorted(war.items()):
|
||||||
war_cmd.append('-s %s:war:$(location %s)' % (a,t))
|
war_cmd.append("-s %s:war:$(location %s)" % (a, t))
|
||||||
war_targets.append(t)
|
war_targets.append(t)
|
||||||
|
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = 'gen_war_install',
|
name = "gen_war_install",
|
||||||
cmd = sh_bang_template % (' '.join(build_cmd + war_targets),
|
cmd = sh_bang_template % (
|
||||||
' '.join(war_cmd + ['-a', 'install'])),
|
" ".join(build_cmd + war_targets),
|
||||||
|
" ".join(war_cmd + ["-a", "install"]),
|
||||||
|
),
|
||||||
srcs = war_targets,
|
srcs = war_targets,
|
||||||
outs = ['war_install.sh'],
|
outs = ["war_install.sh"],
|
||||||
executable = True,
|
executable = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if repository and url:
|
if repository and url:
|
||||||
native.genrule(
|
native.genrule(
|
||||||
name = 'gen_war_deploy',
|
name = "gen_war_deploy",
|
||||||
cmd = sh_bang_template % (
|
cmd = sh_bang_template % (
|
||||||
' '.join(build_cmd + war_targets),
|
" ".join(build_cmd + war_targets),
|
||||||
' '.join(war_cmd + [
|
" ".join(war_cmd + [
|
||||||
'-a', 'deploy',
|
"-a",
|
||||||
'--repository', repository,
|
"deploy",
|
||||||
'--url', url])),
|
"--repository",
|
||||||
|
repository,
|
||||||
|
"--url",
|
||||||
|
url,
|
||||||
|
]),
|
||||||
|
),
|
||||||
srcs = war_targets,
|
srcs = war_targets,
|
||||||
outs = ['war_deploy.sh'],
|
outs = ["war_deploy.sh"],
|
||||||
executable = True,
|
executable = True,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user