C# Class Google.JarResolver.PlayServicesSupport

Play services support is a helper class for managing the Google play services and Android support libraries in a Unity project. This is done by using the Maven repositories that are part of the Android SDK. This class implements the logic of version checking, transitive dependencies, and updating a a directory to make sure that there is only one version of a dependency present.
Afficher le fichier Open project: googlesamples/unity-jar-resolver Class Usage Examples

Private Properties

Свойство Type Description
CreateInstance PlayServicesSupport
FindCandidate Dependency
FindCandidate Dependency
GetDependencies IEnumerable
Log void
PersistDependencies void
ProcessMetadata void
ResetDependencies void

Méthodes publiques

Méthode Description
ClearDependencies ( ) : void

Clears the dependencies for this client.

CopyDependencies ( Dependency>.Dictionary dependencies, string destDirectory, OverwriteConfirmation confirmer ) : void

Copies the dependencies from the repository to the specified directory. The destination directory is checked for an existing version of the dependency before copying. The OverwriteConfirmation delegate is called for the first existing file or directory. If the delegate returns true, the old dependency is deleted and the new one copied.

CreateInstance ( string clientName, string sdkPath, string settingsDirectory, LogMessage logger = null ) : PlayServicesSupport

Creates an instance of PlayServicesSupport. This instance is used to add dependencies for the calling client and invoke the resolution.

DeleteExistingFileOrDirectory ( string path ) : void

Delete a file or directory if it exists.

DependOn ( string group, string artifact, string version, string packageIds = null, string repositories = null ) : void

Adds a dependency to the project.

This method should be called for each library that is required. Transitive dependencies are processed so only directly referenced libraries need to be added.

The version string can be contain a trailing + to indicate " or greater". Trailing 0s are implied. For example:

1.0 means only version 1.0, but also matches 1.0.0.

1.2.3+ means version 1.2.3 or 1.2.4, etc. but not 1.3.

0+ means any version.

LATEST means the only the latest version.

LoadDependencies ( bool allClients, bool keepMissing = false ) : Dependency>.Dictionary

Loads the dependencies from the settings files.

ResolveDependencies ( bool useLatest ) : Dependency>.Dictionary

Performs the resolution process. This determines the versions of the dependencies that should be used. Transitive dependencies are also processed.

Private Methods

Méthode Description
CreateInstance ( string clientName, string sdkPath, string additionalRepositories, string settingsDirectory, LogMessage logger = null ) : PlayServicesSupport

Creates an instance of PlayServicesSupport. This instance is used to add dependencies for the calling client and invoke the resolution.

FindCandidate ( Dependency dep ) : Dependency
FindCandidate ( string repoPath, Dependency dep ) : Dependency

Finds an acceptable candidate for the given dependency.

GetDependencies ( Dependency dep ) : IEnumerable

Gets the dependencies of the given dependency. This is done by reading the .pom file for the BestVersion of the dependency.

Log ( string message, bool verbose = false ) : void

Log a message to the currently set logger.

message is a string to write to the log.

PersistDependencies ( ) : void

Persists the dependencies to the settings file.

ProcessMetadata ( Dependency dep, string fname ) : void

Reads the maven metadata for an artifact. This reads the list of available versions.

ResetDependencies ( ) : void

Resets the dependencies. FOR TESTING ONLY!!!

Method Details

ClearDependencies() public méthode

Clears the dependencies for this client.
public ClearDependencies ( ) : void
Résultat void

CopyDependencies() public méthode

Copies the dependencies from the repository to the specified directory. The destination directory is checked for an existing version of the dependency before copying. The OverwriteConfirmation delegate is called for the first existing file or directory. If the delegate returns true, the old dependency is deleted and the new one copied.
public CopyDependencies ( Dependency>.Dictionary dependencies, string destDirectory, OverwriteConfirmation confirmer ) : void
dependencies Dependency>.Dictionary The dependencies to copy.
destDirectory string Destination directory.
confirmer OverwriteConfirmation Confirmer - the delegate for confirming overwriting.
Résultat void

CreateInstance() public static méthode

Creates an instance of PlayServicesSupport. This instance is used to add dependencies for the calling client and invoke the resolution.
public static CreateInstance ( string clientName, string sdkPath, string settingsDirectory, LogMessage logger = null ) : PlayServicesSupport
clientName string Client name. Must be a valid filename. /// This is used to uniquely identify /// the calling client so that dependencies can be associated with a specific /// client to help in resetting dependencies.
sdkPath string Sdk path for Android SDK.
settingsDirectory string The relative path to the directory /// to save the settings. For Unity projects this is "ProjectSettings"
logger LogMessage Delegate used to write messages to the log.
Résultat PlayServicesSupport

DeleteExistingFileOrDirectory() static public méthode

Delete a file or directory if it exists.
static public DeleteExistingFileOrDirectory ( string path ) : void
path string Path to the file or directory to delete if it exists.
Résultat void

DependOn() public méthode

Adds a dependency to the project.
This method should be called for each library that is required. Transitive dependencies are processed so only directly referenced libraries need to be added.

The version string can be contain a trailing + to indicate " or greater". Trailing 0s are implied. For example:

1.0 means only version 1.0, but also matches 1.0.0.

1.2.3+ means version 1.2.3 or 1.2.4, etc. but not 1.3.

0+ means any version.

LATEST means the only the latest version.

public DependOn ( string group, string artifact, string version, string packageIds = null, string repositories = null ) : void
group string Group - the Group Id of the artiface
artifact string Artifact - Artifact Id
version string Version - the version constraint
packageIds string Optional list of Android SDK package identifiers.
repositories string List of additional repository directories to search for /// this artifact.
Résultat void

LoadDependencies() public méthode

Loads the dependencies from the settings files.
public LoadDependencies ( bool allClients, bool keepMissing = false ) : Dependency>.Dictionary
allClients bool If true, all client dependencies are loaded and returned ///
keepMissing bool If false, missing dependencies result in a /// ResolutionException being thrown. If true, each missing dependency is included in /// the returned set with RepoPath set to an empty string.
Résultat Dependency>.Dictionary

ResolveDependencies() public méthode

Performs the resolution process. This determines the versions of the dependencies that should be used. Transitive dependencies are also processed.
public ResolveDependencies ( bool useLatest ) : Dependency>.Dictionary
useLatest bool If set to true use latest version of a conflicting dependency. /// if false a ResolutionException is thrown in the case of a conflict.
Résultat Dependency>.Dictionary