Browse Source

Implement Buck driven build

Today there are plenty of modern build tool systems available in the
wild (in no particular order):

* http://bazel.io
* https://pantsbuild.github.io
* http://shakebuild.com
* https://ninja-build.org
* https://buckbuild.com

The attributes, that all these build tools have in common, are:

* reliable
* correct
* very fast
* reproducible

It must not always be the other build tool, this project is currently
using. Or, quoting Gerrit Code Review maintainer here:

  "Friends, don't let friends use <the other build tool system>!"

This change is non-complete implementation of JGit build in Buck,
needed by Gerrit Code Review to replace its dependency with standlone
JGit cell. This is very useful when a developer is working on both
projects and is trying to integrate changes made in JGit in Gerrit.

The supported workflow is:

  $ cd jgit
  $ emacs <hack>
  $ cd ../gerrit
  $ buck build --config repositories.jgit=../jgit gerrit

With --config repositories.jgit=../jgit jgit cell is routed through
JGit development tree.

To build jgit, issue:

  $ buck build //:jgit
  [-] PROCESSING BUCK FILES...FINISHED 0,0s

Yes, you can't measure no-op build time, given that Buck daemon is
used.

Change-Id: I301a71b19fba35a5093d8cc64d4ba970c2877a44
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
tags/v4.2.0.201601211800-r
David Ostrovsky 8 years ago
parent
commit
13502fef8f
9 changed files with 212 additions and 0 deletions
  1. 15
    0
      .buckconfig
  2. 2
    0
      .gitignore
  3. 38
    0
      BUCK
  4. 62
    0
      lib/BUCK
  5. 13
    0
      org.eclipse.jgit.archive/BUCK
  6. 10
    0
      org.eclipse.jgit.http.server/BUCK
  7. 10
    0
      org.eclipse.jgit.junit/BUCK
  8. 20
    0
      org.eclipse.jgit/BUCK
  9. 42
    0
      tools/default.defs

+ 15
- 0
.buckconfig View File

@@ -0,0 +1,15 @@
[buildfile]
includes = //tools/default.defs

[java]
src_roots = src, resources

[project]
ignore = .git

[cache]
mode = dir

[download]
maven_repo = http://repo1.maven.org/maven2
in_build = true

+ 2
- 0
.gitignore View File

@@ -1,2 +1,4 @@
/target
/.project
/buck-cache
/buck-out

+ 38
- 0
BUCK View File

@@ -0,0 +1,38 @@
java_library(
name = 'jgit',
exported_deps = ['//org.eclipse.jgit:jgit'],
visibility = ['PUBLIC'],
)

java_library(
name = 'jgit_src',
exported_deps = ['//org.eclipse.jgit:jgit_src'],
visibility = ['PUBLIC'],
)

java_library(
name = 'jgit-servlet',
exported_deps = [
':jgit',
'//org.eclipse.jgit.http.server:jgit-servlet'
],
visibility = ['PUBLIC'],
)

java_library(
name = 'jgit-archive',
exported_deps = [
':jgit',
'//org.eclipse.jgit.archive:jgit-archive'
],
visibility = ['PUBLIC'],
)

java_library(
name = 'junit',
exported_deps = [
':jgit',
'//org.eclipse.jgit.junit:junit'
],
visibility = ['PUBLIC'],
)

+ 62
- 0
lib/BUCK View File

@@ -0,0 +1,62 @@
maven_jar(
name = 'jsch',
bin_sha1 = '658b682d5c817b27ae795637dfec047c63d29935',
src_sha1 = '791359d94d6edcace686a56d0727ee093a2f7c33',
group = 'com.jcraft',
artifact = 'jsch',
version = '0.1.53',
)

maven_jar(
name = 'javaewah',
bin_sha1 = 'eceaf316a8faf0e794296ebe158ae110c7d72a5a',
src_sha1 = 'a50d78eb630e05439461f3130b94b3bcd1ea6f03',
group = 'com.googlecode.javaewah',
artifact = 'JavaEWAH',
version = '0.7.9',
)

maven_jar(
name = 'httpcomponents',
bin_sha1 = '4c47155e3e6c9a41a28db36680b828ced53b8af4',
src_sha1 = 'af4d76be0c46ee26b0d9d1d4a34d244a633cac84',
group = 'org.apache.httpcomponents',
artifact = 'httpclient',
version = '4.3.6',
)

maven_jar(
name = 'slf4j-api',
bin_sha1 = '0081d61b7f33ebeab314e07de0cc596f8e858d97',
src_sha1 = '58d38f68d4a867d4552ae27960bb348d7eaa1297',
group = 'org.slf4j',
artifact = 'slf4j-api',
version = '1.7.2',
)

maven_jar(
name = 'servlet-api',
bin_sha1 = '3cd63d075497751784b2fa84be59432f4905bf7c',
src_sha1 = 'ab3976d4574c48d22dc1abf6a9e8bd0fdf928223',
group = 'javax.servlet',
artifact = 'javax.servlet-api',
version = '3.1.0',
)

maven_jar(
name = 'commons-compress',
bin_sha1 = 'c7d9b580aff9e9f1998361f16578e63e5c064699',
src_sha1 = '396b81bdfd0fb617178e1707ef64832215307c78',
group = 'org.apache.commons',
artifact = 'commons-compress',
version = '1.6',
)

maven_jar(
name = 'junit',
bin_sha1 = '4e031bb61df09069aeb2bffb4019e7a5034a4ee0',
src_sha1 = '28e0ad201304e4a4abf999ca0570b7cffc352c3c',
group = 'junit',
artifact = 'junit',
version = '4.11',
)

+ 13
- 0
org.eclipse.jgit.archive/BUCK View File

@@ -0,0 +1,13 @@
java_library(
name = 'jgit-archive',
srcs = glob(
['src/**'],
excludes = ['src/org/eclipse/jgit/archive/FormatActivator.java'],
),
resources = glob(['resources/**']),
provided_deps = [
'//org.eclipse.jgit:jgit',
'//lib:commons-compress',
],
visibility = ['PUBLIC'],
)

+ 10
- 0
org.eclipse.jgit.http.server/BUCK View File

@@ -0,0 +1,10 @@
java_library(
name = 'jgit-servlet',
srcs = glob(['src/**']),
resources = glob(['resources/**']),
provided_deps = [
'//org.eclipse.jgit:jgit',
'//lib:servlet-api',
],
visibility = ['PUBLIC'],
)

+ 10
- 0
org.eclipse.jgit.junit/BUCK View File

@@ -0,0 +1,10 @@
java_library(
name = 'junit',
srcs = glob(['src/**']),
resources = glob(['resources/**']),
provided_deps = [
'//org.eclipse.jgit:jgit',
'//lib:junit',
],
visibility = ['PUBLIC'],
)

+ 20
- 0
org.eclipse.jgit/BUCK View File

@@ -0,0 +1,20 @@
SRCS = glob(['src/**'])
RESOURCES = glob(['resources/**'])

java_library(
name = 'jgit',
srcs = SRCS,
resources = RESOURCES,
deps = [
'//lib:javaewah',
'//lib:jsch',
'//lib:httpcomponents',
'//lib:slf4j-api',
],
visibility = ['PUBLIC'],
)

java_sources(
name = 'jgit_src',
srcs = SRCS + RESOURCES,
)

+ 42
- 0
tools/default.defs View File

@@ -0,0 +1,42 @@
def java_sources(
name,
srcs,
visibility = ['PUBLIC']
):
java_library(
name = name,
resources = srcs,
visibility = visibility,
)

def maven_jar(
name,
group,
artifact,
version,
bin_sha1,
src_sha1,
visibility = ['PUBLIC']):
jar_name = '%s__jar' % name
src_name = '%s__src' % name

remote_file(
name = jar_name,
sha1 = bin_sha1,
url = 'mvn:%s:%s:jar:%s' % (group, artifact, version),
out = '%s.jar' % jar_name,
)

remote_file(
name = src_name,
sha1 = src_sha1,
url = 'mvn:%s:%s:src:%s' % (group, artifact, version),
out = '%s.jar' % src_name,
)

prebuilt_jar(
name = name,
binary_jar = ':' + jar_name,
source_jar = ':' + src_name,
visibility = visibility)


Loading…
Cancel
Save