From ee400ee73ebae7d34dcdafcf2746bbeaab7ebab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pin=CC=83era?= Date: Sat, 21 Jul 2018 10:15:43 -0400 Subject: [PATCH] Add deprecation annotation to the context classes --- Sources/xpmkit/Generator/GeneratorContext.swift | 1 + Sources/xpmkit/Loader/GraphLoaderContext.swift | 1 + Sources/xpmkit/Utils/Context.swift | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Sources/xpmkit/Generator/GeneratorContext.swift b/Sources/xpmkit/Generator/GeneratorContext.swift index 4771161d0..fa72d08b2 100644 --- a/Sources/xpmkit/Generator/GeneratorContext.swift +++ b/Sources/xpmkit/Generator/GeneratorContext.swift @@ -2,6 +2,7 @@ import Foundation import xpmcore /// Generator context protocol. +@available(*, deprecated, message: "The context approach for injecting dependencies is deprecated. Inject dependencies through the constructor instead.") protocol GeneratorContexting: Contexting { /// Graph that is beging generated. var graph: Graphing { get } diff --git a/Sources/xpmkit/Loader/GraphLoaderContext.swift b/Sources/xpmkit/Loader/GraphLoaderContext.swift index c45ea2ade..3f6501ad1 100644 --- a/Sources/xpmkit/Loader/GraphLoaderContext.swift +++ b/Sources/xpmkit/Loader/GraphLoaderContext.swift @@ -3,6 +3,7 @@ import Foundation import xpmcore /// Protocol that defines the interface of the context that is used during the graph loading. +@available(*, deprecated, message: "The context approach for injecting dependencies is deprecated. Inject dependencies through the constructor instead.") protocol GraphLoaderContexting: Contexting { /// Manifest loader that is used to get a JSON representation of the manifests. var manifestLoader: GraphManifestLoading { get } diff --git a/Sources/xpmkit/Utils/Context.swift b/Sources/xpmkit/Utils/Context.swift index d428aeaaf..e2a1afe67 100644 --- a/Sources/xpmkit/Utils/Context.swift +++ b/Sources/xpmkit/Utils/Context.swift @@ -2,6 +2,7 @@ import Foundation import xpmcore /// Context protocol. +@available(*, deprecated, message: "The context approach for injecting dependencies is deprecated. Inject dependencies through the constructor instead.") protocol Contexting: AnyObject { /// Shell. var shell: Shelling { get } @@ -18,6 +19,7 @@ protocol Contexting: AnyObject { /// xpm uses contexts as a dependency injection mechanism. /// Contexts are initialized by the commands and passed to the different components that will use the dependencies defined in them. +@available(*, deprecated, message: "The context approach for injecting dependencies is deprecated. Inject dependencies through the constructor instead.") class Context: Contexting { /// Util to handle files. let fileHandler: FileHandling