mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-25 17:24:17 -05:00
creating one package which includes sqltoolsservice and credential service (#444)
* creating one package which includes sqltoolsservice and credential service * adding logDir arg to credentials program
This commit is contained in:
20
build.cake
20
build.cake
@@ -41,6 +41,7 @@ public class BuildPlan
|
||||
public string ArtifactsFolder { get; set; }
|
||||
public bool UseSystemDotNetPath { get; set; }
|
||||
public string DotNetFolder { get; set; }
|
||||
public string PackageName { get; set; }
|
||||
public string DotNetInstallScriptURL { get; set; }
|
||||
public string DotNetChannel { get; set; }
|
||||
public string DotNetVersion { get; set; }
|
||||
@@ -313,6 +314,7 @@ Task("OnlyPublish")
|
||||
.IsDependentOn("CodeGen")
|
||||
.Does(() =>
|
||||
{
|
||||
var packageName = buildPlan.PackageName;
|
||||
foreach (var project in buildPlan.MainProjects)
|
||||
{
|
||||
var projectFolder = System.IO.Path.Combine(sourceFolder, project);
|
||||
@@ -320,7 +322,7 @@ Task("OnlyPublish")
|
||||
{
|
||||
foreach (var runtime in buildPlan.Rids)
|
||||
{
|
||||
var outputFolder = System.IO.Path.Combine(publishFolder, project, runtime, framework);
|
||||
var outputFolder = System.IO.Path.Combine(publishFolder, packageName, runtime, framework);
|
||||
var publishArguments = "publish";
|
||||
if (!runtime.Equals("default"))
|
||||
{
|
||||
@@ -337,12 +339,20 @@ Task("OnlyPublish")
|
||||
{
|
||||
Run("install_name_tool", "-add_rpath /usr/local/opt/openssl/lib " + outputFolder + "/System.Security.Cryptography.Native.dylib");
|
||||
}
|
||||
if (requireArchive)
|
||||
{
|
||||
Package(runtime, framework, outputFolder, packageFolder, project.ToLower(), workingDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requireArchive)
|
||||
{
|
||||
foreach (var framework in buildPlan.Frameworks)
|
||||
{
|
||||
foreach (var runtime in buildPlan.Rids)
|
||||
{
|
||||
var outputFolder = System.IO.Path.Combine(publishFolder, packageName, runtime, framework);
|
||||
Package(runtime, framework, outputFolder, packageFolder, packageName, workingDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
CreateRunScript(System.IO.Path.Combine(publishFolder, project, "default"), scriptFolder);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"DotNetVersion": "1.0.0-preview2-003121",
|
||||
"BuildToolsFolder": ".tools",
|
||||
"ArtifactsFolder": "artifacts",
|
||||
"PackageName": "Microsoft.SqlTools.ServiceLayer",
|
||||
"TestProjects": {
|
||||
"Microsoft.SqlTools.ServiceLayer.UnitTests": [
|
||||
"netcoreapp2.0"
|
||||
|
||||
@@ -102,12 +102,13 @@ void CopyEulas(string runtime, string framework, string contentFolder, string pa
|
||||
"*.RTF",
|
||||
SearchOption.AllDirectories).ToList();
|
||||
|
||||
foreach (var file in files) {
|
||||
System.IO.File.Copy(
|
||||
file,
|
||||
System.IO.Path.Combine(
|
||||
contentFolder,
|
||||
System.IO.Path.GetFileName(file)));
|
||||
foreach (var file in files)
|
||||
{
|
||||
var dest = System.IO.Path.Combine(contentFolder, System.IO.Path.GetFileName(file));
|
||||
if (!System.IO.File.Exists(dest))
|
||||
{
|
||||
System.IO.File.Copy(file, dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.SqlTools.Credentials.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
@@ -28,9 +29,15 @@ namespace Microsoft.SqlTools.Credentials
|
||||
return;
|
||||
}
|
||||
|
||||
string logFilePath = "credentials";
|
||||
if (!string.IsNullOrWhiteSpace(commandOptions.LoggingDirectory))
|
||||
{
|
||||
logFilePath = Path.Combine(commandOptions.LoggingDirectory, logFilePath);
|
||||
}
|
||||
|
||||
// turn on Verbose logging during early development
|
||||
// we need to switch to Normal when preparing for public preview
|
||||
Logger.Initialize(minimumLogLevel: LogLevel.Verbose, isEnabled: commandOptions.EnableLogging);
|
||||
Logger.Initialize(logFilePath, minimumLogLevel: LogLevel.Verbose, isEnabled: commandOptions.EnableLogging);
|
||||
Logger.Write(LogLevel.Normal, "Starting SqlTools Credentials Provider");
|
||||
|
||||
// set up the host details and profile paths
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.SqlTools.Credentials.Utility
|
||||
{
|
||||
@@ -26,11 +27,19 @@ namespace Microsoft.SqlTools.Credentials.Utility
|
||||
string arg = args[i];
|
||||
if (arg.StartsWith("--") || arg.StartsWith("-"))
|
||||
{
|
||||
if (arg.StartsWith("--"))
|
||||
{
|
||||
// Extracting arguments and properties
|
||||
arg = arg.Substring(1).ToLowerInvariant();
|
||||
}
|
||||
switch (arg)
|
||||
{
|
||||
case "-enable-logging":
|
||||
EnableLogging = true;
|
||||
break;
|
||||
case "-log-dir":
|
||||
SetLoggingDirectory(args[++i]);
|
||||
break;
|
||||
case "h":
|
||||
case "-help":
|
||||
ShouldExit = true;
|
||||
@@ -64,11 +73,26 @@ namespace Microsoft.SqlTools.Credentials.Utility
|
||||
/// </summary>
|
||||
public bool EnableLogging { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory where log files are output.
|
||||
/// </summary>
|
||||
public string LoggingDirectory { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the program should exit immediately. Set to true when the usage is printed.
|
||||
/// </summary>
|
||||
public bool ShouldExit { get; private set; }
|
||||
|
||||
private void SetLoggingDirectory(string loggingDirectory)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(loggingDirectory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.LoggingDirectory = Path.GetFullPath(loggingDirectory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the usage string describing command-line arguments for the program
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user