Skip to content

Commit

Permalink
Convert TestPlatform.vsix from V2 to V3 format. (#316)
Browse files Browse the repository at this point in the history
* converting TestPlatform.vsix from V2 format to V3 format
  • Loading branch information
Faizan2304 authored Jan 5, 2017
1 parent 230c966 commit 8c179a7
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 19 deletions.
10 changes: 0 additions & 10 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,6 @@ function Create-VsixPackage
Write-Log "Create-VsixPackage: Started."
$packageDir = Get-FullCLRPackageDirectory

# Copy vsix manifests
$vsixManifests = @("*Content_Types*.xml",
"extension.vsixmanifest",
"License.rtf",
"TestPlatform.ObjectModel.manifest",
"TestPlatform.ObjectModel.x86.manifest")
foreach ($file in $vsixManifests) {
Copy-Item $env:TP_PACKAGE_PROJ_DIR\$file $packageDir -Force
}

# Copy legacy dependencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.TestPlatform.Extensions\15.0.0\contentFiles\any\any"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
Expand Down
25 changes: 21 additions & 4 deletions src/Microsoft.TestPlatform.VSIXCreator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Microsoft.TestPlatform.VSIXCreator
{
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -15,7 +16,7 @@ public static void Main(string[] args)
{
var inputDirectory = "win7-x64";
var outputDirectory = System.Environment.CurrentDirectory;
if(args.Length > 0 && !String.IsNullOrEmpty(args[0]))
if (args.Length > 0 && !String.IsNullOrEmpty(args[0]))
{
inputDirectory = args[0];
}
Expand All @@ -31,10 +32,26 @@ public static void Main(string[] args)
System.IO.File.Delete(vsixFilePath);
}

if(System.IO.Directory.Exists(inputDirectory))
if (System.IO.Directory.Exists(inputDirectory))
{
ZipFile.CreateFromDirectory(inputDirectory, vsixFilePath, CompressionLevel.Fastest, false);
}
// Get all files to put in vsix
IEnumerable<string> files = Directory.EnumerateFiles(inputDirectory, "*.*", SearchOption.AllDirectories);
int inputDirectoryLength = inputDirectory.Length;

using (ZipArchive vsixFile = ZipFile.Open(vsixFilePath, ZipArchiveMode.Create))
{
foreach (var file in files)
{
if (!file.EndsWith(".pdb"))
{
// Creating same directory structure as of inputDirectory and replacing \ with / to make compatible with V3 format.
// because if we create vsix with \ then at time of installation sub folder does not get copied.
string addFile = file.Substring(inputDirectoryLength + 1).Replace(@"\", @"/");
vsixFile.CreateEntryFromFile(file, addFile, CompressionLevel.Optimal);
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"manifestVersion": "1.1",
"info": { "id": "Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI,version=1.0.2" },
"packages": [
{
"id": "Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI",
"version": "1.0.3",
"type": "Vsix",
"payloads": [
{
"fileName": "TestPlatform.vsix",
"size": 3083061
}
],
"vsixId": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"extensionDir": "[installdir]\\Common7\\IDE\\Extensions\\qgyll0uu.4m0"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Copyright (c) Microsoft. All Rights Reserved. -->
<Import Project="..\..\packages\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.14.0.12-pre\build\Microsoft.VisualStudio.Sdk.BuildTasks.14.0.props" />
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
<FinalizeManifest>true</FinalizeManifest>
<FinalizeSkipLayout>true</FinalizeSkipLayout>
<IsPackage>true</IsPackage>
<OutputPath>$(TestPlatformRoot)artifacts\$(Configuration)\v3vsix\</OutputPath>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<UseVisualStudioVersion>true</UseVisualStudioVersion>
<ValidateManifest>false</ValidateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(RunningInMicroBuild)' != 'true'">
<FinalizeValidate>false</FinalizeValidate>
<ManifestPublishUrl>https://vsdrop.corp.microsoft.com/file/v1/Products/DevDiv/VS/lab/d15prerel/$(BUILD_BUILDNUMBER);</ManifestPublishUrl>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.targets" />
<Import Project="..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props" />
<ItemGroup>
<VsixFileToCopy Include="Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.json" />
<VsixFileToCopy Include="$(TestPlatformRoot)artifacts\$(Configuration)\TestPlatform.vsix" />
</ItemGroup>
<Target Name="BeforeBuild">
<Copy SourceFiles="@(VsixFileToCopy)" DestinationFolder="$(OutputPath)" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="true" />
</Target>
<ItemGroup>
<MergeManifest Include="$(OutputPath)Microsoft.VisualStudio.Templates.CS.MSTestv2.Desktop.UnitTest.json" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/package/[Content_Types].xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="vsixmanifest" ContentType="text/xml" /><Default Extension="dll" ContentType="application/octet-stream" /><Default Extension="pdb" ContentType="application/octet-stream" /><Default Extension="exe" ContentType="application/octet-stream" /><Default Extension="config" ContentType="application/octet-stream" /><Default Extension="manifest" ContentType="text/xml" /><Default Extension="rtf" ContentType="application/rtf" /></Types>
<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="vsixmanifest" ContentType="text/xml" /><Default Extension="rtf" ContentType="text/richtext" /><Default Extension="dll" ContentType="application/octet-stream" /><Default Extension="exe" ContentType="application/octet-stream" /><Default Extension="config" ContentType="application/octet-stream" /><Default Extension="manifest" ContentType="text/xml" /><Default Extension="json" ContentType="application/json" /></Types>
36 changes: 36 additions & 0 deletions src/package/catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"manifestVersion": "1.1",
"info": { "id": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf,version=1.0.2" },
"packages": [
{
"id": "Component.Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"version": "1.0.2",
"type": "Component",
"extension": true,
"dependencies": {
"Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf": "1.0.2",
"Microsoft.VisualStudio.Component.CoreEditor": "[15.0,16.0)"
},
"localizedResources": [
{
"language": "en-US",
"title": "Microsoft Visual Studio Test Platform",
"description": "Extensible Test Platform that allows developers to discover, execute and analyze automated tests."
}
]
},
{
"id": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"version": "1.0.2",
"type": "Vsix",
"payloads": [
{
"fileName": "TestPlatform.vsix",
"size": 3083061
}
],
"vsixId": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"extensionDir": "[installdir]\\Common7\\IDE\\Extensions\\qgyll0uu.4m0"
}
]
}
11 changes: 8 additions & 3 deletions src/package/extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011">
<Metadata>
<Identity Id="Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf" Version="1.0.1" Language="en-US" Publisher="Microsoft" />
<Identity Id="Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf" Version="1.0.2" Language="en-US" Publisher="Microsoft" />
<DisplayName>Microsoft Visual Studio Test Platform</DisplayName>
<Description xml:space="preserve">Extensible Test Platform that allows developers to discover, execute and analyze automated tests.</Description>
<License>License.rtf</License>
<PackageId>Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI</PackageId>
</Metadata>
<Installation AllUsers="true" Experimental="true">
<Installation AllUsers="true">
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Community" />
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />
Expand All @@ -19,4 +21,7 @@
<Assets>
<Asset Type="Microsoft.TestPlatform.V2" Path="vstest.console.exe" />
</Assets>
</PackageManifest>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>
4 changes: 4 additions & 0 deletions src/package/external/external.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<Version>0.2.0</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Sdk.BuildTasks.14.0">
<Version>14.0.12-pre</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
19 changes: 19 additions & 0 deletions src/package/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"version": "1.0.2",
"type": "Vsix",
"vsixId": "Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf",
"extensionDir": "[installdir]\\Common7\\IDE\\Extensions\\qgyll0uu.4m0",
"files": [
{
"fileName": "/extension.vsixmanifest",
"sha256": "439E8D9C90642193F7D2DEA7C40DEFBE8254F63F1926CC385BDA20A3CAC9B476"
},
{
"fileName": "/License.rtf",
"sha256": "F451AB5C77BB7B9DC19733D5C9585E0F4A86D8BFB447349C5F6F3D1BEA862630"
}
],
"installSize": 8348725,
"dependencies": { "Microsoft.VisualStudio.Component.CoreEditor": "[15.0,16.0)" }
}
2 changes: 1 addition & 1 deletion src/package/package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Content Include="[Content_Types].xml;extension.vsixmanifest;License.rtf;TestPlatform.ObjectModel.manifest;TestPlatform.ObjectModel.x86.manifest">
<Content Include="[Content_Types].xml;extension.vsixmanifest;License.rtf;manifest.json;catalog.json;TestPlatform.ObjectModel.manifest;TestPlatform.ObjectModel.x86.manifest">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down

1 comment on commit 8c179a7

@sbaid
Copy link
Contributor

@sbaid sbaid commented on 8c179a7 Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pl checkin the v3 vsix proj using which u got the artificants which are directly checked in. e.g. if extension.manifest is updated manifest.json need to be generated using it. we need to see if we can get a better recipe than this.

Please sign in to comment.