Skip to content

Xamarin.Android build preparation utility#3051

Merged
jonpryor merged 3 commits intodotnet:masterfrom
grendello:xa/bootstrap
Jun 7, 2019
Merged

Xamarin.Android build preparation utility#3051
jonpryor merged 3 commits intodotnet:masterfrom
grendello:xa/bootstrap

Conversation

@grendello
Copy link
Copy Markdown
Contributor

@grendello grendello commented Apr 30, 2019

Testing:

  • Default mode: run make prepare
  • Verbose debug: run make V=1 prepare
  • CI mode: run make PREPARE_CI=1 prepare
  • Help: run make prepare-help
  • Logs: bin/BuildDebug

Supported operating systems:

  • macOS
  • Linux

Windows support is planned, present but not fully implemented or tested.

This commit implements a make prepare replacement that does not rely on shell
scripts or MSBuild. The idea is that a standalone C# program can perform all the
steps in a more streamlined, more clear way than the current solution. One of
the main goals is to make the process more approachable by external
contributors, but also by the core developers who may want to change some
aspects of XA build preparation (e.g. Android platforms, Mono version etc) but
are not familiar with the build system. Towards that goal, the codebase is
designed so that the minimum amount of searching around it is necessary to
figure out where to make the desired change. Main location serving this purpose
is the build-tools/xaprepare/xaprepare/ConfigAndData directory. It should
be the only location where one needs to look in order to change all and any
aspects of XA preparation.

[TBC]

@grendello grendello added the do-not-merge PR should not be merged. label Apr 30, 2019
@grendello grendello requested a review from jonpryor as a code owner April 30, 2019 19:39
@grendello grendello force-pushed the xa/bootstrap branch 5 times, most recently from e8ae026 to bc91e42 Compare May 6, 2019 16:59
CODEOWNERS Outdated
/build-tools/manifest-attribute-codegen @jonpryor
/build-tools/scripts/PrepareWindows.targets @jonathanpeppers
/build-tools/timing @jonathanpeppers @radekdoulik
/build-tools/xabootstrap @grendello
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor nitpick: should this be bootstrap or prepare? It's not like we're going to have multiple bootstrap systems in here...

Makefile Outdated
msbuild $(BOOTSTRAP_MSBUILD_ARGS) $(BOOTSTRAP_SOLUTION)

bootstrap:
$(MAKE) bootstrap-build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why call $(MAKE) instead of depending on the bootstrap-build target?


1. bazelbuild/bazel (https://github.com/bazelbuild/bazel/)
2. google/desugar (https://android.googlesource.com/platform/external/desugar/+/master/)
3. mono/boringssl (https://github.com/mono/boringssl)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These changes imply that we're doing the wrong thing for the repo ThirdPartyNotices.txt file. The purpose of the repo-level ThirdPartyNotices.txt are for third party dependencies copied into this repo, not from submodules or NuGet packages or the like.

boringssl is included via submodule. linker is included via submodule. etc. These do not need to be present within this ThirdPartyNotices.txt file.

Third party code such as this does need to be listed in the generated and included-within-the-installer bin/$(Configuration)/lib/xamarin.android/ThirdPartyNotices.txt file.

@jonpryor
Copy link
Copy Markdown
Contributor

jonpryor commented May 6, 2019

Why is external/opentk modified?

@@ -0,0 +1,2 @@
http://www.kajabity.com
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's this file for?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There should be a README.md in this directory with required documentation...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accidentally added, probably coming from the nuget

@@ -0,0 +1,12 @@
# Files to remove
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This feels like material for README.md. Alternatively, more details need to be here.

For example, what constitutes "the migration"? How will this interact with checking out different branches?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's just notes to myself, so that I don't forget to remove stuff later on (there's a LOT of it around).

{
partial class Windows : Dependencies
{
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't C++; trailing ; isn't needed. :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

muscle memory :)

Dependencies.AddRange (programs);
Log.Todo ("special treatment for Mono - version checks and such");
}
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't C++; trailing ; isn't needed. :-)

new AndroidPlatformComponent ("platform-28_r04", "28"),

// arguments are: string name, string destDir, Uri relativeUrl = null, bool isMultiVersion = false, bool noSubdirectory = false
{ "docs-24_r01", "docs"},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this would be easier to read & understand if the extension method weren't used here. I'd never previously considered adding an List<SpecificType>.Add(args...) extension method before, and had to pause for a bit to understand what was going on.


public static readonly List<AndroidPlatform> AllPlatforms = new List<AndroidPlatform> {
// API, ID, Framework, Stable
{ 0, "0", null, false },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Likewise here: I'd never considered the ability to add a List<AndroidPlatform>.Add(...) extension method before. While "interesting", I'm not sure it's clearer than the alternative of new AndroidPlatform(...).

Additionally, while the extension method does add argument validation, ensuring that e.g. only one API-1 is added, that means each Add() call is O(n) instead of (amortized) O(1). This shouldn't matter with a list this small, but it is...odd.

{
static readonly Uri url = new Uri ("http://not.an/item");

public override string LicenseText => "not a license item";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happened with the indentation here?

namespace Xamarin.Android.Bootstrap
{
[AttributeUsage (AttributeTargets.Class)]
class TPNAttribute : Attribute
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tabs, not spaces, please. :-)

{ "docs-24_r01", "docs"},
{ "android_m2repository_r16", Path.Combine ("extras", "android", "m2repository")},
{ "x86-28_r04", Path.Combine ("system-images", "android-28", "default", "x86"), new Uri ("sys-img/android/", UriKind.Relative)},
{$"android-ndk-r{AndroidNdkVersion}-{osTag}-x86_64", AndroidNdkDirectory},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Apparently AndroidNdkVersion isn't set when expected/required, because when the build attempts to download this url, it fails:

error : Unable to download URL `https://dl.google.com/android/repository/android-ndk-r-darwin-x86_64.zip` to `/Users/builder/android-archives/android-ndk-r-darwin-x86_64.zip`: Response status code does not indicate success: 404

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BuildAndroidPlatforms.AndroidNdkVersion is const; how could this not be set/available here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The build fails because it uses make prepare and not the new bootstrapper which changed the way NDK references work. At this moment the build failure is expected, until I make the new bootstrapper the "default" in this PR

@jonpryor
Copy link
Copy Markdown
Contributor

jonpryor commented May 6, 2019

Also needed is some form of documentation, not just in build-tools/xabootstrap/README.md, but also in Documentation/building/unix/instructions.md.

There's a new make bootstrap target; what's it do? How does it differ from make prepare? It creates log files; where are those log files located, what can you expect to find there?

@jonpryor
Copy link
Copy Markdown
Contributor

jonpryor commented May 6, 2019

Given that e.g. bin/BuildDebug already contains log files, in the form of msbuild-*.binlog, should bin/BuildDebug/logs be renamed as bin/BuildDebug/bootstrap-logs? Or remove the logs directory and put them into bin/BuildDebug directly?

@grendello grendello force-pushed the xa/bootstrap branch 6 times, most recently from 3629b10 to 973368b Compare May 7, 2019 14:52
@grendello grendello force-pushed the xa/bootstrap branch 10 times, most recently from f19fb36 to e0517cd Compare May 21, 2019 18:06
@grendello
Copy link
Copy Markdown
Contributor Author

So... the commercial pipeline failure is very mysterious, with a possible workaround. The failure is:

Time Elapsed 00:13:55.37
build-tools/scripts/BuildEverything.mk:12: *** non-numeric first argument to `word' function: ''.  Stop.

This is caused by the jenkins rule eventually calling the framework-assemblies rule which is where we see the above error for this $(word) invocation. However, the actual commands in the framework-assemblies rule are never executed as we don't see the echo output - which we would have seen even if there was an error below them!

Running make framework-assemblies directly from the command line makes the rule work fine, which doesn't take us any closer to solving of the mystery, alas. However, the Xcode-provided make is ancient (version 3.81 from April 2006!) and it appears it might be some bug in that release, since the entire build works with make 4.2.1 installed from homebrew. The solution, then, would be to install make and run the pipeline steps with gmake (as the make from homebrew is named, so that it doesn't conflict with the system-provided version). At this point I'm not sure whether it makes sense to spend time trying to fix or work around a bug in a fossil version of software when we have a newer, and working, version available...

Having said that, I'm currently running local jenkins build with make debugging flags in effect, so maybe it will reveal the failure cause...

@grendello
Copy link
Copy Markdown
Contributor Author

The local rebuild with make debugging didn't reveal much:

Time Elapsed 00:07:00.35
Reaping winning child 0x7faf7cc19cc0 PID 52427
Removing child 0x7faf7cc19cc0 PID 52427 from chain.
    Successfully remade target file `leeroy-all'.
    Considering target file `framework-assemblies'.
     File `framework-assemblies' does not exist.
     Finished prerequisites of target file `framework-assemblies'.
    Must remake target `framework-assemblies'.
build-tools/scripts/BuildEverything.mk:12: *** non-numeric first argument to `word' function: ''.  Stop.

@grendello
Copy link
Copy Markdown
Contributor Author

Soooo... Clutching at straws at its best, but... it worked! The solution to the problem (at least locally) was to rename the a foreach variable to something else (I chose api_level) which made the fossil make happy. Let's see if it works on the bot

@grendello
Copy link
Copy Markdown
Contributor Author

Aaaand... it didn't work on the bot :(

Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

I tried the latest changes on Windows again, as of 860732a.

I can build & run the bootstrapper:

# NOTE: I have a 'nuget' powershell alias that points to a NuGet.exe
> nuget restore .\build-tools\xaprepare\xaprepare.sln
> msbuild .\build-tools\xaprepare\xaprepare.sln
> .\build-tools\xaprepare\xaprepare\bin\Debug\xaprepare.exe

Unfortunately xaprepare.exe fails with:

Step Xamarin.Android.Prepare.Step_InstallCorrettoOpenJDK failed: The process cannot access the file because it is being used by another process.                                                                                                              System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallCorrettoOpenJDK failed: The process cannot access the file because it is being used by another process. ---> System.IO.IOException: The process cannot access the file because it is being used by another process.                                                                                                                                                                                                                                 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)                                                                                                                                                                                        at System.IO.__Error.WinIOError()                                                                                                                                                                                                                             at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)                                                                                                                                                                 at System.IO.File.Move(String sourceFileName, String destFileName)                                                                                                                                                                                            at Xamarin.Android.Prepare.Utilities.MoveDirectory(String sourceDir, String destinationDir) in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Utilities.cs:line 472                                                                       at Xamarin.Android.Prepare.Utilities.MoveDirectory(String sourceDir, String destinationDir) in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Utilities.cs:line 464                                                                       at Xamarin.Android.Prepare.Utilities.MoveDirectoryContentsRecursively(String sourceDir, String destinationDir) in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Utilities.cs:line 447                                                    at Xamarin.Android.Prepare.Step_InstallCorrettoOpenJDK.<Execute>d__2.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Steps\Step_InstallCorrettoOpenJDK.cs:line 61                                                                     --- End of stack trace from previous location where exception was thrown ---                                                                                                                                                                                     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                                                                                                                                                             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()                                                                                                                                                                                                  at Xamarin.Android.Prepare.Step.<Run>d__17.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Step.cs:line 42                                                                                                                --- End of stack trace from previous location where exception was thrown ---                                                                                                                                                                                     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)                                                                                                                                                                                  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                                                                                                                                                             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()                                                                                                                                                                                                  at Xamarin.Android.Prepare.Scenario.<Run>d__14.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Scenario.cs:line 33                                                                                                           --- End of inner exception stack trace ---                                                                                                                                                                                                                    at Xamarin.Android.Prepare.Scenario.<Run>d__14.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Scenario.cs:line 44                                                                                                        --- End of stack trace from previous location where exception was thrown ---                                                                                                                                                                                     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)                                                                                                                                                                                  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                                                                                                                                                             at System.Runtime.CompilerServices.TaskAwaiter.GetResult()                                                                                                                                                                                                    at Xamarin.Android.Prepare.Context.<Execute>d__182.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Context.cs:line 753                                                                                                    --- End of stack trace from previous location where exception was thrown ---                                                                                                                                                                                     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)                                                                                                                                                                                  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)                                                                                                                                                             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()                                                                                                                                                                                                  at Xamarin.Android.Prepare.App.<Run>d__3.MoveNext() in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Main.cs:line 154   

Here are the logs I think it made: BuildDebug.zip

If I run it again, I get:

System.IO.IOException: The handle is invalid.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.__Error.WinIOError()
   at System.Console.set_CursorVisible(Boolean value)
   at Xamarin.Android.Prepare.App.Main(String[] args) in C:\src\xamarin-android\build-tools\xaprepare\xaprepare\Main.cs:line 37


utils.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='$EXTRA_MSBUILD_ARGS'"
sh "make prepare-update-mono CONFIGURATION=${env.BuildFlavor} V=1 PREPARE_CI=1 MSBUILD_ARGS='$EXTRA_MSBUILD_ARGS'"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indentation is wrong here; looks like a tabs-vs-spaces problem.

def XADir = "xamarin-android"
def buildTarget = 'jenkins'
def chRootPackages = 'xvfb xauth mono-devel autoconf automake build-essential vim-common p7zip-full cmake gettext libtool libgdk-pixbuf2.0-dev intltool pkg-config ruby scons wget xz-utils git nuget ca-certificates-mono clang g++-mingw-w64 gcc-mingw-w64 libzip-dev zulu-8 unzip lib32stdc++6 lib32z1 libtinfo-dev:i386 linux-libc-dev:i386 zlib1g-dev:i386 gcc-multilib g++-multilib referenceassemblies-pcl zip fsharp psmisc libz-mingw-w64-dev msbuild mono-csharp-shell devscripts fakeroot debhelper libsqlite3-dev sqlite3 libc++-dev cli-common-dev curl libncurses-dev'
def chRootPackages = 'ant xvfb xauth mono-devel autoconf automake build-essential vim-common p7zip-full cmake gettext libtool libtool-bin libgdk-pixbuf2.0-dev intltool pkg-config ruby scons wget xz-utils git nuget ca-certificates-mono clang g++-mingw-w64 gcc-mingw-w64 libzip-dev zulu-8 unzip lib32stdc++6 lib32z1 libtinfo-dev:i386 linux-libc-dev:i386 zlib1g-dev:i386 gcc-multilib g++-multilib referenceassemblies-pcl zip fsharp psmisc libz-mingw-w64-dev msbuild mono-csharp-shell devscripts fakeroot debhelper libsqlite3-dev sqlite3 libc++-dev cli-common-dev curl libncurses-dev ninja-build'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs rebasing atop 9887642.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I know, I'm waiting for the current build to finish


## Introduction

The task and purpose of this utility is to prepare the ``Xamarin.Android` source tree for build by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Too many backticks, screwing up formatting, and I assume you mean "xamarin-android source tree".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I meant the product name - Xamarin.Android - not GitHub repo name xamarin-android

the repository is freshly cloned.

The utility is written in C# as a .NET 4.7 console app and does not depend on any other code within the
`Xamarin.Android` repository.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's the xamarin-android repository.

Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

This time I was able to do:

  1. Downloaded this bundle and put it in ~\android-archives
  2. > msbuild Xamarin.Android.sln /t:Prepare
  3. > msbuild Xamarin.Android.sln -> this one didn't quite work

After step 2, I should have a Configuration.OperatingSystem.props, with the paths to java setup, etc. I get failures like:

"C:\src\xamarin-android\src\r8\r8.csproj" (default target) (26:2) ->
(_BuildR8 target) ->
  EXEC : error : JAVA_HOME is not set and no 'java' command could be found in your PATH. [C:\src\xamarin-android\src\r8\r8.csproj]
  C:\src\xamarin-android\src\r8\r8.targets(20,5): error MSB3073: The command ""C:\src\xamarin-android\build-tools\gradle\gradlew" jar --stacktrace --no-daemon" exited with code 1.

xamarin-android/master current generates this Configuration.OperatingSystem.props on my machine:

<?xml version="1.0" encoding="utf-8"?>                                                                                                                                                                                                                        <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <HostOS Condition=" '$(HostOS)' == '' ">Windows</HostOS>
    <HostOsName Condition=" '$(HostOsName)' == '' ">Windows</HostOsName>
    <HostOsRelease Condition=" '$(HostOsRelease)' == '' ">10</HostOsRelease>
    <HostTriplet Condition=" '$(HostTriplet)' == '' ">x86_64-win32</HostTriplet>
    <HostTriplet32 Condition=" '$(HostTriplet32)' == '' ">i386-win32</HostTriplet32>
    <HostTriplet64 Condition=" '$(HostTriplet64)' == '' ">x86_64-win32</HostTriplet64>
    <HostCpuCount Condition=" '$(HostCpuCount)' == '' ">$([System.Environment]::ProcessorCount)</HostCpuCount>
    <HostBits Condition=" '$(HostBits)' == '' ">64</HostBits>
    <JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' ">C:\Program Files (x86)\Java\jdk1.8.0_161</JavaSdkDirectory>
    <JavaCPath Condition=" '$(JavaCPath)' == '' ">$(JavaSdkDirectory)\bin\javac.exe</JavaCPath>
    <JarPath Condition=" '$(JarPath)' == '' ">$(JavaSdkDirectory)\bin\jar.exe</JarPath>
    <JavaPath Condition=" '$(JavaPath)' == '' ">$(JavaSdkDirectory)\bin\java.exe</JavaPath>
  </PropertyGroup>
</Project>

I also get some NuGet-related failures like:

"C:\src\xamarin-android\external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj" (default target) (53) ->
(CoreCompile target) ->
  AndroidVersionTests.cs(5,7): error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)

Does anything run?

> nuget restore .\external\xamarin-android-tools\Xamarin.Android.Tools.sln

<PropertyGroup>
<_AzureBaseUri>https://xamjenkinsartifact.azureedge.net/mono-jenkins/</_AzureBaseUri>
<_NuGetUri>https://dist.nuget.org/win-x86-commandline/v4.7.1/nuget.exe</_NuGetUri>
<_NuGetPath>$(MSBuildThisFileDirectory)\..\..\.nuget</_NuGetPath>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove all this nuget.exe stuff here?

return false;
}

throw new InvalidOperationException ($"Failed to access bundle at {bundleUrl} (HTTP status: {status})");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this use the error message we have here: https://github.com/xamarin/xamarin-android/blob/46b4c53dc69e41db905bc4b62393d9c8d064d425/build-tools/download-bundle/download-bundle.targets#L32

I think it explains to external contributors a little better.

There might be some other places in here that would hit, this too?

@jonathanpeppers
Copy link
Copy Markdown
Member

jonathanpeppers commented May 31, 2019

Actually @grendello Configuration.OperatingSystem.props is created.

it prints this:

Generating Configuration.OperatingSystem.props <- build-tools\xaprepare\xaprepare\Resources\Configuration.OperatingSystem.props.in

But then I see it doesn't have a $(JavaSdkDirectory):

> cat .\Configuration.OperatingSystem.props                                                                                                                                                                 
<?xml version="1.0" encoding="utf-8"?>                                                                                                                                                                                                                        
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <HostOsName Condition=" '$(HostOsName)' == '' ">Microsoft Windows 10 [Version 10.0.18362]</HostOsName>
        <HostOsFlavor Condition=" '$(HostOsFlavor)' == '' ">Windows 10</HostOsFlavor>
        <HostOsRelease Condition=" '$(HostOsRelease)' == '' ">10.0.18362</HostOsRelease>
        <HostTriplet Condition=" '$(HostTriplet)' == '' "></HostTriplet>
        <HostTriplet32 Condition=" '$(HostTriplet32)' == '' "></HostTriplet32>
        <HostTriplet64 Condition=" '$(HostTriplet64)' == '' "></HostTriplet64>
        <HostCpuCount Condition=" '$(HostCpuCount)' == '' ">4</HostCpuCount>
        <HostBits Condition=" '$(HostBits)' == '' ">64</HostBits>
        <HostCcName Condition=" '$(HostCcName)' == '' "></HostCcName>
        <HostCxxName Condition=" '$(HostCxxName)' == '' "></HostCxxName>
        <HostCc32 Condition=" '$(HostCc32)' == '' "></HostCc32>
        <HostCc64 Condition=" '$(HostCc64)' == '' "></HostCc64>
        <HostCxx32 Condition=" '$(HostCxx32)' == '' "></HostCxx32>
        <HostCxx64 Condition=" '$(HostCxx64)' == '' "></HostCxx64>
        <JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' "></JavaSdkDirectory>
        <JavaCPath Condition=" '$(JavaCPath)' == '' ">javac</JavaCPath>
        <JarPath Condition=" '$(JarPath)' == '' ">jar</JarPath>
        <JavaPath Condition=" '$(JavaPath)' == '' ">java</JavaPath>
        <HostHomebrewPrefix Condition=" '$(HostHomebrewPrefix)' == '' "></HostHomebrewPrefix>
    </PropertyGroup>
</Project>

Both Windows & macOS should have the path to the Coretto java that got installed I think?

@grendello
Copy link
Copy Markdown
Contributor Author

grendello commented May 31, 2019

Actually @grendello Configuration.OperatingSystem.props is created.

it prints this:

Generating Configuration.OperatingSystem.props <- build-tools\xaprepare\xaprepare\Resources\Configuration.OperatingSystem.props.in

But then I see it doesn't have a $(JavaSdkDirectory):

> cat .\Configuration.OperatingSystem.props                                                                                                                                                                 
<?xml version="1.0" encoding="utf-8"?>                                                                                                                                                                                                                        
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <HostOsName Condition=" '$(HostOsName)' == '' ">Microsoft Windows 10 [Version 10.0.18362]</HostOsName>
        <HostOsFlavor Condition=" '$(HostOsFlavor)' == '' ">Windows 10</HostOsFlavor>
        <HostOsRelease Condition=" '$(HostOsRelease)' == '' ">10.0.18362</HostOsRelease>
        <HostTriplet Condition=" '$(HostTriplet)' == '' "></HostTriplet>
        <HostTriplet32 Condition=" '$(HostTriplet32)' == '' "></HostTriplet32>
        <HostTriplet64 Condition=" '$(HostTriplet64)' == '' "></HostTriplet64>
        <HostCpuCount Condition=" '$(HostCpuCount)' == '' ">4</HostCpuCount>
        <HostBits Condition=" '$(HostBits)' == '' ">64</HostBits>
        <HostCcName Condition=" '$(HostCcName)' == '' "></HostCcName>
        <HostCxxName Condition=" '$(HostCxxName)' == '' "></HostCxxName>
        <HostCc32 Condition=" '$(HostCc32)' == '' "></HostCc32>
        <HostCc64 Condition=" '$(HostCc64)' == '' "></HostCc64>
        <HostCxx32 Condition=" '$(HostCxx32)' == '' "></HostCxx32>
        <HostCxx64 Condition=" '$(HostCxx64)' == '' "></HostCxx64>
        <JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' "></JavaSdkDirectory>
        <JavaCPath Condition=" '$(JavaCPath)' == '' ">javac</JavaCPath>
        <JarPath Condition=" '$(JarPath)' == '' ">jar</JarPath>
        <JavaPath Condition=" '$(JavaPath)' == '' ">java</JavaPath>
        <HostHomebrewPrefix Condition=" '$(HostHomebrewPrefix)' == '' "></HostHomebrewPrefix>
    </PropertyGroup>
</Project>

Updated the code to set ~/android-toolchain/jdk on Windows (pointing to Corretto instance we install)

@grendello
Copy link
Copy Markdown
Contributor Author

@monojenkins build

grendello and others added 3 commits June 7, 2019 08:38
Testing:

 * Default mode: run `make prepare`
 * Verbose debug: run `make V=1 prepare`
 * CI mode: run `make PREPARE_CI=1 prepare`
 * Help: run `make prepare-help`
 * Logs: `bin/BuildDebug`

Supported operating systems:

 * macOS
 * Linux

Windows support is planned, present but not fully implemented or tested.

This commit implements a `make prepare` replacement that does not rely on shell
scripts or MSBuild. The idea is that a standalone C# program can perform all the
steps in a more streamlined, more clear way than the current solution. One of
the main goals is to make the process more approachable by external
contributors, but also by the core developers who may want to change some
aspects of XA build preparation (e.g. Android platforms, Mono version etc) but
are not familiar with the build system. Towards that goal, the codebase is
designed so that the minimum amount of searching around it is necessary to
figure out where to make the desired change. Main location serving this purpose
is the `build-tools/xaprepare/xaprepare/ConfigAndData` directory. It should
be the *only* location where one needs to look in order to change all and any
aspects of XA preparation.

[TBC]
Usage: `xaprepare.exe -s=AndroidToolchain`

The step will *only* install Android SDK+NDK as well as the OpenJDK distribution
we provision. No other programs are installed or updated.
Allows a non-authorized https-based clone for local use cases, and cleans
up various logging events to ensure we don't leak secrets. Also includes
some minor azure-pipelines.yaml cleanup.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

full-mono-integration-build For PRs; run a full build (~6-10h for mono bumps), not the faster PR subset (~2h for mono bumps)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants