Skip to content

Commit

Permalink
[build] Fix make prepare ordering (dotnet#937)
Browse files Browse the repository at this point in the history
@Clancey was trying to build xamarin-android, which failed:

	$ make prepare
	./build-tools/scripts/generate-os-info Configuration.OperatingSystem.props
	xbuild /p:Configuration=Debug  /p:_DebugFileExt=.pdb build-tools/dependencies/dependencies.mdproj
	...
	warning : Referenced Project ../../external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj not found, ignoring.
	...
	Xamarin.Android.BuildTools.PrepTasks/JdkInfo.cs(9,23): error CS0234: The type or namespace name 'Tools' does not exist in the namespace 'Xamarin.Android' (are you missing an assembly reference?)

The problem is that `make prepare-deps`, which builds
`build-tools/dependencies/dependencies.mdproj`, implicitly builds
`build-tools/xa-prep-tasks/xa-prep-tasks.csproj`, which in turn
depends on
`external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj`,
which is only reliably created by `make prepare-external`s
`git submodule update --init --recursive`.

Unfortunately, `make prepare-external` wasn't invoked until *after*
`make prepare-deps`, meaning there is no way for `make prepare` to
actually work on a clean install!

(This works on Jenkins because Jenkins automatically checks out all
submodules, so it never encounters this "clean checkout" scenario.)

Reorder the targets that `make prepare` executes so that
`make prepare-external` is run *before* `make prepare-deps`, ensuring
that git submodules exist before we attempt to use them.
  • Loading branch information
jonpryor authored and Redth committed Oct 30, 2017
1 parent 4817592 commit 2dfcf89
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ GetPath = $(shell $(MSBUILD) $(MSBUILD_FLAGS) /p:DoNotLoadOSProperties=True /n
MSBUILD_PREPARE_PROJS = \
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj

prepare-deps:
./build-tools/scripts/generate-os-info Configuration.OperatingSystem.props
$(MSBUILD) $(MSBUILD_FLAGS) build-tools/dependencies/dependencies.mdproj

prepare-external: prepare-deps
prepare-external:
git submodule update --init --recursive
nuget restore $(SOLUTION)
nuget restore Xamarin.Android-Tests.sln
Expand All @@ -102,7 +98,11 @@ prepare-external: prepare-deps
(cd $(call GetPath,JavaInterop) && make bin/Build$(conf)/JdkInfo.props CONFIGURATION=$(conf)) && ) \
true

prepare-props: prepare-external
prepare-deps: prepare-external
./build-tools/scripts/generate-os-info Configuration.OperatingSystem.props
$(MSBUILD) $(MSBUILD_FLAGS) build-tools/dependencies/dependencies.mdproj

prepare-props: prepare-deps
cp build-tools/scripts/Configuration.Java.Interop.Override.props external/Java.Interop/Configuration.Override.props
cp $(call GetPath,MonoSource)/mcs/class/msfinal.pub .

Expand Down

0 comments on commit 2dfcf89

Please sign in to comment.