Skip to content

Commit

Permalink
Merge pull request #184 from TechnologyBrewery/pypiUploadSuffix-fix
Browse files Browse the repository at this point in the history
#177 Fixed pypiUploadSuffix null issue
  • Loading branch information
jacksondelametter authored Aug 9, 2024
2 parents 59ee4f9 + efb5fe5 commit 8a68dbb
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ public class PublishToPyPiRepoMojo extends AbstractHabushuMojo {
* "legacy/"). This variable allows customization in a manner that does not impact the installation API for the
* same repository. Defaults to empty as the most common scenario when overriding the repository URL is to leverage
* one of the repositories mentioned above.
* Note: The property must be set equal to "" in order for Maven to not set the default value to null
*/
@Parameter(property = "habushu.pypiUploadSuffix", defaultValue = "")
protected String pypiUploadSuffix;
protected String pypiUploadSuffix = "";

/**
* {{@link #pypiUploadSuffix repositoryUploadSuffix} contains critical information. The main difference is that
Expand Down Expand Up @@ -192,7 +193,6 @@ protected void publishPackage(PoetryCommandHelper poetryHelper, boolean rebuildP
}

String repoUrl = getRepositoryUrl(publishToDev);

if (StringUtils.isNotEmpty(repoUrl)) {
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
throw new MojoExecutionException(String.format(
Expand Down Expand Up @@ -308,14 +308,13 @@ protected Retryer<Boolean> getRetryer() {
}

String getRepositoryUrl(boolean publishToDev) {
String repoUrl;
String repoUrl = addTrailingSlash(pypiRepoUrl);
if (publishToDev) {
repoUrl = addTrailingSlash(devRepositoryUrl) + devRepositoryUrlUploadSuffix;
} else {
repoUrl = addTrailingSlash(pypiRepoUrl) + pypiUploadSuffix;
repoUrl = addTrailingSlash(devRepositoryUrl) + addTrailingSlash(devRepositoryUrlUploadSuffix);
} else if(!StringUtils.isEmpty(pypiUploadSuffix)) {
repoUrl += addTrailingSlash(pypiUploadSuffix);
}

return addTrailingSlash(repoUrl);
return repoUrl;
}

static String addTrailingSlash(String inputUrl) {
Expand Down

0 comments on commit 8a68dbb

Please sign in to comment.