@Nullable
  public static VirtualFile suggestManifestFileDirectory(@NotNull CompositePackagingElement<?> root, PackagingElementResolvingContext context, ArtifactType artifactType) {
    final VirtualFile metaInfDir = ArtifactUtil.findSourceFileByOutputPath(root, MANIFEST_DIR_NAME, context, artifactType);
    if (metaInfDir != null) {
      return metaInfDir;
    }

    final Ref<VirtualFile> sourceDir = Ref.create(null);
    final Ref<VirtualFile> sourceFile = Ref.create(null);
    ArtifactUtil.processElementsWithSubstitutions(root.getChildren(), context, artifactType, PackagingElementPath.EMPTY,
                                                  new PackagingElementProcessor<>() {
                                                    @Override
                                                    public boolean process(@NotNull PackagingElement<?> element,
                                                                           @NotNull PackagingElementPath path) {
                                                      if (element instanceof FileCopyPackagingElement) {
                                                        final VirtualFile file = ((FileCopyPackagingElement)element).findFile();
                                                        if (file != null) {
                                                          sourceFile.set(file);
                                                        }
                                                      }
                                                      else if (element instanceof DirectoryCopyPackagingElement) {
                                                        final VirtualFile file = ((DirectoryCopyPackagingElement)element).findFile();
                                                        if (file != null) {
                                                          sourceDir.set(file);
                                                          return false;
                                                        }
                                                      }
                                                      return true;
                                                    }
                                                  });

    if (!sourceDir.isNull()) {
      return sourceDir.get();
    }


    final Project project = context.getProject();
    return suggestBaseDir(project, sourceFile.get());
  }
@Nullable
  public static VirtualFile suggestManifestFileDirectory(@NotNull CompositePackagingElement<?> root, PackagingElementResolvingContext context, ArtifactType artifactType)