Remove Buck based build
Bug: Issue 5302 Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
This commit is contained in:
committed by
Hector Oswaldo Caballero
parent
b33d052c45
commit
fdbfcad77d
@@ -1,80 +0,0 @@
|
||||
include_defs('//Documentation/asciidoc.defs')
|
||||
include_defs('//Documentation/config.defs')
|
||||
include_defs('//Documentation/license.defs')
|
||||
include_defs('//tools/git.defs')
|
||||
|
||||
DOC_DIR = 'Documentation'
|
||||
|
||||
JSUI_JAVA_DEPS = ['//gerrit-gwtui:ui_module']
|
||||
JSUI_NON_JAVA_DEPS = ['//polygerrit-ui/app:polygerrit_ui']
|
||||
MAIN_JAVA_DEPS = ['//gerrit-pgm:pgm']
|
||||
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
|
||||
|
||||
|
||||
genasciidoc(
|
||||
name = 'html',
|
||||
out = 'html.zip',
|
||||
directory = DOC_DIR,
|
||||
srcs = SRCS + [':licenses.txt'],
|
||||
attributes = documentation_attributes(git_describe()),
|
||||
backend = 'html5',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
genasciidoc(
|
||||
name = 'searchfree',
|
||||
out = 'searchfree.zip',
|
||||
directory = DOC_DIR,
|
||||
srcs = SRCS + [':licenses.txt'],
|
||||
attributes = documentation_attributes(git_describe()),
|
||||
backend = 'html5',
|
||||
searchbox = False,
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
genlicenses(
|
||||
name = 'licenses.txt',
|
||||
opts = ['--asciidoc'],
|
||||
java_deps = JSUI_JAVA_DEPS + MAIN_JAVA_DEPS,
|
||||
non_java_deps = JSUI_NON_JAVA_DEPS,
|
||||
out = 'licenses.txt',
|
||||
)
|
||||
|
||||
# Required by Google for gerrit-review.
|
||||
genlicenses(
|
||||
name = 'js_licenses.txt',
|
||||
opts = ['--partial'],
|
||||
java_deps = JSUI_JAVA_DEPS,
|
||||
non_java_deps = JSUI_NON_JAVA_DEPS,
|
||||
out = 'js_licenses.txt',
|
||||
)
|
||||
|
||||
python_binary(
|
||||
name = 'gen_licenses',
|
||||
main = 'gen_licenses.py',
|
||||
)
|
||||
|
||||
python_binary(
|
||||
name = 'replace_macros',
|
||||
main = 'replace_macros.py',
|
||||
visibility = ['//ReleaseNotes:'],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'index',
|
||||
cmd = '$(exe //lib/asciidoctor:doc_indexer) ' +
|
||||
'-o $OUT ' +
|
||||
'--prefix "%s/" ' % DOC_DIR +
|
||||
'--in-ext ".txt" ' +
|
||||
'--out-ext ".html" ' +
|
||||
'$SRCS ' +
|
||||
'$(location :licenses.txt)',
|
||||
srcs = SRCS,
|
||||
out = 'index.jar',
|
||||
)
|
||||
|
||||
prebuilt_jar(
|
||||
name = 'index_lib',
|
||||
binary_jar = ':index',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
@@ -1,113 +0,0 @@
|
||||
# Copyright (C) 2013 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
def genasciidoc_htmlonly(
|
||||
name,
|
||||
out,
|
||||
srcs = [],
|
||||
attributes = [],
|
||||
backend = None,
|
||||
searchbox = True,
|
||||
visibility = []):
|
||||
EXPN = '.' + name + '_expn'
|
||||
|
||||
asciidoc = [
|
||||
'$(exe //lib/asciidoctor:asciidoc)',
|
||||
'-z', '$OUT',
|
||||
'--base-dir', '$SRCDIR',
|
||||
'--tmp', '$TMP',
|
||||
'--in-ext', '".txt%s"' % EXPN,
|
||||
'--out-ext', '".html"',
|
||||
]
|
||||
if backend:
|
||||
asciidoc.extend(['-b', backend])
|
||||
for attribute in attributes:
|
||||
asciidoc.extend(['-a', attribute])
|
||||
asciidoc.append('$SRCS')
|
||||
newsrcs = []
|
||||
for src in srcs:
|
||||
fn = src
|
||||
# We have two cases: regular source files and generated files.
|
||||
# Generated files are passed as targets ':foo', and ':' is removed.
|
||||
# 1. regular files: cmd = '-s foo', srcs = ['foo']
|
||||
# 2. generated files: cmd = '-s $(location :foo)', srcs = []
|
||||
srcs = [src]
|
||||
passed_src = fn
|
||||
if fn.startswith(':') :
|
||||
fn = src[1:]
|
||||
srcs = []
|
||||
passed_src = '$(location :%s)' % fn
|
||||
ex = fn + EXPN
|
||||
|
||||
genrule(
|
||||
name = ex,
|
||||
cmd = '$(exe //Documentation:replace_macros) --suffix="%s"' % EXPN +
|
||||
' -s ' + passed_src + ' -o $OUT' +
|
||||
(' --searchbox' if searchbox else ' --no-searchbox'),
|
||||
srcs = srcs,
|
||||
out = ex,
|
||||
)
|
||||
|
||||
newsrcs.append(':%s' % ex)
|
||||
|
||||
genrule(
|
||||
name = name,
|
||||
cmd = ' '.join(asciidoc),
|
||||
srcs = newsrcs,
|
||||
out = out,
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
def genasciidoc(
|
||||
name,
|
||||
out,
|
||||
directory,
|
||||
srcs = [],
|
||||
attributes = [],
|
||||
backend = None,
|
||||
searchbox = True,
|
||||
resources = True,
|
||||
visibility = []):
|
||||
SUFFIX = '_htmlonly'
|
||||
|
||||
genasciidoc_htmlonly(
|
||||
name = name + SUFFIX if resources else name,
|
||||
srcs = srcs,
|
||||
attributes = attributes,
|
||||
backend = backend,
|
||||
searchbox = searchbox,
|
||||
out = (name + SUFFIX + '.zip') if resources else (name + '.zip'),
|
||||
)
|
||||
|
||||
if resources:
|
||||
genrule(
|
||||
name = name,
|
||||
cmd = 'cd $TMP;' +
|
||||
'mkdir -p %s/images;' % directory +
|
||||
'unzip -q $(location %s) -d %s/;'
|
||||
% (':' + name + SUFFIX, directory) +
|
||||
'for s in $SRCS;do ln -s $s %s/;done;' % directory +
|
||||
'mv %s/*.{jpg,png} %s/images;' % (directory, directory) +
|
||||
'cp $(location %s) LICENSES.txt;' % ':licenses.txt' +
|
||||
'zip -qr $OUT *',
|
||||
srcs = glob([
|
||||
'images/*.jpg',
|
||||
'images/*.png',
|
||||
]) + [
|
||||
'//gerrit-prettify:prettify.min.css',
|
||||
'//gerrit-prettify:prettify.min.js',
|
||||
],
|
||||
out = out,
|
||||
visibility = visibility,
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
DOCUMENTATION_DEPS = {
|
||||
"install-quick.txt": ["config-login-register.txt"],
|
||||
"install.txt": ["database-setup.txt"],
|
||||
}
|
||||
|
||||
def documentation_attributes(revision):
|
||||
return [
|
||||
'toc',
|
||||
'newline="\\n"',
|
||||
'asterisk="*"',
|
||||
'plus="+"',
|
||||
'caret="^"',
|
||||
'startsb="["',
|
||||
'endsb="]"',
|
||||
'tilde="~"',
|
||||
'last-update-label!',
|
||||
'source-highlighter=prettify',
|
||||
'stylesheet=DEFAULT',
|
||||
'linkcss=true',
|
||||
'prettifydir=.',
|
||||
'revnumber="%s"' % revision,
|
||||
]
|
||||
@@ -32,6 +32,10 @@ PolyGerrit UI:
|
||||
bazel build gerrit
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
PolyGerrit UI may require additional tools (such as npm). Please read
|
||||
the polygerrit-ui/README.md for more info.
|
||||
|
||||
The output executable WAR will be placed in:
|
||||
|
||||
----
|
||||
|
||||
@@ -1,735 +0,0 @@
|
||||
= Gerrit Code Review - Building with Buck
|
||||
|
||||
|
||||
== Installation
|
||||
|
||||
You need to use Java 8 and Node.js for building gerrit.
|
||||
|
||||
There is currently no binary distribution of Buck, so it has to be manually
|
||||
built and installed. Apache Ant and gcc are required. Currently only Linux
|
||||
and Mac OS are supported.
|
||||
|
||||
Clone the git and build it:
|
||||
|
||||
----
|
||||
git clone https://github.com/facebook/buck
|
||||
cd buck
|
||||
git checkout $(cat ../gerrit/.buckversion)
|
||||
ant
|
||||
----
|
||||
|
||||
If you don't have a `bin/` directory in your home directory, create one:
|
||||
|
||||
----
|
||||
mkdir ~/bin
|
||||
----
|
||||
|
||||
Add the `~/bin` folder to the path:
|
||||
|
||||
----
|
||||
PATH=~/bin:$PATH
|
||||
----
|
||||
|
||||
Note that the buck executable needs to be available in all shell sessions,
|
||||
so also make sure it is appended to the path globally.
|
||||
|
||||
Add a symbolic link in `~/bin` to the buck and buckd executables:
|
||||
|
||||
----
|
||||
ln -s `pwd`/bin/buck ~/bin/
|
||||
ln -s `pwd`/bin/buckd ~/bin/
|
||||
----
|
||||
|
||||
Verify that `buck` is accessible:
|
||||
|
||||
----
|
||||
which buck
|
||||
----
|
||||
|
||||
To enable autocompletion of buck commands, install the autocompletion
|
||||
script from `./scripts/buck-completion.bash` in the buck project. Refer
|
||||
to the script's header comments for installation instructions.
|
||||
|
||||
== Prerequisites
|
||||
|
||||
Buck requires Python version 2.7 to be installed. The Maven download toolchain
|
||||
requires `curl` to be installed.
|
||||
|
||||
[[eclipse]]
|
||||
== Eclipse Integration
|
||||
|
||||
|
||||
=== Generating the Eclipse Project
|
||||
|
||||
Create the Eclipse project:
|
||||
|
||||
----
|
||||
tools/eclipse/project.py
|
||||
----
|
||||
|
||||
and then follow the link:dev-eclipse.html#setup[setup instructions].
|
||||
|
||||
=== Refreshing the Classpath
|
||||
|
||||
If an updated classpath is needed, the Eclipse project can be
|
||||
refreshed and missing dependency JARs can be downloaded:
|
||||
|
||||
----
|
||||
tools/eclipse/project.py
|
||||
----
|
||||
|
||||
|
||||
=== Attaching Sources
|
||||
|
||||
Source JARs are downloaded by default. This allows Eclipse to show
|
||||
documentation or dive into the implementation of a library JAR.
|
||||
|
||||
To save time and bandwidth, download of source JARs can be restricted
|
||||
to only those that are necessary to compile Java source into JavaScript
|
||||
using the GWT compiler:
|
||||
|
||||
----
|
||||
tools/eclipse/project.py --no-src
|
||||
----
|
||||
|
||||
|
||||
[[build]]
|
||||
== Building on the Command Line
|
||||
|
||||
|
||||
=== Gerrit Development WAR File
|
||||
|
||||
To build the Gerrit web application that includes GWT UI and PolyGerrit UI:
|
||||
|
||||
----
|
||||
buck build gerrit
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
PolyGerrit UI may require additional tools (such as npm). Please read
|
||||
the polygerrit-ui/README.md for more info.
|
||||
|
||||
The output executable WAR will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/gerrit/gerrit.war
|
||||
----
|
||||
|
||||
To build the Gerrit web application that includes only GWT UI:
|
||||
|
||||
----
|
||||
buck build gwtgerrit
|
||||
----
|
||||
|
||||
The output executable WAR will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/gwtgerrit/gwtgerrit.war
|
||||
----
|
||||
|
||||
|
||||
=== Headless Mode
|
||||
|
||||
To build Gerrit in headless mode, i.e. without the GWT Web UI:
|
||||
|
||||
----
|
||||
buck build headless
|
||||
----
|
||||
|
||||
The output executable WAR will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/headless/headless.war
|
||||
----
|
||||
|
||||
=== Extension and Plugin API JAR Files
|
||||
|
||||
To build the extension, plugin and GWT API JAR files:
|
||||
|
||||
----
|
||||
buck build api
|
||||
----
|
||||
|
||||
Java binaries, Java sources and Java docs are generated into corresponding
|
||||
project directories in `buck-out/gen`, here as example for plugin API:
|
||||
|
||||
----
|
||||
buck-out/gen/gerrit-plugin-api/plugin-api.jar
|
||||
buck-out/gen/gerrit-plugin-api/plugin-api-javadoc/plugin-api-javadoc.jar
|
||||
buck-out/gen/gerrit-plugin-api/plugin-api-src.jar
|
||||
----
|
||||
|
||||
Install {extension,plugin,gwt}-api to the local maven repository:
|
||||
|
||||
----
|
||||
tools/maven/api.sh install
|
||||
----
|
||||
|
||||
Install gerrit.war to the local maven repository:
|
||||
|
||||
----
|
||||
tools/maven/api.sh war_install
|
||||
----
|
||||
|
||||
=== Plugins
|
||||
|
||||
To build all core plugins:
|
||||
|
||||
----
|
||||
buck build plugins:core
|
||||
----
|
||||
|
||||
The output JAR files for individual plugins will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/plugins/<name>/<name>.jar
|
||||
----
|
||||
|
||||
The JAR files will also be packaged in:
|
||||
|
||||
----
|
||||
buck-out/gen/plugins/core/core.zip
|
||||
----
|
||||
|
||||
To build a specific plugin:
|
||||
|
||||
----
|
||||
buck build plugins/<name>:<name>
|
||||
----
|
||||
|
||||
The output JAR file will be be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/plugins/<name>/<name>.jar
|
||||
----
|
||||
|
||||
Note that when building an individual plugin, the `core.zip` package
|
||||
is not regenerated.
|
||||
|
||||
Additional plugins with BUCK files can be added to the build
|
||||
environment by cloning the source repository into the plugins
|
||||
subdirectory:
|
||||
|
||||
----
|
||||
git clone https://gerrit.googlesource.com/plugins/<name> plugins/<name>
|
||||
echo /plugins/<name> >>.git/info/exclude
|
||||
----
|
||||
|
||||
Additional plugin sources will be automatically added to Eclipse the
|
||||
next time project.py is run:
|
||||
|
||||
----
|
||||
tools/eclipse/project.py
|
||||
----
|
||||
|
||||
|
||||
[[documentation]]
|
||||
=== Documentation
|
||||
|
||||
To build only the documentation for testing or static hosting:
|
||||
|
||||
----
|
||||
buck build docs
|
||||
----
|
||||
|
||||
The generated html files will NOT come with the search box, and will be
|
||||
placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/Documentation/searchfree__tmp/Documentation
|
||||
----
|
||||
|
||||
The html files will also be bundled into `searchfree.zip` in this location:
|
||||
|
||||
----
|
||||
buck-out/gen/Documentation/searchfree/searchfree.zip
|
||||
----
|
||||
|
||||
To build the executable WAR with the documentation included:
|
||||
|
||||
----
|
||||
buck build withdocs
|
||||
----
|
||||
|
||||
The WAR file will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/withdocs/withdocs.war
|
||||
----
|
||||
|
||||
[[soyc]]
|
||||
=== GWT Compile Report
|
||||
|
||||
The GWT compiler can output a compile report (or "story of your compile"),
|
||||
describing the size of the JavaScript and which source classes contributed
|
||||
to the overall download size.
|
||||
|
||||
----
|
||||
buck build soyc
|
||||
----
|
||||
|
||||
The report will be written as an HTML page to the extras directory, and
|
||||
can be opened and viewed in any web browser:
|
||||
|
||||
----
|
||||
extras/gerrit_ui/soycReport/compile-report/index.html
|
||||
----
|
||||
|
||||
Only the "Split Point Report" is created, "Compiler Metrics" are not output.
|
||||
|
||||
[[release]]
|
||||
=== Gerrit Release WAR File
|
||||
|
||||
To build the release of the Gerrit web application, including documentation and
|
||||
all core plugins:
|
||||
|
||||
----
|
||||
buck build release
|
||||
----
|
||||
|
||||
The output release WAR will be placed in:
|
||||
|
||||
----
|
||||
buck-out/gen/release/release.war
|
||||
----
|
||||
|
||||
[[tests]]
|
||||
== Running Unit Tests
|
||||
|
||||
To run all tests including acceptance tests (but not flaky tests):
|
||||
|
||||
----
|
||||
buck test --exclude flaky
|
||||
----
|
||||
|
||||
To exclude flaky and slow tests:
|
||||
|
||||
----
|
||||
buck test --exclude flaky slow
|
||||
----
|
||||
|
||||
To run only a specific group of acceptance tests:
|
||||
|
||||
----
|
||||
buck test --include api
|
||||
----
|
||||
|
||||
The following groups of tests are currently supported:
|
||||
|
||||
* acceptance
|
||||
* api
|
||||
* edit
|
||||
* flaky
|
||||
* git
|
||||
* pgm
|
||||
* rest
|
||||
* server
|
||||
* ssh
|
||||
* slow
|
||||
|
||||
To run a specific test group, e.g. the rest-account test group:
|
||||
|
||||
----
|
||||
buck test //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account
|
||||
----
|
||||
|
||||
To create test coverage report:
|
||||
|
||||
----
|
||||
buck test --code-coverage --code-coverage-format html --no-results-cache
|
||||
----
|
||||
|
||||
The HTML report is created in `buck-out/gen/jacoco/code-coverage/index.html`.
|
||||
|
||||
To run the tests against NoteDb backend:
|
||||
|
||||
----
|
||||
GERRIT_NOTEDB=READ_WRITE buck test
|
||||
----
|
||||
|
||||
To run only tests that do not use SSH:
|
||||
|
||||
----
|
||||
GERRIT_USE_SSH=NO buck test
|
||||
----
|
||||
|
||||
== Dependencies
|
||||
|
||||
Dependency JARs are normally downloaded automatically, but Buck can inspect
|
||||
its graph and download any missing JAR files. This is useful to enable
|
||||
subsequent builds to run without network access:
|
||||
|
||||
----
|
||||
tools/download_all.py
|
||||
----
|
||||
|
||||
When downloading from behind a proxy (which is common in some corporate
|
||||
environments), it might be necessary to explicitly specify the proxy that
|
||||
is then used by `curl`:
|
||||
|
||||
----
|
||||
export http_proxy=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
|
||||
----
|
||||
|
||||
Redirection to local mirrors of Maven Central and the Gerrit storage
|
||||
bucket is supported by defining specific properties in
|
||||
`local.properties`, a file that is not tracked by Git:
|
||||
|
||||
----
|
||||
echo download.GERRIT = http://nexus.my-company.com/ >>local.properties
|
||||
echo download.MAVEN_CENTRAL = http://nexus.my-company.com/ >>local.properties
|
||||
----
|
||||
|
||||
The `local.properties` file may be placed in the root of the gerrit repository
|
||||
being built, or in `~/.gerritcodereview/`. The file in the root of the gerrit
|
||||
repository has precedence.
|
||||
|
||||
== Building against unpublished Maven JARs
|
||||
|
||||
To build against unpublished Maven JARs, like gwtorm or PrologCafe, the custom
|
||||
JARs must be installed in the local Maven repository (`mvn clean install`) and
|
||||
`maven_jar()` must be updated to point to the `MAVEN_LOCAL` Maven repository for
|
||||
that artifact:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
maven_jar(
|
||||
name = 'gwtorm',
|
||||
id = 'gwtorm:gwtorm:42',
|
||||
license = 'Apache2.0',
|
||||
repository = MAVEN_LOCAL,
|
||||
)
|
||||
----
|
||||
|
||||
== Building against artifacts from custom Maven repositories
|
||||
|
||||
To build against custom Maven repositories, two modes of operations are
|
||||
supported: with rewrite in local.properties and without.
|
||||
|
||||
Without rewrite the URL of custom Maven repository can be directly passed
|
||||
to the maven_jar() function:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
GERRIT_FORGE = 'http://gerritforge.com/snapshot'
|
||||
|
||||
maven_jar(
|
||||
name = 'gitblit',
|
||||
id = 'com.gitblit:gitblit:1.4.0',
|
||||
sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa',
|
||||
license = 'Apache2.0',
|
||||
repository = GERRIT_FORGE,
|
||||
)
|
||||
----
|
||||
|
||||
When the custom URL has to be rewritten, then the same logic as with Gerrit
|
||||
known Maven repository is used: Repo name must be defined that matches an entry
|
||||
in local.properties file:
|
||||
|
||||
----
|
||||
download.GERRIT_FORGE = http://my.company.mirror/gerrit-forge
|
||||
----
|
||||
|
||||
And corresponding BUCK excerpt:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
GERRIT_FORGE = 'GERRIT_FORGE:'
|
||||
|
||||
maven_jar(
|
||||
name = 'gitblit',
|
||||
id = 'com.gitblit:gitblit:1.4.0',
|
||||
sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa',
|
||||
license = 'Apache2.0',
|
||||
repository = GERRIT_FORGE,
|
||||
)
|
||||
----
|
||||
|
||||
=== Caching Build Results
|
||||
|
||||
Build results can be locally cached, saving rebuild time when
|
||||
switching between Git branches. Buck's documentation covers
|
||||
caching in link:http://facebook.github.io/buck/concept/buckconfig.html[buckconfig].
|
||||
The trivial case using a local directory is:
|
||||
|
||||
----
|
||||
cat >.buckconfig.local <<EOF
|
||||
[cache]
|
||||
mode = dir
|
||||
dir = buck-cache
|
||||
EOF
|
||||
----
|
||||
|
||||
[[clean-cache]]
|
||||
=== Cleaning The Buck Cache
|
||||
|
||||
The cache for the Gerrit Code Review project is located in
|
||||
`~/.gerritcodereview/buck-cache/locally-built-artifacts`.
|
||||
|
||||
The Buck cache should never need to be manually deleted. If you find yourself
|
||||
deleting the Buck cache regularly, then it is likely that there is something
|
||||
wrong with your environment or your workflow.
|
||||
|
||||
If you really do need to clean the cache manually, then:
|
||||
|
||||
----
|
||||
rm -rf ~/.gerritcodereview/buck-cache/locally-built-artifacts
|
||||
----
|
||||
|
||||
Note that the root `buck-cache` folder should not be deleted as it also contains
|
||||
the `downloaded-artifacts` directory, which holds the artifacts that got
|
||||
downloaded (not built locally).
|
||||
|
||||
[[buck-daemon]]
|
||||
=== Using Buck daemon
|
||||
|
||||
Buck ships with a daemon command `buckd`, which uses the
|
||||
link:https://github.com/martylamb/nailgun[Nailgun] protocol for running
|
||||
Java programs from the command line without incurring the JVM startup
|
||||
overhead.
|
||||
|
||||
Using a Buck daemon can save significant amounts of time as it avoids the
|
||||
overhead of starting a Java virtual machine, loading the buck class files
|
||||
and parsing the build files for each command.
|
||||
|
||||
It is safe to run several buck daemons started from different project
|
||||
directories and they will not interfere with each other. Buck's documentation
|
||||
covers daemon in http://facebook.github.io/buck/command/buckd.html[buckd].
|
||||
|
||||
To use `buckd` the additional
|
||||
link:https://facebook.github.io/watchman[watchman] program must be installed.
|
||||
|
||||
To disable `buckd`, the environment variable `NO_BUCKD` must be set. It's not
|
||||
recommended to put it in the shell config, as it can be forgotten about it and
|
||||
then assumed Buck was working as it should when it should be using buckd.
|
||||
Prepend the variable to Buck invocation instead:
|
||||
|
||||
----
|
||||
NO_BUCKD=1 buck build gerrit
|
||||
----
|
||||
|
||||
[[watchman]]
|
||||
=== Installing watchman
|
||||
|
||||
Watchman is used internally by Buck to monitor directory trees and is needed
|
||||
for buck daemon to work properly. Because buckd is activated by default in the
|
||||
latest version of Buck, it searches for the watchman executable in the
|
||||
path and issues a warning when it is not found and kills buckd.
|
||||
|
||||
To prepare watchman installation on Linux:
|
||||
|
||||
----
|
||||
git clone https://github.com/facebook/watchman.git
|
||||
cd watchman
|
||||
./autogen.sh
|
||||
----
|
||||
|
||||
To install it in user home directory (without root privileges):
|
||||
|
||||
----
|
||||
./configure --prefix $HOME/watchman
|
||||
make install
|
||||
----
|
||||
|
||||
To install it system wide:
|
||||
|
||||
----
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
----
|
||||
|
||||
Put $HOME/watchman/bin/watchman in path or link to $HOME/bin/watchman.
|
||||
|
||||
To install watchman on OS X:
|
||||
|
||||
----
|
||||
brew install --HEAD watchman
|
||||
----
|
||||
|
||||
See the original documentation for more information:
|
||||
link:https://facebook.github.io/watchman/docs/install.html[Watchman
|
||||
installation].
|
||||
|
||||
=== Override Buck's settings
|
||||
|
||||
Additional JVM args for Buck can be set in `.buckjavaargs` in the
|
||||
project root directory. For example to override Buck's default 1GB
|
||||
heap size:
|
||||
|
||||
----
|
||||
cat > .buckjavaargs <<EOF
|
||||
-Xms8000m -Xmx16000m
|
||||
EOF
|
||||
----
|
||||
|
||||
== Rerun unit tests
|
||||
|
||||
Test execution results are cached by Buck. If a test that was already run
|
||||
needs to be repeated, the unit test cache for that test must be removed first:
|
||||
|
||||
----
|
||||
rm -rf buck-out/bin/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account/.rest-account/
|
||||
----
|
||||
|
||||
After clearing the cache, the test can be run again:
|
||||
|
||||
----
|
||||
buck test //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account
|
||||
[-] TESTING...FINISHED 12,3s (12 PASS/0 FAIL)
|
||||
RESULTS FOR //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account
|
||||
PASS 970ms 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.CapabilitiesIT
|
||||
PASS 999ms 1 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.EditPreferencesIT
|
||||
PASS 1,2s 1 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetAccountDetailIT
|
||||
PASS 951ms 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetAccountIT
|
||||
PASS 6,4s 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetDiffPreferencesIT
|
||||
PASS 1,2s 4 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.PutUsernameIT
|
||||
TESTS PASSED
|
||||
----
|
||||
|
||||
An alternative approach is to use Buck's `--filters` (`-f`) option:
|
||||
|
||||
----
|
||||
buck test -f 'com.google.gerrit.acceptance.rest.account.CapabilitiesIT'
|
||||
Using buckd.
|
||||
[-] PROCESSING BUCK FILES...FINISHED 1,0s [100%]
|
||||
[-] BUILDING...FINISHED 2,8s [100%] (334/701 JOBS, 110 UPDATED, 5,1% CACHE MISS)
|
||||
[-] TESTING...FINISHED 9,2s (6 PASS/0 FAIL)
|
||||
RESULTS FOR SELECTED TESTS
|
||||
PASS 8,0s 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.CapabilitiesIT
|
||||
PASS <100ms 4 Passed 0 Skipped 0 Failed //tools:util_test
|
||||
TESTS PASSED
|
||||
----
|
||||
|
||||
When this option is used, the cache is disabled per design and doesn't need to
|
||||
be explicitly deleted. Note, that this is a known issue, that python tests are
|
||||
always executed.
|
||||
|
||||
Note that when this option is used, the whole unit test cache is dropped, so
|
||||
repeating the
|
||||
|
||||
----
|
||||
buck test
|
||||
----
|
||||
|
||||
causes all tests to be executed again.
|
||||
|
||||
To run tests without using cached results at all, use the `--no-results-cache`
|
||||
option:
|
||||
|
||||
----
|
||||
buck test --no-results-cache
|
||||
----
|
||||
|
||||
== Cross-compiling Java8 to Java7
|
||||
|
||||
After switching to Java8, we should take care to not end up
|
||||
with Java8 code in stable branches. We assume that we don't
|
||||
really want to switch java versions locally every time we switch
|
||||
branches.
|
||||
|
||||
Given that source level on 'stable-2.13' is 7, source level incompatibility
|
||||
will be already correctly detected, so that Java8 compiler would refuse
|
||||
to compile lambdas with -source 7 argument. However, unless bootclasspath
|
||||
is adjusted to point to Java7 runtime, it's possible to end up with broken
|
||||
code, that would compile with Java8 but will not run on Java7 runtime.
|
||||
|
||||
To prevent this, add this line to your '.buckconfig.local' in the Gerrit
|
||||
source root directory when working on stable branches:
|
||||
|
||||
----
|
||||
[java]
|
||||
extra_arguments = -Xbootclasspath/p:/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre/lib/rt.jar
|
||||
----
|
||||
|
||||
With this in place, methods that were added only in Java8 in runtime library,
|
||||
would be correctly refused to compile by Java8:
|
||||
|
||||
----
|
||||
$ java -version
|
||||
openjdk version "1.8.0_101"
|
||||
|
||||
$ buck build gerrit-server:server
|
||||
/home/davido/projects/gerrit/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java:218: error: cannot find symbol
|
||||
return Collections.emptySortedSet();
|
||||
^
|
||||
symbol: method emptySortedSet()
|
||||
location: class java.util.Collections
|
||||
----
|
||||
|
||||
== Upgrading Buck
|
||||
|
||||
The following tests should be executed, when Buck version is upgraded:
|
||||
|
||||
* buck build release
|
||||
* tools/maven/api.sh install
|
||||
* buck test
|
||||
* buck build gerrit, change some sources in gerrit-server project,
|
||||
repeat buck build gerrit and verify that gerrit.war was updated
|
||||
* install and verify new gerrit site
|
||||
* upgrade and verify existing gerrit site
|
||||
* reindex existing gerrit site
|
||||
* verify that tools/eclipse/project.py produces sane Eclipse project
|
||||
* verify that tools/eclipse/project.py --src generates sources as well
|
||||
* verify that unit test execution from Eclipse works
|
||||
* verify that daemon started from Eclipse works
|
||||
* verify that GWT SDM debug session started from Eclipse works
|
||||
|
||||
== Known issues and bugs
|
||||
|
||||
=== Symbolic links and `watchman`
|
||||
|
||||
`Buck` with activated `Watchman` has currently a
|
||||
[known bug](https://github.com/facebook/buck/issues/341) related to
|
||||
symbolic links. The symbolic links are used very often with external
|
||||
plugins, that are linked per symbolic link to the plugins directory.
|
||||
With this use case Buck is failing to rebuild the plugin artifact
|
||||
after it was built. All attempts to convince Buck to rebuild will fail.
|
||||
The only known way to recover is to weep out `buck-out` directory. The
|
||||
better workaround is to avoid using Watchman in this specific use case.
|
||||
Watchman can either be de-installed or disabled. See
|
||||
link:#buck-daemon[Using Buck daemon] section above how to temporarily
|
||||
disable `buckd`.
|
||||
|
||||
== Error Prone integration
|
||||
|
||||
link:http://errorprone.info[Error Prone] is a static analysis tool for
|
||||
Java that catches common programming mistakes at compile-time. It can
|
||||
be permanenty or instantly activated. For permanent activation, add these
|
||||
lines to your `.buckconfig.local` file in gerrit tree:
|
||||
|
||||
```
|
||||
[sanitizers]
|
||||
error_prone = 1
|
||||
```
|
||||
|
||||
For instant activation, pass this config option to the `build` or `test`
|
||||
commands:
|
||||
|
||||
```
|
||||
buck build --config sanitizers.error_prone=1 gerrit
|
||||
```
|
||||
|
||||
== Troubleshooting Buck
|
||||
|
||||
In some cases problems with Buck itself need to be investigated. See for example
|
||||
link:https://gerrit-review.googlesource.com/62411[this attempt to upgrade Buck]
|
||||
and link:https://github.com/facebook/buck/pull/227[the fix that was needed] to
|
||||
make the update possible.
|
||||
|
||||
To build Gerrit with a custom version of Buck, the following steps are necessary:
|
||||
|
||||
1. In the Buck git apply any necessary changes from pull requests
|
||||
2. Compile Buck with `ant`
|
||||
3. In the root of the Gerrit project create a `.nobuckcheck` file to prevent Buck
|
||||
from updating itself
|
||||
4. Replace the sha1 in Gerrit's `.buckversion` file with the required version from
|
||||
the custom Buck build
|
||||
5. Build Gerrit as usual
|
||||
|
||||
GERRIT
|
||||
------
|
||||
Part of link:index.html[Gerrit Code Review]
|
||||
|
||||
SEARCHBOX
|
||||
---------
|
||||
@@ -4,15 +4,15 @@
|
||||
From build process perspective there are three types of plugins:
|
||||
|
||||
* Maven driven
|
||||
* Buck in tree driven
|
||||
* Buck standalone driven
|
||||
* Bazel tree driven
|
||||
* Bazel standalone
|
||||
|
||||
These types can be combined: if both files in plugin's root directory exist:
|
||||
|
||||
* `BUCK`
|
||||
* `BUILD`
|
||||
* `pom.xml`
|
||||
|
||||
the plugin can be built with both Buck and Maven.
|
||||
the plugin can be built with both Bazel and Maven.
|
||||
|
||||
|
||||
== Maven driven build
|
||||
@@ -52,35 +52,35 @@ mvn install
|
||||
Repeat step 1. above.
|
||||
|
||||
|
||||
== Buck in tree driven
|
||||
== Bazel in tree driven
|
||||
|
||||
|
||||
The fact that plugin contains `BUCK` file doesn't mean that building this
|
||||
plugin from the plugin directory works. For now it doesn't. Buck in tree driven
|
||||
The fact that plugin contains `BUILD` file doesn't mean that building this
|
||||
plugin from the plugin directory works. For now it doesn't. Bazel in tree driven
|
||||
means it can only be built from within Gerrit tree. Clone or link the plugin
|
||||
into gerrit/plugins directory:
|
||||
|
||||
----
|
||||
cd gerrit
|
||||
buck build plugins/<plugin-name>:<plugin-name>
|
||||
bazel build plugins/<plugin-name>:<plugin-name>
|
||||
----
|
||||
|
||||
The output can be normally found in the following directory:
|
||||
|
||||
----
|
||||
buck-out/gen/plugins/<plugin-name>/<plugin-name>.jar
|
||||
bazel-genfiles/plugins/<plugin-name>/<plugin-name>.jar
|
||||
----
|
||||
|
||||
Some plugins describe their build process in `src/main/resources/Documentation/build.md`
|
||||
file. It may worth checking.
|
||||
|
||||
== Buck standalone driven
|
||||
== Bazel standalone driven
|
||||
|
||||
Only few plugins support that mode for now:
|
||||
|
||||
----
|
||||
cd reviewers
|
||||
buck build plugin
|
||||
bazel build reviewers
|
||||
----
|
||||
|
||||
GERRIT
|
||||
|
||||
@@ -33,7 +33,7 @@ and
|
||||
In Eclipse, choose 'Import existing project' and select the `gerrit` project
|
||||
from the current working directory.
|
||||
|
||||
Expand the `gerrit` project, right-click on the `buck-out` folder, select
|
||||
Expand the `gerrit` project, right-click on the `eclipse-out` folder, select
|
||||
'Properties', and then under 'Attributes' check 'Derived'.
|
||||
|
||||
Note that if you make any changes in the project configuration
|
||||
@@ -55,7 +55,7 @@ settings prefer when formatting source code.
|
||||
== Site Initialization
|
||||
|
||||
Build once on the command line with
|
||||
link:dev-buck.html#build[Buck] and then follow
|
||||
link:dev-bazel.html#build[Bazel] and then follow
|
||||
link:dev-readme.html#init[Site Initialization] in the
|
||||
Developer Setup guide to configure a local site for testing.
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ file:
|
||||
</manifestEntries>
|
||||
----
|
||||
|
||||
For Buck driven plugins, the following line must be included in the BUCK
|
||||
For Bazel driven plugins, the following line must be included in the BUILD
|
||||
configuration file:
|
||||
|
||||
[source,python]
|
||||
@@ -1347,7 +1347,7 @@ plugins:
|
||||
</manifestEntries>
|
||||
----
|
||||
|
||||
or in the `BUCK` configuration file for Buck driven plugins:
|
||||
or in the `BUILD` configuration file for Bazel driven plugins:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1412,7 +1412,7 @@ driven plugins:
|
||||
</manifestEntries>
|
||||
----
|
||||
|
||||
or in the `BUCK` configuration file for Buck driven plugins
|
||||
or in the `BUILD` configuration file for Bazel driven plugins
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
= Gerrit Code Review - Developer Setup
|
||||
|
||||
Bazel or Facebook Buck is needed to compile the code, and an SQL database to
|
||||
Google Bazel is needed to compile the code, and an SQL database to
|
||||
house the review metadata. H2 is recommended for development
|
||||
databases, as it requires no external server process.
|
||||
|
||||
@@ -21,9 +21,7 @@ cloned.
|
||||
[[compile_project]]
|
||||
== Compiling
|
||||
|
||||
Please refer to either <<dev-buck#,Building with Buck>> or
|
||||
<<dev-bazel#,Building with Bazel>>.
|
||||
|
||||
Please refer to <<dev-bazel#,Building with Bazel>>.
|
||||
|
||||
== Switching between branches
|
||||
|
||||
@@ -50,32 +48,12 @@ screw up your project.
|
||||
To use the Eclipse IDE for development, please see
|
||||
link:dev-eclipse.html[Eclipse Setup].
|
||||
|
||||
For details on how to configure the Eclipse workspace with Buck,
|
||||
refer to: link:dev-buck.html#eclipse[Eclipse integration with Buck].
|
||||
For details on how to configure the Eclipse workspace with Bazel,
|
||||
refer to: link:dev-bazel.html#eclipse[Eclipse integration with Bazel].
|
||||
|
||||
|
||||
== Configuring IntelliJ IDEA
|
||||
|
||||
=== Build based on Buck
|
||||
|
||||
To use IntelliJ IDEA for development, the easiest way is to follow
|
||||
Eclipse integration and then open it as Eclipse project in IDEA.
|
||||
You need the Eclipse plugin activated in IntelliJ IDEA.
|
||||
|
||||
Once you start compiling using both buck and your Gerrit project in
|
||||
IDEA, you will likely need to mark the below directories as generated
|
||||
sources roots. You can do so using the IDEA "Project" view. In the
|
||||
context menu of each one of these, use "Mark Directory As" to mark
|
||||
them as "Generated Sources Root":
|
||||
|
||||
----
|
||||
__auto_value_tests_gen__
|
||||
__httpd_gen__
|
||||
__server_gen__
|
||||
----
|
||||
|
||||
=== Build based on Bazel
|
||||
|
||||
Please refer to <<dev-intellij#,IntelliJ Setup>> for detailed
|
||||
instructions.
|
||||
|
||||
@@ -97,12 +75,6 @@ the terminal.
|
||||
After compiling <<compile_project,(above)>>, run Gerrit's 'init' command to
|
||||
create a testing site for development use:
|
||||
|
||||
.Build based on Buck
|
||||
----
|
||||
java -jar buck-out/gen/gerrit/gerrit.war init -d ../gerrit_testsite
|
||||
----
|
||||
|
||||
.Build based on Bazel
|
||||
----
|
||||
$(bazel info output_base)/external/local_jdk/bin/java \
|
||||
-jar bazel-bin/gerrit.war init -d ../gerrit_testsite
|
||||
@@ -169,10 +141,8 @@ A new review site is created for each test and the Gerrit daemon is
|
||||
started on that site. When the test has finished the Gerrit daemon is
|
||||
shutdown.
|
||||
|
||||
For instructions on running the integration tests with Buck,
|
||||
please refer to:
|
||||
link:dev-buck.html#tests[Running integration tests with Buck].
|
||||
For Bazel, please refer to <<dev-bazel#tests,Running Unit Tests with Bazel>>.
|
||||
For instructions on running the integration tests with Bazel,
|
||||
please refer to: <<dev-bazel#tests,Running Unit Tests with Bazel>>.
|
||||
|
||||
[[run_daemon]]
|
||||
=== Running the Daemon
|
||||
@@ -180,14 +150,6 @@ For Bazel, please refer to <<dev-bazel#tests,Running Unit Tests with Bazel>>.
|
||||
The daemon can be directly launched from the build area, without
|
||||
copying to the test site:
|
||||
|
||||
.Build based on Buck
|
||||
----
|
||||
java -jar buck-out/gen/gerrit/gerrit.war daemon -d \
|
||||
../gerrit_testsite --console-log
|
||||
|
||||
----
|
||||
|
||||
.Build based on Bazel
|
||||
----
|
||||
$(bazel info output_base)/external/local_jdk/bin/java \
|
||||
-jar bazel-bin/gerrit.war daemon -d ../gerrit_testsite \
|
||||
@@ -213,12 +175,6 @@ Python scripts for troubleshooting.
|
||||
Gerrit Inspect can be started by adding '-s' option to the
|
||||
command used to launch the daemon:
|
||||
|
||||
.Build based on Buck
|
||||
----
|
||||
java -jar buck-out/gen/gerrit/gerrit.war daemon -d ../gerrit_testsite -s
|
||||
----
|
||||
|
||||
.Build based on Bazel
|
||||
----
|
||||
$(bazel info output_base)/external/local_jdk/bin/java \
|
||||
-jar bazel-bin/gerrit.war daemon -d ../gerrit_testsite -s
|
||||
@@ -250,12 +206,6 @@ when using the Inspector.
|
||||
The embedded H2 database can be queried and updated from the
|
||||
command line. If the daemon is not currently running:
|
||||
|
||||
.Build based on Buck
|
||||
----
|
||||
java -jar buck-out/gen/gerrit/gerrit.war gsql -d ../gerrit_testsite
|
||||
----
|
||||
|
||||
.Build based on Bazel
|
||||
----
|
||||
$(bazel info output_base)/external/local_jdk/bin/java \
|
||||
-jar bazel-bin/gerrit.war gsql -d ../gerrit_testsite -s
|
||||
|
||||
@@ -111,8 +111,8 @@ the subproject.
|
||||
* link:dev-release-subproject.html#prepare-release[Prepare the Release]
|
||||
* link:dev-release-subproject.html#publish-release[Publish the Release]
|
||||
|
||||
* Update the `id`, `bin_sha1`, and `src_sha1` values in the `maven_jar`
|
||||
for the Subproject in `/lib/BUCK` to the released version.
|
||||
* Update the `artifact`, `sha1`, and `src_sha1` values in the `maven_jar`
|
||||
for the Subproject in `WORKSPACE` to the released version.
|
||||
|
||||
[[update-versions]]
|
||||
=== Update Versions and Create Release Tag
|
||||
@@ -147,9 +147,8 @@ Tag the plugins:
|
||||
* Build the Gerrit WAR, API JARs and documentation
|
||||
+
|
||||
----
|
||||
buck clean
|
||||
buck build --no-cache release docs
|
||||
./tools/maven/api.sh install <buck|bazel>
|
||||
bazel build release Documentation:searchfree
|
||||
./tools/maven/api.sh install
|
||||
----
|
||||
|
||||
* Sanity check WAR
|
||||
@@ -157,11 +156,10 @@ Tag the plugins:
|
||||
|
||||
* Verify plugin versions
|
||||
+
|
||||
Sometimes `buck` doesn't rebuild plugins after they are tagged, and the
|
||||
versions don't reflect the tag. Verify the versions:
|
||||
Verify the versions:
|
||||
+
|
||||
----
|
||||
java -jar ./buck-out/gen/release/release.war init --list-plugins
|
||||
java -jar bazel-bin/release.war init --list-plugins
|
||||
----
|
||||
|
||||
[[publish-gerrit]]
|
||||
@@ -174,30 +172,24 @@ versions don't reflect the tag. Verify the versions:
|
||||
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
|
||||
configuration] for deploying to Maven Central
|
||||
|
||||
* Make sure that the version is updated in the `VERSION` file and in
|
||||
* Make sure that the version is updated in the `version.bzl` file and in
|
||||
the `pom.xml` files as described in the link:#update-versions[Update
|
||||
Versions and Create Release Tag] section.
|
||||
|
||||
* Push the WAR to Maven Central:
|
||||
+
|
||||
----
|
||||
./tools/maven/api.sh war_deploy <buck|bazel>
|
||||
./tools/maven/api.sh war_deploy
|
||||
----
|
||||
|
||||
* Push the plugin artifacts to Maven Central:
|
||||
+
|
||||
----
|
||||
./tools/maven/api.sh deploy <buck|bazel>
|
||||
----
|
||||
+
|
||||
If no artifacts are uploaded, clean the `buck-out` folder and retry:
|
||||
+
|
||||
----
|
||||
buck clean ; rm -rf buck-out
|
||||
./tools/maven/api.sh deploy
|
||||
----
|
||||
|
||||
* To where the artifacts are uploaded depends on the `GERRIT_VERSION` in
|
||||
the `VERSION` file:
|
||||
the `version.bzl` file:
|
||||
|
||||
** SNAPSHOT versions are directly uploaded into the Sonatype snapshots
|
||||
repository and no further action is needed:
|
||||
@@ -318,7 +310,7 @@ Push the new Release Tag on the plugins:
|
||||
==== Upload the Documentation
|
||||
|
||||
* Extract the documentation files from the zip file generated from
|
||||
`buck build docs`: `buck-out/gen/Documentation/searchfree/searchfree.zip`.
|
||||
`bazel build searchfree`: `bazel-bin/Documentation/searchfree.zip`.
|
||||
|
||||
* Upload the files manually via web browser to the appropriate folder
|
||||
in the
|
||||
@@ -368,7 +360,7 @@ including some or all of the following in the email:
|
||||
+
|
||||
The SHA1 and MD5 can be taken from the artifact page on Sonatype. The
|
||||
SHA256 can be generated with
|
||||
`openssl sha -sha256 buck-out/gen/release/release.war` or an equivalent
|
||||
`openssl sha -sha256 bazel-bin/release.war` or an equivalent
|
||||
command.
|
||||
|
||||
* Update the new discussion group announcement to be sticky
|
||||
@@ -388,8 +380,7 @@ All new development that is done in the `master` branch will be included in the
|
||||
next Gerrit release. The Gerrit version should be set to the snapshot version
|
||||
for the next release.
|
||||
|
||||
Use the `version` tool to set the version in the `VERSION` file:
|
||||
:
|
||||
Use the `version` tool to set the version in the `version.bzl` file:
|
||||
|
||||
----
|
||||
./tools/version.py 2.11-SNAPSHOT
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (C) 2013 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# TODO(sop): Be more detailed: version, link to Maven Central
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from collections import defaultdict, deque
|
||||
import json
|
||||
from os import chdir, path
|
||||
from shutil import copyfileobj
|
||||
from subprocess import Popen, PIPE
|
||||
from sys import stdout, stderr
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--asciidoc', action='store_true')
|
||||
parser.add_argument('--partial', action='store_true')
|
||||
parser.add_argument('targets', nargs='+')
|
||||
args = parser.parse_args()
|
||||
|
||||
KNOWN_PROVIDED_DEPS = [
|
||||
'//lib/bouncycastle:bcpg',
|
||||
'//lib/bouncycastle:bcpkix',
|
||||
'//lib/bouncycastle:bcprov',
|
||||
]
|
||||
|
||||
for target in args.targets:
|
||||
if not target.startswith('//'):
|
||||
print('Target must be absolute: %s' % target, file=stderr)
|
||||
|
||||
def parse_graph():
|
||||
graph = defaultdict(list)
|
||||
while not path.isfile('.buckconfig'):
|
||||
chdir('..')
|
||||
query = ' + '.join('deps(%s)' % t for t in args.targets)
|
||||
p = Popen([
|
||||
'buck', 'query', query,
|
||||
'--output-attributes=buck.direct_dependencies'], stdout=PIPE)
|
||||
obj = json.load(p.stdout)
|
||||
for target, attrs in obj.iteritems():
|
||||
for dep in attrs['buck.direct_dependencies']:
|
||||
|
||||
if target in KNOWN_PROVIDED_DEPS:
|
||||
continue
|
||||
|
||||
if (args.partial
|
||||
and dep == '//gerrit-gwtexpui:CSS'
|
||||
and target == '//gerrit-gwtui:ui_module'):
|
||||
continue
|
||||
|
||||
graph[target].append(dep)
|
||||
r = p.wait()
|
||||
if r != 0:
|
||||
exit(r)
|
||||
return graph
|
||||
|
||||
graph = parse_graph()
|
||||
licenses = defaultdict(set)
|
||||
|
||||
do_not_distribute = False
|
||||
queue = deque(args.targets)
|
||||
while queue:
|
||||
target = queue.popleft()
|
||||
for dep in graph[target]:
|
||||
if not dep.startswith('//lib:LICENSE-'):
|
||||
continue
|
||||
if 'DO_NOT_DISTRIBUTE' in dep:
|
||||
do_not_distribute = True
|
||||
licenses[dep].add(target)
|
||||
queue.extend(graph[target])
|
||||
|
||||
if do_not_distribute:
|
||||
print('DO_NOT_DISTRIBUTE license found', file=stderr)
|
||||
for target in args.targets:
|
||||
print('...via %s:' % target)
|
||||
Popen(['buck', 'query',
|
||||
'allpaths(%s, //lib:LICENSE-DO_NOT_DISTRIBUTE)' % target],
|
||||
stdout=stderr).communicate()
|
||||
exit(1)
|
||||
|
||||
used = sorted(licenses.keys())
|
||||
|
||||
if args.asciidoc:
|
||||
print("""\
|
||||
= Gerrit Code Review - Licenses
|
||||
|
||||
Gerrit open source software is licensed under the <<Apache2_0,Apache
|
||||
License 2.0>>. Executable distributions also include other software
|
||||
components that are provided under additional licenses.
|
||||
|
||||
[[cryptography]]
|
||||
== Cryptography Notice
|
||||
|
||||
This distribution includes cryptographic software. The country
|
||||
in which you currently reside may have restrictions on the import,
|
||||
possession, use, and/or re-export to another country, of encryption
|
||||
software. BEFORE using any encryption software, please check
|
||||
your country's laws, regulations and policies concerning the
|
||||
import, possession, or use, and re-export of encryption software,
|
||||
to see if this is permitted. See the
|
||||
link:http://www.wassenaar.org/[Wassenaar Arrangement]
|
||||
for more information.
|
||||
|
||||
The U.S. Government Department of Commerce, Bureau of Industry
|
||||
and Security (BIS), has classified this software as Export
|
||||
Commodity Control Number (ECCN) 5D002.C.1, which includes
|
||||
information security software using or performing cryptographic
|
||||
functions with asymmetric algorithms. The form and manner of
|
||||
this distribution makes it eligible for export under the License
|
||||
Exception ENC Technology Software Unrestricted (TSU) exception
|
||||
(see the BIS Export Administration Regulations, Section 740.13)
|
||||
for both object code and source code.
|
||||
|
||||
Gerrit includes an SSH daemon (Apache SSHD), to support authenticated
|
||||
uploads of changes directly from `git push` command line clients.
|
||||
|
||||
Gerrit includes an SSH client (JSch), to support authenticated
|
||||
replication of changes to remote systems, such as for automatic
|
||||
updates of mirror servers, or realtime backups.
|
||||
|
||||
For either feature to function, Gerrit requires the
|
||||
link:http://java.sun.com/javase/technologies/security/[Java Cryptography extensions]
|
||||
and/or the
|
||||
link:http://www.bouncycastle.org/java.html[Bouncy Castle Crypto API]
|
||||
to be installed by the end-user.
|
||||
|
||||
== Licenses
|
||||
""")
|
||||
|
||||
for n in used:
|
||||
libs = sorted(licenses[n])
|
||||
name = n[len('//lib:LICENSE-'):]
|
||||
if args.asciidoc:
|
||||
print()
|
||||
print('[[%s]]' % name.replace('.', '_'))
|
||||
print("=== " + name)
|
||||
print()
|
||||
else:
|
||||
print()
|
||||
print(name)
|
||||
print()
|
||||
print('----')
|
||||
for d in libs:
|
||||
if d.startswith('//lib:') or d.startswith('//lib/'):
|
||||
p = d[len('//lib:'):]
|
||||
else:
|
||||
p = d[d.index(':')+1:].lower()
|
||||
if '__' in p:
|
||||
p = p[:p.index('__')]
|
||||
print('* ' + p)
|
||||
if args.asciidoc:
|
||||
print()
|
||||
print('[[%s_license]]' % name.replace('.', '_'))
|
||||
print('----')
|
||||
with open(n[2:].replace(':', '/')) as fd:
|
||||
copyfileobj(fd, stdout)
|
||||
print()
|
||||
print('----')
|
||||
|
||||
if args.asciidoc:
|
||||
print("""
|
||||
GERRIT
|
||||
------
|
||||
Part of link:index.html[Gerrit Code Review]
|
||||
""")
|
||||
@@ -61,7 +61,6 @@
|
||||
== Developer
|
||||
. Getting Started
|
||||
.. link:dev-readme.html[Developer Setup]
|
||||
.. link:dev-buck.html[Building with Buck]
|
||||
.. link:dev-bazel.html[Building with Bazel]
|
||||
.. link:dev-eclipse.html[Eclipse Setup]
|
||||
.. link:dev-intellij.html[IntelliJ Setup]
|
||||
|
||||
@@ -596,7 +596,7 @@ The project-specific download commands must be configured in the
|
||||
+
|
||||
----
|
||||
[plugin "project-download-commands"]
|
||||
Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && buck build ${project}
|
||||
Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && bazel build ${project}
|
||||
Update = git fetch ${url} ${ref} && git checkout FETCH_HEAD && git submodule update
|
||||
----
|
||||
+
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
def genlicenses(
|
||||
name,
|
||||
out,
|
||||
opts = [],
|
||||
java_deps = [],
|
||||
non_java_deps = [],
|
||||
visibility = []):
|
||||
cmd = ['$(exe :gen_licenses)']
|
||||
cmd.extend(opts)
|
||||
cmd.append('>$OUT')
|
||||
cmd.extend(java_deps)
|
||||
cmd.extend(non_java_deps)
|
||||
|
||||
# Must use $(classpath) for Java deps, since transitive dependencies are not
|
||||
# first-order dependencies of the output jar, so changes would not cause
|
||||
# invalidation of the build cache key for the genrule.
|
||||
cmd.extend('; true $(classpath %s)' % d for d in java_deps)
|
||||
|
||||
# Must use $(location) for non-Java deps, since $(classpath) will fail with an
|
||||
# error. This is ok, because transitive dependencies are included in the
|
||||
# output artifacts for everything _except_ Java libraries.
|
||||
cmd.extend('; true $(location %s)' % d for d in non_java_deps)
|
||||
|
||||
genrule(
|
||||
name = name,
|
||||
out = out,
|
||||
cmd = ' '.join(cmd),
|
||||
visibility = visibility,
|
||||
)
|
||||
@@ -6,9 +6,9 @@ link:rest-api.html[REST API].
|
||||
|
||||
Please note that this feature is only usable with documentation built-in.
|
||||
You'll need to
|
||||
`buck build withdocs`
|
||||
`bazel build withdocs`
|
||||
or
|
||||
`buck build release`
|
||||
`bazel build release`
|
||||
to test this feature.
|
||||
|
||||
[[documentation-endpoints]]
|
||||
|
||||
Reference in New Issue
Block a user