Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
<TestsFlavor>$(_TestsProfiledAotName)$(_TestsAotName)</TestsFlavor>
</PropertyGroup>
<PropertyGroup>
<JavacSourceVersion>1.8</JavacSourceVersion>
<JavacTargetVersion>1.8</JavacTargetVersion>
<JavacSourceVersion>17</JavacSourceVersion>
<JavacTargetVersion>17</JavacTargetVersion>
</PropertyGroup>
<PropertyGroup>
<AndroidNdkFullPath>$([System.IO.Path]::GetFullPath ('$(AndroidNdkDirectory)'))</AndroidNdkFullPath>
Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/Jar.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<_Jar>"$(JarPath)"</_Jar>
<_Targets>-source $(JavacSourceVersion) -target $(JavacTargetVersion)</_Targets>
<_DestDir>$(IntermediateOutputPath)__CreateTestJarFile-bin</_DestDir>
<_AndroidJar>-bootclasspath "$(AndroidSdkDirectory)\platforms\android-$(_AndroidApiLevelName)\android.jar"</_AndroidJar>
<_AndroidJar>-classpath "$(AndroidSdkDirectory)\platforms\android-$(_AndroidApiLevelName)\android.jar"</_AndroidJar>
<_CP>-cp "$(_JavaInteropJarPath)"</_CP>
<_JavacFilesResponse>$(IntermediateOutputPath)__javac_response.txt</_JavacFilesResponse>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/JavaCallableWrappers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<_MonoAndroidRuntimeJar>$(MicrosoftAndroidSdkOutDir)java_runtime.jar</_MonoAndroidRuntimeJar>
</PropertyGroup>
<Exec
Command="&quot;$(JavaCPath)&quot; $(_Target) $(_D) -bootclasspath $(_AndroidJar)$(PathSeparator)&quot;$(_MonoAndroidJar)&quot;$(PathSeparator)&quot;$(_MonoAndroidRuntimeJar)&quot; @$(IntermediateOutputPath)jcw/classes.txt"
Command="&quot;$(JavaCPath)&quot; $(_Target) $(_D) -classpath $(_AndroidJar)$(PathSeparator)&quot;$(_MonoAndroidJar)&quot;$(PathSeparator)&quot;$(_MonoAndroidRuntimeJar)&quot; @$(IntermediateOutputPath)jcw/classes.txt"
/>
<Exec
Condition="Exists('$(_MonoAndroidJar)')"
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/JavaSourceUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ string CreateResponseFile ()

if (BootClassPath != null && BootClassPath.Any ()) {
var classpath = string.Join (Path.PathSeparator.ToString (), BootClassPath.Select (p => Path.GetFullPath (p.ItemSpec)));
AppendArg (response, "--bootclasspath");
AppendArg (response, "--classpath");
AppendArg (response, classpath);
}

Expand Down
11 changes: 7 additions & 4 deletions src/Xamarin.Android.Build.Tasks/Tasks/Javac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ protected override string GenerateCommandLineCommands ()
// Running command: C:\Program Files (x86)\Java\jdk1.6.0_20\bin\javac.exe
// "-J-Dfile.encoding=UTF8"
// "-d" "bin\classes"
// "-classpath" "C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\AndroidMSBuildTest\AndroidMSBuildTest\obj\Debug\android\bin\mono.android.jar"
// "-bootclasspath" "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-8\android.jar"
// "-classpath" "C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\AndroidMSBuildTest\AndroidMSBuildTest\obj\Debug\android\bin\mono.android.jar";"C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-8\android.jar"
// "-encoding" "UTF-8"
// "@C:\Users\Jonathan\AppData\Local\Temp\tmp79c4ac38.tmp"

Expand All @@ -69,9 +68,13 @@ protected override string GenerateCommandLineCommands ()

protected override void WriteOptionsToResponseFile (StreamWriter sw)
{
var jars = new List<string> ();
if (Jars != null)
jars.AddRange (Jars.Select (i => i.ItemSpec.Replace (@"\", @"\\")));
jars.Add (JavaPlatformJarPath.Replace (@"\", @"\\"));

sw.WriteLine ($"-d \"{ClassesOutputDirectory.Replace (@"\", @"\\")}\"");
sw.WriteLine ("-classpath \"{0}\"", Jars == null || !Jars.Any () ? null : string.Join (Path.PathSeparator.ToString (), Jars.Select (i => i.ItemSpec.Replace (@"\", @"\\"))));
sw.WriteLine ("-bootclasspath \"{0}\"", JavaPlatformJarPath.Replace (@"\", @"\\"));
sw.WriteLine ("-classpath \"{0}\"", string.Join (Path.PathSeparator.ToString (), jars));
sw.WriteLine ($"-encoding UTF8");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ public void CheckJavaError ()
b.ThrowOnBuildFailure = false;
Assert.IsFalse (b.Build (proj), "Build should have failed.");
var ext = b.IsUnix ? "" : ".exe";
var text = $"TestMe.java(1,8): javac{ext} error JAVAC0000: error: class, interface, or enum expected";
var text = $"TestMe.java(1,8): javac{ext} error JAVAC0000: error: class, interface, enum, or record expected";
Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, text), "TestMe.java(1,8) expected");
text = $"TestMe2.java(1,41): javac{ext} error JAVAC0000: error: ';' expected";
Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, text), "TestMe2.java(1,41) expected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<BundleToolVersion Condition="'$(BundleToolVersion)' == ''">@BUNDLETOOL_VERSION@</BundleToolVersion>
<_XamarinAndroidMSBuildDirectory>$(MSBuildThisFileDirectory)</_XamarinAndroidMSBuildDirectory>

<JavacSourceVersion Condition=" '$(JavacSourceVersion)' == '' ">1.8</JavacSourceVersion>
<JavacTargetVersion Condition=" '$(JavacTargetVersion)' == '' ">1.8</JavacTargetVersion>
<JavacSourceVersion Condition=" '$(JavacSourceVersion)' == '' ">17</JavacSourceVersion>
<JavacTargetVersion Condition=" '$(JavacTargetVersion)' == '' ">17</JavacTargetVersion>

<!-- Enable nuget package conflict resolution -->
<ResolveAssemblyConflicts>true</ResolveAssemblyConflicts>
Expand Down
2 changes: 1 addition & 1 deletion src/java-runtime/java-runtime.targets
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<_AndroidJar>"$(AndroidSdkDirectory)\platforms\android-$(AndroidJavaRuntimeApiLevel)\android.jar"</_AndroidJar>
</PropertyGroup>
<Exec
Command="&quot;$(JavaCPath)&quot; $(_Target) -d %(_RuntimeOutput.IntermediateRuntimeOutputPath) -h %(_RuntimeOutput.IntermediateRuntimeOutputPath) -bootclasspath $(_AndroidJar)$(PathSeparator)&quot;%(_RuntimeOutput.OutputJar)&quot; @%(_RuntimeOutput.IntermediateRuntimeClassesTxt)"
Command="&quot;$(JavaCPath)&quot; $(_Target) -d %(_RuntimeOutput.IntermediateRuntimeOutputPath) -h %(_RuntimeOutput.IntermediateRuntimeOutputPath) -classpath $(_AndroidJar)$(PathSeparator)&quot;%(_RuntimeOutput.OutputJar)&quot; @%(_RuntimeOutput.IntermediateRuntimeClassesTxt)"
/>
<Copy
SourceFiles="$(IntermediateOutputPath)release/mono_android_Runtime.h"
Expand Down