google-java-format is not uniformly available in package management
systems across OSes. More importantly, we want to make sure that all
contributors are using a standardized version, to avoid unnecessary
changes due to slight differences between versions.
While we're in the dev documentation, link to the Google Java Style
Guide, and remove some wording that is clearly redundant with the style
guide.
Change-Id: Ib14dab2e692339f836083fad08a7a435a2f24470
Downloaded artifacts went directly into
~/.gerritcodereview/buck-cache
while artifacts built by BUCK went into the directory's `cache`
subdirectory:
~/.gerritcodereview/buck-cache/cache
. When just walking the file hierarchy on the command line, this
`cache` sub-directory is hardly visible, due to all the downloaded
artifacts. To increase visibility, we change to
* ~/.gerritcodereview/buck-cache/downloaded-artifacts
(for downloaded artifacts)
* ~/.gerritcodereview/buck-cache/locally-built-artifacts
(for artifacts built by buck locally)
That way `~/.gerritcodereview/buck-cache` (instead of one directory
and 100s files) now only contains two directories.
Change-Id: I7327ff6c1736f9af8ea15450949dc6a4bc10b684
Use the canonical syntax to specify the python executable to use.
Avoids a fatal error if /usr/bin/python is a too old version (< 2.7).
Change-Id: I3e8affb52be993d35c0dcf90774d962a59ef5635
SSL connections done by Curl will be attempted to be made secure by
using the CA certificated bundle but when the connection can be
established but not secured, Curl will not fail.
Change-Id: Id2fb1e3b65aed3e3334b2db302d028181ebd1e81
The check_output method is only available from Python 2.7, so a wrapper
method was introduced for compatibility with 2.6.
The ZipFile class does not include context manager support in Python
2.6, so the file download code was written to explicitly open and close
the zip files.
Since Buck itself now requires at least Python 2.7, these workarounds
are no longer necessary. Remove them.
Also, tidy up a few minor PEP-8 coding style violations in the modified
files.
Change-Id: I9a1b25ddf7494e25ccadeaed0c1d85cd1ce2fd09
On Arch Linux using Python 2.7.6 with a recent clone of buck,
I got the following error:
Traceback (most recent call last):
File "gerrit/tools/download_file.py", line 100, in <module>
cache_ent = cache_entry(args)
File "gerrit/tools/download_file.py", line 80, in cache_entry
h = sha1(args.u).hexdigest()
TypeError: Unicode-objects must be encoded before hashing
Change-Id: I7a638b56a14cf579ba57f2a5c17df62cf3fbf266
Currently only predefined Maven repositories are supported by Buck maven_jar.
Additional logic exists to redirect to a local repository mirror.
Current implementation relies on the repository name matching between repo
passed to maven_jar and redirect definition defined in local.properties that
is not under Git control.
This change extends that by allowing to pass not only the repo name but the
complete URL to maven_jar. The augmented implementation checks if it is a
known Maven repository: if it is, then the behavious is unchanged, if not,
then the passed URL is used.
As result plugin's can use custom Maven repositories:
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,
)
Plugin owned Maven repositories can also be rewritten in local.properties.
To achieve that custom repository name must be passed to the maven_jar()
function, like known repositories, and the URL must be defined in
local.properties.
local.properties excerpt:
download.GERRIT_FORGE = http://my.company.mirror/gerrit-forge
BUCK excerpt:
GERRIT_FORGE = 'GERRIT_FORGE:'
maven_jar(
name = 'gitblit',
id = 'com.gitblit:gitblit:1.4.0',
sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa',
license = 'Apache2.0',
repository = GERRIT_FORGE,
)
Python unit test can be executed with other Java unit tests:
buck test tools:python_tests
Change-Id: Ib31d51f0884b1ca1a07b6492f861f404db115946
After switching to Eclipse Maven repository for pulling JGit lib, we
have the problem that according to Eclipse release train the JARs have
to be signed. That collids with our jgit patch for diff deserialization.
To rectify that, add `unsign` parameter to maven_jar() function.
Change-Id: Ib7bfa5d16f980a64b887d61a4b4ec325e6ffb0a1
This change fixes the following problems:
* MAVEN_LOCAL definition must be prefixed with 'file://' for curl to work
* src_sha1 was unnecessary required to define source artifact
* update the documentation that sha1 must not be provided
Change-Id: I1cee6588897c928f01bac5cc9fb252251f4f8027
Standardize the definition of MAVEN_LOCAL as ~/.m2/repository.
This makes it slightly easier to point to a custom build of a
dependency such as gwtorm or PrologCafe by installing the JAR to
the local Maven repository and updating the maven_jar() rule to
use repository = MAVEN_LOCAL instead of GERRIT.
Change-Id: I2e54d1039608c0195a992dbc12fe74bb513466c6
shutil.copyfile can raise shutil.Error and IOError. Catch these and
exit with error status after logging the error to the console.
Change-Id: I63b8caa371cc7034bbb3f19d0bd3fdd0446af2bf
If extracting files fails, it prints the error message but then
continues.
Make it exit with error status in this case.
Change-Id: I19fafda68a85b46300a1abaf6a86567cf1f712b0
download_file caches original zips in ~/.gerritcodereview/buck-cache.
If this is a different filesystem than $(pwd)/buck-out a symlink
was used to connect the build file with the original archive. This
confuses Buck when creating the $SRCDIR for a genrule().
If a hardlink does not work, copy the file.
Change-Id: If66c59fb6aecc93b5a3e85cdd76ef880538875ff
Per [1] the correct URL is <bucket>.storage.googleapis.com/<object>.
Update existing references to project resources to use this domain
name instead of the old name.
[1] https://developers.google.com/storage/docs/reference-uris
Change-Id: I3788cfb4504b3908d2b5eccbdf52beffc3d18387
If buck build was done on a system without curl installed
a misleading error message would be printed out:
error creating directory /home/user/.gerritcodereview/buck-cache
However, the real error was that invocation of curl failed. Since
it was an OSError it was handled with the wrong except block.
Separate handling of the OSError for the folder creation and curl
invocation.
Change-Id: Ic7e7c2c2704ea4cbccff4689dffe17a436108395
If the SHA-1 does not match the downloaded file content, delete the
file from the cache. This allows a user to fix whatever connectivity
problem led to the corruption and re-run buck build to download
the correct content.
Change-Id: I2f72fb2b187675ec9d5cda650d8982bc93a00189
This is a generic downloader that can be used for other
dependencies, like ZIP files containing JS.
Change-Id: I643f81fc06d790cebaa0eb677fa232ba0c652053