Skip to content

Commit

Permalink
Updates for packaging from ipy2 (with changes for ipy3) (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
slide committed Aug 24, 2018
1 parent 833ae04 commit f650273
Show file tree
Hide file tree
Showing 20 changed files with 271 additions and 175 deletions.
72 changes: 7 additions & 65 deletions Build.proj
Expand Up @@ -5,6 +5,7 @@
<BuildFlavour Condition=" '$(BuildFlavour)' == '' ">Debug</BuildFlavour>
<MainBuildPrefix Condition=" '$(MainBuildPrefix)' == '' "></MainBuildPrefix>
<Mono Condition="'$(OS)' != 'Windows_NT'">true</Mono>
<MacOS Condition="'$(OS)' == 'Unix' AND Exists('/Applications') AND Exists('/Library') AND Exists('/System') AND Exists('/Volumes')">true</MacOS>

<RootDir>$(MSBuildThisFileDirectory)</RootDir>
<Solution>$(RootDir)IronPython.sln</Solution>
Expand All @@ -14,12 +15,13 @@
<BuildSysDir>$(RootDir)Build</BuildSysDir>
<MSBuildCommunityTasksPath>$(RootDir)Util\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
<TargetFrameworks Condition="'$(TargetFrameworks)' == ''">net45;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<ChocolateyVersion>0.10.8</ChocolateyVersion>
</PropertyGroup>



<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets" />
<Import Project="$(BuildSysDir)\Versioning.targets" />


<PropertyGroup>
<StageDir>$(RootDir)Package\$(BuildFlavour)\Stage\IronPython-$(PackageVersion)</StageDir>
<PackageDir>$(RootDir)Package\$(BuildFlavour)\Packages\IronPython-$(PackageVersion)</PackageDir>
Expand Down Expand Up @@ -134,68 +136,8 @@

<Target Name="Stage" DependsOnTargets="$(StageDependsOn)" />

<Target Name="Package" DependsOnTargets="MsiPackage;ZipPackage;NuGetPackage;ChocoPackage;DebPackage" />

<Target Name="MakePackageDir">
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')" />
</Target>

<ItemGroup>
<Package Include="IronPython">
<NuSpecDir>$(RootDir)\Package\nuget</NuSpecDir>
</Package>
<Package Include="IronPython.StdLib">
<NuSpecDir>$(RootDir)\Package\nuget</NuSpecDir>
</Package>
</ItemGroup>

<PropertyGroup>
<NuSpecInputs>@(Package->'%(NuSpecDir)\%(Identity).nuspec')</NuSpecInputs>
<NuPkgOutputs>@(Package->'$(PackageDir)\%(Identity).$(PackageVersion).nupkg')</NuPkgOutputs>
</PropertyGroup>

<Target Name="NuGetPackage" DependsOnTargets="Stage;MakePackageDir"
Inputs="$(NuSpecInputs)"
Outputs="$(NuPkgOutputs)">
<ItemGroup>
<DLLsFiles Include="**\DLLs\IronPython.*.dll" />
<DLLsFiles Include="**\DLLs\IronPython.*.xml" />
</ItemGroup>

<!-- Copy the files from DLLs into the main directory for nuget packaging -->
<Copy SourceFiles="@(DLLsFiles)" CopiedFiles="@(CopiedFiles)" DestinationFolder="$([System.IO.Path]::GetFullPath('%(DLLsFiles.RecursiveDir)\..'))">
<Output TaskParameter="CopiedFiles" ItemName="TempCopied" />
</Copy>
<Exec Command="$(NuGet) pack &quot;%(NuSpecDir)\%(Package.Identity).nuspec&quot; -BasePath &quot;$(StageDir)&quot; -OutputDirectory &quot;$(PackageDir)&quot; -Version $(PackageVersion)" />
<!-- Delete the copied files -->
<Delete Files="@(TempCopied)" />
</Target>
<!-- This looks like an empty target, but the targets files use it as an AfterTargets -->
<Target Name="Package" DependsOnTargets="Stage" />

<Target Name="ChocoPackage" Condition="'$(OS)' != 'Unix' " DependsOnTargets="Stage;MakePackageDir"
Outputs="$(PackageDir)\ironpython.chocolatey.$(PackageVersion).nupkg">
<Exec Command="$(NuGet) install chocolatey -Version $(ChocolateyVersion) -OutputDirectory &quot;$(RootDir)\packages&quot; -Source https://api.nuget.org/v3/index.json" />
<Exec Command="$(RootDir)packages\chocolatey.$(ChocolateyVersion)\tools\chocolateyInstall\choco.exe pack &quot;$(RootDir)\Package\choco\IronPython.nuspec&quot; --outputdirectory &quot;$(StageDir)&quot; --version $(PackageVersion) STAGEDIR=&quot;$(StageDir)&quot;" />
<Move SourceFiles="$(StageDir)\ironpython3.$(PackageVersion).nupkg" DestinationFiles="$(PackageDir)\ironpython3.chocolatey.$(PackageVersion).nupkg" />
</Target>

<Target Name="ZipPackage" DependsOnTargets="Stage;MakePackageDir"
Outputs="$(PackageDir)\IronPython.$(PackageVersion).zip">
<ItemGroup>
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\**\IronPythonTest.*" />
</ItemGroup>
<Zip ZipLevel="9" Files="@(ZipFiles)" ZipFileName="$(PackageDir)\IronPython.$(PackageVersion).zip" WorkingDirectory="$(StageDir)" />
</Target>

<Target Name="DebPackage" Condition="'$(OS)' == 'Unix' " DependsOnTargets="Stage;MakePackageDir" />

<Target Name="MsiPackage" Condition="'$(OS)' != 'Unix' " DependsOnTargets="Stage;MakePackageDir">
<ItemGroup>
<CleanupFiles Include="$(StageDir)\net45\IronPythonTest.dll"/>
</ItemGroup>
<Delete Files="@(CleanupFiles)" />
<MSBuild
Projects="$(RootDir)\Package\msi\IronPython.Installer.wixproj"
Properties="BindInputPaths=$(StageDir);OutputPath=$(PackageDir);Configuration=$(BuildFlavour);Platform=x64"
/>
</Target>
<Import Project="$(RootDir)\Package\**\*.Packaging.targets" />
</Project>
48 changes: 0 additions & 48 deletions Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions Package/choco/Choco.Packaging.targets
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="ChocoPackage" Condition="'$(OS)' != 'Unix' " AfterTargets="Package"
Outputs="$(PackageDir)\ironpython.chocolatey.$(PackageVersion).nupkg">
<PropertyGroup>
<ChocolateyVersion>0.10.8</ChocolateyVersion>
</PropertyGroup>
<Exec Command="$(NuGet) install chocolatey -Version $(ChocolateyVersion) -OutputDirectory &quot;$(RootDir)packages&quot; -Source https://api.nuget.org/v3/index.json" />
<Exec Command="$(RootDir)packages\chocolatey.$(ChocolateyVersion)\tools\chocolateyInstall\choco.exe pack -r &quot;$(RootDir)Package\choco\IronPython.nuspec&quot; --outputdirectory &quot;$(StageDir)&quot; --version $(PackageVersion) STAGEDIR=&quot;$(StageDir)&quot;" />
<Move SourceFiles="$(StageDir)\ironpython3.$(PackageVersion).nupkg" DestinationFiles="$(PackageDir)\ironpython3.chocolatey.$(PackageVersion).nupkg" />
</Target>
</Project>
1 change: 1 addition & 0 deletions Package/choco/IronPython.nuspec
Expand Up @@ -23,5 +23,6 @@
<file src="$STAGEDIR$\net45\DLLs\**" target="DLLs" exclude="**\*.xml" />
<file src="$STAGEDIR$\Lib\**" target="Lib" />
<file src="$STAGEDIR$\LICENSE;$STAGEDIR$\README.md" />
<file src="tools\*" target="tools" />
</files>
</package>
3 changes: 3 additions & 0 deletions Package/choco/tools/VERIFICATION.txt
@@ -0,0 +1,3 @@
VERIFICATION Verification is intended to assist the Chocolatey moderators and community in verifying that this package's contents are trustworthy.

This package is published by the IronPython Project itself. The binaries are identical to other package types published by the project, in particular the IronPython nuget package.
8 changes: 8 additions & 0 deletions Package/deb/DEBIAN/control
@@ -0,0 +1,8 @@
Package: ironpython3
Version: {xxx}
Priority: optional
Architecture: all
Depends: mono-runtime (>=5.12), libmono-posix4.0-cil (>=5.12)
Section: python
Description: Implementation of the Python 3.4 language
on the .NET Framework (IRON -> Implementation Runs on .NET).
51 changes: 51 additions & 0 deletions Package/deb/Deb.Packaging.targets
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="DebPackage" Condition="'$(OS)' == 'Unix' AND '$(MacOS)' != 'true'" AfterTargets="Package">
<PropertyGroup>
<TempFolder>temp</TempFolder>
<PackageDebFolder>Package/deb</PackageDebFolder>
<PackageTempFolder>$(PackageDebFolder)/$(TempFolder)</PackageTempFolder>
</PropertyGroup>

<ItemGroup>
<StdLibFiles Include="$(StageDir)/Lib/**/*.*" />
</ItemGroup>

<ItemGroup>
<ApplicationFiles Include="$(StageDir)/net45/*.exe" />
<ApplicationFiles Include="$(StageDir)/net45/**/*.dll" Exclude="IronPythonTest.dll" />
</ItemGroup>

<ItemGroup>
<ScriptFiles Include="$(PackageDebFolder)/ipy*" />
</ItemGroup>

<!-- Build the application deb -->
<Exec Command="chmod 777 $(StageDir)/net45/*.exe" />
<Exec Command="rm -rf $(PackageTempFolder)" />
<Exec Command="mkdir -p $(PackageTempFolder)/DEBIAN" />
<Exec Command="cp $(PackageDebFolder)/DEBIAN/* $(PackageTempFolder)/DEBIAN"/>

<FileUpdate Files="$(PackageTempFolder)/DEBIAN/control"
Regex="{xxx}"
ReplacementText="$(PackageVersion)" />

<ItemGroup>
<StdLibOutputFiles Include="$(StageDir)/Lib/**/*.py" />
</ItemGroup>
<Exec Command="dos2unix %(StdLibOutputFiles.Identity)" />
<Exec Command="dos2unix $(PackageTempFolder)/DEBIAN/control"/>

<Copy SourceFiles="@(ScriptFiles)" DestinationFolder="$(PackageTempFolder)/usr/bin/"/>
<Copy SourceFiles="@(ApplicationFiles)" DestinationFolder="$(PackageTempFolder)/usr/share/ironpython2.7/%(ApplicationFiles.RecursiveDir)"/>
<Copy SourceFiles="@(StdLibFiles)" DestinationFolder="$(PackageTempFolder)/usr/lib/ironpython2.7/%(StdLibFiles.RecursiveDir)"/>

<Exec Command="fakeroot dpkg-deb -v --build $(PackageTempFolder)"/>
<Copy
SourceFiles="$(PackageDebFolder)/$(TempFolder).deb"
DestinationFiles="$(PackageDir)/ironpython_$(PackageVersion).deb"/>
<Delete Files="$(PackageDebFolder)/$(TempFolder).deb"/>

<RemoveDir Directories="$(PackageTempFolder)" />
</Target>
</Project>
1 change: 1 addition & 0 deletions Package/deb/ipy
1 change: 1 addition & 0 deletions Package/deb/ipy3
2 changes: 2 additions & 0 deletions Package/deb/ipy3.4
@@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/mono /usr/share/ironpython3.4/ipy.exe $*
27 changes: 11 additions & 16 deletions Package/msi/IronPython.Installer.wixproj
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\..\Build\Common.proj" />
<Import Project="$(MSBuildThisFileDirectory)..\..\Directory.Build.props" />
<Import Project="$(BeforeTargetFiles)" />
<Import Project="$(RootDir)packages\wix\3.11.1\build\wix.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
Expand All @@ -13,13 +14,8 @@
<DefineSolutionProperties>false</DefineSolutionProperties>
<SuppressPdbOutput>true</SuppressPdbOutput>
<SuppressSpecificWarnings>5151</SuppressSpecificWarnings>

<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(MSBuildProjectDirectory)\..\..\Util\Wix\</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath>

<BindInputPaths Condition=" '$(BindInputPaths)' == '' ">$(MSBuildProjectDirectory)\..\..\Package\Stage\$(Configuration)\IronPython-$(DisplayVersion)</BindInputPaths>
<BuildDir Condition=" '$(BuildDir)' == '' ">$(MSBuildProjectDirectory)\..\..\bin\$(Configuration)</BuildDir>
<BindInputPaths Condition=" '$(BindInputPaths)' == '' ">$(RootDir)Package\Stage\$(Configuration)\IronPython-$(DisplayVersion)</BindInputPaths>
<BuildDir Condition=" '$(BuildDir)' == '' ">$(RootDir)bin\$(Configuration)</BuildDir>

<MsiVersion Condition=" '$(MsiVersion)' == '' ">$(MajorVersion).$(MinorVersion).$(MicroVersion).$(AssemblyFileRevision)</MsiVersion>
<SetMsiAssemblyNameFileVersion>True</SetMsiAssemblyNameFileVersion>
Expand All @@ -44,6 +40,9 @@
<WixConstant Include="PlatformDir">
<Value>$(BindInputPaths)\net45</Value>
</WixConstant>
<WixConstant Include="IpyExeComponentGuid">
<Value>{419DAD09-D6E8-47F0-BC58-874019842004}</Value>
</WixConstant>
</ItemGroup>

<PropertyGroup>
Expand Down Expand Up @@ -79,6 +78,10 @@
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<HarvestDirectory Include="$(BindInputPaths)\Lib">
Expand All @@ -89,12 +92,4 @@
</HarvestDirectory>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
19 changes: 5 additions & 14 deletions Package/msi/IronPython.wxs
Expand Up @@ -12,13 +12,10 @@
<File Id="IronPython.Modules.dll" KeyPath="yes" Source="$(var.PlatformDir)\IronPython.Modules.dll" />
</Component>

<Component Guid="{419DAD09-D6E8-47F0-BC58-874019842004}">
<Component Guid="$(var.IpyExeComponentGuid)">
<File Id="ipy.exe" KeyPath="yes" Source="$(var.PlatformDir)\ipy.exe">
<netfx:NativeImage Id="ngen_ipy.exe" Platform="all" AppBaseDirectory="INSTALLDIR"/>
</File>
<File Id="ipy32.exe" Source="$(var.PlatformDir)\ipy32.exe">
<netfx:NativeImage Id="ngen_ipy32.exe" Platform="all" AppBaseDirectory="INSTALLDIR"/>
</File>
</Component>

<Component Guid="{F7E1626D-3007-405D-A656-1A971D172A07}">
Expand All @@ -32,9 +29,6 @@
<File Id="ipyw.exe" KeyPath="yes" Source="$(var.PlatformDir)\ipyw.exe">
<netfx:NativeImage Id="ngen_ipyw.exe" Platform="all" AppBaseDirectory="INSTALLDIR"/>
</File>
<File Id="ipyw32.exe" Source="$(var.PlatformDir)\ipyw32.exe">
<netfx:NativeImage Id="ngen_ipyw32.exe" Platform="all" AppBaseDirectory="INSTALLDIR"/>
</File>
</Component>

<Directory Id="IronPython_DLLs" Name="DLLs">
Expand All @@ -52,24 +46,21 @@

<Component Guid="{B5D964A4-37EB-4A59-9D63-726DB1F84E5E}">
<File Id="LICENSE" KeyPath="yes" />
<!-- <File Id="License.html" /> -->
<!-- <File Id="License.rtf" Source="$(var.PlatformDir)\..\..\..\..\..\License.rtf"/> -->
<!--<File Id="License.StdLib.txt" /> -->
</Component>

<Component>
<RegistryValue Id="InstallationKey"
Root='HKLM' Key='SOFTWARE\IronPython\$(var.ReleaseSeries)\InstallPath' Type='string' Value='[INSTALLDIR]' />
Root="HKLM" Key="SOFTWARE\IronPython\$(var.ReleaseSeries)\InstallPath" Type="string" Value="[INSTALLDIR]" />
</Component>

<Component>
<RegistryValue Id='VSNet45ReferenceAssemblyKey'
Root='HKLM' Key='SOFTWARE\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\$(var.ProductShortName)$(var.ReleaseSeries)' Type='string' Value='[INSTALLDIR]' />
<RegistryValue Id="VSNet45ReferenceAssemblyKey"
Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\$(var.ProductShortName)$(var.ReleaseSeries)" Type="string" Value="[INSTALLDIR]" />
</Component>

</DirectoryRef>

<DirectoryRef Id='GAC'>
<DirectoryRef Id="GAC">
<Component Guid="{38CF0071-81C1-41A2-9F64-F3667160A5F5}">
<File Id="gac_IronPython.dll" Name="IronPython.dll" Assembly=".net" KeyPath="yes" Source="$(var.PlatformDir)\IronPython.dll" >
<netfx:NativeImage Id="ngen_IronPython.dll" Platform="all" AppBaseDirectory="INSTALLDIR"/>
Expand Down
17 changes: 17 additions & 0 deletions Package/msi/Msi.Packaging.targets
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Target Name="MsiPackage" Condition="'$(OS)' != 'Unix' " AfterTargets="Package">
<ItemGroup>
<CleanupFiles Include="$(StageDir)\net45\IronPythonTest.dll"/>
</ItemGroup>
<PropertyGroup>
<WixVersion>3.11.1</WixVersion>
</PropertyGroup>
<Delete Files="@(CleanupFiles)" />
<Exec Command="$(NuGet) install wix -Version $(WixVersion) -OutputDirectory &quot;$(RootDir)packages&quot; -Source https://api.nuget.org/v3/index.json" />
<MSBuild
Projects="$(RootDir)Package\msi\IronPython.Installer.wixproj"
Properties="BindInputPaths=$(StageDir);OutputPath=$(PackageDir);Configuration=$(BuildFlavour);Platform=x64"
/>
</Target>
</Project>

0 comments on commit f650273

Please sign in to comment.