-
Notifications
You must be signed in to change notification settings - Fork 560
[installers] Share installer payload generation logic #2733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,12 @@ import groovy.json.JsonSlurper | |
|
||
def XADir = "xamarin-android" | ||
|
||
def MSBUILD_AUTOPROVISION_ARGS="/p:AutoProvision=True /p:AutoProvisionUsesSudo=True /p:IgnoreMaxMonoVersion=False" | ||
def EXTRA_MSBUILD_ARGS="/p:AutoProvision=True /p:AutoProvisionUsesSudo=True /p:IgnoreMaxMonoVersion=False" | ||
|
||
def isPr = false // Default to CI | ||
|
||
def hasPrLabelFullMonoIntegrationBuild = false | ||
|
||
def buildTarget = 'jenkins' | ||
|
||
def stageWithTimeout(stageName, timeoutValue, timeoutUnit, directory, fatal, ctAttempts = 0, Closure body) { | ||
|
@@ -120,9 +122,17 @@ timestamps { | |
env.ghprbPullLongDescription = '' | ||
|
||
if (hasPrLabel(env.GitRepo, env.ghprbPullId, 'full-mono-integration-build')) { | ||
hasPrLabelFullMonoIntegrationBuild = true | ||
buildTarget = 'jenkins' | ||
} else { | ||
buildTarget = 'all' | ||
// Also compile host libs for windows so that a complete VSIX can be created | ||
if (isUnix()) { | ||
def uname = sh script: 'uname', returnStdout: true | ||
if (uname.startsWith("Darwin")) { | ||
EXTRA_MSBUILD_ARGS += " /p:AndroidSupportedHostJitAbis=Darwin:mxe-Win32:mxe-Win64" | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
@@ -137,15 +147,22 @@ timestamps { | |
} | ||
|
||
stageWithTimeout('prepare deps', 30, 'MINUTES', XADir, true) { // Typically takes less than 2 minutes | ||
sh "make prepare-deps CONFIGURATION=${env.BuildFlavor} V=1 MSBUILD_ARGS='$MSBUILD_AUTOPROVISION_ARGS'" | ||
sh "make prepare-deps CONFIGURATION=${env.BuildFlavor} V=1 MSBUILD_ARGS='$EXTRA_MSBUILD_ARGS'" | ||
} | ||
|
||
stageWithTimeout('build', 6, 'HOURS', XADir, true) { // Typically takes less than one hour except a build on a new bot to populate local caches can take several hours | ||
sh "make prepare ${buildTarget} CONFIGURATION=${env.BuildFlavor} V=1 MSBUILD_ARGS='$MSBUILD_AUTOPROVISION_ARGS'" | ||
sh "make prepare ${buildTarget} CONFIGURATION=${env.BuildFlavor} V=1 MSBUILD_ARGS='$EXTRA_MSBUILD_ARGS'" | ||
} | ||
|
||
stageWithTimeout('create vsix', 30, 'MINUTES', XADir, true) { // Typically takes less than 5 minutes | ||
sh "make create-vsix CONFIGURATION=${env.BuildFlavor}" | ||
stageWithTimeout('create installers', 30, 'MINUTES', XADir, true) { // Typically takes less than 5 minutes | ||
if (isPr) { | ||
// Override _MSBUILD_ARGS to ensure we only package the `AndroidSupportedTargetJitAbis` which are built. | ||
// Also ensure that we don't require mono bundle components in the installer if this is not a full mono integration build. | ||
def msbuildInstallerArgs = hasPrLabelFullMonoIntegrationBuild ? '' : '/p:IncludeMonoBundleComponents=False' | ||
sh "make create-installers CONFIGURATION=${env.BuildFlavor} _MSBUILD_ARGS='${msbuildInstallerArgs}'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this overriding |
||
} else { | ||
sh "make create-installers CONFIGURATION=${env.BuildFlavor}" | ||
} | ||
} | ||
|
||
stageWithTimeout('package oss', 30, 'MINUTES', XADir, true) { // Typically takes less than 5 minutes | ||
|
@@ -166,7 +183,7 @@ timestamps { | |
} | ||
|
||
stageWithTimeout('publish packages to Azure', 30, 'MINUTES', '', true, 3) { // Typically takes less than a minute, but provide ample time in situations where logs may be quite large | ||
def publishBuildFilePaths = "${XADir}/xamarin.android-oss*.zip,${XADir}/bin/Build*/Xamarin.Android.Sdk*.vsix,${XADir}/build-status*,${XADir}/xa-build-status*"; | ||
def publishBuildFilePaths = "${XADir}/xamarin.android-oss*.zip,${XADir}/bin/Build*/Xamarin.Android.Sdk-OSS*,${XADir}/build-status*,${XADir}/xa-build-status*"; | ||
|
||
if (!isPr) { | ||
publishBuildFilePaths = "${publishBuildFilePaths},${XADir}/bin/${env.BuildFlavor}/bundle-*.zip" | ||
|
@@ -185,7 +202,6 @@ timestamps { | |
def skipNunitTests = false | ||
|
||
if (isPr) { | ||
def hasPrLabelFullMonoIntegrationBuild = hasPrLabel(env.GitRepo, env.ghprbPullId, 'full-mono-integration-build') | ||
def hasPrLabelRunTestsRelease = hasPrLabel(env.GitRepo, env.ghprbPullId, 'run-tests-release') | ||
skipNunitTests = hasPrLabelFullMonoIntegrationBuild || hasPrLabelRunTestsRelease | ||
echo "Run all tests: Labels on the PR: 'full-mono-integration-build' (${hasPrLabelFullMonoIntegrationBuild}) and/or 'run-tests-release' (${hasPrLabelRunTestsRelease})" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{46529930-A5CC-4205-A50D-0AAAC639F082}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>createpkg</RootNamespace> | ||
<AssemblyName>create-pkg</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<OutputPath>..\..\bin\Build$(Configuration)</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<Optimize>true</Optimize> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include="distribution.xml.in" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="create-pkg.targets" /> | ||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\installers\create-installers.targets" /> | ||
<PropertyGroup> | ||
<BuildDependsOn>ResolveReferences</BuildDependsOn> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<PkgInstallDir>/</PkgInstallDir> | ||
<PkgInstallDir Condition="$([MSBuild]::IsOsPlatform(Linux))">/usr</PkgInstallDir> | ||
<PayloadDir>$(OutputPath)\pkg\archive</PayloadDir> | ||
<PkgOutputPath>$(OutputPath)\pkg\packages</PkgOutputPath> | ||
<PkgResourcesPath>$(OutputPath)\pkg\resources</PkgResourcesPath> | ||
<PkgDistributionDestination>$(OutputPath)\pkg\distribution.xml</PkgDistributionDestination> | ||
<PkgLicenseSrcEn Condition="'$(PkgLicenseSrcEn)' == ''">$(XamarinAndroidSourcePath)\LICENSE</PkgLicenseSrcEn> | ||
<PkgLicenseDestinationEn>$(PkgResourcesPath)\en.lproj</PkgLicenseDestinationEn> | ||
<PkgScriptsDir>$(MSBuildThisFileDirectory)scripts</PkgScriptsDir> | ||
<UpdateInfoGuid>d1ec039f-f3db-468b-a508-896d7c382999</UpdateInfoGuid> | ||
</PropertyGroup> | ||
<Target Name="_CopyFilesToPayloadDir" | ||
DependsOnTargets="ConstructInstallerItems;GetXAVersion" > | ||
<PropertyGroup> | ||
<XAFrameworkDir>$(PayloadDir)\Library\Frameworks\Xamarin.Android.framework\Versions\$(XAVersion)</XAFrameworkDir> | ||
<MonoFrameworkExternalDir>$(PayloadDir)\Library\Frameworks\Mono.framework\External</MonoFrameworkExternalDir> | ||
<MSBuildTargetsDir>$(XAFrameworkDir)\lib\xamarin.android\xbuild\Xamarin\Android</MSBuildTargetsDir> | ||
<MSBuildFrameworksDir>$(XAFrameworkDir)\lib\xamarin.android\xbuild-frameworks\MonoAndroid</MSBuildFrameworksDir> | ||
</PropertyGroup> | ||
<RemoveDir Directories="$(PayloadDir)" /> | ||
<Copy | ||
SourceFiles="@(FrameworkItemsUnix)" | ||
DestinationFiles="@(FrameworkItemsUnix->'$(MSBuildFrameworksDir)\%(RelativePath)')" | ||
/> | ||
<Copy | ||
SourceFiles="@(MSBuildItemsUnix)" | ||
DestinationFiles="@(MSBuildItemsUnix->'$(MSBuildTargetsDir)\%(RelativePath)')" | ||
/> | ||
<Copy | ||
SourceFiles="@(XATargetsSrcFiles)" | ||
DestinationFolder="$(XAFrameworkDir)\lib\xamarin.android\xbuild\Xamarin" | ||
/> | ||
<Copy | ||
SourceFiles="@(LegacyTargetsFiles)" | ||
DestinationFolder="$(XAFrameworkDir)\lib\xamarin.android\xbuild\Novell" | ||
/> | ||
<Copy | ||
SourceFiles="@(MonoDocFiles)" | ||
DestinationFolder="$(XAFrameworkDir)\lib\monodoc" | ||
/> | ||
<Copy | ||
SourceFiles="@(VersionFiles);$(PkgLicenseSrcEn)" | ||
DestinationFolder="$(XAFrameworkDir)" | ||
/> | ||
</Target> | ||
<Target Name="_CreateSymbolicLinks" | ||
DependsOnTargets="_CopyFilesToPayloadDir"> | ||
pjcollins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Exec WorkingDirectory="$(PayloadDir)\Library\Frameworks\Xamarin.Android.framework\Versions" | ||
Command="ln -fs $(XAVersion) Current" | ||
/> | ||
<!-- Required for VS Mac Updater --> | ||
<MakeDir Directories="$(PayloadDir)\Developer" /> | ||
<Exec WorkingDirectory="$(PayloadDir)\Developer" | ||
Command="ln -fs "../Library/Frameworks/Xamarin.Android.framework/Versions/Current" MonoAndroid" | ||
/> | ||
<Exec WorkingDirectory="$(MSBuildTargetsDir)\lib" | ||
Command="ln -fs host-$(HostOS) host" | ||
/> | ||
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild" /> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild" | ||
Command="ln -fs "../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild/Novell" ." | ||
/> | ||
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild\Xamarin" /> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild\Xamarin" | ||
Command="ln -fs "../../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild/Xamarin/Android" ." | ||
/> | ||
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild-frameworks" /> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild-frameworks" | ||
Command="ln -fs "../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild-frameworks/MonoAndroid" ." | ||
/> | ||
<MakeDir Directories="$(MonoFrameworkExternalDir)\monodoc" /> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc" | ||
Command="ln -fs "../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-docs.source" ." | ||
/> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc" | ||
Command="ln -fs "../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-lib.tree" ." | ||
/> | ||
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc" | ||
Command="ln -fs "../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-lib.zip" ." | ||
/> | ||
</Target> | ||
<Target Name="_FinalizePayload" | ||
DependsOnTargets="_CreateSymbolicLinks"> | ||
<ReplaceFileContents | ||
SourceFile="distribution.xml.in" | ||
DestinationFile="$(PkgDistributionDestination)" | ||
Replacements="@PACKAGE_TITLE@=Xamarin.Android $(ProductVersion)" | ||
/> | ||
<Exec | ||
WorkingDirectory="$(XamarinAndroidSourcePath)" | ||
ConsoleToMSBuild="true" | ||
Command="git log --no-color --first-parent -n1 --pretty=format:%ct"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="UpdateInfoVersion" /> | ||
</Exec> | ||
<WriteLinesToFile | ||
File="$(XAFrameworkDir)\updateinfo" | ||
Lines="$(UpdateInfoGuid) $(UpdateInfoVersion)" | ||
Overwrite="true" | ||
/> | ||
<MakeDir Directories="$(PkgLicenseDestinationEn)" /> | ||
<Copy | ||
SourceFiles="$(PkgLicenseSrcEn)" | ||
DestinationFiles="$(PkgLicenseDestinationEn)\License" | ||
/> | ||
</Target> | ||
<Target Name="CreatePkg" | ||
Condition=" '$(HostOS)' == 'Darwin' " | ||
DependsOnTargets="_FinalizePayload"> | ||
<MakeDir Directories="$(PkgOutputPath)"/> | ||
<PropertyGroup> | ||
<PkgProductOutputPath Condition="'$(PkgProductOutputPath)' == ''">$(OutputPath)Xamarin.Android.Sdk-$(XAOSSInstallerSuffix).pkg</PkgProductOutputPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PkgBuildArgs Include="--root "$(PayloadDir)"" /> | ||
<PkgBuildArgs Include="--identifier com.xamarin.android.pkg" /> | ||
<PkgBuildArgs Include="--version $(XAVersion)"/> | ||
<PkgBuildArgs Include="--install-location "$(PkgInstallDir)" "/> | ||
<PkgBuildArgs Include="--scripts "$(PkgScriptsDir)" "/> | ||
<PkgBuildArgs Include=""$(PkgOutputPath)/xamarin.android.pkg" "/> | ||
</ItemGroup> | ||
<Exec Command="pkgbuild @(PkgBuildArgs, ' ')" /> | ||
<ItemGroup> | ||
<ProductBuildArgs Include="--resources "$(PkgResourcesPath)"" /> | ||
<ProductBuildArgs Include="--distribution "$(PkgDistributionDestination)"" /> | ||
<ProductBuildArgs Include="--package-path "$(PkgOutputPath)"" /> | ||
<ProductBuildArgs Include=""$(PkgProductOutputPath)"" /> | ||
</ItemGroup> | ||
<Exec Command="productbuild @(ProductBuildArgs, ' ')" /> | ||
</Target> | ||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<installer-gui-script minSpecVersion="1"> | ||
<license file="License" mime-type="application/rtf" /> | ||
<title>@PACKAGE_TITLE@</title> | ||
<pkg-ref id="xamarin.android"> | ||
<bundle-version/> | ||
</pkg-ref> | ||
<choices-outline> | ||
<line choice="default"> | ||
<line choice="xamarin.android"/> | ||
</line> | ||
</choices-outline> | ||
<choice id="default"/> | ||
<choice id="xamarin.android" visible="false"> | ||
<pkg-ref id="xamarin.android"/> | ||
</choice> | ||
<pkg-ref id="xamarin.android">#xamarin.android.pkg</pkg-ref> | ||
</installer-gui-script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
INSTALLATION_ROOT=/Library/Frameworks/Xamarin.Android.framework/Versions | ||
PREVIOUS_VERSION=$(readlink "$INSTALLATION_ROOT/Current") | ||
PREVIOUS_VERSION_PATH="$INSTALLATION_ROOT/$PREVIOUS_VERSION" | ||
pjcollins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Ensure previously installed version is removed. | ||
if [ -d "$PREVIOUS_VERSION_PATH" ]; then | ||
rm -rf "$PREVIOUS_VERSION_PATH" | ||
fi | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.