Simplify war rule Current implementation makes assumption for the location of context content artifacts: one sub directory level. This is not future proof as migration to built in gwt_binary() has shown. Move from inducing the location to use of Buck's own $(location) macro and provide the paramter to pack_war.py through cmd rather than srcs. Change-Id: I69037920e21963a62c8edd6edc296d72c7454e5a
diff --git a/war.bucklet b/war.bucklet index 0394375..0ac346a 100644 --- a/war.bucklet +++ b/war.bucklet
@@ -20,7 +20,8 @@ # name = 'gitiles', # libs = ['//gitiles-servlet:servlet'], # context = [ -# ':recourses.zip', +# '//gitiles-servlet:static-resources', +# ':web_xml', # ], # visibility = ['PUBLIC'] # ) @@ -38,27 +39,15 @@ for l in pgmlibs: cmd.extend(['--pgmlib', l]) - src = [] dep = [] if context: - root = get_base_path() - if root: - root = '/'.join(['..' for _ in root.split('/')]) + '/' - for r in context: - dep.append(r[:r.rindex('.')]) - if r.startswith('//'): - r = root + r[2:] - r = r.replace(':', '/') - elif r.startswith(':'): - r = r[1:] - src.append(genfile(r)) - if src: - cmd.append('$SRCS') + for t in context: + dep.append(t) + cmd.append('$(location %s)' % t) genrule( name = name, cmd = ' '.join(cmd), - srcs = src, deps = libs + pgmlibs + dep + ['//bucklets/tools:pack_war'], out = name + '.war', visibility = visibility,