Skip to content

Commit f277816

Browse files
author
Nate McMaster
committed
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.
1 parent 80e6430 commit f277816

File tree

22 files changed

+73
-103
lines changed

22 files changed

+73
-103
lines changed

src/Microsoft.DotNet.Watcher.Tools/Internal/MsBuildFileSetFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ private string FindWatchTargetsDir()
164164
{
165165
AppContext.BaseDirectory,
166166
assemblyDir,
167-
Path.Combine(assemblyDir, "../../tools"), // from nuget cache
168-
Path.Combine(assemblyDir, "tools") // from local build
167+
Path.Combine(assemblyDir, "../../toolassets"), // from nuget cache
168+
Path.Combine(assemblyDir, "toolassets"), // from local build
169+
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
169170
};
170171

171172
var targetPath = searchPaths.Select(p => Path.Combine(p, WatchTargetsFileName)).First(File.Exists);

src/Microsoft.DotNet.Watcher.Tools/Microsoft.DotNet.Watcher.Tools.nuspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
</dependencies>
2020
</metadata>
2121
<files>
22+
<file src="prefercliruntime" target="\prefercliruntime" />
2223
<file src="dotnet-watch.dll" target="lib\netcoreapp1.0\" />
2324
<file src="dotnet-watch.deps.json" target="lib\netcoreapp1.0\" />
2425
<file src="dotnet-watch.runtimeconfig.json" target="lib\netcoreapp1.0\" />
25-
<file src="tools\DotNetWatchCommon.targets" target="tools\" />
26-
<file src="tools\DotNetWatchInner.targets" target="tools\" />
27-
<file src="tools\DotNetWatchOuter.targets" target="tools\" />
28-
<file src="tools\*.targets" target="tools\" />
26+
<file src="toolassets\DotNetWatchCommon.targets" target="toolassets\" />
27+
<file src="toolassets\DotNetWatchInner.targets" target="toolassets\" />
28+
<file src="toolassets\DotNetWatchOuter.targets" target="toolassets\" />
29+
<file src="toolassets\*.targets" target="toolassets\" />
2930
</files>
3031
</package>

src/Microsoft.DotNet.Watcher.Tools/prefercliruntime

Whitespace-only changes.

src/Microsoft.DotNet.Watcher.Tools/project.json

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
{
22
"version": "1.0.0-*",
3-
"description": "Command line tool to watch for source file changes during development and restart the dotnet command.",
4-
"packOptions": {
5-
"tags": [
6-
"dotnet",
7-
"watch"
8-
],
9-
"files": {
10-
"include": "tools/*.targets"
11-
}
12-
},
133
"buildOptions": {
144
"outputName": "dotnet-watch",
155
"warningsAsErrors": true,
166
"emitEntryPoint": true,
177
"debugType": "portable",
188
"keyFile": "../../tools/Key.snk",
19-
"copyToOutput": "tools/*.targets",
9+
"copyToOutput": "toolassets/*.targets",
2010
"embed": {
2111
"mappings": {
2212
"dotnetwatch.targets": "dotnetwatch.targets"
@@ -28,7 +18,8 @@
2818
},
2919
"publishOptions": {
3020
"include": [
31-
"tools/*.targets"
21+
"toolassets/*.targets",
22+
"prefercliruntime"
3223
]
3324
},
3425
"dependencies": {
@@ -38,7 +29,7 @@
3829
},
3930
"Microsoft.NETCore.App": {
4031
"type": "platform",
41-
"version": "1.0.1"
32+
"version": "1.0.0"
4233
}
4334
},
4435
"frameworks": {

src/Microsoft.Extensions.Caching.SqlConfig.Tools/Microsoft.Extensions.Caching.SqlConfig.Tools.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
</dependencies>
2121
</metadata>
2222
<files>
23+
<file src="prefercliruntime" target="\prefercliruntime" />
2324
<file src="dotnet-sql-cache.dll" target="lib\netcoreapp1.0\" />
2425
<file src="dotnet-sql-cache.deps.json" target="lib\netcoreapp1.0\" />
2526
<file src="dotnet-sql-cache.runtimeconfig.json" target="lib\netcoreapp1.0\" />

src/Microsoft.Extensions.Caching.SqlConfig.Tools/prefercliruntime

Whitespace-only changes.

src/Microsoft.Extensions.Caching.SqlConfig.Tools/project.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,13 @@
66
"warningsAsErrors": true,
77
"keyFile": "../../tools/Key.snk",
88
"compile": "../Shared/**/*.cs"
9-
109
},
11-
"description": "Command line tool to create tables and indexes in a Microsoft SQL Server database for distributed caching.",
12-
"packOptions": {
13-
"repository": {
14-
"type": "git",
15-
"url": "https://github.com/aspnet/DotNetTools"
16-
},
17-
"tags": [
18-
"cache",
19-
"distributedcache",
20-
"sqlserver"
21-
]
10+
"publishOptions": {
11+
"include": "prefercliruntime"
2212
},
2313
"dependencies": {
2414
"Microsoft.NETCore.App": {
25-
"version": "1.0.1",
15+
"version": "1.0.0",
2616
"type": "platform"
2717
},
2818
"System.Data.SqlClient": "4.1.0"

src/Microsoft.Extensions.SecretManager.Tools/Internal/ProjectIdResolver.cs

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ public string Resolve(string project, string configuration)
8181
return id;
8282
}
8383

84-
public void Dispose()
85-
{
86-
foreach (var file in _tempFiles)
87-
{
88-
TryDelete(file);
89-
}
90-
}
91-
9284
private string GetTargetFile()
9385
{
9486
var assemblyDir = Path.GetDirectoryName(GetType().GetTypeInfo().Assembly.Location);
@@ -98,33 +90,23 @@ private string GetTargetFile()
9890
{
9991
AppContext.BaseDirectory,
10092
assemblyDir, // next to assembly
101-
Path.Combine(assemblyDir, "../../tools"), // inside the nupkg
93+
Path.Combine(assemblyDir, "../../toolassets"), // inside the nupkg
94+
Path.Combine(assemblyDir, "toolassets"), // for local builds
95+
Path.Combine(AppContext.BaseDirectory, "../../toolassets"), // relative to packaged deps.json
10296
};
10397

104-
var foundFile = searchPaths
98+
return searchPaths
10599
.Select(dir => Path.Combine(dir, TargetsFileName))
106100
.Where(File.Exists)
107-
.FirstOrDefault();
108-
109-
if (foundFile != null)
110-
{
111-
return foundFile;
112-
}
101+
.First();
102+
}
113103

114-
// This should only really happen during testing. Current build system doesn't give us a good way to ensure the
115-
// test project has an always-up to date version of the targets file.
116-
// TODO cleanup after we switch to an MSBuild system in which can specify "CopyToOutputDirectory: Always" to resolve this issue
117-
var outputPath = Path.GetTempFileName();
118-
using (var resource = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(TargetsFileName))
119-
using (var stream = new FileStream(outputPath, FileMode.Create))
104+
public void Dispose()
105+
{
106+
foreach (var file in _tempFiles)
120107
{
121-
resource.CopyTo(stream);
108+
TryDelete(file);
122109
}
123-
124-
// cleanup
125-
_tempFiles.Add(outputPath);
126-
127-
return outputPath;
128110
}
129111

130112
private static void TryDelete(string file)

src/Microsoft.Extensions.SecretManager.Tools/Microsoft.Extensions.SecretManager.Tools.nuspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
</dependencies>
2323
</metadata>
2424
<files>
25-
<file src="FindUserSecretsProperty.targets" target="tools\" />
25+
<file src="prefercliruntime" target="\prefercliruntime" />
26+
<file src="toolassets\FindUserSecretsProperty.targets" target="toolassets\" />
2627
<file src="dotnet-user-secrets.dll" target="lib\netcoreapp1.0\" />
2728
<file src="dotnet-user-secrets.deps.json" target="lib\netcoreapp1.0\" />
2829
<file src="dotnet-user-secrets.runtimeconfig.json" target="lib\netcoreapp1.0\" />

src/Microsoft.Extensions.SecretManager.Tools/prefercliruntime

Whitespace-only changes.

src/Microsoft.Extensions.SecretManager.Tools/project.json

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,21 @@
55
"emitEntryPoint": true,
66
"warningsAsErrors": true,
77
"keyFile": "../../tools/Key.snk",
8-
"copyToOutput": "*.targets",
9-
"embed": {
10-
"mappings": {
11-
"FindUserSecretsProperty.targets": "./FindUserSecretsProperty.targets"
12-
}
13-
},
8+
"copyToOutput": "toolassets/*.targets",
149
"compile": {
1510
"include": "../Shared/**/*.cs"
1611
}
1712
},
18-
"description": "Command line tool to manage user secrets for Microsoft.Extensions.Configuration.",
19-
"packOptions": {
20-
"repository": {
21-
"type": "git",
22-
"url": "https://github.com/aspnet/DotNetTools"
23-
},
24-
"tags": [
25-
"configuration",
26-
"secrets",
27-
"usersecrets"
28-
],
29-
"files": {
30-
"mappings": {
31-
"tools/FindUserSecretsProperty.targets": "FindUserSecretsProperty.targets"
32-
}
33-
}
34-
},
3513
"publishOptions": {
3614
"include": [
37-
"*.targets"
15+
"toolassets/*.targets",
16+
"prefercliruntime"
3817
]
3918
},
4019
"dependencies": {
4120
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
4221
"Microsoft.NETCore.App": {
43-
"version": "1.0.1",
22+
"version": "1.0.0",
4423
"type": "platform"
4524
}
4625
},

test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.cmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
if not "%1" == "" (
44
echo "Deleting %1\TestProjects"
55
rmdir /s /q %1\TestProjects
6-
echo "Deleting %1\tools"
7-
rmdir /s /q %1\tools
6+
echo "Deleting %1\toolassets"
7+
rmdir /s /q %1\toolassets
88
)
99

10-
mkdir %1\tools
11-
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\tools\*.targets %1\tools
10+
mkdir %1\toolassets
11+
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\toolassets\*.targets %1\toolassets

test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ if [ -z $1 ]; then
44
echo "Deleting $1/TestProjects"
55
rm -rf $1/TestProjects
66

7-
echo "Deleting $1/tools"
8-
rm -rf $1/tools
7+
echo "Deleting $1/toolassets"
8+
rm -rf $1/toolassets
99
fi
1010

11-
mkdir -p $1/tools
12-
cp ../../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets $1/tools
11+
mkdir -p $1/toolassets
12+
cp ../../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets $1/toolassets
1313

1414
exit 0
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@ECHO OFF
22
:again
33
if not "%1" == "" (
4-
echo "Deleting %1\tools"
5-
rmdir /s /q %1\tools
4+
echo "Deleting %1\toolassets"
5+
rmdir /s /q %1\toolassets
66
)
77

8-
mkdir %1\tools
9-
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\tools\*.targets %1\tools
8+
mkdir %1\toolassets
9+
copy ..\..\src\Microsoft.DotNet.Watcher.Tools\toolassets\*.targets %1\toolassets
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

33
if [ -z $1 ]; then
4-
echo "Deleting $1/tools"
5-
rm -rf $1/tools
4+
echo "Deleting $1/toolassets"
5+
rm -rf $1/toolassets
66
fi
77

8-
mkdir -p $1/tools
9-
echo "Copying ./../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets"
10-
cp ../../src/Microsoft.DotNet.Watcher.Tools/tools/*.targets $1/tools
8+
mkdir -p $1/toolassets
9+
echo "Copying ./../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets"
10+
cp ../../src/Microsoft.DotNet.Watcher.Tools/toolassets/*.targets $1/toolassets
1111

1212
exit 0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@ECHO OFF
2+
:again
3+
if not "%1" == "" (
4+
echo "Deleting %1\toolassets"
5+
rmdir /s /q %1\toolassets
6+
)
7+
8+
mkdir %1\toolassets
9+
copy ..\..\src\Microsoft.Extensions.SecretManager.Tools\toolassets\*.targets %1\toolassets
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z $1 ]; then
4+
echo "Deleting $1/toolassets"
5+
rm -rf $1/toolassets
6+
fi
7+
8+
mkdir -p $1/toolassets
9+
echo "Copying ./../src/Microsoft.Extensions.SecretManager.Tools/toolassets/*.targets"
10+
cp ../../src/Microsoft.Extensions.SecretManager.Tools/toolassets/*.targets $1/toolassets
11+
12+
exit 0

test/Microsoft.Extensions.SecretManager.Tools.Tests/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
}
2121
}
2222
}
23+
},
24+
"scripts": {
25+
"precompile": "copyfiles %compile:OutputDir%"
2326
}
2427
}

0 commit comments

Comments
 (0)