Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use local_manifests/local.xml rather than local_manifest.xml #42

Merged
merged 1 commit into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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