From 34de70a5d42fc89275c9108351cf2e8154ff3322 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Thu, 31 Dec 2015 11:18:02 -0800 Subject: [PATCH] buck: build standalone jgit binary Construct the java_application JAR wrapped with the shell script header. This is enough to clone a repository over HTTPs: $ buck build :jgit_bin $ buck-out/gen/jgit_bin/jgit_bin clone https://... Change-Id: I4aceb4e77b2ec9be76a32ec93d94f2dafe9acce6 --- BUCK | 6 +++++ lib/BUCK | 36 +++++++++++++++++++++++++ org.eclipse.jgit.http.apache/BUCK | 12 +++++++++ org.eclipse.jgit.pgm/BUCK | 44 +++++++++++++++++++++++++++++++ org.eclipse.jgit.ui/BUCK | 7 +++++ 5 files changed, 105 insertions(+) create mode 100644 org.eclipse.jgit.http.apache/BUCK create mode 100644 org.eclipse.jgit.pgm/BUCK create mode 100644 org.eclipse.jgit.ui/BUCK diff --git a/BUCK b/BUCK index 7704281ec..fca0e8a7f 100644 --- a/BUCK +++ b/BUCK @@ -36,3 +36,9 @@ java_library( ], visibility = ['PUBLIC'], ) + +genrule( + name = 'jgit_bin', + cmd = 'ln -s $(location //org.eclipse.jgit.pgm:jgit) $OUT', + out = 'jgit_bin', +) diff --git a/lib/BUCK b/lib/BUCK index 19cc2e039..f33cadbbe 100644 --- a/lib/BUCK +++ b/lib/BUCK @@ -25,6 +25,24 @@ maven_jar( version = '4.3.6', ) +maven_jar( + name = 'httpcore', + bin_sha1 = 'f91b7a4aadc5cf486df6e4634748d7dd7a73f06d', + src_sha1 = '1b0aa62a6a91e9fa00c16f0a4a2c874804ed3b1e', + group = 'org.apache.httpcomponents', + artifact = 'httpcore', + version = '4.3.3', +) + +maven_jar( + name = 'commons-logging', + bin_sha1 = 'f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f', + src_sha1 = '28bb0405fddaf04f15058fbfbe01fe2780d7d3b6', + group = 'commons-logging', + artifact = 'commons-logging', + version = '1.1.3', +) + maven_jar( name = 'slf4j-api', bin_sha1 = '0081d61b7f33ebeab314e07de0cc596f8e858d97', @@ -34,6 +52,15 @@ maven_jar( version = '1.7.2', ) +maven_jar( + name = 'slf4j-simple', + bin_sha1 = '760055906d7353ba4f7ce1b8908bc6b2e91f39fa', + src_sha1 = '09474919128b3a7fcf21a5f9c907f5251f234544', + group = 'org.slf4j', + artifact = 'slf4j-simple', + version = '1.7.2', +) + maven_jar( name = 'servlet-api', bin_sha1 = '3cd63d075497751784b2fa84be59432f4905bf7c', @@ -52,6 +79,15 @@ maven_jar( version = '1.6', ) +maven_jar( + name = 'args4j', + bin_sha1 = '139441471327b9cc6d56436cb2a31e60eb6ed2ba', + src_sha1 = '22631b78cc8f60a6918557e8cbdb33e90f63a77f', + group = 'args4j', + artifact = 'args4j', + version = '2.0.15', +) + maven_jar( name = 'junit', bin_sha1 = '4e031bb61df09069aeb2bffb4019e7a5034a4ee0', diff --git a/org.eclipse.jgit.http.apache/BUCK b/org.eclipse.jgit.http.apache/BUCK new file mode 100644 index 000000000..f48f33a1a --- /dev/null +++ b/org.eclipse.jgit.http.apache/BUCK @@ -0,0 +1,12 @@ +java_library( + name = 'http-apache', + srcs = glob(['src/**']), + resources = glob(['resources/**']), + deps = [ + '//org.eclipse.jgit:jgit', + '//lib:commons-logging', + '//lib:httpcomponents', + '//lib:httpcore', + ], + visibility = ['PUBLIC'], +) diff --git a/org.eclipse.jgit.pgm/BUCK b/org.eclipse.jgit.pgm/BUCK new file mode 100644 index 000000000..64237c32e --- /dev/null +++ b/org.eclipse.jgit.pgm/BUCK @@ -0,0 +1,44 @@ +java_library( + name = 'pgm', + srcs = glob(['src/**']), + resources = glob(['resources/**']), + deps = [ + ':services', + '//org.eclipse.jgit:jgit', + '//org.eclipse.jgit.archive:jgit-archive', + '//org.eclipse.jgit.http.apache:http-apache', + '//org.eclipse.jgit.ui:ui', + '//lib:args4j', + ], + visibility = ['PUBLIC'], +) + +prebuilt_jar( + name = 'services', + binary_jar = ':services__jar', +) + +genrule( + name = 'services__jar', + cmd = 'cd $SRCDIR ; zip -qr $OUT .', + srcs = glob(['META-INF/services/*']), + out = 'services.jar', +) + +genrule( + name = 'jgit', + cmd = 'cat $SRCDIR/jgit.sh $(location :jgit_jar) >$OUT;' + + 'chmod a+x $OUT', + srcs = ['jgit.sh'], + out = 'jgit', + visibility = ['PUBLIC'], +) + +java_binary( + name = 'jgit_jar', + main_class = 'org.eclipse.jgit.pgm.Main', + deps = [ + ':pgm', + '//lib:slf4j-simple', + ], +) diff --git a/org.eclipse.jgit.ui/BUCK b/org.eclipse.jgit.ui/BUCK new file mode 100644 index 000000000..fcd87cf9a --- /dev/null +++ b/org.eclipse.jgit.ui/BUCK @@ -0,0 +1,7 @@ +java_library( + name = 'ui', + srcs = glob(['src/**']), + resources = glob(['resources/**']), + deps = ['//org.eclipse.jgit:jgit'], + visibility = ['PUBLIC'], +)