summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2016-11-06 09:06:54 +0100
committerDavid Pursehouse <david.pursehouse@gmail.com>2017-01-18 19:13:16 -0400
commite92a0c3adc7035e5188194e145b8cd010887b569 (patch)
treeecce3f7fbb5db1d637bf855bd3f42826f806609b
parentb667c182cbaf56fd4382362f042062343bac0856 (diff)
downloadjgit-e92a0c3adc7035e5188194e145b8cd010887b569.tar.gz
jgit-e92a0c3adc7035e5188194e145b8cd010887b569.zip
Implement initial framework of Bazel build
The initial implementation only builds the packages consumed by Gerrit Code Review. Test build and execution is not implemented. We prefer to consume maven_jar custom rule from bazlets repository, for the same reasons as in the Gerrit project: * Caching artifacts across different clones and projects * Exposing source classifiers and neverlink artifact TEST PLAN: $ bazel build :all $ unzip -t bazel-genfiles/all.zip Archive: bazel-genfiles/all.zip testing: libjgit-archive.jar OK testing: libjgit-servlet.jar OK testing: libjgit.jar OK testing: libjunit.jar OK No errors detected in compressed data of bazel-genfiles/all.zip. Change-Id: Ia837ce95d9829fe2515f37b7a04a71a4598672a0 Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
-rw-r--r--.gitignore6
-rw-r--r--BUILD19
-rw-r--r--WORKSPACE97
-rw-r--r--org.eclipse.jgit.archive/BUILD15
-rw-r--r--org.eclipse.jgit.http.server/BUILD12
-rw-r--r--org.eclipse.jgit.junit/BUILD12
-rw-r--r--org.eclipse.jgit/BUILD29
-rw-r--r--tools/BUILD0
-rw-r--r--tools/bazlets.bzl17
9 files changed, 207 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e78f8fd9b1..b52fac6f2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,9 @@
/buck-out
/target
infer-out
+bazel-bin
+bazel-genfiles
+bazel-jgit
+bazel-out
+bazel-testlogs
+*~
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000000..79c5e3f385
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,19 @@
+package(default_visibility = ['//visibility:public'])
+
+genrule(
+ name = 'all',
+ srcs = [
+ '//org.eclipse.jgit:jgit',
+ '//org.eclipse.jgit.archive:jgit-archive',
+ '//org.eclipse.jgit.http.server:jgit-servlet',
+ '//org.eclipse.jgit.junit:junit',
+ ],
+ cmd = ' && '.join([
+ 'p=$$PWD',
+ 't=$$(mktemp -d || mktemp -d -t bazel-tmp)',
+ 'cp $(SRCS) $$t',
+ 'cd $$t',
+ 'zip -qr $$p/$@ .',
+ ]),
+ outs = ['all.zip'],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000000..902c6b24d6
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,97 @@
+workspace(name="jgit")
+
+load("//tools:bazlets.bzl", "load_bazlets")
+load_bazlets(commit = "3afbeab55ece585dbfc7a980bf7214b24ddbbe86")
+load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl",
+ "maven_jar"
+)
+
+maven_jar(
+ name = 'jsch',
+ artifact = 'com.jcraft:jsch:0.1.53',
+ sha1 = '658b682d5c817b27ae795637dfec047c63d29935',
+)
+
+maven_jar(
+ name = 'javaewah',
+ artifact = 'com.googlecode.javaewah:JavaEWAH:1.1.6',
+ sha1 = '94ad16d728b374d65bd897625f3fbb3da223a2b6',
+)
+
+maven_jar(
+ name = 'httpclient',
+ artifact = 'org.apache.httpcomponents:httpclient:4.3.6',
+ sha1 = '4c47155e3e6c9a41a28db36680b828ced53b8af4',
+)
+
+maven_jar(
+ name = 'httpcore',
+ artifact = 'org.apache.httpcomponents:httpcore:4.3.3',
+ sha1 = 'f91b7a4aadc5cf486df6e4634748d7dd7a73f06d',
+)
+
+maven_jar(
+ name = 'commons_logging',
+ artifact = 'commons-logging:commons-logging:1.1.3',
+ sha1 = 'f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f',
+)
+
+maven_jar(
+ name = 'log_api',
+ artifact = 'org.slf4j:slf4j-api:1.7.2',
+ sha1 = '0081d61b7f33ebeab314e07de0cc596f8e858d97',
+)
+
+maven_jar(
+ name = 'slf4j_simple',
+ artifact = 'org.slf4j:slf4j-simple:1.7.2',
+ sha1 = '760055906d7353ba4f7ce1b8908bc6b2e91f39fa',
+)
+
+maven_jar(
+ name = 'servlet_api_3_1',
+ artifact = 'javax.servlet:javax.servlet-api:3.1.0',
+ sha1 = '3cd63d075497751784b2fa84be59432f4905bf7c',
+)
+
+maven_jar(
+ name = 'commons_compress',
+ artifact = 'org.apache.commons:commons-compress:1.6',
+ sha1 = 'c7d9b580aff9e9f1998361f16578e63e5c064699',
+)
+
+maven_jar(
+ name = 'tukaani_xz',
+ artifact = 'org.tukaani:xz:1.3',
+ sha1 = '66db21c8484120cb6a51b5b3ea47b6f383942bec',
+)
+
+maven_jar(
+ name = 'args4j',
+ artifact = 'args4j:args4j:2.0.15',
+ sha1 = '139441471327b9cc6d56436cb2a31e60eb6ed2ba',
+)
+
+maven_jar(
+ name = 'junit',
+ artifact = 'junit:junit:4.11',
+ sha1 = '4e031bb61df09069aeb2bffb4019e7a5034a4ee0',
+)
+
+maven_jar(
+ name = 'hamcrest_library',
+ artifact = 'org.hamcrest:hamcrest-library:1.3',
+ sha1 = '4785a3c21320980282f9f33d0d1264a69040538f',
+)
+
+maven_jar(
+ name = 'hamcrest_core',
+ artifact = 'org.hamcrest:hamcrest-core:1.3',
+ sha1 = '42a25dc3219429f0e5d060061f71acb49bf010a0',
+)
+
+maven_jar(
+ name = 'gson',
+ artifact = 'com.google.code.gson:gson:2.2.4',
+ sha1 = 'a60a5e993c98c864010053cb901b7eab25306568',
+)
diff --git a/org.eclipse.jgit.archive/BUILD b/org.eclipse.jgit.archive/BUILD
new file mode 100644
index 0000000000..c74f6d8a20
--- /dev/null
+++ b/org.eclipse.jgit.archive/BUILD
@@ -0,0 +1,15 @@
+package(default_visibility = ['//visibility:public'])
+
+java_library(
+ name = 'jgit-archive',
+ srcs = glob(
+ ['src/**'],
+ exclude = ['src/org/eclipse/jgit/archive/FormatActivator.java'],
+ ),
+ resources = glob(['resources/**']),
+ resource_strip_prefix = 'org.eclipse.jgit.archive/resources',
+ deps = [ # We want these deps to be provided_deps
+ '//org.eclipse.jgit:jgit',
+ '@commons_compress//jar',
+ ],
+)
diff --git a/org.eclipse.jgit.http.server/BUILD b/org.eclipse.jgit.http.server/BUILD
new file mode 100644
index 0000000000..88dc8040bf
--- /dev/null
+++ b/org.eclipse.jgit.http.server/BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ['//visibility:public'])
+
+java_library(
+ name = 'jgit-servlet',
+ srcs = glob(['src/**']),
+ resources = glob(['resources/**']),
+ resource_strip_prefix = 'org.eclipse.jgit.http.server/resources',
+ deps = [ # We want these deps to be provided_deps
+ '//org.eclipse.jgit:jgit',
+ '@servlet_api_3_1//jar',
+ ],
+)
diff --git a/org.eclipse.jgit.junit/BUILD b/org.eclipse.jgit.junit/BUILD
new file mode 100644
index 0000000000..e0b358ae31
--- /dev/null
+++ b/org.eclipse.jgit.junit/BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ['//visibility:public'])
+
+java_library(
+ name = 'junit',
+ srcs = glob(['src/**']),
+ resources = glob(['resources/**']),
+ resource_strip_prefix = 'org.eclipse.jgit.junit/resources',
+ deps = [ # We want these deps to be provided_deps
+ '//org.eclipse.jgit:jgit',
+ '@junit//jar',
+ ],
+)
diff --git a/org.eclipse.jgit/BUILD b/org.eclipse.jgit/BUILD
new file mode 100644
index 0000000000..2abf228082
--- /dev/null
+++ b/org.eclipse.jgit/BUILD
@@ -0,0 +1,29 @@
+package(default_visibility = ['//visibility:public'])
+
+INSECURE_CIPHER_FACTORY = [
+ 'src/org/eclipse/jgit/transport/InsecureCipherFactory.java',
+]
+
+SRCS = glob(['src/**'], exclude=INSECURE_CIPHER_FACTORY)
+RESOURCES = glob(['resources/**'])
+
+java_library(
+ name = 'jgit',
+ srcs = SRCS,
+ resources = RESOURCES,
+ resource_strip_prefix = 'org.eclipse.jgit/resources',
+ deps = [
+ ':insecure_cipher_factory',
+ '@javaewah//jar',
+ '@jsch//jar',
+ '@httpclient//jar',
+ '@servlet_api_3_1//jar',
+ '@log_api//jar',
+ ],
+)
+
+java_library(
+ name = 'insecure_cipher_factory',
+ srcs = INSECURE_CIPHER_FACTORY,
+ javacopts = ['-Xep:InsecureCipherMode:OFF'],
+)
diff --git a/tools/BUILD b/tools/BUILD
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tools/BUILD
diff --git a/tools/bazlets.bzl b/tools/bazlets.bzl
new file mode 100644
index 0000000000..e14e488492
--- /dev/null
+++ b/tools/bazlets.bzl
@@ -0,0 +1,17 @@
+NAME = "com_googlesource_gerrit_bazlets"
+
+def load_bazlets(
+ commit,
+ local_path = None
+ ):
+ if not local_path:
+ native.git_repository(
+ name = NAME,
+ remote = "https://gerrit.googlesource.com/bazlets",
+ commit = commit,
+ )
+ else:
+ native.local_repository(
+ name = NAME,
+ path = local_path,
+ )