Skip to content

Commit a12eff2

Browse files
committed
[xaprepare] Split out Java.Interop prep logic
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3232168&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=5076e147-fc66-561e-6c69-3aa777afefc5 The unit tests are failing go build: /Users/runner/runners/2.160.0/work/1/s/external/Java.Interop/src/Java.Interop/Tests/Interop-Tests.projitems(11,3): error MSB4019: The imported project "/Users/runner/runners/2.160.0/work/1/s/external/Java.Interop/bin/BuildRelease/JdkInfo.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. The problem is that for the "APK Instrumentation - macOS" job doesn't create `external/Java.Interop/bin/BuildRelease/JdkInfo.props`. Add a new `Step_PrepareExternalJavaInterop` step which creates `JdkInfo.props`, which should allow things to build. Move the previous `JdkInfo.props` generation logic out of `Step_PrepareExternal`, so that the `xaprepare -s:Required` can just build the required Java.Interop bits, and not "lots".
1 parent 86bbbfe commit a12eff2

File tree

8 files changed

+77
-25
lines changed

8 files changed

+77
-25
lines changed

build-tools/xaprepare/xaprepare/Scenarios/Scenario_PrepareExternal.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public Scenario_PrepareExternal ()
1212
protected override void AddSteps (Context context)
1313
{
1414
Steps.Add (new Step_PrepareExternal ());
15+
Steps.Add (new Step_PrepareExternalJavaInterop ());
1516

1617
// disable installation of missing programs...
1718
context.SetCondition (KnownConditions.AllowProgramInstallation, false);

build-tools/xaprepare/xaprepare/Scenarios/Scenario_Required.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ protected override void AddSteps (Context context)
1515
throw new ArgumentNullException (nameof (context));
1616

1717
Steps.Add (new Step_GenerateFiles (atBuildStart: true, onlyRequired: true));
18+
Steps.Add (new Step_PrepareExternalJavaInterop ());
1819
}
1920
}
2021
}

build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ protected override void AddSteps (Context context)
2020
Steps.Add (new Step_GenerateFiles (atBuildStart: true));
2121
Steps.Add (new Step_PrepareProps ());
2222
Steps.Add (new Step_PrepareExternal ());
23+
Steps.Add (new Step_PrepareExternalJavaInterop ());
2324
Steps.Add (new Step_PrepareLocal ());
2425
Steps.Add (new Step_DownloadMonoArchive ());
2526
AddRequiredOSSpecificSteps (true);

build-tools/xaprepare/xaprepare/Steps/Step_PrepareExternal.Unix.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,6 @@ async Task<bool> ExecuteOSSpecific (Context context, NuGetRunner nuget)
2424
if (!result)
2525
return false;
2626

27-
string javaInteropDir = context.Properties.GetRequiredValue (KnownProperties.JavaInteropFullPath);
28-
Log.StatusLine ();
29-
result = await make.Run (
30-
logTag: "java-interop-prepare",
31-
workingDirectory: javaInteropDir,
32-
arguments: new List <string> {
33-
"prepare",
34-
$"CONFIGURATION={context.Configuration}",
35-
$"JAVA_HOME={context.OS.JavaHome}",
36-
$"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
37-
}
38-
);
39-
if (!result)
40-
return false;
41-
42-
Log.StatusLine ();
43-
result = await make.Run (
44-
logTag: "java-interop-props",
45-
workingDirectory: javaInteropDir,
46-
arguments: new List <string> {
47-
$"bin/Build{context.Configuration}/JdkInfo.props",
48-
$"CONFIGURATION={context.Configuration}",
49-
$"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
50-
}
51-
);
5227
return result;
5328
}
5429
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
using System.IO;
3+
using System.Threading.Tasks;
4+
5+
namespace Xamarin.Android.Prepare
6+
{
7+
partial class Step_PrepareExternalJavaInterop
8+
{
9+
async Task<bool> ExecuteOSSpecific (Context context)
10+
{
11+
string javaInteropDir = context.Properties.GetRequiredValue (KnownProperties.JavaInteropFullPath);
12+
Log.StatusLine ();
13+
var result = await make.Run (
14+
logTag: "java-interop-prepare",
15+
workingDirectory: javaInteropDir,
16+
arguments: new List <string> {
17+
"prepare",
18+
$"CONFIGURATION={context.Configuration}",
19+
$"JAVA_HOME={context.OS.JavaHome}",
20+
$"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
21+
}
22+
);
23+
if (!result)
24+
return false;
25+
26+
Log.StatusLine ();
27+
result = await make.Run (
28+
logTag: "java-interop-props",
29+
workingDirectory: javaInteropDir,
30+
arguments: new List <string> {
31+
$"bin/Build{context.Configuration}/JdkInfo.props",
32+
$"CONFIGURATION={context.Configuration}",
33+
$"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
34+
}
35+
);
36+
return result;
37+
}
38+
}
39+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.IO;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
5+
namespace Xamarin.Android.Prepare
6+
{
7+
partial class Step_PrepareExternalJavaInterop
8+
{
9+
async Task<bool> ExecuteOSSpecific (Context context)
10+
{
11+
return true;
12+
}
13+
}
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
using System.IO;
3+
using System.Threading.Tasks;
4+
5+
namespace Xamarin.Android.Prepare
6+
{
7+
partial class Step_PrepareExternalJavaInterop : Step
8+
{
9+
public Step_PrepareExternalJavaInterop ()
10+
: base ("Preparing external/Java.Interop")
11+
{}
12+
13+
protected override async Task<bool> Execute (Context context)
14+
{
15+
return await ExecuteOSSpecific (context);
16+
}
17+
}
18+
}

build-tools/xaprepare/xaprepare/xaprepare.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
<Compile Include="Steps\Step_InstallMonoRuntimes.cs" />
144144
<Compile Include="Steps\Step_PrepareExternal.cs" />
145145
<Compile Include="Steps\Step_PrepareExternalGitDependencies.cs" />
146+
<Compile Include="Steps\Step_PrepareExternalJavaInterop.cs" />
146147
<Compile Include="Steps\Step_PrepareImageDependencies.cs" />
147148
<Compile Include="Steps\Step_PrepareLocal.cs" />
148149
<Compile Include="Steps\Step_PrepareMSBuild.cs" />
@@ -197,6 +198,7 @@
197198
<Compile Include="Steps\Step_BuildMonoRuntimes.Unix.cs" />
198199
<Compile Include="Steps\Step_GenerateFiles.Unix.cs" />
199200
<Compile Include="Steps\Step_PrepareExternal.Unix.cs" />
201+
<Compile Include="Steps\Step_PrepareExternalJavaInterop.Unix.cs" />
200202
<Compile Include="Steps\Step_PrepareImageDependencies.Unix.cs" />
201203
<Compile Include="ToolRunners\MakeRunner.Unix.cs" />
202204
<Compile Include="ToolRunners\MakeRunner.OutputSink.Unix.cs" />
@@ -260,6 +262,7 @@
260262
<Compile Include="Steps\Step_GenerateFiles.Windows.cs" />
261263
<Compile Include="Steps\Step_InstallCorrettoOpenJDK.Windows.cs" />
262264
<Compile Include="Steps\Step_PrepareExternal.Windows.cs" />
265+
<Compile Include="Steps\Step_PrepareExternalJavaInterop.Windows.cs" />
263266
</ItemGroup>
264267
<ItemGroup>
265268
<None Include="App.config" />

0 commit comments

Comments
 (0)