Skip to content

Commit

Permalink
Return the packed project artifact as the location of the Artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jul 28, 2023
1 parent 713fe84 commit 9ba09a3
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ public ArtifactKey getKey() {

@Override
public File getLocation(boolean fetch) {
if (project != null) {
File basedir = project.getBasedir();
if (basedir != null) {
return basedir;
}
File projectLocation = getProjectLocation();
if (projectLocation != null) {
return projectLocation;
}
if (fetch && locationSupplier != null && (location == null || !location.exists())) {
File file = locationSupplier.apply(this);
Expand All @@ -79,16 +77,28 @@ public File getLocation(boolean fetch) {
return location;
}

@Override
public CompletableFuture<File> fetchArtifact() {
private File getProjectLocation() {
if (project != null) {
File packedArtifact = project.getArtifact();
if (packedArtifact != null && packedArtifact.isFile()) {
return packedArtifact;
}
//TODO this really looks wrong! It should the file of the artifact (if present!) or the output directory,
// but the basedir most likely only works for tycho ...
File basedir = project.getBasedir();
if (basedir != null) {
return CompletableFuture.completedFuture(basedir);
return basedir;
}
}
return null;
}

@Override
public CompletableFuture<File> fetchArtifact() {
File projectLocation = getProjectLocation();
if (projectLocation != null) {
return CompletableFuture.completedFuture(projectLocation);
}
if (location != null && location.exists()) {
return CompletableFuture.completedFuture(location);
}
Expand All @@ -109,19 +119,14 @@ public CompletableFuture<File> fetchArtifact() {

@Override
public Optional<File> getLocation() {
if (project != null) {
//TODO this really looks wrong! It should the file of the artifact (if present!) or the output directory,
// but the basedir most likely only works for tycho ...
File basedir = project.getBasedir();
if (basedir != null) {
return Optional.of(basedir);
}
File projectLocation = getProjectLocation();
if (projectLocation != null) {
return Optional.of(projectLocation);
}
if (location != null) {
//TODO actually location.exists() should be used here! But some code has problems with that!
return Optional.of(location);
}
// TODO Auto-generated method stub
return Optional.empty();
}

Expand Down

0 comments on commit 9ba09a3

Please sign in to comment.