Skip to content

Commit

Permalink
[MASSEMBLY-791] - overrideUmask option to ensure permissions in packa…
Browse files Browse the repository at this point in the history
…ged archive match expected ones.
  • Loading branch information
mabrarov committed Jul 5, 2023
1 parent 4d0130c commit 37a1341
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,12 @@ public interface AssemblerConfigurationSource {
* @return Override group name.
*/
String getOverrideGroupName();

/**
* @return mask which is applied to permissions of files/directories before they are put into assembly.
* If {@code null} then the mask is not explicitly configured and remains implementation-specific.
*/
default Integer getOverrideUmask() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ protected Archiver createArchiver(
if (StringUtils.isNotBlank(configSource.getOverrideGroupName())) {
archiver.setOverrideGroupName(StringUtils.trim(configSource.getOverrideGroupName()));
}
final Integer overrideUmask = configSource.getOverrideUmask();
if (overrideUmask != null) {
archiver.setUmask(overrideUmask);
}

return archiver;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ public abstract class AbstractAssemblyMojo extends AbstractMojo implements Assem
@Parameter
private String overrideGroupName;

/**
* Override of mask which is applied to permissions of files/directories before they are put into assembly.
* If {@code null} then the mask is not explicitly configured and remains implementation-specific.
* If invalid value is specified - like negative value - then behaviour is implementation specific, i.e. depends
* on underlying library which is used for building of assembly.
*/
@Parameter
private Integer overrideUmask;

public static FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject) {
if (mainProject != null) {
// 5
Expand Down Expand Up @@ -879,4 +888,9 @@ public Integer getOverrideGid() {
public String getOverrideGroupName() {
return this.overrideGroupName;
}

@Override
public Integer getOverrideUmask() {
return this.overrideUmask;
}
}

0 comments on commit 37a1341

Please sign in to comment.