From 14f08ccf055dd46f287ad5b316b90bfb7f54d898 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 16 Jul 2020 16:41:46 -0700 Subject: [PATCH] Add clone directory (#589) --- docs/reference/schema.md | 4 ++++ src/Microsoft.Tye.Core/ApplicationFactory.cs | 2 +- src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs | 1 + src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs | 3 +++ src/schema/tye-schema.json | 5 +++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/reference/schema.md b/docs/reference/schema.md index 4d106d7d..dad266c5 100644 --- a/docs/reference/schema.md +++ b/docs/reference/schema.md @@ -216,6 +216,10 @@ A path to another tye.yaml to be used by the application. A reference to a repository that will be cloned and used by the application. By default, it is a string that would be passed after `git clone`. +#### `cloneDirectory` (string) + +The directory to clone to. If unspecified, tye will clone into the .tye/deps relative to where tye is started. + #### `azureFunction` (string) A path to a folder which contains an azure function project. diff --git a/src/Microsoft.Tye.Core/ApplicationFactory.cs b/src/Microsoft.Tye.Core/ApplicationFactory.cs index 8c212a5d..41f98e09 100644 --- a/src/Microsoft.Tye.Core/ApplicationFactory.cs +++ b/src/Microsoft.Tye.Core/ApplicationFactory.cs @@ -186,7 +186,7 @@ namespace Microsoft.Tye else if (!string.IsNullOrEmpty(configService.Repository)) { // clone to .tye folder - var path = Path.Join(rootConfig.Source.DirectoryName, ".tye", "deps"); + var path = configService.CloneDirectory ?? Path.Join(rootConfig.Source.DirectoryName, ".tye", "deps"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); diff --git a/src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs b/src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs index fa2636d0..aabebe9f 100644 --- a/src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs +++ b/src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs @@ -44,5 +44,6 @@ namespace Microsoft.Tye.ConfigModel public string? FuncExecutable { get; set; } public string? Version { get; set; } public string? Architecture { get; set; } + public string? CloneDirectory { get; internal set; } } } diff --git a/src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs b/src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs index 19d8305a..e719bb9f 100644 --- a/src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs +++ b/src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs @@ -152,6 +152,9 @@ namespace Tye.Serialization case "pathToFunc": service.FuncExecutable = YamlParser.GetScalarValue(key, child.Value); break; + case "cloneDirectory": + service.CloneDirectory = YamlParser.GetScalarValue(key, child.Value); + break; default: throw new TyeYamlException(child.Key.Start, CoreStrings.FormatUnrecognizedKey(key)); } diff --git a/src/schema/tye-schema.json b/src/schema/tye-schema.json index c46a5755..0d9a3b31 100644 --- a/src/schema/tye-schema.json +++ b/src/schema/tye-schema.json @@ -285,6 +285,11 @@ { "description": "The repository url which will be cloned.", "type": "string" + }, + "cloneDirectory": + { + "description": "The directory to clone the repository into.", + "type": "string" } }, "required": [