Skip to content

Commit 611bb66

Browse files
jonpryordellis1972
authored andcommitted
[create-vsix] Allow overriding the created .vsix filename (#577)
We want to use the `make create-vsix` target to create the commercial `Xamarin.Android.Sdk.vsix` file, but we want it to have a different filename, matching commit + commit count information from the internal `monodroid` repo, not the xamarin-android repo. Uppdate `create-vsix.csproj` to accept a new `$(VsixPath)` property, which is the path of the .vsix file to create. Update the default `$(VsixPath)` filename to be `Xamarin.Android.Sdk-OSS*`, so that if a customer downloads both a Jenkins OSS build and a commercial .vsix build, it will be easier to differentiate between them. (The `.vsix` package name information is *not* changed, thus it is not possible to concurrently have both the commercial and OSS builds installed in the same VS 2017 SKU.) Update the `make create-vsix` target so that the output path and other MSBuild properties can more easily be overridden: make create-vsix CONFIGURATIONS=Debug VSIX=`pwd`/MyNewPackage.vsix The `$(VSIX)` **make**(1) variable sets the `$(VsixPath)` MSBuild property. *Note*: the current-working-directory for `make create-vsix` is `build-tools/create-vsix`; consequently, this command: make create-vsix CONFIGURATIONS=Debug VSIX=MyNewPackage.vsix will create `./build-tools/create-vsix/MyNewPackage.vsix`, *not* `./MyNewPackage.vsix`.
1 parent d63b362 commit 611bb66

File tree

3 files changed

+25
-44
lines changed

3 files changed

+25
-44
lines changed

build-tools/create-vsix/create-vsix.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{94756FEB-1F64-411D-A18E-81B5158F776A}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<RootNamespace>Xamarin.Android.Sdk</RootNamespace>
10-
<AssemblyName>Xamarin.Android.Sdk</AssemblyName>
10+
<AssemblyName>Xamarin.Android.Sdk-OSS</AssemblyName>
1111
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1212
<CreateVsixContainer Condition=" '$(CreateVsixContainer)' == '' ">False</CreateVsixContainer>
1313
<CopyBuildOutputToOutputDirectory>False</CopyBuildOutputToOutputDirectory>

build-tools/create-vsix/create-vsix.targets

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitBlame" />
4-
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitBranch" />
5-
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitCommitHash" />
6-
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitCommitsInRange" />
3+
<Import Project="..\scripts\XAVersionInfo.targets" />
74
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.ReplaceFileContents" />
85
<PropertyGroup>
96
<!-- Don't ever deploy, since that won't work on Mac -->
@@ -81,7 +78,7 @@
8178
</ItemGroup>
8279
</Target>
8380
<Target Name="GetVsixVersion"
84-
DependsOnTargets="_GetVersionInfo"
81+
DependsOnTargets="GetXAVersionInfo"
8582
Returns="$(VsixVersion)">
8683
<PropertyGroup>
8784
<VsixVersion>$(ProductVersion).$(_XACommitCount)</VsixVersion>
@@ -94,57 +91,34 @@
9491
<IsExperimental Condition=" '$(IsProductComponent)' == 'True' ">false</IsExperimental>
9592
</PropertyGroup>
9693
</Target>
97-
<Target Name="_GetVersionInfo">
98-
<GitBlame
99-
FileName="$(XamarinAndroidSourcePath)\Configuration.props"
100-
LineFilter="&lt;ProductVersion&gt;"
101-
WorkingDirectory="$(XamarinAndroidSourcePath)"
102-
ToolPath="$(GitToolPath)"
103-
ToolExe="$(GitToolExe)">
104-
<Output TaskParameter="Commits" ItemName="_XAVersionCommit" />
105-
</GitBlame>
106-
<GitCommitsInRange
107-
StartCommit="%(_XAVersionCommit.CommitHash)"
108-
WorkingDirectory="$(XamarinAndroidSourcePath)"
109-
ToolPath="$(GitToolPath)"
110-
ToolExe="$(GitToolExe)">
111-
<Output TaskParameter="CommitCount" PropertyName="_XACommitCount" />
112-
</GitCommitsInRange>
113-
<GitCommitHash
114-
WorkingDirectory="$(XamarinAndroidSourcePath)"
115-
ToolPath="$(GitToolPath)"
116-
ToolExe="$(GitToolExe)">
117-
<Output TaskParameter="AbbreviatedCommitHash" PropertyName="_XAHash" />
118-
</GitCommitHash>
119-
<GitBranch
120-
WorkingDirectory="$(XamarinAndroidSourcePath)"
121-
ToolPath="$(GitToolPath)"
122-
ToolExe="$(GitToolExe)">
123-
<Output TaskParameter="Branch" PropertyName="_XABranch" />
124-
</GitBranch>
125-
</Target>
12694
<Target Name="_CreateDependencies"
127-
DependsOnTargets="_GetVersionInfo"
95+
DependsOnTargets="GetXAVersionInfo"
12896
BeforeTargets="Build"
12997
Inputs="Xamarin.Android.Sdk.pkgdef.in"
13098
Outputs="Xamarin.Android.Sdk.pkgdef">
13199
<ReplaceFileContents
132100
SourceFile="Xamarin.Android.Sdk.pkgdef.in"
133101
DestinationFile="Xamarin.Android.Sdk.pkgdef"
134-
Replacements="@PACKAGE_VERSION@=$(ProductVersion);@PACKAGE_VERSION_BUILD@=$(_XACommitCount);@PACKAGE_HEAD_REV@=$(_XAHash);@PACKAGE_HEAD_BRANCH@=$(_XABranch)">
102+
Replacements="@PACKAGE_VERSION@=$(ProductVersion);@PACKAGE_VERSION_BUILD@=$(XAVersionCommitCount);@PACKAGE_HEAD_REV@=$(XAVersionHash);@PACKAGE_HEAD_BRANCH@=$(XAVersionBranch)">
135103
</ReplaceFileContents>
136104
</Target>
137-
<Target Name="_CopyToBuildConfiguration"
138-
DependsOnTargets="_GetVersionInfo"
139-
Inputs="$(OutputPath)$(AssemblyName).vsix"
140-
Outputs="..\..\bin\Build$(Configuration)\$(AssemblyName).vsix">
105+
<Target Name="_GetVsixPath"
106+
DependsOnTargets="GetXAVersionInfo">
141107
<PropertyGroup>
142-
<_Branch>$(_XABranch.Replace ('/', '-'))</_Branch>
108+
<_Branch>$(XAVersionBranch.Replace ('/', '-'))</_Branch>
143109
<_Branch>$(_Branch.Replace ('\', '-'))</_Branch>
144110
</PropertyGroup>
111+
<PropertyGroup>
112+
<VsixPath Condition=" '$(VsixPath)' == '' ">..\..\bin\Build$(Configuration)\$(AssemblyName)-$(ProductVersion).$(XAVersionCommitCount)_$(XAVersionBranch)_$(XAVersionHash).vsix</VsixPath>
113+
</PropertyGroup>
114+
</Target>
115+
<Target Name="_CopyToBuildConfiguration"
116+
DependsOnTargets="_GetVsixPath"
117+
Inputs="$(OutputPath)$(AssemblyName).vsix"
118+
Outputs="$(VsixPath)">
145119
<Copy
146120
SourceFiles="$(OutputPath)$(AssemblyName).vsix"
147-
DestinationFiles="..\..\bin\Build$(Configuration)\$(AssemblyName)-$(ProductVersion).$(_XACommitCount)_$(_Branch)_$(_XAHash).vsix"
121+
DestinationFiles="$(VsixPath)"
148122
/>
149123
</Target>
150124
</Project>

build-tools/scripts/BuildEverything.mk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,14 @@ _BUNDLE_ZIPS_EXCLUDE = \
130130

131131
create-vsix:
132132
$(foreach conf, $(CONFIGURATIONS), \
133-
MONO_IOMAP=all MONO_OPTIONS=--arch=64 msbuild $(MSBUILD_FLAGS) build-tools/create-vsix/create-vsix.csproj /p:Configuration=$(conf) /p:CreateVsixContainer=True ; )
133+
MONO_IOMAP=all MONO_OPTIONS=--arch=64 msbuild $(MSBUILD_FLAGS) /p:Configuration=$(conf) /p:CreateVsixContainer=True \
134+
build-tools/create-vsix/create-vsix.csproj \
135+
$(if $(VSIX),"/p:VsixPath=$(VSIX)") \
136+
$(if $(PRODUCT_COMPONENT),/p:IsProductComponent="$(PRODUCT_COMPONENT)") \
137+
$(if $(PACKAGE_VERSION),/p:ProductVersion="$(PACKAGE_VERSION)") \
138+
$(if $(PACKAGE_HEAD_BRANCH),/p:XAVersionBranch="$(PACKAGE_HEAD_BRANCH)") \
139+
$(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \
140+
$(if $(COMMIT),/p:XAVersionHash="$(COMMIT)") ; )
134141

135142
package-oss-name:
136143
@echo ZIP_OUTPUT=$(ZIP_OUTPUT)

0 commit comments

Comments
 (0)