Skip to content

Conversation

pjcollins
Copy link
Member

@pjcollins pjcollins commented Feb 13, 2019

Introduces a new create-pkg project next to create-vsix to be used
in a similar way to create a macOS installer for xamarin-android. The
build-tools/installers/create-installers.targets file has also been
added to keep track of all of the content we require in both our macOS
and Windows installers. These shared items, properties, and targets are
used by both installer projects to ensure uniformity between the two
installers we produce.

The ConstructInstallerItems target determines the majority of the files
which should end up in the installer. Behavior will vary depending on the
existance of certain files or the values of certain msbuild properties.
This was done intentionally to be able to support creating installers for
PR builds, open source packages, and commercial packages.

The AndroidFirstFrameworkVersion, AndroidLatestStableFrameworkVersion,
and AndroidLatestFrameworkVersion MSBuild properties (along with some
hardcoded values) are used to determine which API levels the installer
will support.

The AndroidSupportedTargetJitAbi MSBuild property is used to determine
which Android ABIs the installer will support.

The IncludeMonoBundleComponents MSBuild property is used to determine
whether or not the components which come from a full mono integration
build should be included in the installers.

The new create-installers make target will attempt to package all of
the relevant files for every ABI specified in the ALL_JIT_ABIS variable
in build-tools/scripts/BuildEverything.mk. This behavior can be
overridden by specifying an empty value for _MSBUILD_ARGS when calling
the create-installers make rule (as build.groovy does), or by providing
an alternate value for /p:AndroidSupportedTargetJitAbis when building
either installer directly from MSBuild.

The build.groovy script has been updated to handle creating different
installer types for PR builds and full builds. Our macOS PR builds will
now build a mxe-win flavored version of libmono-android, so that it can
be included in a vsix installer and used to extend test coverage for our
PR builds in the future. PR builds will also package a limited set of
Android ABI support as briefly mentioned above.

A new pkg preinstall script has also been added to fix an issue that
would result in old installations being left on disk. Now, the macOS
installer will attempt to remove the version currently symlinked to
/Library/Frameworks/Xamarin.Android.framework/Versions/Current
before running.

Fixes #2686.

@pjcollins pjcollins added do-not-merge PR should not be merged. Area: Installer Issues with macOS .pkg or Windows .vsix contents. labels Feb 13, 2019
@pjcollins pjcollins requested a review from jonpryor as a code owner February 13, 2019 21:38
@pjcollins
Copy link
Member Author

Initial testing of a .pkg produced by this new create-pkg project has produced positive results with a couple of XA projects (build/package/deploy) from both command line msbuild and VS Mac.

@jonpryor
Copy link
Contributor

It occurs to me that build-tools/scripts has become a bit of a mish-mash of...things...and that it would be better if we had more semantically meaningful names and descriptions.

As such, instead of build-tools/scripts/installers/create-installers.targets, could we "flatten" that into build-tools/installers/create-installers.targets (removing the scripts portion entirely).

jonpryor pushed a commit that referenced this pull request Feb 14, 2019
Xamarin.Android provides a variety of targets for use by the
[Xamarin.Android Designer][0], which are used to help prepare a
project for consumption by the Xamarin.Android Designer.

Historically these targets were kept within the commercial repo.

Move the `GetExtraLibraryLocationsForDesigner` and related MSBuild
targets and unit tests from xamarin/monodroid@40a23fbf into the
xamarin-android repo.

Moving the targets will hopefully permit the Xamarin.Android Designer
integration tests to use the xamarin-android OSS build artifacts and
installers (e.g. PR #2733), allowing breakage caused by changes
within the `xamarin-android` repo to be more quickly identified and
fixed.  (Currently, commercial installer creation can be
significantly delayed, which increases the time it takes for the
Designer integration tests to get a chance to run, and any breakage
found and reported, before breakage can be fixed.)

[0]: https://docs.microsoft.com/en-us/xamarin/android/user-interface/android-designer/
@jonpryor
Copy link
Contributor

This should also update build-tools/automation/build.groovy so that the .pkg is created and uploaded, e.g. (untested)

diff --git a/build-tools/automation/build.groovy b/build-tools/automation/build.groovy
index dd58d6cc..fe57e8ab 100644
--- a/build-tools/automation/build.groovy
+++ b/build-tools/automation/build.groovy
@@ -97,6 +97,10 @@ timestamps {
             sh "make create-vsix CONFIGURATION=${env.BuildFlavor}"
         }
 
+        stageWithTimeout('create pkg', 30, 'MINUTES', XADir, true) {    // Typically takes less than 5 minutes
+            sh "msbuild /p:Configuration=${env.BuildFlavor} /t:CreatePkg build-tools/create-pkg/create-pkg.csproj"
+        }
+
         stageWithTimeout('build tests', 30, 'MINUTES', XADir, true) {    // Typically takes less than 10 minutes
             sh "make all-tests CONFIGURATION=${env.BuildFlavor}"
         }
@@ -111,7 +115,7 @@ timestamps {
         }
 
         stageWithTimeout('publish packages to Azure', 10, 'MINUTES', XADir, true) {    // Typically takes less than a minute
-            def publishBuildFilePaths = "xamarin.android-oss*.zip,bin/${env.BuildFlavor}/bundle-*.zip,bin/Build*/Xamarin.Android.Sdk*.vsix,prepare-image-dependencies.sh,build-status*,xa-build-status*";
+            def publishBuildFilePaths = "xamarin.android-oss*.zip,bin/${env.BuildFlavor}/bundle-*.zip,bin/Build*/Xamarin.Android.Sdk*.vsix,bin/Build*/*.pkg,prepare-image-dependencies.sh,build-status*,xa-build-status*";
             echo "publishBuildFilePaths: ${publishBuildFilePaths}"
             def stageStatus = publishPackages(publishBuildFilePaths)
             if (stageStatus != 0) {

@pjcollins pjcollins force-pushed the create-installers branch from ce0e2a8 to 5cea7c8 Compare March 4, 2019 20:17
@pjcollins pjcollins changed the title Add 'create-pkg' project to create a .pkg installer from a local build tree [installers] Share installer payload generation logic Mar 4, 2019
@pjcollins pjcollins removed the do-not-merge PR should not be merged. label Mar 6, 2019
@pjcollins pjcollins force-pushed the create-installers branch from cbce7aa to 3158c70 Compare March 6, 2019 21:15
@pjcollins pjcollins force-pushed the create-installers branch from 3158c70 to a3d67f4 Compare March 6, 2019 23:02
@pjcollins pjcollins force-pushed the create-installers branch from a3d67f4 to 7e49940 Compare March 7, 2019 18:40
@jonpryor
Copy link
Contributor

jonpryor commented Mar 8, 2019

There are merge conflicts. :-(

Additionally, commit f74cd44 added some additional files which should be installed:

  • xbuild\Xamarin\Android\jit-times.exe
  • xbuild\Xamarin\Android\$(HostOS)\jit-times

@pjcollins
Copy link
Member Author

@jonpryor I'm also working on another required make change, we'll need to override AndroidSupportedTargetJitAbis when creating installers for a non PR build.

@pjcollins pjcollins force-pushed the create-installers branch 4 times, most recently from b040ed5 to 1a7c188 Compare March 11, 2019 22:10
@pjcollins pjcollins force-pushed the create-installers branch 2 times, most recently from 88d9ba2 to 0c39012 Compare March 12, 2019 17:30
Introduces a new `create-pkg` project next to `create-vsix` to be used
in a similar way to create a macOS installer for xamarin-android. The
`build-tools/installers/create-installers.targets` file has also been
added to keep track of all of the content we require in both our macOS
and Windows installers. These shared items, properties, and targets are
used by both installer projects to ensure uniformity between the two
installers we produce.

The `ConstructInstallerItems` target determines the majority of the files
which should end up in the installer. Behavior will vary depending on the
existance of certain files or the values of certain msbuild properties.
This was done intentionally to be able to support creating installers for
PR builds, open source packages, and commercial packages.

The `AndroidFirstFrameworkVersion`, `AndroidLatestStableFrameworkVersion`,
and `AndroidLatestFrameworkVersion` MSBuild properties (along with some
hardcoded values) are used to determine which API levels the installer
will support.

The `AndroidSupportedTargetJitAbi` MSBuild property is used to determine
which Android ABIs the installer will support.

The `IncludeMonoBundleComponents` MSBuild property is used to determine
whether or not the components which come from a full mono integration
build should be included in the installers.

The new `create-installers` make target will attempt to package all of
the relevant files for every ABI specified in the `ALL_JIT_ABIS` variable
in `build-tools/scripts/BuildEverything.mk`. This behavior can be
overridden by specifying an empty value for `_MSBUILD_ARGS` when calling
the `create-installers` make rule (as build.groovy does), or by providing
an alternate value for `/p:AndroidSupportedTargetJitAbis` when building
either installer directly from MSBuild.

The build.groovy script has been updated to handle creating different
installer types for PR builds and full builds. Our macOS PR builds will
now build a mxe-win flavored version of `libmono-android`, so that it can
be included in a vsix installer and used to extend test coverage for our
PR builds in the future. PR builds will also package a limited set of
Android ABI support as briefly mentioned above.

A new pkg preinstall script has also been added to fix an issue that
would result in old installations being left on disk. Now, the macOS
installer will attempt to remove the version currently symlinked to
`/Library/Frameworks/Xamarin.Android.framework/Versions/Current`
before running.

Fixes dotnet#2686.
// 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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Installer Issues with macOS .pkg or Windows .vsix contents.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove glob use from create-vsix.csproj
3 participants