Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Xamarin.Android.sln
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "download-bundle", "build-to
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jit-times", "tools\jit-times\jit-times.csproj", "{F3CFF31C-037B-450F-B22D-1D6E529B2DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "create-pkg", "build-tools\create-pkg\create-pkg.csproj", "{46529930-A5CC-4205-A50D-0AAAC639F082}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Xamarin.Android.NamingCustomAttributes\Xamarin.Android.NamingCustomAttributes.projitems*{3f1f2f50-af1a-4a5a-bedb-193372f068d7}*SharedItemsImports = 4
Expand Down Expand Up @@ -371,6 +373,10 @@ Global
{F3CFF31C-037B-450F-B22D-1D6E529B2DCC}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{F3CFF31C-037B-450F-B22D-1D6E529B2DCC}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{F3CFF31C-037B-450F-B22D-1D6E529B2DCC}.Release|AnyCPU.Build.0 = Release|Any CPU
{46529930-A5CC-4205-A50D-0AAAC639F082}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{46529930-A5CC-4205-A50D-0AAAC639F082}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{46529930-A5CC-4205-A50D-0AAAC639F082}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{46529930-A5CC-4205-A50D-0AAAC639F082}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -432,6 +438,7 @@ Global
{1E5501E8-49C1-4659-838D-CC9720C5208F} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{F3CFF31C-037B-450F-B22D-1D6E529B2DCC} = {864062D3-A415-4A6F-9324-5820237BA058}
{46529930-A5CC-4205-A50D-0AAAC639F082} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {53A1F287-EFB2-4D97-A4BB-4A5E145613F6}
Expand Down
30 changes: 23 additions & 7 deletions build-tools/automation/build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"
}
}
}
}

Expand All @@ -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}'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this overriding _MSBUILD_ARGS and not MSBUILD_ARGS?

} else {
sh "make create-installers CONFIGURATION=${env.BuildFlavor}"
}
}

stageWithTimeout('package oss', 30, 'MINUTES', XADir, true) { // Typically takes less than 5 minutes
Expand All @@ -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"
Expand All @@ -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})"
Expand Down
33 changes: 33 additions & 0 deletions build-tools/create-pkg/create-pkg.csproj
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>
137 changes: 137 additions & 0 deletions build-tools/create-pkg/create-pkg.targets
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">
<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 &quot;../Library/Frameworks/Xamarin.Android.framework/Versions/Current&quot; MonoAndroid"
/>
<Exec WorkingDirectory="$(MSBuildTargetsDir)\lib"
Command="ln -fs host-$(HostOS) host"
/>
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild" />
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild"
Command="ln -fs &quot;../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild/Novell&quot; ."
/>
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild\Xamarin" />
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild\Xamarin"
Command="ln -fs &quot;../../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild/Xamarin/Android&quot; ."
/>
<MakeDir Directories="$(MonoFrameworkExternalDir)\xbuild-frameworks" />
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\xbuild-frameworks"
Command="ln -fs &quot;../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/xamarin.android/xbuild-frameworks/MonoAndroid&quot; ."
/>
<MakeDir Directories="$(MonoFrameworkExternalDir)\monodoc" />
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc"
Command="ln -fs &quot;../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-docs.source&quot; ."
/>
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc"
Command="ln -fs &quot;../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-lib.tree&quot; ."
/>
<Exec WorkingDirectory="$(MonoFrameworkExternalDir)\monodoc"
Command="ln -fs &quot;../../../Xamarin.Android.framework/Versions/$(XAVersion)/lib/monodoc/MonoAndroid-lib.zip&quot; ."
/>
</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 &quot;$(PayloadDir)&quot;" />
<PkgBuildArgs Include="--identifier com.xamarin.android.pkg" />
<PkgBuildArgs Include="--version $(XAVersion)"/>
<PkgBuildArgs Include="--install-location &quot;$(PkgInstallDir)&quot; "/>
<PkgBuildArgs Include="--scripts &quot;$(PkgScriptsDir)&quot; "/>
<PkgBuildArgs Include="&quot;$(PkgOutputPath)/xamarin.android.pkg&quot; "/>
</ItemGroup>
<Exec Command="pkgbuild @(PkgBuildArgs, ' ')" />
<ItemGroup>
<ProductBuildArgs Include="--resources &quot;$(PkgResourcesPath)&quot;" />
<ProductBuildArgs Include="--distribution &quot;$(PkgDistributionDestination)&quot;" />
<ProductBuildArgs Include="--package-path &quot;$(PkgOutputPath)&quot;" />
<ProductBuildArgs Include="&quot;$(PkgProductOutputPath)&quot;" />
</ItemGroup>
<Exec Command="productbuild @(ProductBuildArgs, ' ')" />
</Target>
</Project>
18 changes: 18 additions & 0 deletions build-tools/create-pkg/distribution.xml.in
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>
11 changes: 11 additions & 0 deletions build-tools/create-pkg/scripts/preinstall
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"

# Ensure previously installed version is removed.
if [ -d "$PREVIOUS_VERSION_PATH" ]; then
rm -rf "$PREVIOUS_VERSION_PATH"
fi

1 change: 0 additions & 1 deletion build-tools/create-vsix/create-vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' " />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' " />
<Import Project="..\..\Configuration.props" />
<ItemGroup>
<Compile Include="AndroidSdkPackage.cs" />
<Content Include="Resources\AndroidSdkPackage.ico">
Expand Down
Loading