@@ -96,32 +96,30 @@ def _download_lfs(repository_ctx):
9696 'alias(name = "file", actual = "//:%s", visibility = ["//visibility:public"])\n ' % name ,
9797 )
9898
99+ _lfs_archive_attrs = {
100+ "build_file" : attr .label (doc = "The file to use as the BUILD file for this repository. " +
101+ "Either build_file or build_file_content can be specified, but not both." ),
102+ "build_file_content" : attr .string (doc = "The content for the BUILD file for this repository. " +
103+ "Either build_file or build_file_content can be specified, but not both." ),
104+ "strip_prefix" : attr .string (default = "" , doc = "A directory prefix to strip from the extracted files." ),
105+ }
106+
99107lfs_archive = repository_rule (
100108 doc = "Export the contents from an on-demand LFS archive. The corresponding path should be added to be ignored " +
101109 "in `.lfsconfig`." ,
102110 implementation = _download_and_extract_lfs_archive ,
103111 attrs = {
104112 "src" : attr .label (mandatory = True , doc = "Local path to the LFS archive to extract." ),
105- "build_file_content" : attr .string (doc = "The content for the BUILD file for this repository. " +
106- "Either build_file or build_file_content can be specified, but not both." ),
107- "build_file" : attr .label (doc = "The file to use as the BUILD file for this repository. " +
108- "Either build_file or build_file_content can be specified, but not both." ),
109- "strip_prefix" : attr .string (default = "" , doc = "A directory prefix to strip from the extracted files." ),
110- },
113+ } | _lfs_archive_attrs ,
111114)
112115
113116lfs_archives = repository_rule (
114117 doc = "Overlay the contents from on-demand LFS archives. The corresponding paths should be added to be ignored " +
115118 "in `.lfsconfig`." ,
116119 implementation = _download_and_extract_lfs_archives ,
117120 attrs = {
118- "build_file" : attr .label (doc = "The file to use as the BUILD file for this repository. " +
119- "Either build_file or build_file_content can be specified, but not both." ),
120- "build_file_content" : attr .string (doc = "The content for the BUILD file for this repository. " +
121- "Either build_file or build_file_content can be specified, but not both." ),
122121 "srcs" : attr .label_list (doc = "Local paths to the LFS archives to extract in order." , mandatory = True ),
123- "strip_prefix" : attr .string (default = "" , doc = "A directory prefix to strip from the extracted files." ),
124- },
122+ } | _lfs_archive_attrs ,
125123)
126124
127125lfs_files = repository_rule (
0 commit comments