Package hudson.plugins.repo
Class RepoScm
- java.lang.Object
-
- hudson.scm.SCM
-
- hudson.plugins.repo.RepoScm
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCM>
,Serializable
@ExportedBean public class RepoScm extends SCM implements Serializable
The main entrypoint of the plugin. This class contains code to store user configuration and to check out the code using a repo binary.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RepoScm.DescriptorImpl
A DescriptorImpl contains variables used server-wide.-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
-
-
Constructor Summary
Constructors Constructor Description RepoScm(String manifestRepositoryUrl)
The constructor takes in user parameters and sets them.RepoScm(String manifestRepositoryUrl, String manifestBranch, String manifestFile, String manifestGroup, String mirrorDir, int jobs, int depth, String localManifest, String destinationDir, String repoUrl, boolean currentBranch, boolean resetFirst, boolean quiet, boolean trace, boolean showAllChanges)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildEnvironment(Run<?,?> build, Map<String,String> env)
Adds environmental variables for the builds to the given map.SCMRevisionState
calcRevisionsFromBuild(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener)
void
checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline)
PollingResult
compareRemoteRevisionWith(Job<?,?> job, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline)
ChangeLogParser
createChangeLogParser()
int
getDepth()
Returns the depth used for sync.RepoScm.DescriptorImpl
getDescriptor()
String
getDestinationDir()
Returns the destination directory.Map<String,String>
getExtraEnvVars()
Returns the value of extraEnvVars.String
getIgnoreProjects()
returns list of ignore projects.int
getJobs()
Returns the number of jobs used for sync.String
getKey()
String
getLocalManifest()
Returns the contents of the local_manifests/local.xml.String
getManifestBranch()
Returns the manifest branch name.String
getManifestFile()
Returns the initial manifest file name.String
getManifestGroup()
Returns the group of projects to fetch.String
getManifestPlatform()
Returns the platform of projects to fetch.String
getManifestRepositoryUrl()
Returns the manifest repository URL.String
getMirrorDir()
Returns the name of the mirror directory.String
getRepoBranch()
Returns the repo branch.String
getRepoUrl()
Returns the repo url.boolean
isCleanFirst()
Returns the value of cleanFirst.boolean
isCurrentBranch()
Returns the value of currentBranch.boolean
isFetchSubmodules()
Returns the value of fetchSubmodules.boolean
isForceSync()
Returns the value of forceSync.boolean
isManifestSubmodules()
Returns the value of manifestSubmodules.boolean
isNoCloneBundle()
Returns the value of noCloneBundle.boolean
isNoTags()
Returns the value of noTags.boolean
isQuiet()
Returns the value of quiet.boolean
isResetFirst()
Returns the value of resetFirst.boolean
isShowAllChanges()
Returns the value of showAllChanges.boolean
isTrace()
Returns the value of trace.boolean
isWorktree()
Returns the value of isWorktree.void
setCleanFirst(boolean cleanFirst)
Set cleanFirst.void
setCurrentBranch(boolean currentBranch)
Set currentBranch.void
setDepth(int depth)
Set the depth used for sync.void
setDestinationDir(String destinationDir)
Set the destination directory.void
setExtraEnvVars(Map<String,String> extraEnvVars)
Set additional environment variables to use.void
setFetchSubmodules(boolean fetchSubmodules)
Set fetchSubmodules.void
setForceSync(boolean forceSync)
Enables --force-sync option on repo sync command.void
setIgnoreProjects(String ignoreProjects)
Sets list of projects which changes will be ignored when calculating whether job needs to be rebuild.void
setJobs(int jobs)
Set the number of jobs used for sync.void
setLocalManifest(String localManifest)
Set the content of the local manifest.void
setManifestBranch(String manifestBranch)
Set the manifest branch name.void
setManifestFile(String manifestFile)
Set the initial manifest file name.void
setManifestGroup(String manifestGroup)
Set the group of projects to fetch.void
setManifestPlatform(String manifestPlatform)
Set the platform of projects to fetch.void
setManifestSubmodules(boolean manifestSubmodules)
Set manifestSubmodules.void
setMirrorDir(String mirrorDir)
Set the name of the mirror directory.void
setNoCloneBundle(boolean noCloneBundle)
Set noCloneBundle.void
setNoTags(boolean noTags)
Set noTags.void
setQuiet(boolean quiet)
Set quiet.void
setRepoBranch(String repoBranch)
Set the repo branch.void
setRepoUrl(String repoUrl)
Set the repo url.void
setResetFirst(boolean resetFirst)
Set resetFirst.void
setShowAllChanges(boolean showAllChanges)
Set showAllChanges.void
setTrace(boolean trace)
Set trace.void
setWorktree(boolean worktree)
Set worktree.-
Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, _for, all, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getBrowser, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
-
-
-
-
Constructor Detail
-
RepoScm
@Deprecated public RepoScm(String manifestRepositoryUrl, String manifestBranch, String manifestFile, String manifestGroup, String mirrorDir, int jobs, int depth, String localManifest, String destinationDir, String repoUrl, boolean currentBranch, boolean resetFirst, boolean quiet, boolean trace, boolean showAllChanges)
Deprecated.The constructor takes in user parameters and sets them. Each job using the RepoSCM will call this constructor.- Parameters:
manifestRepositoryUrl
- The URL for the manifest repository.manifestBranch
- The branch of the manifest repository. Typically this is null or the empty string, which will cause repo to default to "master".manifestFile
- The file to use as the repository manifest. Typically this is null which will cause repo to use the default of "default.xml"manifestGroup
- The group name for the projects that need to be fetched. Typically, this is null and all projects tagged 'default' will be fetched.mirrorDir
- The path of the mirror directory to reference when initializing repo.jobs
- The number of concurrent jobs to use for the sync command. If this is 0 or negative the jobs parameter is not specified.depth
- This is the depth to use when syncing. By default this is 0 and the full history is synced.localManifest
- May be null, a string containing XML, or an URL. 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_manifests/local.xmldestinationDir
- If not null then the source is synced to the destinationDir subdirectory of the workspace.repoUrl
- If not null then use this url as repo base, instead of the default.currentBranch
- If this value is true, add the "-c" option when executing "repo sync".resetFirst
- If this value is true, do "repo forall -c 'git reset --hard'" before syncing.quiet
- If this value is true, add the "-q" option when executing "repo sync".trace
- If this value is true, add the "--trace" option when executing "repo init" and "repo sync".showAllChanges
- If this value is true, add the "--first-parent" option to "git log" when determining changesets.
-
RepoScm
@DataBoundConstructor public RepoScm(String manifestRepositoryUrl)
The constructor takes in user parameters and sets them. Each job using the RepoSCM will call this constructor.- Parameters:
manifestRepositoryUrl
- The URL for the manifest repository.
-
-
Method Detail
-
getManifestRepositoryUrl
@Exported public String getManifestRepositoryUrl()
Returns the manifest repository URL.
-
getManifestBranch
@Exported public String getManifestBranch()
Returns the manifest branch name. By default, this is null and repo defaults to "master".
-
getManifestFile
@Exported public String getManifestFile()
Returns the initial manifest file name. By default, this is null and repo defaults to "default.xml"
-
getManifestGroup
@Exported public String getManifestGroup()
Returns the group of projects to fetch. By default, this is null and repo will fetch the default group.
-
getManifestPlatform
@CheckForNull public String getManifestPlatform()
Returns the platform of projects to fetch. By default, this is null and repo will automatically fetch the appropriate platform.
-
getRepoUrl
@Exported public String getRepoUrl()
Returns the repo url. by default, this is null and repo is fetched from aosp
-
getRepoBranch
@Exported public String getRepoBranch()
Returns the repo branch. by default, this is null and repo is used from the default branch
-
getMirrorDir
@Exported public String getMirrorDir()
Returns the name of the mirror directory. By default, this is null and repo does not use a mirror.
-
getJobs
@Exported public int getJobs()
Returns the number of jobs used for sync. By default, this is null and repo does not use concurrent jobs.
-
getDepth
@Exported public int getDepth()
Returns the depth used for sync. By default, this is null and repo will sync the entire history.
-
getLocalManifest
@Exported public String getLocalManifest()
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.
-
getDestinationDir
@Exported public String getDestinationDir()
Returns the destination directory. By default, this is null and the source is synced to the root of the workspace.
-
getIgnoreProjects
@Exported public String getIgnoreProjects()
returns list of ignore projects.
-
isCurrentBranch
@Exported public boolean isCurrentBranch()
Returns the value of currentBranch.
-
isResetFirst
@Exported public boolean isResetFirst()
Returns the value of resetFirst.
-
isCleanFirst
@Exported public boolean isCleanFirst()
Returns the value of cleanFirst.
-
isShowAllChanges
@Exported public boolean isShowAllChanges()
Returns the value of showAllChanges.
-
isQuiet
@Exported public boolean isQuiet()
Returns the value of quiet.
-
isForceSync
@Exported public boolean isForceSync()
Returns the value of forceSync.
-
isTrace
@Exported public boolean isTrace()
Returns the value of trace.
-
isNoTags
@Exported public boolean isNoTags()
Returns the value of noTags.
-
isNoCloneBundle
@Exported public boolean isNoCloneBundle()
Returns the value of noCloneBundle.
-
isWorktree
@Exported public boolean isWorktree()
Returns the value of isWorktree.
-
isManifestSubmodules
@Exported public boolean isManifestSubmodules()
Returns the value of manifestSubmodules.
-
isFetchSubmodules
public boolean isFetchSubmodules()
Returns the value of fetchSubmodules.
-
getExtraEnvVars
@Exported public Map<String,String> getExtraEnvVars()
Returns the value of extraEnvVars.
-
setManifestBranch
@DataBoundSetter public void setManifestBranch(@CheckForNull String manifestBranch)
Set the manifest branch name.- Parameters:
manifestBranch
- The branch of the manifest repository. Typically this is null or the empty string, which will cause repo to default to "master".
-
setManifestFile
@DataBoundSetter public void setManifestFile(@CheckForNull String manifestFile)
Set the initial manifest file name.- Parameters:
manifestFile
- The file to use as the repository manifest. Typically this is null which will cause repo to use the default of "default.xml"
-
setManifestGroup
@DataBoundSetter public void setManifestGroup(@CheckForNull String manifestGroup)
Set the group of projects to fetch.- Parameters:
manifestGroup
- The group name for the projects that need to be fetched. Typically, this is null and all projects tagged 'default' will be fetched.
-
setManifestPlatform
@DataBoundSetter public void setManifestPlatform(@CheckForNull String manifestPlatform)
Set the platform of projects to fetch.- Parameters:
manifestPlatform
- The platform for the projects that need to be fetched. Typically, this is null and only projects for the current platform will be fetched.
-
setMirrorDir
@DataBoundSetter public void setMirrorDir(@CheckForNull String mirrorDir)
Set the name of the mirror directory.- Parameters:
mirrorDir
- The path of the mirror directory to reference when initializing repo.
-
setJobs
@DataBoundSetter public void setJobs(int jobs)
Set the number of jobs used for sync.- Parameters:
jobs
- The number of concurrent jobs to use for the sync command. If this is 0 or negative the jobs parameter is not specified.
-
setDepth
@DataBoundSetter public void setDepth(int depth)
Set the depth used for sync.- Parameters:
depth
- This is the depth to use when syncing. By default this is 0 and the full history is synced.
-
setLocalManifest
@DataBoundSetter public void setLocalManifest(@CheckForNull String localManifest)
Set the content of the local manifest.- Parameters:
localManifest
- May be null, a string containing XML, or an URL. 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_manifests/local.xml
-
setDestinationDir
@DataBoundSetter public void setDestinationDir(@CheckForNull String destinationDir)
Set the destination directory.- Parameters:
destinationDir
- If not null then the source is synced to the destinationDir subdirectory of the workspace.
-
setCurrentBranch
@DataBoundSetter public void setCurrentBranch(boolean currentBranch)
Set currentBranch.- Parameters:
currentBranch
- If this value is true, add the "-c" option when executing "repo sync".
-
setResetFirst
@DataBoundSetter public void setResetFirst(boolean resetFirst)
Set resetFirst.- Parameters:
resetFirst
- If this value is true, do "repo forall -c 'git reset --hard'" before syncing.
-
setCleanFirst
@DataBoundSetter public void setCleanFirst(boolean cleanFirst)
Set cleanFirst.- Parameters:
cleanFirst
- If this value is true, do "repo forall -c 'git clean -fdx'" before syncing.
-
setQuiet
@DataBoundSetter public void setQuiet(boolean quiet)
Set quiet.- Parameters:
quiet
- * If this value is true, add the "-q" option when executing "repo sync".
-
setTrace
@DataBoundSetter public void setTrace(boolean trace)
Set trace.- Parameters:
trace
- If this value is true, add the "--trace" option when executing "repo init" and "repo sync".
-
setShowAllChanges
@DataBoundSetter public void setShowAllChanges(boolean showAllChanges)
Set showAllChanges.- Parameters:
showAllChanges
- If this value is true, add the "--first-parent" option to "git log" when determining changesets.
-
setNoCloneBundle
@DataBoundSetter public void setNoCloneBundle(boolean noCloneBundle)
Set noCloneBundle.- Parameters:
noCloneBundle
- If this value is true, add the "--no-clone-bundle" option when running the "repo init" and "repo sync" commands.
-
setWorktree
@DataBoundSetter public void setWorktree(boolean worktree)
Set worktree.- Parameters:
worktree
- If this value is true, add the "--worktree" option when running the "repo init" command.
-
setRepoUrl
@DataBoundSetter public void setRepoUrl(@CheckForNull String repoUrl)
Set the repo url.- Parameters:
repoUrl
- If not null then use this url as repo base, instead of the default
-
setRepoBranch
@DataBoundSetter public void setRepoBranch(@CheckForNull String repoBranch)
Set the repo branch.- Parameters:
repoBranch
- If not null then use this as branch for repo itself instead of the default.
-
setForceSync
@DataBoundSetter public void setForceSync(boolean forceSync)
Enables --force-sync option on repo sync command.- Parameters:
forceSync
- If this value is true, add the "--force-sync" option when executing "repo sync".
-
setNoTags
@DataBoundSetter public final void setNoTags(boolean noTags)
Set noTags.- Parameters:
noTags
- If this value is true, add the "--no-tags" option when executing "repo sync".
-
setManifestSubmodules
@DataBoundSetter public void setManifestSubmodules(boolean manifestSubmodules)
Set manifestSubmodules.- Parameters:
manifestSubmodules
- If this value is true, add the "--submodules" option when executing "repo init".
-
setFetchSubmodules
@DataBoundSetter public void setFetchSubmodules(boolean fetchSubmodules)
Set fetchSubmodules.- Parameters:
fetchSubmodules
- If this value is true, add the "--fetch-submodules" option when executing "repo sync".
-
setIgnoreProjects
@DataBoundSetter public final void setIgnoreProjects(String ignoreProjects)
Sets list of projects which changes will be ignored when calculating whether job needs to be rebuild. This field corresponds to serverpath i.e. "name" section of the manifest.- Parameters:
ignoreProjects
- String representing project names separated by " ".
-
setExtraEnvVars
@DataBoundSetter public void setExtraEnvVars(@CheckForNull Map<String,String> extraEnvVars)
Set additional environment variables to use. These variables will override any parameter from the project or variable set in environment already.- Parameters:
extraEnvVars
- Additional environment variables to set.
-
calcRevisionsFromBuild
public SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?,?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException
- Overrides:
calcRevisionsFromBuild
in classSCM
- Throws:
IOException
InterruptedException
-
compareRemoteRevisionWith
public PollingResult compareRemoteRevisionWith(@Nonnull Job<?,?> job, @Nullable Launcher launcher, @Nullable FilePath workspace, @Nonnull TaskListener listener, @Nonnull SCMRevisionState baseline) throws IOException, InterruptedException
- Overrides:
compareRemoteRevisionWith
in classSCM
- Throws:
IOException
InterruptedException
-
checkout
public void checkout(@Nonnull Run<?,?> build, @Nonnull Launcher launcher, @Nonnull FilePath workspace, @Nonnull TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState baseline) throws IOException, InterruptedException
- Overrides:
checkout
in classSCM
- Throws:
IOException
InterruptedException
-
buildEnvironment
public void buildEnvironment(@Nonnull Run<?,?> build, @Nonnull Map<String,String> env)
Adds environmental variables for the builds to the given map.- Overrides:
buildEnvironment
in classSCM
-
createChangeLogParser
public ChangeLogParser createChangeLogParser()
- Specified by:
createChangeLogParser
in classSCM
-
getDescriptor
public RepoScm.DescriptorImpl getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<SCM>
- Overrides:
getDescriptor
in classSCM
-
-