use of com.google.copybara.doc.annotations.UsesFlags in project copybara by google.
the class RemoteFileModule method remoteArchiveOrigin.
@StarlarkMethod(name = "origin", doc = "Defines a remote file origin. This is a WIP and experimental. Do not use. ", parameters = { @Param(name = "unpack_method", defaultValue = "None", doc = "The method by which to unpack the remote file. Currently 'zip' allowed. 'tar' and" + " 'as-is' to be added soon.", named = true), @Param(name = "author", defaultValue = "'Copybara <noreply@copybara.io>'", doc = "Author to attribute the change to", named = true), // TODO(joshgoldman): support labels in addition to message
@Param(name = "message", defaultValue = "'Placeholder message'", doc = "Message to attach to the change", named = true) })
@UsesFlags(RemoteFileOptions.class)
public RemoteArchiveOrigin remoteArchiveOrigin(String fileType, String author, String message) throws EvalException, ValidationException {
GeneralOptions generalOptions = options.get(GeneralOptions.class);
RemoteFileOptions remoteFileOptions = options.get(RemoteFileOptions.class);
return new RemoteArchiveOrigin(fileType, Author.parse(author), message, remoteFileOptions.getTransport(), generalOptions.profiler(), remoteFileOptions);
}
use of com.google.copybara.doc.annotations.UsesFlags in project copybara by google.
the class PatchModule method quiltApply.
@SuppressWarnings("unused")
@StarlarkMethod(name = "quilt_apply", doc = "A transformation that applies and updates patch files using Quilt. Compared to" + " `patch.apply`, this transformation supports updating the content of patch files" + " if they can be successfully applied with fuzz. The patch files must be included" + " in the destination_files glob in order to get updated. Underneath, Copybara" + " runs `quilt import; quilt push; quilt refresh` for each patch file in the" + " `series` file in order. Currently, all patch files and the `series` file must" + " reside in a \"patches\" sub-directory under the root directory containing the" + " migrated code. This means it has the limitation that the migrated code itself" + " cannot contain a directory with the name \"patches\".", parameters = { @Param(name = "series", named = true, positional = false, doc = "A file which contains a list of patches to apply. It is similar to the `series`" + " parameter in `patch.apply` transformation, and is required for Quilt." + " Patches listed in this file will be applied relative to the checkout dir," + " and the leading path component is stripped via the `-p1` flag. Currently" + " this file should be the `patches/series` file in the root directory" + " of the migrated code.") }, useStarlarkThread = true)
@Example(title = "Workflow to apply and update patches", before = "Suppose the destination repository's directory structure looks like:\n" + "```\n" + "source_root/BUILD\n" + "source_root/copy.bara.sky\n" + "source_root/migrated_file1\n" + "source_root/migrated_file2\n" + "source_root/patches/series\n" + "source_root/patches/patch1.patch\n" + "```\n" + "Then the transformations in `source_root/copy.bara.sky` should look like:", code = "[\n" + " patch.quilt_apply(series = \"patches/series\"),\n" + " core.move(\"\", \"source_root\"),\n" + "]", after = "In this example, `patch1.patch` is applied to `migrated_file1` and/or `migrated_file2`." + " `patch1.patch` itself will be updated during the migration if it is applied with" + " fuzz.")
@UsesFlags(PatchingOptions.class)
public QuiltTransformation quiltApply(String series, StarlarkThread thread) throws EvalException {
ImmutableList.Builder<ConfigFile> builder = ImmutableList.builder();
ConfigFile seriesFile = parseSeries(series, builder);
return new QuiltTransformation(seriesFile, builder.build(), patchingOptions, /*reverse=*/
false, thread.getCallerLocation());
}
Aggregations