Update packaging for tools

Move targets files in to 'toolassets'. The 'tools' folder has conventions in NuGet that we don't want applied to these packages.

Downgrade to Microsoft.NETCore.App 1.0.0

Add 'prefercliruntime' package.
This commit is contained in:
Nate McMaster 2016-12-07 09:30:18 -08:00
parent 80e6430332
commit f277816556
No known key found for this signature in database
GPG Key ID: BD729980AA6A21BD
22 changed files with 73 additions and 103 deletions

View File

@ -164,8 +164,9 @@ namespace Microsoft.DotNet.Watcher.Internal
{ {
AppContext.BaseDirectory, AppContext.BaseDirectory,
assemblyDir, assemblyDir,
Path.Combine(assemblyDir, "../../tools"), // from nuget cache Path.Combine(assemblyDir, "../../toolassets"), // from nuget cache
Path.Combine(assemblyDir, "tools") // from local build Path.Combine(assemblyDir, "toolassets"), // from local build
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
}; };
var targetPath = searchPaths.Select(p => Path.Combine(p, WatchTargetsFileName)).First(File.Exists); var targetPath = searchPaths.Select(p => Path.Combine(p, WatchTargetsFileName)).First(File.Exists);

View File

@ -19,12 +19,13 @@
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>
<file src="prefercliruntime" target="\prefercliruntime" />
<file src="dotnet-watch.dll" target="lib\netcoreapp1.0\" /> <file src="dotnet-watch.dll" target="lib\netcoreapp1.0\" />
<file src="dotnet-watch.deps.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-watch.deps.json" target="lib\netcoreapp1.0\" />
<file src="dotnet-watch.runtimeconfig.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-watch.runtimeconfig.json" target="lib\netcoreapp1.0\" />
<file src="tools\DotNetWatchCommon.targets" target="tools\" /> <file src="toolassets\DotNetWatchCommon.targets" target="toolassets\" />
<file src="tools\DotNetWatchInner.targets" target="tools\" /> <file src="toolassets\DotNetWatchInner.targets" target="toolassets\" />
<file src="tools\DotNetWatchOuter.targets" target="tools\" /> <file src="toolassets\DotNetWatchOuter.targets" target="toolassets\" />
<file src="tools\*.targets" target="tools\" /> <file src="toolassets\*.targets" target="toolassets\" />
</files> </files>
</package> </package>

View File

@ -1,22 +1,12 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"description": "Command line tool to watch for source file changes during development and restart the dotnet command.",
"packOptions": {
"tags": [
"dotnet",
"watch"
],
"files": {
"include": "tools/*.targets"
}
},
"buildOptions": { "buildOptions": {
"outputName": "dotnet-watch", "outputName": "dotnet-watch",
"warningsAsErrors": true, "warningsAsErrors": true,
"emitEntryPoint": true, "emitEntryPoint": true,
"debugType": "portable", "debugType": "portable",
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"copyToOutput": "tools/*.targets", "copyToOutput": "toolassets/*.targets",
"embed": { "embed": {
"mappings": { "mappings": {
"dotnetwatch.targets": "dotnetwatch.targets" "dotnetwatch.targets": "dotnetwatch.targets"
@ -28,7 +18,8 @@
}, },
"publishOptions": { "publishOptions": {
"include": [ "include": [
"tools/*.targets" "toolassets/*.targets",
"prefercliruntime"
] ]
}, },
"dependencies": { "dependencies": {
@ -38,7 +29,7 @@
}, },
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"type": "platform", "type": "platform",
"version": "1.0.1" "version": "1.0.0"
} }
}, },
"frameworks": { "frameworks": {

View File

@ -20,6 +20,7 @@
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>
<file src="prefercliruntime" target="\prefercliruntime" />
<file src="dotnet-sql-cache.dll" target="lib\netcoreapp1.0\" /> <file src="dotnet-sql-cache.dll" target="lib\netcoreapp1.0\" />
<file src="dotnet-sql-cache.deps.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-sql-cache.deps.json" target="lib\netcoreapp1.0\" />
<file src="dotnet-sql-cache.runtimeconfig.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-sql-cache.runtimeconfig.json" target="lib\netcoreapp1.0\" />

View File

@ -6,23 +6,13 @@
"warningsAsErrors": true, "warningsAsErrors": true,
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"compile": "../Shared/**/*.cs" "compile": "../Shared/**/*.cs"
}, },
"description": "Command line tool to create tables and indexes in a Microsoft SQL Server database for distributed caching.", "publishOptions": {
"packOptions": { "include": "prefercliruntime"
"repository": {
"type": "git",
"url": "https://github.com/aspnet/DotNetTools"
},
"tags": [
"cache",
"distributedcache",
"sqlserver"
]
}, },
"dependencies": { "dependencies": {
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"version": "1.0.1", "version": "1.0.0",
"type": "platform" "type": "platform"
}, },
"System.Data.SqlClient": "4.1.0" "System.Data.SqlClient": "4.1.0"

View File

@ -81,14 +81,6 @@ namespace Microsoft.Extensions.SecretManager.Tools.Internal
return id; return id;
} }
public void Dispose()
{
foreach (var file in _tempFiles)
{
TryDelete(file);
}
}
private string GetTargetFile() private string GetTargetFile()
{ {
var assemblyDir = Path.GetDirectoryName(GetType().GetTypeInfo().Assembly.Location); var assemblyDir = Path.GetDirectoryName(GetType().GetTypeInfo().Assembly.Location);
@ -98,33 +90,23 @@ namespace Microsoft.Extensions.SecretManager.Tools.Internal
{ {
AppContext.BaseDirectory, AppContext.BaseDirectory,
assemblyDir, // next to assembly assemblyDir, // next to assembly
Path.Combine(assemblyDir, "../../tools"), // inside the nupkg Path.Combine(assemblyDir, "../../toolassets"), // inside the nupkg
Path.Combine(assemblyDir, "toolassets"), // for local builds
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
}; };
var foundFile = searchPaths return searchPaths
.Select(dir => Path.Combine(dir, TargetsFileName)) .Select(dir => Path.Combine(dir, TargetsFileName))
.Where(File.Exists) .Where(File.Exists)
.FirstOrDefault(); .First();
}
if (foundFile != null) public void Dispose()
{
foreach (var file in _tempFiles)
{ {
return foundFile; TryDelete(file);
} }
// This should only really happen during testing. Current build system doesn't give us a good way to ensure the
// test project has an always-up to date version of the targets file.
// TODO cleanup after we switch to an MSBuild system in which can specify "CopyToOutputDirectory: Always" to resolve this issue
var outputPath = Path.GetTempFileName();
using (var resource = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(TargetsFileName))
using (var stream = new FileStream(outputPath, FileMode.Create))
{
resource.CopyTo(stream);
}
// cleanup
_tempFiles.Add(outputPath);
return outputPath;
} }
private static void TryDelete(string file) private static void TryDelete(string file)

View File

@ -22,7 +22,8 @@
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>
<file src="FindUserSecretsProperty.targets" target="tools\" /> <file src="prefercliruntime" target="\prefercliruntime" />
<file src="toolassets\FindUserSecretsProperty.targets" target="toolassets\" />
<file src="dotnet-user-secrets.dll" target="lib\netcoreapp1.0\" /> <file src="dotnet-user-secrets.dll" target="lib\netcoreapp1.0\" />
<file src="dotnet-user-secrets.deps.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-user-secrets.deps.json" target="lib\netcoreapp1.0\" />
<file src="dotnet-user-secrets.runtimeconfig.json" target="lib\netcoreapp1.0\" /> <file src="dotnet-user-secrets.runtimeconfig.json" target="lib\netcoreapp1.0\" />

View File

@ -5,42 +5,21 @@
"emitEntryPoint": true, "emitEntryPoint": true,
"warningsAsErrors": true, "warningsAsErrors": true,
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"copyToOutput": "*.targets", "copyToOutput": "toolassets/*.targets",
"embed": {
"mappings": {
"FindUserSecretsProperty.targets": "./FindUserSecretsProperty.targets"
}
},
"compile": { "compile": {
"include": "../Shared/**/*.cs" "include": "../Shared/**/*.cs"
} }
}, },
"description": "Command line tool to manage user secrets for Microsoft.Extensions.Configuration.",
"packOptions": {
"repository": {
"type": "git",
"url": "https://github.com/aspnet/DotNetTools"
},
"tags": [
"configuration",
"secrets",
"usersecrets"
],
"files": {
"mappings": {
"tools/FindUserSecretsProperty.targets": "FindUserSecretsProperty.targets"
}
}
},
"publishOptions": { "publishOptions": {
"include": [ "include": [
"*.targets" "toolassets/*.targets",
"prefercliruntime"
] ]
}, },
"dependencies": { "dependencies": {
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"version": "1.0.1", "version": "1.0.0",
"type": "platform" "type": "platform"
} }
}, },

View File

@ -3,9 +3,9 @@
if not "%1" == "" ( if not "%1" == "" (
echo "Deleting %1\TestProjects" echo "Deleting %1\TestProjects"
rmdir /s /q %1\TestProjects rmdir /s /q %1\TestProjects
echo "Deleting %1\tools" echo "Deleting %1\toolassets"
rmdir /s /q %1\tools rmdir /s /q %1\toolassets
) )
mkdir %1\tools mkdir %1\toolassets
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\tools\*.targets %1\tools copy ..\..\src\Microsoft.DotNet.Watcher.Tools\toolassets\*.targets %1\toolassets

View File

@ -4,11 +4,11 @@ if [ -z $1 ]; then
echo "Deleting $1/TestProjects" echo "Deleting $1/TestProjects"
rm -rf $1/TestProjects rm -rf $1/TestProjects
echo "Deleting $1/tools" echo "Deleting $1/toolassets"
rm -rf $1/tools rm -rf $1/toolassets
fi fi
mkdir -p $1/tools mkdir -p $1/toolassets
cp ../../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets $1/tools cp ../../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets $1/toolassets
exit 0 exit 0

View File

@ -1,9 +1,9 @@
@ECHO OFF @ECHO OFF
:again :again
if not "%1" == "" ( if not "%1" == "" (
echo "Deleting %1\tools" echo "Deleting %1\toolassets"
rmdir /s /q %1\tools rmdir /s /q %1\toolassets
) )
mkdir %1\tools mkdir %1\toolassets
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\tools\*.targets %1\tools copy ..\..\src\Microsoft.DotNet.Watcher.Tools\toolassets\*.targets %1\toolassets

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -z $1 ]; then if [ -z $1 ]; then
echo "Deleting $1/tools" echo "Deleting $1/toolassets"
rm -rf $1/tools rm -rf $1/toolassets
fi fi
mkdir -p $1/tools mkdir -p $1/toolassets
echo "Copying ./../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets" echo "Copying ./../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets"
cp ../../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets $1/tools cp ../../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets $1/toolassets
exit 0 exit 0

View File

@ -0,0 +1,9 @@
@ECHO OFF
:again
if not "%1" == "" (
echo "Deleting %1\toolassets"
rmdir /s /q %1\toolassets
)
mkdir %1\toolassets
copy ..\..\src\Microsoft.Extensions.SecretManager.Tools\toolassets\*.targets %1\toolassets

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [ -z $1 ]; then
echo "Deleting $1/toolassets"
rm -rf $1/toolassets
fi
mkdir -p $1/toolassets
echo "Copying ./../src/Microsoft.Extensions.SecretManager.Tools/toolassets/*.targets"
cp ../../src/Microsoft.Extensions.SecretManager.Tools/toolassets/*.targets $1/toolassets
exit 0

View File

@ -20,5 +20,8 @@
} }
} }
} }
},
"scripts": {
"precompile": "copyfiles %compile:OutputDir%"
} }
} }