270 Commits

Author SHA1 Message Date
Shawn Pearce
55583ac43e Update buck
$TMP, $DEPS, $SRCS, $OUT are no longer supplied by Buck in the
environment unless they appear in the command line.  Pass $TMP
where it was assumed to be magically supplied. This allows steps
to continue to use buck-out/gen/ for temporary storage instead of
polluting the system /tmp.

Change-Id: Iea8380e5f93fa16ec77457eb76404832bde93a39
2013-10-18 17:06:56 +00:00
David Pursehouse
7a16e859a4 Handle KeyboardInterrupt in Buck build wrapper scripts
Pressing Ctrl-C during the build results in an ugly Python
TraceBack.

Add handling of KeyboardInterrupt and print a useful message.

This fixes most cases, but there are still a few TraceBacks
coming from inside Buck.  These will need to be fixed upstream.

Change-Id: I3f0dc19f3be599460a2a6409642a70a195b50753
2013-10-18 15:10:25 +09:00
Shawn Pearce
b899eff7f3 Include lib/asciidoctor/java in the Eclipse classpath
Having these in the classpath permits the sources to be modified
in Eclipse just like any other Java source file.

Change-Id: I6256f5db793dd056a61e934720cb40056d50cfd0
2013-10-07 17:15:26 -07:00
David Pursehouse
6c25ea8fdd Fix a few coding style nits in Buck build Python scripts
- Prefix regex strings with `r`
- Remove unused imports
- Rename variables and parameters to avoid redefinition of
  built-in types `dir` and `type`

Change-Id: Ia21667b89631c751f241dd6499a2e460e3435697
2013-09-26 16:50:07 +09:00
Shawn Pearce
0672a19c54 Create buck.properties during tools/eclipse/project.py
Change-Id: I7fdccee7d08e2177a5bb4a4ecbcf17be9d4ada39
2013-09-24 12:27:31 -07:00
Shawn Pearce
a7a3ee1e3a Update Buck to latest master
genrule() no longer supports running commands run only for the
side-effect with no output file. Actions like download_sources or
eclipse need to be handled using Python scripts executed from the
user's shell, otherwise Buck fails if caching is enabled.

Change-Id: I361fc20675f211e15e4ab7942ef52778d0a615c2
2013-09-20 19:41:26 -07:00
Martin Fick
13aeac24b6 Add a bulk query suite tester
This query suite tester allows queries to be stored in
files to easily be executed in bulk.  The output of the
queries are stored for easy analysis.

Change-Id: Ibcfb395ec0fdfb2c46ed2cc02032cc4eb7395a43
2013-09-19 18:29:07 +00:00
Yuxuan 'fishy' Wang
e6cbae9ef6 Remove asciidoc.conf
Asciidoctor doesn't support the conf file, so we remove it, do the macro
replacing ourselves, and put all the attributes into the command line
parameters.

Change-Id: I21b49e5a2d75ff0f9b52f26fccaae42fcbaa0837
2013-09-04 21:31:03 -07:00
Shawn Pearce
5314a0ed02 tools/maven/mvn: Fix error message if mvn is not found
The correct reference to the action name is args.a.  action is an old
variable that was replaced by args.a and this reference was missed.

Bug: issue 2086
Change-Id: Ibfbf523db8a8adfbf72f31de3ddc7b0ec96014eb
2013-08-26 08:28:09 -07:00
David Ostrovsky
56fe1f8dc3 BUCK: fix build against unpublished JARs
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
2013-08-16 16:26:59 +00:00
Shawn Pearce
71ab2f0f63 Simplify buck build eclipse by removing $OUT and $DEPS
It does not appear to be necessary to include either $OUT or $DEPS
in the command line when building the project and classpath files
for Eclipse. Omit these as $DEPS is starting to be deprecated by
Buck and will eventually disappear.

Change-Id: I40f9a357dfa8114efaf0212bd1ff4cb51197b67f
2013-08-14 16:25:58 -07:00
Shawn Pearce
abb43dd89f Delete deprecated maven_deploy, maven_install rules
These have been replaced by //tools/maven.

Change-Id: Ia3710b90d29222ea6344a8fbbd4c407b6f9c9731
2013-08-14 16:12:55 -07:00
Shawn Pearce
e585fc0449 Define MAVEN_LOCAL for unpublished Maven JARs
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
2013-08-14 15:40:35 -07:00
David Pursehouse
e277fc3f74 download_file: Catch exceptions raised from shutil.copyfile
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
2013-08-08 10:50:20 +09:00
David Pursehouse
8ea0650c8c download_file: Exit with error if extracting files from zip fails
If extracting files fails, it prints the error message but then
continues.

Make it exit with error status in this case.

Change-Id: I19fafda68a85b46300a1abaf6a86567cf1f712b0
2013-08-08 10:48:51 +09:00
Shawn Pearce
f98b3798a6 Support build where ~/ and $(pwd) are different filesystems
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
2013-08-06 12:20:30 -07:00
Shawn Pearce
5047911dba Rename DEFS files to *.defs
The build system used mixed names for essentially the same things.
Rename all DEFS files to *.defs matching the handful of other files
that are already using this convention.

Change-Id: I3269bd5db5d8d83f5e192ea910f19431c2a4a1cf
2013-07-30 17:18:33 +00:00
Shawn Pearce
e31a767d39 Move download and download_sources to //tools
These are already named using the alias in the .buckconfig.  Moving
them down to tools allows their program to drop a visbility rule, and
shortens the top level file a bit.

Change-Id: I4193249c02850cb7aca3bf7fab81113c5f7b7d8b
2013-07-30 17:15:59 +00:00
Shawn Pearce
064978650b Move Maven support to //tools/maven
Rewrite the Maven tool to accept a spec of things to process on the
command line and use $(location) in the invoking genrule() to locate
the necessary files from Buck.  This gets rid of special cases in the
mvn wrapper tool and allows the definition to be given completely from
Buck as part of the build description.

Maven needs to be single threaded to perform repository updates safely
so only one genrule() target is declared to buck for the deploy or
install action. The rule is given all artifact information in a single
pass, allowing the mvn.py wrapper to execute them.

Change-Id: Idbcf645b69280420987a0e8f52947ba93ac9e6f0
2013-07-29 17:30:58 -07:00
Shawn Pearce
3765bb8add Cleanup maven_deploy, maven_install build rules
Use GERRIT_VERSION rather than GERRIT_VER.  VER is not a commonly used
term to name the version string of a software product; VERSION is.

Make the maven_deploy and maven_install rules a little more typical
by passing in the target name separate from the action.

Change-Id: I13a5d94cf5b078cfcb91c69177cadfc2953db33e
2013-07-29 14:05:26 -07:00
Shawn Pearce
1e6c3639f7 Move version.jar to gerrit-war
This saves about 70ms when running targets like
//gerrit-gwtui:ui_chrome that reference a JAR in
gerrit-common but do not need the Version file.

Change-Id: Iab7377f3c5e1ce82cc3dc3ddcb3b1e4f9f12a8b7
2013-07-29 13:54:38 -07:00
Shawn Pearce
b46c76ea89 Split acceptance tests into one target per test
Buck runs tests in parallel based on the targets declared in BUCK
files.  Making each test its own target allows the tests to run in
parallel in separate JVMs.  Parallel execution enables slow acceptance
tests to take less wall clock time when multiple cores are available.

Acceptance tests leak an entire server environment for every @Test
method run.  Fragmenting the tests into units allows them to be
garbage collected by the operating system when the test JVM dies.
This avoids stressing the Java GC with lots of garbage as more tests
pile into the finite heap space.

With this change and the newer version of buck, a clean build and
execution of all tests takes my laptop only 1m25s to execute when
running on battery.

Change-Id: Ia3f689a9e6ca6c620026cc720ccca924387e1363
2013-07-27 11:34:23 -07:00
Shawn Pearce
11d27c8ee8 Update Buck
Latest version of buck is faster than the prior version used by
Gerrit.  No-op updates when loading a debug version of the UI now take
only 1.804s on my laptop (previously 7s) and a draft UI compile is
only 24.659s (previously 39s).

The slow acceptance tests must now be excluded with `--exclude slow`.
Buck changed the meaning of the -e option to be --emulator, which is
unfortunately useful only for Android application developers.

genrule() now needs to use $(exe) to reference the binary to run,
offers $(location) to make it easier to find files in the build tree.

The empty srcs array is no longer required for genrule().  Buck has
determined it is sufficiently powerful with $(location) and deps that
requiring srcs is unnecessary.

Supporting .src.zip files in the srcs array of java_library() means
Gerrit no longer needs to run a separate genrule() to extract files
produced by ANTLR, or call javac inside of the BuckPrologCompiler
support glue.

Change-Id: Ib03042921a081b867a7aad0423bd45523e42917a
2013-07-26 18:11:51 -07:00
Shawn Pearce
0479e0f971 Merge branch 'stable-2.7'
* stable-2.7:
  Update JGit to patch security hole during clone
  Switch to gs-maven-wagon for API deployment

Conflicts:
	pom.xml

Change-Id: Id851a01ea2e89c0a19c4fadd6328231f8374c8c8
2013-06-22 17:41:35 -07:00
Shawn Pearce
b5bc06d885 Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
  Switch to gs-maven-wagon for API deployment
2013-06-22 17:17:27 -07:00
Shawn Pearce
d500500b5e Update URLs for Google Cloud Storage
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
2013-06-21 11:01:45 -07:00
Shawn Pearce
c609188f9d Switch to gs-maven-wagon for API deployment
Change-Id: I0a920ea71dcc886a263dc24fa8cc2ac19f3bbb99
2013-06-21 10:52:08 -07:00
Shawn Pearce
fb58a8cd87 Fix eclipse classpath to include GWT unit test deps
Change-Id: Ia8fe603e40a94be29962ee27c3f073f80958f392
2013-06-14 14:17:23 -07:00
Sasa Zivkov
4709fff0f3 Better error reporting when curl is not installed
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
2013-06-13 17:41:19 +02:00
Shawn Pearce
cd9b933274 Merge "Extend gerrit_plugin() with manifest_entries" 2013-06-03 12:16:43 +00:00
David Ostrovsky
1f5813e89e Extend gerrit_plugin() with manifest_entries
Change-Id: I7648972696e2e27ef7da0a9b9f0b01a3e61810a7
2013-06-01 11:05:26 +02:00
David Ostrovsky
6e6a967004 BUCK: deploy plugin api to local and remote maven repos
`buck build api_install` copies the artifacts to the local maven repository.

`buck build api_deploy` uploads the artifacts to the remote maven repository.
The type of the repo is induced from the Gerrit version name, i. e.
* 2.8-SNAPSHOT: snapshot repo
* 2.8: release repo

Change-Id: I063834bb39311a4d92f5fdbb183f70b1fb8418b6
2013-05-31 19:54:23 +02:00
David Ostrovsky
72623a1a3e Refactor check_output out of pack_war
Change-Id: I3128564ad2bda92eb9a041c398aad9abddbd9740
2013-05-30 21:47:34 +00:00
Shawn Pearce
7d1adf840b Merge "Fix genantlr() to support buck caching" 2013-05-30 21:29:02 +00:00
Shawn Pearce
217613bd26 Merge "Make source JARs for {extension,plugin}-api targets" 2013-05-30 21:28:45 +00:00
David Ostrovsky
df36b6a972 Make source JARs for {extension,plugin}-api targets
BUCK is currently lacking native support for source jar generation.
Generate sources JARs for the API manually, until BUCK supports it.

Change-Id: I64fda0fdd82ca3ca37ac46d74e9550b2d9dddb39
2013-05-30 14:27:59 -07:00
Shawn Pearce
9e4e243cfd Fix genantlr() to support buck caching
genrule() can only produce one output. This is critical to the way
buck caching works for build results. The solution I learned from
the Buck team is to have the genrule() produce a ZIP file containing
all of the outputs, and use a unique genrule() to extract each
output from the ZIP.

Developers can now opt-into the buck cache by writing a local
config file:

  cat >.buckconfig.local <<EOF
  [cache]
    mode = dir
    dir = buck-cache
  EOF

This can be very useful when switching commits around with GWT UI
code. If the UI code does not modify between commits there is no
rebuild time. If UI code does modify, rebuild time is reduced to
0 when switching back to a prior version you had previously built.

The cache needs local disk, so its not enabled by default.

Change-Id: If8f79637004fbc13ea37c419e5c9bb582a489ab5
2013-05-30 14:12:07 -07:00
Shawn Pearce
3b4ca73c2c Fix download and download_sources to aggressively get all targets
Run any target that depends on download_file, no matter what its
name is. This allows grabbing codemirror without confusing the
__download_bin case with assuming a __download_src target exists.

Change-Id: Iaf7cc3000164aa46376314f8d24dc1f057ab06c3
2013-05-23 10:45:51 -07:00
Shawn Pearce
eb2eeec491 Delete corrupt cache entries from ~/.gerritcodereview/buck-cache
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
2013-05-22 17:54:32 -07:00
David Ostrovsky
dcee57212f Delete Maven based build
The Maven build does not work since the introduction of CodeMirror.
Remove the build until to prevent people from trying to use a broken
build process.  If buck is rejected this commit will be reverted, and
we will attempt to fix the Maven build to include CodeMirror.  If buck
is accepted, we just saved time by avoiding a messy Maven change.

Change-Id: I147d8d1741d52f59de1d2ddce8e5e82583990c14
2013-05-21 20:28:56 -07:00
Shawn Pearce
8713eb859e Rename download_jar to download_file
This is a generic downloader that can be used for other
dependencies, like ZIP files containing JS.

Change-Id: I643f81fc06d790cebaa0eb677fa232ba0c652053
2013-05-20 11:25:59 -07:00
Shawn Pearce
78734edfce Merge "Embed clippy.swf with a GWT DataResource" 2013-05-20 18:21:49 +00:00
Shawn Pearce
a8eec02ca1 Embed clippy.swf with a GWT DataResource
Using a DataResource allows the GWT compiler to manage inserting the
binary into the application context.  This works in all run modes,
making the clippy movie always available, even in GWT hosted debug.

Change-Id: I02869d65d9787265ebe40046e0dbf883fd7ea9e1
2013-05-20 11:21:30 -07:00
Shawn Pearce
279e07de52 Move //lib/DEFS to //tools/DEFS
The macro rules this file defines have nothing to do with the
third-party dependency libraries, but instead are global definitions
used throughout the Gerrit build process. Most build tools are
hidden under //tools, so move these definitions to that directory.

Change-Id: I5e95d7cef734228ca818428a266afc0ac9fa0385
2013-05-18 14:10:44 -07:00
David Pursehouse
45286f196a Cache downloaded JAR files in ~/.gerritcodereview/buck-cache
Instead of caching downloaded files in `./buck-cache` in the
working folder, cache them in `.gerritcodereview/buck-cache` in
the user's home folder.

This offers two advantages:

- Cached files are not lost if the working folder is removed, or
  untracked files are removed with `git clean`.

- The same cached files can be shared between multiple working
  folders, i.e. if the developer has separate workspaces to work
  on different target branches.

Change-Id: I3e132df85c43431c2454421b1de0d9e901679540
2013-05-17 13:52:19 +09:00
David Pursehouse
94a928b9a9 Use rstrip/lstrip to remove trailing/leading slashes
Change-Id: I572fbaaae5ab23909f4daa54f0ea7d56d5b78263
2013-05-16 09:01:21 -07:00
David Pursehouse
14f9aa65f9 Handle CalledProcessError when removing files from downloaded zip file
Instead of exiting with a python stack trace, catch the error and
print a formatted error message, then exit with error code.

Change-Id: I5935ed46e71cdba4e28c06291a9f009e83f20536
2013-05-16 15:59:55 +00:00
David Pursehouse
9d9d68f2bb Separate error handling for curl error and mkdirs error
If creating the cache directory fails, it is reported as a failure
to run curl.

Separate the error handling and print an appropriate error message.

At the same time, remove redundant calls to `str()` when printing
error messages.

Change-Id: Id6f2c76b16b3101f800cc194a5cb0c2875c4414a
2013-05-16 15:59:13 +00:00
David Pursehouse
6fb2c4d8e0 Allow local.properties to be placed in ~/.gerritcodereview
The local.properties file must currently be placed in the root of the
gerrit project.  If the project is removed or untracked files are
removed, the settings are lost.

Add support for keeping the file in the `.gerritcodereview` folder in
the user's home folder.

If the file exists in both the gerrit root and `~/.gerritcodereview`,
the one in the root takes precedence.

Change-Id: I815637cf47e84d29c33afa8aafa562d6915f5326
2013-05-16 08:58:16 -07:00
Shawn Pearce
60bdd68aa5 Merge "Fix download target to only download binary JARs" 2013-05-14 15:25:43 +00:00