This reverts commit 5db3bba3e2d85662bacedc5d2f215fff7d8d2805.
I was too fast to submit 5db3bba. Besides forgetting to submit the
referenced changes in some submodules some people reported issues
with the interception of the javax.inject.Inject in some JEE containers.
Change-Id: I931ad329d2e7be6f6ce804b8395489a021c8240b
The Guice team is discouraging use of its specific annotation where
possible, to increase JSR330 compliance.
Leave optional injection alone for now, which needs to be manually
replaced with OptionalBinder.
Change-Id: I4f53a518ba6f36fd67af12f3540dc44cbad07ff8
This was an accident; I had the wrong thing selected in Eclipse when I
pressed Ctrl-Shift-O. It was surprisingly fast and the delta is
surprisingly small so I figured I'd submit it.
Change-Id: I7069f47509c981b59c84755a5aed7945c7f0c9fc
Add -l option to magic branch to pass approvals through git push.
One use case is to support Work In Progress (WIP) Workflow backed by
WIP label. In this scenario new label is introduced with (-1,0) range
to mark a change as WIP. This change allows to optionally mark a new
patch set as WIP through `git push`.
With configuration of push macro in .git/config:
git config remote.wip.url ssh://review.example.com:29418/project
git config remote.wip.push HEAD:refs/for/master%l=wip-1
WIP patch set can be uploaded with:
git push wip
Another use case is to do %l=Verified+1 if a change was compiled and
tested locally, e.g.:
git config alias r '! buck build gerrit && buck test --all && \\
git push gerrit-review HEAD:refs/for/master%l=Verified+1'
Then all these can be done in one step - compile, run tests and push to
review:
git r
Change-Id: I52a67993952f32f8a04d9c0226f1c456a6f522b4
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
New version has features which be useful for Gerrit core and plugins:
* new hidden attribute, specifying to hide it in help message
* new depends attribute, specifying the dependent option(s)
* multiValued attribute was removed
Change-Id: Ic7e9f37231cb83940db50fe3b9efe8ad972108cf
In d6ccccf96a238 Sasa Zivkov explained OSGI runtimes do not accept the
javax.annotation.* package to be provided by the application, as part
of the package is already included with the JRE.
Now that Gerrit has its own version of the @Nullable annotation, drop
the jsr305 library dependency.
Change-Id: I253fd74af7a73c5d5bc4a0b35755cc449957e0f2
When deploying Gerrit in an osgi container we see an issue where the
javax.annotation.Nullable annotation is not available at runtime.
As a consequence Guice injection throws an error if a (Nullable)
parameter is null.
A research on that topic reveals that this is caused by the Split
Package issue in osgi [1]. The javax.annotation.* package is split
as one part of it comes from JRE and another one from the jsr305
packaged in gerrit.war.
Since guice supports usage of any Nullable annotation type whose simple
name is "Nullable" [2], we can use own Nullable annotation type.
[1] http://wiki.osgi.org/wiki/Split_Packages
[2] https://code.google.com/p/google-guice/source/browse/core/src/com/google/inject/internal/Nullability.java
Change-Id: I63b27be6d695e73fd92940e42169d09f751d7274
Guice 4.0-beta leaked the maven metadata files for Guava when it was
repacked to a private namespace. This confuses Buck when creating a
combined JAR that has both Guice and Guava.
Guice also leaked the source files for javax.annotation into its
binary JAR files. Buck sometimes finds and extracts these source
files at compile time, creating duplicate versions of the classes.
Change-Id: Iea0a3394530abd8b0853d016b7cb2f5182f82a96
Guice does not like to pass an Injector as part of an @Assisted
invocation of an object. More recent versions of Guice are logging
a warning advising a performance boost of ~6500% is possible if
the class stops accepting Injector in the constructor and instead
uses a more concrete type.
In this case Guice was very correct about the code being slow.
Every option declared required a linear scan through the entire
Injector stack looking for any candidate binding that might match
the OptionHandlerFactory signature. This scan ran on each request,
which is incredibly slow.
Build the map once in the injector and retain as a singleton.
Change-Id: Ib620e7bf1e24241bd373d2cb55c89c3fe3284645
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
The metaVar used in @Option annotations was not being respected.
Use this value before asking the handler for its default value.
Change-Id: If0193983b9ebbb646ac325f28fefcb667b4f5bec
Implement a new build system using Buck[1], Facebook's
open source clone of Google's internal build system.
Pros:
- Concise build language
- Test and build output is concise
- Test failures and stack traces show on terminal
- Reliable incrementals; clean is unnecessary
- Extensible with simple blocks of Python
- Fast
buck: clean: 0.452s, full 1m21.083s [*], no-op: 7.145s,
mvn: clean: 4.596s, full 2m53.776s, no-op: 59.108s,
[*] full build includes downloading all dependencies,
time can vary due to remote server performance.
Cons:
- No Windows support
- No native Maven Central support (added by macros)
- No native GWT, Prolog, or WAR support (added by macros)
- Bootstrap of buck requires Ant
Getting started:
git clone https://gerrit.googlesource.com/buck
cd buck
ant
Mac OS X:
PATH="`pwd`/bin:/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands:$PATH"
Linux:
PATH="`pwd`/bin:$PATH"
Importing into Eclipse:
$ time buck build :eclipse
0m48.949s
Import existing project from `pwd`
Import 'gerrit' (do not import other Maven based projects)
Expand 'gerrit'
Right click 'buck-out' > Properties
Under Attributes check 'Derived'
If the code doesn't currently compile but an updated classpath
is needed, refresh the configs and obtain missing JARs:
$ buck build :eclipse_project :download
Running JUnit tests:
$ time buck test --all -e slow # skip slow tests
0m19.320s
$ time buck test --all # includes acceptance tests
5m17.517s
Building WAR:
$ buck build :gerrit
$ java -jar buck-out/gen/gerrit.war
Building release:
$ buck test --all && buck build :api :release
$ java -jar buck-out/gen/release.war
$ ls -lh buck-out/gen/{extension,plugin}-api.jar
Downloading dependencies:
Dependencies are normally downloaded automatically, but Buck can
inspect its graph and download missing dependencies so future
compiles can run without the network:
$ buck build :download
[1] http://facebook.github.io/buck/
Change-Id: I40853b108bd8e153cefa0896a5280a9a5ff81655
Git doesn't want to modify the network protocol to support passing
data from the git push client to the server. Work around this by
embedding option data into a new style of reference specification:
refs/for/master%r=alice,cc=bob,cc=charlie,topic=options
is now parsed by the server as:
- set topic to "options"
- CC charlie and bob
- add reviewer alice
- for branch refs/heads/master
If % is used the "extra information" after the branch name is
parsed as options with args4j. Each option is delimited by ",".
Selecting publish vs. draft should be done with options draft or
publish, appearing anywhere in the refspec after the % marker:
refs/for/master%draft
refs/for/master%draft,r=alice
refs/for/master%r=alice,draft
refs/for/master%r=alice,publish
Change-Id: I895bd1218c2099b5b45cac943039bbd12565370c
All existing JSON APIs are converted to this new style.
/changes/{id} parses the id field from a JSON response from a prior
response and uses that to uniquely identify a change and verify the
caller can see it. If the user requests only /changes/{id}/ then the
data is returned as a single JSON object.
This commit also gives full remote control of plugins using the
/plugins/ namespace:
PUT /plugins/{name} (JAR as request body)
POST /plugins/{name} (JSON object {url:"https://..."})
DELETE /plugins/{name}
GET /plugins/{name}/gerrit~status
POST /plugins/{name}/gerrit~reload
POST /plugins/{name}/gerrit~enable
POST /plugins/{name}/gerrit~disable
The commit provides some project admin commands:
GET /projects/{name}/description
PUT /projects/{name}/description
GET /projects/{name}/parent
PUT /projects/{name}/parent
Project dashboards have moved:
GET /projects/{name}/dashboards
GET /projects/{name}/dashboards/{id}
GET /projects/{name}/dashboards/default
To access project names containing /, the name must be encoded with
URL encoding, translating / to %2F.
Change-Id: I6a38902ee473003ec637758b7c911f926a2e948a
The RestApiServlet wasn't able to handle command-line parsers which
included required arguments. These can now be specified by passing
a Set of which param names to look for and treat as arguments.
Change-Id: Ia1400c7decbb896f038ab016c063e9ee6e5991d9
Signed-off-by: Brad Larson <bklarson@gmail.com>
Eclipse overwrites these files when we import projects using m2e.
Eclipse 3 writes a timestamp at the top of these files making the Git
working tree dirty. Eclipse 4 (Juno) still overwrites these files but
doesn't write the timestamp. This should help keeping the working tree
clean. However, since the timestamp is currently present in these
files, Eclispe 4 would still make them dirty by overwriting and
effectively removing the timestamp.
This change removes the timestamp from these files. This help those
using Eclipse 4 and doesn't make it worse for those still using Eclispe
3.
Change-Id: Ic23299a12ac80f7294bcc602c8565889069a0d10
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* changes:
REST API /projects/$SUGGEST
REST API /projects/
REST API /accounts/self/capabilities
Define a native REST API client
/projects/: Support JSON output format
Make ls-projects available on HTTP as GET /projects/
Support alias "self" in queries
Update GWT to 2.4.0
Update Gson to 2.1
The query string takes the same arguments as the command line tool,
so `ls-projects --type CODE --show-branch foo` can be written out as
`GET /projects/?type=CODE&show-branch=foo`. Output is identical.
Using /projects/ is anonymous and does not require authentication.
/a/projects/ requires HTTP authentication using the same scheme
that is applied to Git operations over HTTP, typically using the
HTTP password that is generated for a user or SSL certificate auth.
Change-Id: I577ae60eba40cfb358fe41ed8f3cf9481662e738
The 2.3 was released and what we have in the master branch
is targeted for 2.4.
Change-Id: Idca8a12aaef1dc5ea5f628b3640881e66f04dc9c
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Given a map of String to String[], like to what an HttpServletRequest
makes available from the query string, feed the values into the parser
and update the bean with the parsed state.
This makes parsing from a query string rather trivial.
Change-Id: I41829d35e59594770c1b6512c241b92182a03afe
Make the handling of --help common across all uses of CmdLineParser.
This will eventually make it easier to support more complex parsing
cases that need to span objects.
Change-Id: I38b153035cfc5cce80ca631be66c8b4d4683590d
Refactored the GWT client code to include only what the gerrit GWT
client. The gerrit GWT build was giving build warnings since the
getAsync() signature and implementation used types that were
not available to GWT.
Split the reviewdb into a client and server package.
Organized the imports to ease the migration.
Change-Id: I6cd6125eddcb1dd2b5c5e353edf163544248026b
Use the new FactoryModuleBuilder everywhere, instead of FactoryProvider.
Updated the OptionHandlers to be generic, instead of ignoring the type
parameter.
Removed the GuiceHelper and refactored the HttpLog implementation to
depend on a request attribute for passing the current user.
Change-Id: Ic7d94118c7ab6c46fa784b88acefd7434bb58a44
I meant to keep reusing the 2.1 version number for the entire
2.1 series during development, but botched it during the 2.1.4
development cycle and set it to 2.1.4-SNAPSHOT by mistake. Put
it back to 2.1-SNAPSHOT since 2.1.4 is released.
Change-Id: I37e206c0609bf3fd94a5aab8ea301c98b7fb013e
Signed-off-by: Shawn O. Pearce <sop@google.com>
Using -- as a way to break the option parser and start doing
argument parsing is very common. Teach all of our commands
to work that way.
Change-Id: Iaeb1be2ee443fce7f09a9eff6dd7270e1ba91509
Signed-off-by: Shawn O. Pearce <sop@google.com>
We've changed so much since the 2.0.24 release that I'm really not
comfortable calling it 2.0.25.
Change-Id: I9cf28b0a97e0f74838bf893b79ce3105e0a7bfdb
Signed-off-by: Shawn O. Pearce <sop@google.com>