Skip to content

Commit e587cf6

Browse files
authored
[build] Remove the make prepare-core targets (#951)
The `make prepare-core` target was added in 1de5501, as a "stopgap" to simplify adding support for building the xamarin/Java.Interop repo using .NET Core, as `MonoInfo.props` and `Java.Runtime.Environment.dll.config` were still required by various parts of the build system, but those files were only created via Makefile targets. `Java.Runtime.Environment.dll.config` generation was migrated to MSBuild in e02d857. Update `Java.Interop.BootstrapTasks.targets` so that `MonoInfo.props` is generated via MSBuild target. This removes the need to have a `make prepare-core` target at all.
1 parent e02d857 commit e587cf6

File tree

4 files changed

+90
-54
lines changed

4 files changed

+90
-54
lines changed

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ PTESTS = \
3838
ATESTS = \
3939
bin/Test$(CONFIGURATION)/Android.Interop-Tests.dll
4040

41-
BUILD_PROPS = bin/Build$(CONFIGURATION)/MonoInfo.props
42-
4341
all: $(DEPENDENCIES) $(TESTS)
4442

4543
run-all-tests:
@@ -54,17 +52,16 @@ include build-tools/scripts/msbuild.mk
5452

5553
prepare:: $(BUILD_PROPS)
5654

57-
prepare:: prepare-core
55+
prepare::
5856
$(MSBUILD) $(MSBUILD_FLAGS) -target:Prepare
5957
$(MSBUILD) $(MSBUILD_FLAGS) -target:Restore
6058

61-
prepare-core: bin/Build$(CONFIGURATION)/MonoInfo.props
62-
6359
clean:
6460
-$(MSBUILD) $(MSBUILD_FLAGS) /t:Clean
6561
-rm -Rf bin/$(CONFIGURATION) bin/Build$(CONFIGURATION) bin/Test$(CONFIGURATION)
6662

6763
include build-tools/scripts/mono.mk
64+
-include bin/Build$(CONFIGURATION)/mono.mk
6865
-include bin/Build$(CONFIGURATION)/JdkInfo.mk
6966

7067
JAVA_RUNTIME_ENVIRONMENT_DLLMAP_OVERRIDE = Java.Runtime.Environment.Override.dllmap

build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks.targets

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,105 @@
11
<Project>
22

3+
<Target Name="_CreateMonoInfoProps"
4+
Condition=" $([MSBuild]::IsOSPlatform ('linux')) Or $([MSBuild]::IsOSPlatform ('osx')) "
5+
AfterTargets="AfterBuild"
6+
DependsOnTargets="_GetLinuxMonoPaths;_GetMacOSMonoPaths"
7+
Inputs="$(MSBuildThisFileFullPath);$(MSBuildThisFileDirectory)Java.Interop.BootstrapTasks.csproj"
8+
Outputs="$(_OutputPath)MonoInfo.props">
9+
<ItemGroup>
10+
<_MonoInfoLine Include="&lt;Project&gt;" />
11+
<_MonoInfoLine Include=" &lt;Choose&gt;" />
12+
<_MonoInfoLine Include=" &lt;When Condition=&quot; %27%24(MonoFrameworkPath)%27 == %27%27 &quot;&gt;" />
13+
<_MonoInfoLine Include=" &lt;PropertyGroup&gt;" />
14+
<_MonoInfoLine Include=" &lt;MonoFrameworkPath&gt;$(_MonoFrameworkPath)&lt;/MonoFrameworkPath&gt;" />
15+
<_MonoInfoLine Include=" &lt;MonoLibs &gt;$(_MonoLibs)&lt;/MonoLibs&gt;" />
16+
<_MonoInfoLine Include=" &lt;/PropertyGroup&gt;" />
17+
<_MonoInfoLine Include=" &lt;ItemGroup&gt;" />
18+
<_MonoInfoLine Include=" &lt;MonoIncludePath Include=&quot;$(_MonoIncludePath)&quot; /&gt;" />
19+
<_MonoInfoLine Include=" &lt;/ItemGroup&gt;" />
20+
<_MonoInfoLine Include=" &lt;/When&gt;" />
21+
<_MonoInfoLine Include=" &lt;/Choose&gt;" />
22+
<_MonoInfoLine Include="&lt;/Project&gt;" />
23+
</ItemGroup>
24+
<WriteLinesToFile
25+
File="$(_OutputPath)MonoInfo.props"
26+
Lines="@(_MonoInfoLine)"
27+
Overwrite="True"
28+
/>
29+
<Touch Files="$(_OutputPath)MonoInfo.props" />
30+
</Target>
31+
32+
<Target Name="_CreateMonoMk"
33+
AfterTargets="AfterBuild"
34+
DependsOnTargets="_GetLinuxMonoPaths;_GetMacOSMonoPaths"
35+
Inputs="$(MSBuildThisFileFullPath);$(MSBuildThisFileDirectory)Java.Interop.BootstrapTasks.csproj"
36+
Outputs="$(_OutputPath)mono.mk">
37+
<ItemGroup>
38+
<_MonoMkLine Include="JI_MONO_LIB_PATH=$(_MonoLibPath)" />
39+
</ItemGroup>
40+
<WriteLinesToFile
41+
File="$(_OutputPath)mono.mk"
42+
Lines="@(_MonoMkLine)"
43+
Overwrite="True"
44+
/>
45+
<Touch Files="$(_OutputPath)mono.mk" />
46+
</Target>
47+
48+
<Target Name="_GetLinuxMonoPaths"
49+
Condition=" $([MSBuild]::IsOSPlatform ('linux')) ">
50+
<Exec
51+
Command="which mono"
52+
ConsoleToMsBuild="True">
53+
<Output TaskParameter="ConsoleOutput" PropertyName="_MonoPath" />
54+
</Exec>
55+
<Exec
56+
Command="pkg-config --variable=libdir mono-2"
57+
ConsoleToMsBuild="True">
58+
<Output TaskParameter="ConsoleOutput" PropertyName="_MonoPkgConfigLibdir" />
59+
</Exec>
60+
<Exec
61+
Command="pkg-config --variable=includedir mono-2"
62+
ConsoleToMsBuild="True">
63+
<Output TaskParameter="ConsoleOutput" PropertyName="_MonoPkgConfigIncludedir" />
64+
</Exec>
65+
<PropertyGroup>
66+
<_MonoLibPath>$([System.IO.Path]::GetDirectoryName($(_MonoPath)))/../lib/</_MonoLibPath>
67+
<_MonoFrameworkPath>$(_MonoPkgConfigLibdir)/libmonosgen-2.0.so</_MonoFrameworkPath>
68+
<_MonoIncludePath>$(_MonoPkgConfigIncludedir)</_MonoIncludePath>
69+
<_MonoLibs>-L "$(_MonoPkgConfigLibdir)" -lmonosgen-2.0</_MonoLibs>
70+
</PropertyGroup>
71+
</Target>
72+
73+
<Target Name="_GetMacOSMonoPaths"
74+
Condition=" $([MSBuild]::IsOSPlatform ('osx')) ">
75+
<PropertyGroup>
76+
<_MonoBase>/Library/Frameworks/Mono.framework/</_MonoBase>
77+
<_MonoLibPath>$(_MonoBase)Libraries/</_MonoLibPath>
78+
<_MonoFrameworkPath>$(_MonoLibPath)libmonosgen-2.0.1.dylib</_MonoFrameworkPath>
79+
<_MonoIncludePath>$(_MonoBase)Headers/mono-2.0</_MonoIncludePath>
80+
<_MonoLibs>-L "$(_MonoLibPath)" -lmonosgen-2.0</_MonoLibs>
81+
</PropertyGroup>
82+
</Target>
83+
84+
385
<Target Name="_CreatePackagePathsProps"
486
AfterTargets="AfterBuild"
587
Inputs="$(MSBuildThisFileFullPath);$(MSBuildThisFileDirectory)Java.Interop.BootstrapTasks.csproj"
688
Outputs="$(_OutputPath)PackagePaths.props">
789
<ItemGroup>
890
<_Path Include="PkgNUnit_ConsoleRunner" Destination="$(PkgNUnit_ConsoleRunner)" />
991
</ItemGroup>
10-
<Message Text="PkgNUnit_ConsoleRunner=$(PkgNUnit_ConsoleRunner)" />
1192
<ItemGroup>
12-
<_Line Include="&lt;Project&gt;" />
13-
<_Line Include=" &lt;PropertyGroup&gt;" />
14-
<_Line Include="@(_Path->' &lt;%(Identity) Condition=&quot; %27%24(%(Identity))%27 == %27%27 &quot;&gt;%(Destination)&lt;/%(Identity)&gt;', '
93+
<_PackagePathsLine Include="&lt;Project&gt;" />
94+
<_PackagePathsLine Include=" &lt;PropertyGroup&gt;" />
95+
<_PackagePathsLine Include="@(_Path->' &lt;%(Identity) Condition=&quot; %27%24(%(Identity))%27 == %27%27 &quot;&gt;%(Destination)&lt;/%(Identity)&gt;', '
1596
')" />
16-
<_Line Include=" &lt;/PropertyGroup&gt;" />
17-
<_Line Include="&lt;/Project&gt;" />
97+
<_PackagePathsLine Include=" &lt;/PropertyGroup&gt;" />
98+
<_PackagePathsLine Include="&lt;/Project&gt;" />
1899
</ItemGroup>
19100
<WriteLinesToFile
20101
File="$(_OutputPath)PackagePaths.props"
21-
Lines="@(_Line)"
102+
Lines="@(_PackagePathsLine)"
22103
Overwrite="True"
23104
/>
24105
<Touch Files="$(_OutputPath)PackagePaths.props" />

build-tools/automation/azure-pipelines.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ jobs:
176176

177177
- template: templates\install-dependencies.yaml
178178

179-
- script: make prepare-core CONFIGURATION=$(Build.Configuration) JI_MAX_JDK=$(MaxJdkVersion)
180-
displayName: make prepare-core
181-
182179
- template: templates\core-build.yaml
183180

184181
- template: templates\core-tests.yaml

build-tools/scripts/mono.mk

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,3 @@ endif # $(V) != 0
3838
ifneq ($(MONO_OPTIONS),)
3939
export MONO_OPTIONS
4040
endif # $(MONO_OPTIONS) != ''
41-
42-
ifeq ($(OS),Darwin)
43-
JI_MONO_BASE = /Library/Frameworks/Mono.framework/
44-
JI_MONO_LIB_PATH = $(JI_MONO_BASE)Libraries/
45-
JI_MONO_FRAMEWORK_PATH = $(JI_MONO_LIB_PATH)libmonosgen-2.0.1.dylib
46-
JI_MONO_INCLUDE_PATHS = $(JI_MONO_BASE)Headers/mono-2.0
47-
JI_MONO_LIBS = -L $(JI_MONO_LIB_PATH) -lmonosgen-2.0
48-
endif
49-
ifeq ($(OS),Linux)
50-
JI_MONO_LIB_PATH = $(dir `which mono`)/../lib/
51-
JI_MONO_FRAMEWORK_PATH = $(shell pkg-config --variable=libdir mono-2)/libmonosgen-2.0.so
52-
JI_MONO_INCLUDE_PATHS = $(shell pkg-config --variable=includedir mono-2)
53-
JI_MONO_LIBS = -L $(shell pkg-config --variable=libdir mono-2) -lmonosgen-2.0
54-
endif
55-
56-
57-
58-
$(JI_MONO_FRAMEWORK_PATH):
59-
@echo "error: No Mono framework found\!";
60-
@exit 1
61-
62-
bin/Build$(CONFIGURATION)/MonoInfo.props: $(JI_MONO_INCLUDE_PATHS) $(JI_MONO_FRAMEWORK_PATH)
63-
-mkdir -p `dirname "$@"`
64-
-rm "$@"
65-
echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' > "$@"
66-
echo ' <Choose>' >> "$@"
67-
echo " <When Condition=\" '\$$(MonoFrameworkPath)' == '' \">" >> "$@"
68-
echo ' <PropertyGroup>' >> "$@"
69-
echo " <MonoFrameworkPath>$(JI_MONO_FRAMEWORK_PATH)</MonoFrameworkPath>" >> "$@"
70-
echo " <MonoLibs >$(JI_MONO_LIBS)</MonoLibs>" >> "$@"
71-
echo ' </PropertyGroup>' >> "$@"
72-
echo ' <ItemGroup>' >> "$@"
73-
for p in $(JI_MONO_INCLUDE_PATHS); do \
74-
echo " <MonoIncludePath Include=\"$$p\" />" >> "$@"; \
75-
done
76-
echo ' </ItemGroup>' >> "$@"
77-
echo ' </When>' >> "$@"
78-
echo ' </Choose>' >> "$@"
79-
echo '</Project>' >> "$@"

0 commit comments

Comments
 (0)