Skip to content

Commit

Permalink
Merge pull request #42 from aswild/pull/local_manifest
Browse files Browse the repository at this point in the history
Use local_manifests/local.xml rather than local_manifest.xml
  • Loading branch information
rsandell authored Jan 10, 2017
2 parents 3a1f82d + 44b1577 commit 57eff0c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
24 changes: 16 additions & 8 deletions src/main/java/hudson/plugins/repo/RepoScm.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public int getDepth() {
return depth;
}
/**
* Returns the contents of the local_manifest.xml. By default, this is null
* and a local_manifest.xml is neither created nor modified.
* Returns the contents of the local_manifests/local.xml. By default, this is null
* and a local_manifests/local.xml is neither created nor modified.
*/
@Exported
public String getLocalManifest() {
Expand Down Expand Up @@ -297,9 +297,10 @@ public boolean isForceSync() {
* @param depth This is the depth to use when syncing. By default this is 0
* and the full history is synced.
* @param localManifest May be null, a string containing XML, or an URL.
* If XML, this string is written to .repo/local_manifest.xml
* If XML, this string is written to
* .repo/local_manifests/local.xml
* If an URL, the URL is fetched and the content is written
* to .repo/local_manifest.xml
* to .repo/local_manifests/local.xml
* @param destinationDir If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
* @param repoUrl If not null then use this url as repo base,
Expand Down Expand Up @@ -453,9 +454,9 @@ public void setDepth(final int depth) {
*
* @param localManifest
* May be null, a string containing XML, or an URL.
* If XML, this string is written to .repo/local_manifest.xml
* If XML, this string is written to .repo/local_manifests/local.xml
* If an URL, the URL is fetched and the content is written
* to .repo/local_manifest.xml
* to .repo/local_manifests/local.xml
*/
@DataBoundSetter
public void setLocalManifest(@CheckForNull final String localManifest) {
Expand Down Expand Up @@ -815,9 +816,16 @@ private boolean checkoutCode(final Launcher launcher,
}
if (workspace != null) {
FilePath rdir = workspace.child(".repo");
FilePath lm = rdir.child("local_manifest.xml");
lm.delete();
FilePath lmdir = rdir.child("local_manifests");
// Delete the legacy local_manifest.xml in case it exists from a previous build
rdir.child("local_manifest.xml").delete();
if (lmdir.exists()) {
lmdir.deleteContents();
} else {
lmdir.mkdirs();
}
if (localManifest != null) {
FilePath lm = lmdir.child("local.xml");
String expandedLocalManifest = env.expand(localManifest);
if (expandedLocalManifest.startsWith("<?xml")) {
lm.write(expandedLocalManifest, null);
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/help-localManifest.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
<p>
The contents of <code>.repo/local_manifest.xml</code>. This is written prior to
calling sync. The default is to not use a <code>local_manifest.xml</code> file.
The contents of <code>.repo/local_manifests/local.xml</code>. This is written prior to
calling sync. The default is to not use a <code>local.xml</code> file.
</p>
<p>The contents may be given here literally, as XML; see the example below.
Such literal content <b>must</b> start with the
Expand Down

0 comments on commit 57eff0c

Please # to comment.