From c8b37e8fd1c6cc232d5f3b8fdcfb4ab98c5cf77a Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Wed, 17 Jul 2019 14:39:56 +0200 Subject: [PATCH] Update (#762) * put LICENSE file into .jar * fix typo * add clarification comment in PY wrapper --- c/tools/brotli.c | 6 +++--- java/BUILD | 12 ++++++++++++ java/org/brotli/dec/BUILD | 1 + java/org/brotli/dec/pom.xml | 25 +++++++++++++++++++++++++ java/org/brotli/wrapper/common/BUILD | 1 + java/org/brotli/wrapper/dec/BUILD | 1 + java/org/brotli/wrapper/enc/BUILD | 1 + python/_brotli.cc | 15 ++++++++------- 8 files changed, 52 insertions(+), 10 deletions(-) diff --git a/c/tools/brotli.c b/c/tools/brotli.c index d2c0485..04606a8 100644 --- a/c/tools/brotli.c +++ b/c/tools/brotli.c @@ -263,7 +263,7 @@ static Command ParseParams(Context* params) { return COMMAND_HELP; } else if (c == 'j' || c == 'k') { if (keep_set) { - fprintf(stderr, "argument --rm / -j or --keep / -n already set\n"); + fprintf(stderr, "argument --rm / -j or --keep / -k already set\n"); return COMMAND_INVALID; } keep_set = BROTLI_TRUE; @@ -388,7 +388,7 @@ static Command ParseParams(Context* params) { return COMMAND_HELP; } else if (strcmp("keep", arg) == 0) { if (keep_set) { - fprintf(stderr, "argument --rm / -j or --keep / -n already set\n"); + fprintf(stderr, "argument --rm / -j or --keep / -k already set\n"); return COMMAND_INVALID; } keep_set = BROTLI_TRUE; @@ -401,7 +401,7 @@ static Command ParseParams(Context* params) { params->copy_stat = BROTLI_FALSE; } else if (strcmp("rm", arg) == 0) { if (keep_set) { - fprintf(stderr, "argument --rm / -j or --keep / -n already set\n"); + fprintf(stderr, "argument --rm / -j or --keep / -k already set\n"); return COMMAND_INVALID; } keep_set = BROTLI_TRUE; diff --git a/java/BUILD b/java/BUILD index f7dd0c0..cd55c54 100644 --- a/java/BUILD +++ b/java/BUILD @@ -36,6 +36,18 @@ cc_library( # <<< JNI headers +genrule( + name = "license_resource", + srcs = ["@org_brotli//:LICENSE"], + outs = ["META-INF/LICENSE"], + cmd = "cp -f $< $@", +) + +java_library( + name = "license", + resources = [":license_resource"], +) + ######################################################## # WARNING: do not (transitively) depend on this target! ######################################################## diff --git a/java/org/brotli/dec/BUILD b/java/org/brotli/dec/BUILD index f17e512..0cc0cbf 100644 --- a/java/org/brotli/dec/BUILD +++ b/java/org/brotli/dec/BUILD @@ -17,6 +17,7 @@ java_library( exclude = ["*Test*.java"], ), proguard_specs = ["proguard.pgcfg"], + resource_jars = ["//:license"], ) load(":build_defs.bzl", "brotli_java_test") diff --git a/java/org/brotli/dec/pom.xml b/java/org/brotli/dec/pom.xml index bf609dc..946fddf 100644 --- a/java/org/brotli/dec/pom.xml +++ b/java/org/brotli/dec/pom.xml @@ -133,6 +133,31 @@ + + maven-resources-plugin + 3.1.0 + + + copy-license + validate + + copy-resources + + + ${project.build.outputDirectory}/META-INF + + + ../../../../ + + LICENSE + + false + + + + + + diff --git a/java/org/brotli/wrapper/common/BUILD b/java/org/brotli/wrapper/common/BUILD index 4f7ed84..7c3480a 100644 --- a/java/org/brotli/wrapper/common/BUILD +++ b/java/org/brotli/wrapper/common/BUILD @@ -18,6 +18,7 @@ java_library( ["*.java"], exclude = ["*Test*.java"], ), + resource_jars = ["//:license"], ) java_library( diff --git a/java/org/brotli/wrapper/dec/BUILD b/java/org/brotli/wrapper/dec/BUILD index 754541a..d1c8f5b 100644 --- a/java/org/brotli/wrapper/dec/BUILD +++ b/java/org/brotli/wrapper/dec/BUILD @@ -13,6 +13,7 @@ java_library( ["*.java"], exclude = ["*Test*.java"], ), + resource_jars = ["//:license"], ) java_library( diff --git a/java/org/brotli/wrapper/enc/BUILD b/java/org/brotli/wrapper/enc/BUILD index b3d10b9..9aea6ba 100644 --- a/java/org/brotli/wrapper/enc/BUILD +++ b/java/org/brotli/wrapper/enc/BUILD @@ -18,6 +18,7 @@ java_library( ["*.java"], exclude = ["*Test*.java"], ), + resource_jars = ["//:license"], ) java_library( diff --git a/python/_brotli.cc b/python/_brotli.cc index 5e1828e..d4075bd 100644 --- a/python/_brotli.cc +++ b/python/_brotli.cc @@ -703,13 +703,14 @@ PyDoc_STRVAR(brotli_doc, "Implementation module for the Brotli library."); static struct PyModuleDef brotli_module = { PyModuleDef_HEAD_INIT, - "_brotli", - brotli_doc, - 0, - brotli_methods, - NULL, - NULL, - NULL + "_brotli", /* m_name */ + brotli_doc, /* m_doc */ + 0, /* m_size */ + brotli_methods, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ }; #else #define INIT_BROTLI init_brotli