From 077cc9e775836a10c2c7123d94e4cbcef5341b8a Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Tue, 14 Apr 2026 23:14:56 -0700 Subject: [PATCH 1/4] feat: crowdin distribution deprecations --- .../actions/DistributionAddAction.java | 18 ++++++++++++++---- .../actions/DistributionEditAction.java | 7 +++++++ .../picocli/DistributionAddSubcommand.java | 6 +++--- .../picocli/DistributionEditSubcommand.java | 4 ++-- .../resources/messages/messages.properties | 2 ++ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java b/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java index b5b5cee68..365f7d3c7 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java @@ -28,6 +28,7 @@ import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; import static com.crowdin.cli.utils.console.ExecutionStatus.OK; +import static com.crowdin.cli.utils.console.ExecutionStatus.WARNING; import static com.crowdin.client.distributions.model.ExportMode.DEFAULT; @AllArgsConstructor @@ -53,7 +54,16 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client) ); boolean isStringsBasedProject = Objects.equals(project.getType(), Type.STRINGS_BASED); - if (isStringsBasedProject && exportMode != null) { + if (exportMode != null) { + out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_export_mode"))); + } + if (files != null) { + out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_file"))); + } + + ExportMode effectiveExportMode = exportMode != null ? exportMode : (files != null ? DEFAULT : null); + + if (isStringsBasedProject && effectiveExportMode != null) { throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.distribution.strings_based_export_mode")); } @@ -88,15 +98,15 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client) .filter(file -> files.contains(file.getPath())) .map(FileInfo::getId) .collect(Collectors.toList()); - } else if (exportMode == DEFAULT && !isStringsBasedProject) { + } else if (effectiveExportMode == DEFAULT && !isStringsBasedProject) { throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.distribution.empty_file")); } Distribution distribution = null; if (!isStringsBasedProject) { - AddDistributionRequest addDistributionRequest = RequestBuilder.addDistribution(name, exportMode, fileIds, bundleIds); + AddDistributionRequest addDistributionRequest = RequestBuilder.addDistribution(name, effectiveExportMode, fileIds, bundleIds); Optional.ofNullable(name).ifPresent(addDistributionRequest::setName); - Optional.ofNullable(exportMode).ifPresent(addDistributionRequest::setExportMode); + Optional.ofNullable(effectiveExportMode).ifPresent(addDistributionRequest::setExportMode); Optional.ofNullable(fileIds).ifPresent(addDistributionRequest::setFileIds); Optional.ofNullable(bundleIds).ifPresent(addDistributionRequest::setBundleIds); diff --git a/src/main/java/com/crowdin/cli/commands/actions/DistributionEditAction.java b/src/main/java/com/crowdin/cli/commands/actions/DistributionEditAction.java index 23f32df23..4872db69e 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DistributionEditAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DistributionEditAction.java @@ -64,6 +64,13 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client) } String existingExportMode = foundDistribution.get().getExportMode(); + if (exportMode != null) { + out.println(ExecutionStatus.WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_export_mode"))); + } + if (files != null) { + out.println(ExecutionStatus.WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_file"))); + } + List requests = new ArrayList<>(); if (name != null) { diff --git a/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java index 5bc55ecee..b9218e96d 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java @@ -23,10 +23,10 @@ class DistributionAddSubcommand extends ActCommandDistribution { @CommandLine.Parameters(descriptionKey = "crowdin.distribution.add.name") protected String name; - @CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.export-mode", defaultValue = "default", order = -2) + @CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.export-mode", order = -2, hidden = true) protected ExportMode exportMode; - @CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.file", order = -2) + @CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.file", order = -2, hidden = true) protected List files; @CommandLine.Option(names = {"--bundle-id"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.bundle-id", order = -2) @@ -59,7 +59,7 @@ protected List checkOptions() { errors.add(RESOURCE_BUNDLE.getString("error.distribution.incorrect_file_command_usage")); } - if (exportMode == DEFAULT && bundleIds != null) { + if ((exportMode == DEFAULT || (exportMode == null && files != null)) && bundleIds != null) { errors.add(RESOURCE_BUNDLE.getString("error.distribution.incorrect_bundle_id_command_usage")); } diff --git a/src/main/java/com/crowdin/cli/commands/picocli/DistributionEditSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/DistributionEditSubcommand.java index d45cf48da..a69d6834d 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/DistributionEditSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/DistributionEditSubcommand.java @@ -22,10 +22,10 @@ class DistributionEditSubcommand extends ActCommandDistribution { @CommandLine.Option(names = {"--name"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.name", order = -2) protected String name; - @CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.export-mode", order = -2) + @CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.export-mode", order = -2, hidden = true) protected ExportMode exportMode; - @CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.file", order = -2) + @CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.file", order = -2, hidden = true) protected List files; @CommandLine.Option(names = {"--bundle-id"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.bundle-id", order = -2) diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 926810f82..27b023fd1 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -682,6 +682,8 @@ error.distribution.incorrect_bundle_id_command_usage=The '--bundle-id' is used o error.distribution.strings_based_export_mode=String-based projects do not support export mode setting error.distribution.no_edit=Specify the parameters to edit the distribution error.distribution.not_found=Couldn't find distribution with the specified hash %s +warning.distribution.deprecated_export_mode=The '--export-mode' option is deprecated and will be removed in the next major release. We recommend using bundles instead. See https://support.crowdin.com/developer/api/v2/#tag/Distributions +warning.distribution.deprecated_file=The '--file' option is deprecated and will be removed in the next major release. We recommend using bundles instead. See https://support.crowdin.com/developer/api/v2/#tag/Distributions error.pre_translate.directory_or_file_only=Either '--file' or '--directory' can be specified error.pre_translate.engine_id=Machine Translation should be used with the '--engine-id' parameter From 81da150bd2521ed2517531f4625c8f735d352a14 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Tue, 14 Apr 2026 23:33:31 -0700 Subject: [PATCH 2/4] Update src/main/resources/messages/messages.properties Co-authored-by: Andrii Bodnar <29282228+andrii-bodnar@users.noreply.github.com> --- src/main/resources/messages/messages.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 27b023fd1..19001e526 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -682,8 +682,8 @@ error.distribution.incorrect_bundle_id_command_usage=The '--bundle-id' is used o error.distribution.strings_based_export_mode=String-based projects do not support export mode setting error.distribution.no_edit=Specify the parameters to edit the distribution error.distribution.not_found=Couldn't find distribution with the specified hash %s -warning.distribution.deprecated_export_mode=The '--export-mode' option is deprecated and will be removed in the next major release. We recommend using bundles instead. See https://support.crowdin.com/developer/api/v2/#tag/Distributions -warning.distribution.deprecated_file=The '--file' option is deprecated and will be removed in the next major release. We recommend using bundles instead. See https://support.crowdin.com/developer/api/v2/#tag/Distributions +warning.distribution.deprecated_export_mode=The '--export-mode' option is deprecated and will be removed in the next major release. Use '--bundle-id' instead +warning.distribution.deprecated_file=The '--file' option is deprecated and will be removed in the next major release. Use '--bundle-id' instead error.pre_translate.directory_or_file_only=Either '--file' or '--directory' can be specified error.pre_translate.engine_id=Machine Translation should be used with the '--engine-id' parameter From fe2d392933a0cd4fac769bfcb8c625daa8c41ed8 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Tue, 14 Apr 2026 23:46:53 -0700 Subject: [PATCH 3/4] remove not null export mode values --- .../cli/commands/actions/DistributionAddAction.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java b/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java index 365f7d3c7..c645102f4 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java @@ -61,9 +61,7 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client) out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_file"))); } - ExportMode effectiveExportMode = exportMode != null ? exportMode : (files != null ? DEFAULT : null); - - if (isStringsBasedProject && effectiveExportMode != null) { + if (isStringsBasedProject && exportMode != null) { throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.distribution.strings_based_export_mode")); } @@ -98,15 +96,15 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client) .filter(file -> files.contains(file.getPath())) .map(FileInfo::getId) .collect(Collectors.toList()); - } else if (effectiveExportMode == DEFAULT && !isStringsBasedProject) { + } else if (exportMode == DEFAULT && !isStringsBasedProject) { throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.distribution.empty_file")); } Distribution distribution = null; if (!isStringsBasedProject) { - AddDistributionRequest addDistributionRequest = RequestBuilder.addDistribution(name, effectiveExportMode, fileIds, bundleIds); + AddDistributionRequest addDistributionRequest = RequestBuilder.addDistribution(name, exportMode, fileIds, bundleIds); Optional.ofNullable(name).ifPresent(addDistributionRequest::setName); - Optional.ofNullable(effectiveExportMode).ifPresent(addDistributionRequest::setExportMode); + Optional.ofNullable(exportMode).ifPresent(addDistributionRequest::setExportMode); Optional.ofNullable(fileIds).ifPresent(addDistributionRequest::setFileIds); Optional.ofNullable(bundleIds).ifPresent(addDistributionRequest::setBundleIds); From 0c1c9018089a34f0aa57f0cfec14857bf8b01f5d Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Tue, 14 Apr 2026 23:52:19 -0700 Subject: [PATCH 4/4] fix check --- .../crowdin/cli/commands/picocli/DistributionAddSubcommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java index b9218e96d..c2ea10910 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java @@ -59,7 +59,7 @@ protected List checkOptions() { errors.add(RESOURCE_BUNDLE.getString("error.distribution.incorrect_file_command_usage")); } - if ((exportMode == DEFAULT || (exportMode == null && files != null)) && bundleIds != null) { + if (exportMode == DEFAULT && bundleIds != null) { errors.add(RESOURCE_BUNDLE.getString("error.distribution.incorrect_bundle_id_command_usage")); }