Move Eclipse related stuff into tools/eclipse

Try to reduce the size of the top-level BUCK file by moving
anything that has to do with Eclipse project generation and
classpath management into tools/eclipse.

Change-Id: Id779eaff4fe732908b28a8e3441004e364b59e21
This commit is contained in:
Shawn Pearce 2013-05-10 12:38:49 -07:00
parent 6796c3f36b
commit 82e66ee4e5
21 changed files with 100 additions and 89 deletions

View File

@ -2,7 +2,8 @@
gerrit = //:gerrit
release = //:release
download = //:download
eclipse = //:eclipse
eclipse = //tools/eclipse:eclipse
eclipse_project = //tools/eclipse:eclipse_project
[buildfile]
includes = //lib/DEFS

65
BUCK
View File

@ -42,7 +42,8 @@ java_library(
genrule(
name = 'download',
cmd = 'buck build $(buck audit classpath --dot :eclipse_classpath' +
cmd = 'buck build ' +
'$(buck audit classpath --dot //tools/eclipse:classpath' +
'| egrep \'^ "//lib/\''+
'| cut -d\\" -f2' +
'| sort | uniq)',
@ -50,65 +51,3 @@ genrule(
deps = [],
out = '__fake.download__',
)
genrule(
name = 'eclipse',
cmd = '',
srcs = [],
deps = [
':_eclipse_project',
':_eclipse_classpath',
],
out = '__fake.eclipse__',
)
genrule(
name = 'eclipse_project',
cmd = '',
srcs = [],
deps = [
':_eclipse_project',
':_eclipse_classpath_nocompile',
],
out = '__fake.eclipse__',
)
java_library(
name = 'eclipse_classpath',
deps = LIBS + PGMLIBS + [
'//gerrit-acceptance-tests:acceptance_tests',
'//gerrit-gwtdebug:gwtdebug',
'//gerrit-gwtui:ui_module',
'//gerrit-httpd:httpd_tests',
'//gerrit-main:main_lib',
'//gerrit-server:server__compile',
'//lib/prolog:compiler_lib',
] + scan_plugins(),
)
genrule(
name = '_eclipse_project',
cmd = '${//tools:eclipse_project} $OUT',
srcs = [],
deps = ['//tools:eclipse_project'],
out = 'eclipse_project',
)
genrule(
name = '_eclipse_classpath',
cmd = '${//tools:eclipse_classpath} $OUT $DEPS',
srcs = [],
deps = [
':eclipse_classpath',
'//tools:eclipse_classpath',
],
out = 'eclipse_classpath',
)
genrule(
name = '_eclipse_classpath_nocompile',
cmd = '${//tools:eclipse_classpath}',
srcs = [],
deps = ['//tools:eclipse_classpath'],
out = '__fake.eclipse__',
)

View File

@ -18,5 +18,5 @@ java_test(
],
source_under_test = TEST,
labels = ['slow'],
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -2,5 +2,5 @@ java_library(
name = 'gwtdebug',
srcs = ['src/main/java/com/google/gerrit/gwtdebug/GerritDebugLauncher.java'],
deps = ['//lib/gwt:dev'],
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -75,7 +75,7 @@ gwt_module(
'//lib/gwt:user',
],
visibility = [
'//:eclipse_classpath',
'//tools/eclipse:classpath',
'//Documentation:licenses.txt',
],
)

View File

@ -28,5 +28,5 @@ java_test(
],
source_under_test = [':httpd'],
# TODO(sop) Remove after Buck supports Eclipse
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -9,5 +9,5 @@ java_library(
name = 'main_lib',
srcs = ['src/main/java/Main.java'],
deps = ['//gerrit-launcher:launcher'],
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -21,6 +21,7 @@ java_library2(
visibility = [
'//:',
'//gerrit-acceptance-tests:',
'//tools/eclipse:classpath',
'//Documentation:licenses.txt',
],
)

View File

@ -12,6 +12,7 @@ java_library(
visibility = [
'//:',
'//gerrit-gwtdebug:gwtdebug',
'//tools/eclipse:classpath',
],
)
@ -35,5 +36,8 @@ prebuilt_jar(
name = 'log4j-config',
binary_jar = genfile('log4j-config.jar'),
deps = [':log4j-config__jar'],
visibility = ['//:'],
visibility = [
'//:',
'//tools/eclipse:classpath',
],
)

View File

@ -82,7 +82,7 @@ def java_library2(
srcs = srcs,
resources = resources,
deps = deps + compile_deps,
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)
# Break the dependency chain by passing the newly built
# JAR to consumers through a prebuilt_jar().

View File

@ -19,5 +19,5 @@ java_library(
name = 'compiler_lib',
srcs = ['java/BuckPrologCompiler.java'],
deps = [':prolog-cafe'],
visibility = ['//:eclipse_classpath'],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -9,15 +9,3 @@ python_binary(
main = 'pack_war.py',
visibility = ['PUBLIC'],
)
python_binary(
name = 'eclipse_classpath',
main = 'eclipse_classpath.py',
visibility = ['PUBLIC'],
)
python_binary(
name = 'eclipse_project',
main = 'eclipse_project.py',
visibility = ['PUBLIC'],
)

73
tools/eclipse/BUCK Normal file
View File

@ -0,0 +1,73 @@
include_defs('//tools/build.defs')
genrule(
name = 'eclipse',
cmd = '',
srcs = [],
deps = [
':_classpath',
':_project',
],
out = '__fake.eclipse__',
)
genrule(
name = 'eclipse_project',
cmd = '',
srcs = [],
deps = [
':_classpath_nocompile',
':_project',
],
out = '__fake.eclipse__',
)
java_library(
name = 'classpath',
deps = LIBS + PGMLIBS + [
'//gerrit-acceptance-tests:acceptance_tests',
'//gerrit-gwtdebug:gwtdebug',
'//gerrit-gwtui:ui_module',
'//gerrit-httpd:httpd_tests',
'//gerrit-main:main_lib',
'//gerrit-server:server__compile',
'//lib/prolog:compiler_lib',
] + scan_plugins(),
)
genrule(
name = '_project',
cmd = '${:gen_project} $OUT',
srcs = [],
deps = [':gen_project'],
out = 'project',
)
genrule(
name = '_classpath',
cmd = '${:gen_classpath} $OUT $DEPS',
srcs = [],
deps = [
':classpath',
':gen_classpath',
],
out = 'classpath',
)
genrule(
name = '_classpath_nocompile',
cmd = '${:gen_classpath}',
srcs = [],
deps = [':gen_classpath'],
out = '__fake.eclipse__',
)
python_binary(
name = 'gen_classpath',
main = 'gen_classpath.py',
)
python_binary(
name = 'gen_project',
main = 'gen_project.py',
)

View File

@ -15,15 +15,18 @@
#
# TODO(sop): Remove hack after Buck supports Eclipse
from os import path, link
from os import path, symlink
import re
from subprocess import Popen, PIPE
from sys import argv
from xml.dom import minidom
OUT = argv[1] if len(argv) >= 2 else None
ROOT = path.dirname(path.dirname(path.abspath(__file__)))
MAIN = ['//:eclipse_classpath']
ROOT = path.abspath(__file__)
for _ in range(0, 3):
ROOT = path.dirname(ROOT)
MAIN = ['//tools/eclipse:classpath']
GWT = ['//gerrit-gwtui:ui_module']
JRE = '/'.join([
'org.eclipse.jdt.launching.JRE_CONTAINER',
@ -115,4 +118,4 @@ p = path.join(ROOT, '.classpath')
with open(p, 'w') as fd:
doc.writexml(fd, addindent = ' ', newl = '\n', encoding='UTF-8')
if OUT:
link(p, OUT)
symlink(p, OUT)

View File

@ -19,7 +19,9 @@ from os import path, symlink
from sys import argv
OUT = argv[1]
ROOT = path.dirname(path.dirname(path.abspath(__file__)))
ROOT = path.abspath(__file__)
for _ in range(0, 3):
ROOT = path.dirname(ROOT)
p = path.join(ROOT, '.project')
with open(p, 'w') as fd: