153 Commits

Author SHA1 Message Date
Shawn Pearce
1691f61558 Merge "Buck: Add support for non transitive plugin dependencies" 2013-12-18 00:02:54 +00:00
David Pursehouse
9db23781da Use consistent test site locations in documentation and debug configs
The naming of the test site is inconsistent in the documentation.  Some
parts refer to `gerrit_testsite` while other parts, and the default
debug configurations, refer to `test_site`.

Update the documentation and debug configs to use `gerrit_testsite`.

Change-Id: I5b1fb5c9dcc6c9a39e7d95e88d4e0ea9df384b09
2013-12-17 19:36:24 +09:00
David Ostrovsky
1ef2557f6f Buck: Add support for non transitive plugin dependencies
In some cases it might be useful to be able to pass dependencies as non
transitive dependencies, that not included in final plugin binary.

Why? When plugin dependencies are needed in both bootstrap classpath and
in plugin then they must be put in $gerrit_path/lib dir. Having them in lib
and inside the plugin doesn't make much sense.

This change exposes compile_deps parameter to the gerrit_{plugin|extension}
methods. It is possible to create both versions of the plugin: with and without
dependencies.

  gerrit_plugin(
    name = 'javamelody',
    srcs = glob(['src/main/java/**/*.java']),
    resources = glob(['src/main/resources/**/*']),
    manifest_entries = [
      'Gerrit-PluginName: javamelody',
      'Gerrit-Module: com.googlesource.gerrit.plugins.javamelody.Module',
      'Gerrit-HttpModule: com.googlesource.gerrit.plugins.javamelody.HttpModule',
    ],
    deps = [
      '//plugins/javamelody/lib:javamelody',
      '//plugins/javamelody/lib:jrobin',
    ],
  )

  gerrit_plugin(
    name = 'javamelody-no-deps',
    srcs = glob(['src/main/java/**/*.java']),
    resources = glob(['src/main/resources/**/*']),
    manifest_entries = [
      'Gerrit-PluginName: javamelody',
      'Gerrit-Module: com.googlesource.gerrit.plugins.javamelody.Module',
      'Gerrit-HttpModule: com.googlesource.gerrit.plugins.javamelody.HttpModule',
    ],
    compile_deps = [
      '//plugins/javamelody/lib:javamelody',
      '//plugins/javamelody/lib:jrobin',
    ],
  )

Change-Id: Ia274dbeb18de8807f0ab1edf7144f12ff0d02d74
2013-12-09 23:56:37 +01:00
David Ostrovsky
a3f72e4bb8 Buck: fix api_install rule
Change-Id: I069b52004781b3b1a8d64514da3f2e4da8047816
2013-12-06 19:12:12 +01:00
David Pursehouse
28694a09c9 Merge branch 'stable-2.8'
* stable-2.8:
  Buck: add build for gerrit-plugin-gwtui
  Fix configuration for plugin and extension API artifact deployment

Conflicts:
	BUCK
	gerrit-plugin-gwtui/BUCK
	tools/maven/BUCK

Change-Id: I4267b0a6397823a00a11db268b02a50c4f79d4ed
2013-12-06 15:04:07 +09:00
David Ostrovsky
acc959d645 Buck: add build for gerrit-plugin-gwtui
This plugin module was left out during Buck migration.

  $>buck build api

produces now plugin-gwtui.jar and plugin-gwtui-src.jar.

Buck Maven bridge was enhanced to {install|deploy} the new artifact to
remote or local Maven repositories:

  $>buck build install_api

deployes

  gerrit-plugin-gwtui-2.9-SNAPSHOT-sources.jar
  gerrit-plugin-gwtui-2.9-SNAPSHOT.jar

to local Maven repository.

Change-Id: Idae18f6df2e67fe53d57b8c35caa4226333e269b
(cherry picked from commit c8cffc8e928a9277621ffff6cb740f79cd662195)
2013-12-05 17:20:26 +09:00
David Pursehouse
a92ba47ef1 Fix configuration for plugin and extension API artifact deployment
Add the necessary settings in the fake pom.xml file, and correct the URL
in the BUCK file to make deployment with gs-maven-wagon work.

Change-Id: I6d1f84c850c70f731d061d9e50a062d37c68baf2
2013-12-05 16:30:04 +09:00
Shawn Pearce
9e1c29b49f Merge changes I4b879eeb,If2a048df,Iac31374d,I31603a80
* changes:
  Don't put plugins into system classpath
  Isolate plugin class directories from each other
  Display UI build failures in browser
  Unify debug launch configs and auto-detect browser
2013-12-02 15:35:02 +00:00
Shawn Pearce
130afbd65e Don't put plugins into system classpath
Plugin code is often loaded into the workspace in Eclipse, and is
therefore part of the default project path. Detect this at startup
time by looking for gerrit.buck-out system property and building a
new classpath consisting only of the primary classes and JARs.

The GWT compiler, tests and plugins are excluded from the classpath,
preventing weird collisions with the dynamically loaded plugins from
$site_path/plugins.

PluginLoader recognizes the split output directory used by Eclipse and
loads the latest classes files ahead of anything from the JAR in
$site_path/plugins. This makes development of most code changes quick
by hiding the staleness of the installed JAR.

Change-Id: I4b879eebbcb332384c4e747d3f0c4b5c948c5fed
2013-11-30 15:34:54 -08:00
Shawn Pearce
9e4d5aa347 Isolate plugin class directories from each other
Configure Eclipse to compile/copy each plugin's classes and resources
into its own private classes folder.  This should fix the duplicate
resource warnings for about.md or other documentation and static image
assets.

Move test and utility classes into their own directories too. This
has no real impact on the runtime classpath at this time, but opens
the door to do something more creative later.

Change-Id: If2a048dfe0349f671a17f9e80d6f22a69a5c0ade
2013-11-30 13:17:18 -08:00
Shawn Pearce
3ed6b83ec2 Merge "Save GWT compile time by avoiding javac" 2013-11-30 19:24:38 +00:00
David Ostrovsky
acb9af332b Buck: Adjust to unflattened directory structure for python libraries
Since this Buck's commit 59759043f66de17140b423a7f11a2d8827b4cbbf the whole
unflattened subtree is used.

Change-Id: I4ec930a452d4867add3f5dd46430d3184c2a7277
2013-11-30 20:19:33 +01:00
Shawn Pearce
05cb053378 Save GWT compile time by avoiding javac
GWT only needs the rebind code for CSS and ServerLinker to be
precompiled as bytecode. Save build time by passing no source
files to the java_library() used by gwt_module().

For a full draft build of ui_safari this cuts the refresh time
down from 32.015s to 26.158s on my MacBook. Saving 6s on each
UI reload adds up during development.

The common annotations need to be provided as bytecode, avoiding
spurious warnings from GWT when there is a Java syntax error.

Change-Id: I37826498650c65c05303e7d4d1177d05781c56f6
2013-11-30 11:06:50 -08:00
Shawn Pearce
cda2121828 Unify debug launch configs and auto-detect browser
Use the same permutation selector applied by the server at runtime to
automatically detect the browser making the request and build/refresh
that UI permutation.

Change-Id: I31603a80e23a8e4e2c46325be4dac808d8f98a5c
2013-11-29 18:14:57 -08:00
Shawn Pearce
4e1a8bc63d Update Buck
Buck changed export_deps from a boolean to be exported_deps, a list of
dependencies that are to be added to deps and also exported.  This
allows libraries to have dependencies for implementation use only, but
not expose them to callers for linkage.

exported_deps aren't transparently transitive anymore.  This mostly
impacts the plugin-api:lib rule.

This is the first time Gerrit is using upstream Buck with no patches.

- Java memory settings for Buck can now be supplied in a project
  specific file using `.buckjavaargs` in the root directory.  The file
  replaces the `.buckrc` previously supported by Gerrit's fork.

- Temporary directories for java_application() invoked from genrule()
  is now supplied as part of the arguments using $TMP.  This removes
  one of the patches Gerrit had for Buck.

- Unit tests use the system temporary directory during testing.  This
  can be faster if the temporary directory is a tmpfs.  Unfortunately
  not all passing tests clean up after themselves, making it possible
  to exhaust system memory and swap with useless tmpfs contents.
  Using the system temporary directory for tests removes another patch
  Gerrit had on top of Buck.

Change-Id: I3a9fe4aab0a33a8673df727e618122027a742638
2013-11-29 10:50:59 -08:00
David Ostrovsky
a791cc4fdc Eclipse: Bump java source and target level to 7
Change-Id: I53aea923c09d80aeff16726bab736ab74976fcdf
2013-11-29 00:15:50 +01:00
David Ostrovsky
b4b30cb937 Buck: Bump java default source and target level to 7
Buck lacks a feature to set java source level and target level per project
base, i. e. in .buckconfig file under java section.

The only method that currently is supported and described in the
documentation is to pass custom levels to java_library and java_test methods.

That would work, but that approach would require to touch dozens of files.

Second approach could be to just patch system wide Buck with this patch[1].
However that is not really an option because in this case the increased
java source and target level applies on all projects and branches.
Particularly it is undesirable to build Gerrit 2.8 stable branch or other
projects that were migrated to Buck (e. g. JGit) with increased java source
and target level.

This change redefines the standard definitions of java_test() and
java_library() methods and increases the java source and target level in the
new defined functions. With the combination of "include = default.defs"
construct in .buildconfig file it is garanteed that all BUCK files first
"see" the redefined methods.

Disadvantage of the approach is that every time the original method
definitions are changed in upstream Buck (i. e. new paramters are introduced)
this patch must be changed too.

The best approach would be to extend Buck and enable definition of source and
target level per project base (in .buckconfig file).

[1] https://github.com/facebook/buck/pull/67

Change-Id: Ifaba1eb41e9ac2f033e704a75723f3595e1c1ee5
2013-11-28 23:34:05 +01:00
Bruce Zu
2d6c1e3a10 Fix build failure caused by missing 'gerrit-plugin-gwtui:client' target
In bb360ebe the target '//gerrit-plugin-gwtui:client' was renamed to
'//gerrit-plugin-gwtui:gwtui-api', but the 'tools/eclipse/BUCK' and
'tools/gwt-constants.defs' files were not updated to use it, thus
running 'tools/eclipse/project' failed with a "No such build target"
error.

Change-Id: I72307de9bac2484722b666ac0f5d0c0bb99b3906
2013-11-25 03:00:25 +00:00
Shawn Pearce
154d4181a8 Fix plugin references to moved :plugin-api
The plugin api moved into the gerrit-plugin-api package.
Change the reference created by gerrit_plugin() to match.

Change-Id: I390a22f512835847367ae2993a7a9bddf9d11b5c
2013-11-24 13:45:30 -08:00
David Ostrovsky
bb360ebe06 Buck: generate javadocs for plugin and extension API
buck build api

generates now javadocs.

  buck build api_install

installs all plugin/extension related artifacts with javadocs in the
local Maven repository.

Change-Id: Ifa6a8eb469f388e16449576ff2bff01a5dce67dd
2013-11-24 02:04:51 +01:00
Shawn Pearce
ebc0a5c51a Merge "Require Java 7" 2013-11-18 04:12:35 +00:00
Shawn Pearce
6d2762a554 Merge "Buck: Support plugin own Maven repositories" 2013-11-18 04:12:12 +00:00
David Ostrovsky
2536d06da0 Buck: Support plugin own Maven repositories
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
2013-11-18 01:12:09 +01:00
Shawn Pearce
10f09d3d52 Require Java 7
Jetty 9 was built with compiler settings producing class files that
are not recognized by Java 6 runtimes.

Gerrit 2.9 will require Java 7 as its minimum runtime version.

Change-Id: Ifed3f9e07bf77a7a737b16c20e6e400acd990649
2013-11-16 19:58:03 -08:00
David Ostrovsky
c53827816d Buck: Add support for gerrit GWT plugins
This changes extends gerrit_plugin function with additional gwt_module
parameters. When passed, GWT application is created. Assumtion is met,
that this application depends on gerrit-plugin-gwtui module.

With this change Gerrit GWT plugins can be build with Buck:

  MODULE = 'com.googlesource.gerrit.plugins.cookbook.HelloForm'

  gerrit_plugin(
    name = 'cookbook-plugin',
    srcs = glob(['src/main/java/**/*.java']),
    resources = glob(['src/main/**/*']),
    gwt_module = MODULE,
    manifest_entries = [
      'Gerrit-PluginName: cookbook',
      'Gerrit-Module: com.googlesource.gerrit.plugins.cookbook.Module',
      'Gerrit-HttpModule: com.googlesource.gerrit.plugins.cookbook.HttpModule',
      'Gerrit-SshModule: com.googlesource.gerrit.plugins.cookbook.SshModule',
    ]
  )

Change-Id: I4b131c7c2672675d99457651fcee63bf4f149c2f
2013-11-15 09:53:24 +01:00
David Ostrovsky
0dd4462e97 gerrit-plugin-gwtui: make the project visible to eclipse
Change-Id: I67e32e675294b34a43954b69090a1551293dbe80
2013-11-08 19:59:07 +01:00
David Ostrovsky
c8cffc8e92 Buck: add build for gerrit-plugin-gwtui
This plugin module was left out during Buck migration.

  $>buck build api

produces now plugin-gwtui.jar and plugin-gwtui-src.jar.

Buck Maven bridge was enhanced to {install|deploy} the new artifact to
remote or local Maven repositories:

  $>buck build install_api

deployes

  gerrit-plugin-gwtui-2.9-SNAPSHOT-sources.jar
  gerrit-plugin-gwtui-2.9-SNAPSHOT.jar

to local Maven repository.

Change-Id: Idae18f6df2e67fe53d57b8c35caa4226333e269b
2013-11-07 19:52:15 +01:00
David Ostrovsky
e6bc8b523b Add unit test for EditDeserializer
Change-Id: I42ebb8a5f085066cd4d8dbe8cc953d7fcb849eef
2013-11-05 14:19:06 -08:00
David Ostrovsky
2dbda45dee Buck: extend the tool chain to support unsigning JARs
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
2013-11-04 06:21:54 +01:00
David Pursehouse
8108a00038 Update jgit to 3.1.0.201310021548-r
Change-Id: Ib1526cd97353933dee1b76de33239cbcb31107b0
2013-11-04 05:45:30 +01:00
David Ostrovsky
6e0a3e5da8 Buck: extend the tool chain to support unsigning JARs
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
2013-10-28 21:30:53 +01:00
David Pursehouse
71a869fefe Update jgit to 3.1.0.201310021548-r
Change-Id: Ib1526cd97353933dee1b76de33239cbcb31107b0
2013-10-23 20:09:48 +02:00
Yuxuan 'fishy' Wang
ec4b06a6e2 REST endpoint for searching Gerrit documentation.
The documentation of this endpoint is available in
rest-api-docsearch[.txt|.html].

The UI of showing the search result and doing the search will be in a
separate change.

Change-Id: Ifa4f5a7d576ada7f88a4fa1b765a38cba6d7e964
2013-10-18 18:33:17 -07:00
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