WASM: Add pkgproj for the browser debug proxy/host transport package (#40494)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 7 Aug 2020 20:52:31 +0000 (22:52 +0200)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 20:52:31 +0000 (22:52 +0200)
* WASM: Add pkgproj for the browser debug proxy/host transport package

* Update src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
eng/Subsets.props
src/mono/netcore/nuget/Directory.Build.props [new file with mode: 0644]
src/mono/netcore/nuget/Directory.Build.targets [new file with mode: 0644]
src/mono/netcore/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/Microsoft.NETCore.BrowserDebugHost.Transport.pkgproj [new file with mode: 0644]
src/mono/netcore/nuget/descriptions.json [new file with mode: 0644]
src/mono/netcore/nuget/mono-packages.proj [new file with mode: 0644]
src/mono/netcore/nuget/packageIndex.json [new file with mode: 0644]
src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs

index 2c52c18..293b591 100644 (file)
@@ -57,7 +57,7 @@
     <DefaultCoreClrSubsets>clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages</DefaultCoreClrSubsets>
 
     <DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
-    <DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib</DefaultMonoSubsets>
+    <DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages</DefaultMonoSubsets>
 
     <DefaultLibrariesSubsets>libs.native+libs.ref+libs.src+libs.pretest+libs.packages</DefaultLibrariesSubsets>
 
@@ -92,6 +92,7 @@
     <SubsetName Include="Mono" Description="The Mono runtime and CoreLib." />
     <SubsetName Include="Mono.Runtime" Description="The Mono .NET runtime." />
     <SubsetName Include="Mono.CoreLib" Description="The managed System.Private.CoreLib library for Mono." />
+    <SubsetName Include="Mono.Packages" Description="The projects that produce NuGet packages for the Mono runtime." />
 
     <!-- Libs -->
     <SubsetName Include="Libs" Description="The libraries native part, refs and source assemblies, test infra and packages, but NOT the tests (use Libs.Tests to request those explicitly)" />
     <ProjectToBuild Include="$(MonoProjectRoot)llvm\llvm-init.proj" Category="mono" />
   </ItemGroup>
 
+  <ItemGroup Condition="$(_subset.Contains('+mono.packages+'))">
+    <ProjectToBuild Include="$(MonoProjectRoot)netcore\nuget\mono-packages.proj" Category="mono" Pack="true" />
+  </ItemGroup>
+
   <ItemGroup Condition="$(_subset.Contains('+mono.runtime+'))">
     <ProjectToBuild Include="$(MonoProjectRoot)mono.proj" Category="mono" />
   </ItemGroup>
diff --git a/src/mono/netcore/nuget/Directory.Build.props b/src/mono/netcore/nuget/Directory.Build.props
new file mode 100644 (file)
index 0000000..dc82034
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+
+  <!-- Packaging projects (.pkgproj) are non-SDK-style, so they need to directly import Directory.Build.props -->
+  <Import Project="../../Directory.Build.props" />
+
+  <Import Project="$(NuGetPackageRoot)\microsoft.dotnet.build.tasks.packaging\$(MicrosoftDotNetBuildTasksPackagingVersion)\build\Microsoft.DotNet.Build.Tasks.Packaging.props" />
+
+  <PropertyGroup>
+    <PackageDescriptionFile>$(MSBuildThisFileDirectory)/descriptions.json</PackageDescriptionFile>
+    <PackageLicenseFile>$(CoreclrDir)/LICENSE.TXT</PackageLicenseFile>
+
+    <ReleaseNotes>https://go.microsoft.com/fwlink/?LinkID=799421</ReleaseNotes>
+
+    <ProjectUrl>https://dot.net</ProjectUrl>
+
+    <PackageIndexFile>$(MSBuildThisFileDirectory)/packageIndex.json</PackageIndexFile>
+    <PackagePlatform>AnyCPU</PackagePlatform>
+
+    <!-- mono doesn't currently use the index so don't force it to be in sync -->
+    <SkipIndexCheck>true</SkipIndexCheck>
+
+    <VersionTxtFile Condition="'$(VersionTxtFile)' == ''">$(ArtifactsObjDir)version.txt</VersionTxtFile>
+  </PropertyGroup>
+
+  <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">
+    <!-- Add required legal files to packages -->
+    <File Condition="Exists('$(PackageLicenseFile)')"
+          Include="$(PackageLicenseFile)" >
+      <SkipPackageFileCheck>true</SkipPackageFileCheck>
+    </File>
+    <PackageIndex Include="$(PackageIndexFile)" />
+
+    <!-- Add version file to packages -->
+    <File Include="$(VersionTxtFile)"
+          Condition="Exists('$(VersionTxtFile)')">
+          <SkipPackageFileCheck>true</SkipPackageFileCheck>
+    </File>
+  </ItemGroup>
+
+</Project>
diff --git a/src/mono/netcore/nuget/Directory.Build.targets b/src/mono/netcore/nuget/Directory.Build.targets
new file mode 100644 (file)
index 0000000..568d3d3
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <Import Project="../../Directory.Build.targets" />
+
+  <Import Project="$(NuGetPackageRoot)\microsoft.dotnet.build.tasks.packaging\$(MicrosoftDotNetBuildTasksPackagingVersion)\build\Microsoft.DotNet.Build.Tasks.Packaging.targets" />
+
+</Project>
diff --git a/src/mono/netcore/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/Microsoft.NETCore.BrowserDebugHost.Transport.pkgproj b/src/mono/netcore/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/Microsoft.NETCore.BrowserDebugHost.Transport.pkgproj
new file mode 100644 (file)
index 0000000..f361ca5
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
+
+  <PropertyGroup>
+    <IsShipping>false</IsShipping>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="$(MonoProjectRoot)wasm\debugger\BrowserDebugHost\BrowserDebugHost.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageFile Include="$(ArtifactsDir)bin\BrowserDebugHost\$(TargetArchitecture)\$(Configuration)\BrowserDebugProxy.dll">
+      <TargetPath>tools\$(NetCoreAppCurrent)\BrowserDebugProxy.dll</TargetPath>
+    </PackageFile>
+    <PackageFile Include="$(ArtifactsDir)bin\BrowserDebugHost\$(TargetArchitecture)\$(Configuration)\BrowserDebugHost.dll">
+      <TargetPath>tools\$(NetCoreAppCurrent)\BrowserDebugHost.dll</TargetPath>
+    </PackageFile>
+    <PackageFile Include="$(ArtifactsDir)bin\BrowserDebugHost\$(TargetArchitecture)\$(Configuration)\BrowserDebugHost.runtimeconfig.json">
+      <TargetPath>tools\$(NetCoreAppCurrent)\BrowserDebugHost.runtimeconfig.json</TargetPath>
+    </PackageFile>
+  </ItemGroup>
+
+  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
+</Project>
diff --git a/src/mono/netcore/nuget/descriptions.json b/src/mono/netcore/nuget/descriptions.json
new file mode 100644 (file)
index 0000000..5fb2e80
--- /dev/null
@@ -0,0 +1,12 @@
+[
+    {
+        "Name": "NuGet3MinVersion",
+        "Description": "When using NuGet 3.x this package requires at least version {0}.",
+        "CommonTypes": [ ]
+    },
+    {
+        "Name": "Microsoft.NETCore.BrowserDebugHost.Transport",
+        "Description": "Internal package for sharing BrowserDebugHost.",
+        "CommonTypes": [ ]
+    }
+]
diff --git a/src/mono/netcore/nuget/mono-packages.proj b/src/mono/netcore/nuget/mono-packages.proj
new file mode 100644 (file)
index 0000000..0f2794e
--- /dev/null
@@ -0,0 +1,13 @@
+<Project>
+  <Import Sdk="Microsoft.Build.Traversal" Project="Sdk.props" />
+
+  <ItemGroup Condition="'$(TargetOS)' == 'Browser'">
+    <ProjectReference Include="Microsoft.NETCore.BrowserDebugHost.Transport\Microsoft.NETCore.BrowserDebugHost.Transport.pkgproj" />
+  </ItemGroup>
+
+  <Import Sdk="Microsoft.Build.Traversal" Project="Sdk.targets" />
+
+  <!-- Ordering matters! Overwriting the Pack target which should just invoke Build. -->
+  <Target Name="Pack" DependsOnTargets="Build">
+  </Target>
+</Project>
diff --git a/src/mono/netcore/nuget/packageIndex.json b/src/mono/netcore/nuget/packageIndex.json
new file mode 100644 (file)
index 0000000..7a73a41
--- /dev/null
@@ -0,0 +1,2 @@
+{
+}
\ No newline at end of file
index 9a038a0..aee852c 100644 (file)
@@ -8,4 +8,6 @@
     <ProjectReference Include="..\BrowserDebugProxy\BrowserDebugProxy.csproj" />
   </ItemGroup>
 
+  <Target Name="GetFilesToPackage" />
+
 </Project>
index 197d499..61707ae 100644 (file)
@@ -20,7 +20,7 @@ namespace Microsoft.WebAssembly.Diagnostics
         HashSet<SessionId> sessions = new HashSet<SessionId>();
         Dictionary<SessionId, ExecutionContext> contexts = new Dictionary<SessionId, ExecutionContext>();
 
-        public MonoProxy(ILoggerFactory loggerFactory, bool hideWebDriver = true) : base(loggerFactory) { hideWebDriver = true; }
+        public MonoProxy(ILoggerFactory loggerFactory, bool hideWebDriver = true) : base(loggerFactory) { this.hideWebDriver = hideWebDriver; }
 
         readonly bool hideWebDriver;
 
@@ -149,8 +149,6 @@ namespace Microsoft.WebAssembly.Diagnostics
             return res.Value?["result"] ? ["value"]?.Value<bool>() ?? false;
         }
 
-        static int bpIdGenerator;
-
         protected override async Task<bool> AcceptCommand(MessageId id, string method, JObject args, CancellationToken token)
         {
             // Inspector doesn't use the Target domain or sessions
@@ -995,4 +993,4 @@ namespace Microsoft.WebAssembly.Diagnostics
             }
         }
     }
-}
\ No newline at end of file
+}