From 44b1577b5143cf2fb930c62b08675f99d89b663e Mon Sep 17 00:00:00 2001 From: Allen Wild Date: Fri, 6 Jan 2017 23:25:01 -0500 Subject: [PATCH] Use local_manifests/local.xml rather than local_manifest.xml Using .repo/local_manifest.xml has been deprecated for a while, and prints a warning which dirtys the build log, so adopt the new convention of .repo/local_manifests/*.xml. I arbitrarily chose "local.xml" for the file name. Change-Id: Iaef7077312ce8a1cb195143011ca4ebcaf9e209b --- .../java/hudson/plugins/repo/RepoScm.java | 24 ++++++++++++------- src/main/webapp/help-localManifest.html | 4 ++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java index d272ac2..e423d21 100644 --- a/src/main/java/hudson/plugins/repo/RepoScm.java +++ b/src/main/java/hudson/plugins/repo/RepoScm.java @@ -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() { @@ -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, @@ -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) { @@ -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("

- The contents of .repo/local_manifest.xml. This is written prior to -calling sync. The default is to not use a local_manifest.xml file. + The contents of .repo/local_manifests/local.xml. This is written prior to +calling sync. The default is to not use a local.xml file.

The contents may be given here literally, as XML; see the example below. Such literal content must start with the