Skip to content

Commit

Permalink
[JENKINS-17236] Initial version of ArtifactManager (no Maven support …
Browse files Browse the repository at this point in the history
…yet).

Originally-Committed-As: e1eea67bb2fa1a356492e91313d84a523f441b34
  • Loading branch information
jglick committed Mar 15, 2013
1 parent 2a60c0f commit fa81618
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/hudson/maven/MavenBuild.java
Expand Up @@ -427,7 +427,7 @@ public FilePath getModuleSetRootDir() {
}

public FilePath getArtifactsDir() {
return new FilePath(MavenBuild.this.getArtifactsDir());
return new FilePath(MavenBuild.this.getArtifactsDir());//XXX
}

public void setResult(Result result) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/maven/MavenBuildProxy.java
Expand Up @@ -207,7 +207,7 @@ public FilePath getModuleSetRootDir() {
return core.getModuleSetRootDir();
}

public FilePath getArtifactsDir() {
public FilePath getArtifactsDir() { // XX
return core.getArtifactsDir();
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/hudson/maven/reporters/MavenArtifact.java
Expand Up @@ -177,7 +177,7 @@ public String getExtension() {
}

Artifact a = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier);
a.setFile(getFile(build));
a.setFile(getFile(build)); // XXX

return a;
}
Expand All @@ -196,7 +196,7 @@ private String getSeed(String extension) {
/**
* Obtains the {@link File} representing the archived artifact.
*/
public File getFile(MavenBuild build) throws IOException {
public File getFile(MavenBuild build) throws IOException { // XXX
File f = new File(new File(new File(new File(build.getArtifactsDir(), groupId), artifactId), version), canonicalName);
if(!f.exists())
throw new IOException("Archived artifact is missing: "+f);
Expand All @@ -209,10 +209,10 @@ public File getFile(MavenBuild build) throws IOException {
* TODO: figure out how to make this URL more discoverable to the remote API.
*/
public HttpResponse doFile(@AncestorInPath MavenArtifactRecord parent) throws IOException {
return HttpResponses.staticResource(getFile(parent.parent));
return HttpResponses.staticResource(getFile(parent.parent)); // XXX
}

private FilePath getArtifactArchivePath(MavenBuildProxy build, String groupId, String artifactId, String version) {
private FilePath getArtifactArchivePath(MavenBuildProxy build, String groupId, String artifactId, String version) { // XXX
return build.getArtifactsDir().child(groupId).child(artifactId).child(version).child(canonicalName);
}

Expand All @@ -228,7 +228,7 @@ public void archive(MavenBuildProxy build, File file, BuildListener listener) th
FilePath origin = new FilePath(file);
if (!target.exists()) {
listener.getLogger().println("[JENKINS] Archiving "+ file+" to "+target);
origin.copyTo(target);
origin.copyTo(target); // XXX use an ArtifactManager method instead
} else if (!origin.digest().equals(target.digest())) {
listener.getLogger().println("[JENKINS] Re-archiving "+file);
origin.copyTo(target);
Expand Down
Expand Up @@ -159,7 +159,7 @@ public Void call(MavenBuild build) throws IOException, InterruptedException {
for (File assembly : assemblies) {
if(mavenArtifacts.contains(assembly))
continue; // looks like this is already archived
FilePath target = build.getArtifactsDir().child(assembly.getName());
FilePath target = build.getArtifactsDir().child(assembly.getName()); // XXX
listener.getLogger().println("[JENKINS] Archiving "+ assembly+" to "+target);
new FilePath(assembly).copyTo(target);
// TODO: fingerprint
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/maven/reporters/MavenArtifactRecord.java
Expand Up @@ -172,7 +172,7 @@ public void deploy(MavenEmbedder embedder, ArtifactRepository deploymentReposito
}
Artifact main = mainArtifact.toArtifact(handlerManager, artifactFactory, parent);
if (!isPOM())
main.addMetadata(new ProjectArtifactMetadata(main, pomArtifact.getFile(parent)));
main.addMetadata(new ProjectArtifactMetadata(main, pomArtifact.getFile(parent))); // XXX

if (main.getType().equals("maven-plugin")) {
GroupRepositoryMetadata metadata = new GroupRepositoryMetadata(main.getGroupId());
Expand Down Expand Up @@ -206,11 +206,11 @@ public void install(MavenEmbedder embedder) throws MavenEmbedderException, IOExc

Artifact main = mainArtifact.toArtifact(handlerManager,factory,parent);
if(!isPOM())
main.addMetadata(new ProjectArtifactMetadata(main,pomArtifact.getFile(parent)));
installer.install(mainArtifact.getFile(parent),main,embedder.getLocalRepository());
main.addMetadata(new ProjectArtifactMetadata(main,pomArtifact.getFile(parent))); // XXX
installer.install(mainArtifact.getFile(parent),main,embedder.getLocalRepository()); // XXX

for (MavenArtifact aa : attachedArtifacts)
installer.install(aa.getFile(parent), aa.toArtifact(handlerManager, factory, parent), embedder.getLocalRepository());
installer.install(aa.getFile(parent), aa.toArtifact(handlerManager, factory, parent), embedder.getLocalRepository()); // XXX
}

public void recordFingerprints() throws IOException {
Expand Down

0 comments on commit fa81618

Please sign in to comment.