-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Fix @(JavaDocJar) #5479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| ### Issues fixed | ||
|
|
||
| * [GitHub 2745](https://github.com/xamarin/xamarin-android/issues/2745): | ||
| The `@(JavaDocJar)` build action would either cause an MSB3375 error, | ||
| or wasn't used at all. | ||
|
|
||
| #### Deprecation of JavaDocJar Build action in favor of JavaSourceJar | ||
|
|
||
| The `@(JavaDocJar)` Build action is deprecated, and will not work in .NET 6. | ||
| Please use the `@(JavaSourceJar)` build action. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Directory.Build.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <Project> | ||
|
|
||
| <Target Name="UpdateResources" | ||
| DependsOnTargets="_UpdateJavaSourceJar_Bytecode;_UpdateJavaSourceJar_Sources;_UpdateJavaSourceJar_Javadoc"> | ||
| </Target> | ||
|
|
||
| <ItemGroup> | ||
| <JavaSourceJarTest Include="java/com/microsoft/android/test/msbuildtest/JavaSourceJarTest.java" /> | ||
| </ItemGroup> | ||
|
|
||
| <Target Name="_UpdateJavaSourceJar_Bytecode" | ||
| Inputs="@(JavaSourceJarTest)" | ||
| Outputs="Resources\javasourcejartest.jar"> | ||
| <PropertyGroup> | ||
| <_SourceVersions>-source $(JavacSourceVersion) -target $(JavacTargetVersion)</_SourceVersions> | ||
| <_Outdir>$(IntermediateOutputPath)/classes</_Outdir> | ||
| </PropertyGroup> | ||
| <MakeDir Directories="$(_Outdir)" /> | ||
| <!-- Note: do NOT include `-parameters`; we want parameter name inferrence via -sources or -javadoc --> | ||
| <Exec Command="$(JavaCPath) $(_SourceVersions) -d $(_Outdir) @(JavaSourceJarTest, ' ')" /> | ||
| <Exec | ||
| Command="$(JarPath) cf Resources/javasourcejartest.jar -C $(_Outdir) ." | ||
| WorkingDirectory="$(MSBuildThisFileDirectory)" | ||
| /> | ||
| </Target> | ||
|
|
||
| <Target Name="_UpdateJavaSourceJar_Sources" | ||
| Inputs="@(JavaSourceJarTest)" | ||
| Outputs="Resources\javasourcejartest-sources.jar"> | ||
| <Exec | ||
| Command="$(JarPath) cf Resources/javasourcejartest-sources.jar -C java ." | ||
| WorkingDirectory="$(MSBuildThisFileDirectory)" | ||
| /> | ||
| </Target> | ||
|
|
||
| <Target Name="_UpdateJavaSourceJar_Javadoc" | ||
| Inputs="@(JavaSourceJarTest)" | ||
| Outputs="Resources/javasourcejartest-javadoc.jar"> | ||
| <PropertyGroup> | ||
| <_Javadoc>"$(Java8SdkDirectory)/bin/javadoc"</_Javadoc> | ||
| <_Outdir>$(IntermediateOutputPath)/javadoc</_Outdir> | ||
| </PropertyGroup> | ||
| <MakeDir Directories="$(_Outdir)" /> | ||
| <Exec | ||
| Command="$(_Javadoc) -public -d "$(_Outdir)" @(JavaSourceJarTest, ' ')" | ||
| WorkingDirectory="$(MSBuildThisFileDirectory)" | ||
| /> | ||
| <Exec | ||
| Command="$(JarPath) cf Resources/javasourcejartest-javadoc.jar -C "$(_Outdir)" ." | ||
| WorkingDirectory="$(MSBuildThisFileDirectory)" | ||
| /> | ||
| </Target> | ||
|
|
||
| </Project> |
Binary file added
BIN
+389 KB
...oid.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Resources/javasourcejartest-javadoc.jar
Binary file not shown.
Binary file added
BIN
+1.42 KB
...oid.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Resources/javasourcejartest-sources.jar
Binary file not shown.
Binary file added
BIN
+1.51 KB
...rin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Resources/javasourcejartest.jar
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,61 +8,6 @@ namespace Xamarin.Android.Build.Tests | |
| { | ||
| static class InlineData | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bit of a nit pick, but should this still be called InLineData? cos its not really inline its embedded ? |
||
| { | ||
| #if false // Java source with javadoc | ||
| package com.xamarin.android.test.msbuildtest; | ||
|
|
||
| public class JavaSourceJarTest | ||
| { | ||
| /** | ||
| * Returns greeting message. | ||
| * <p> | ||
| * Returns "Morning, ", "Hello, " or "Evening, " with name argument, | ||
| * depending on the argument hour. | ||
| * </p> | ||
| * @param name name to display. | ||
| * @param date time to determine the greeting message. | ||
| * @return the resulting message. | ||
| */ | ||
| public String greet (String name, java.util.Date date) | ||
| { | ||
| String head = date.getHours () < 11 ? "Morning, " : date.getHours () < 17 ? "Hello, " : "Evening, "; | ||
| return head + name; | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| public const string JavaSourcesJarBase64 = @" | ||
| UEsDBBQACAgIAC2gP0wAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgIC | ||
| AAtoD9MAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLE | ||
| lN0XWqBAlY6BnEG5oaKmj4FyUm56QqOOcXFeQXJZYA1WvycvFyAQBQSwcIlldz8EQAAABFAAAAUEsDBBQACAgIACqgP0w | ||
| AAAAAAAAAAAAAAAA7AAAAY29tL3hhbWFyaW4vYW5kcm9pZC90ZXN0L21zYnVpbGR0ZXN0L0phdmFTb3VyY2VKYXJUZXN0 | ||
| LmphdmF1kc1uwjAMx+99CosTsCqI0yRgG4dNQki7jL2Aaaw2Wz4qJ2WbJt59SSgfQsyq4kb+2X/babH6xJqgckZ8o0FWV | ||
| qCV7JQUgXwQxm87pWX6nxdF2221qqDS6D2scYcb13FFa+T3CBS/BUSbjMfZwxjeKHRsPdRMFJStwZD3UU8cgUX7eM0OXh | ||
| 3byJYwiN+KtHbRg2MYvOyoj8CXCg1YNATIdWfIhvJYSFJLViY1ZyE0ZwKa2O1ZenLWXrbIaA718hEcSOVbjT/iipEYYlj | ||
| 1DAVioyxlnX+nXHKeLUNMvtO3qEn2/YY3gROSK8Kwv6XOSviIaxddUFo8p1ZSP6Oceth+sp5vCCU8ZELUFFZxeg/DESxg | ||
| OoWny0XD7JSb7FbGfco4vcbs8jHmp+R+zix8l/s9xPbFvvgDUEsHCDlC8jY2AQAAawIAAFBLAQIUABQACAgIAC2gP0wAA | ||
| AAAAgAAAAAAAAAJAAQAAAAAAAAAAAAAAAAAAABNRVRBLUlORi/+ygAAUEsBAhQAFAAICAgALaA/TJZXc/BEAAAARQAAAB | ||
| QAAAAAAAAAAAAAAAAAPQAAAE1FVEEtSU5GL01BTklGRVNULk1GUEsBAhQAFAAICAgAKqA/TDlC8jY2AQAAawIAADsAAAA | ||
| AAAAAAAAAAAAAwwAAAGNvbS94YW1hcmluL2FuZHJvaWQvdGVzdC9tc2J1aWxkdGVzdC9KYXZhU291cmNlSmFyVGVzdC5q | ||
| YXZhUEsFBgAAAAADAAMA5gAAAGICAAAAAA=="; | ||
|
|
||
| public const string JavaClassesJarBase64 = @" | ||
| UEsDBBQACAgIAO+EP0wAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgIC | ||
| ADvhD9MAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLE | ||
| lN0XWqBAlY6BnEG5oaKmj4FyUm56QqOOcXFeQXJZYA1WvycvFyAQBQSwcIlldz8EQAAABFAAAAUEsDBBQACAgIALOEP0w | ||
| AAAAAAAAAAAAAAAA8AAAAY29tL3hhbWFyaW4vYW5kcm9pZC90ZXN0L21zYnVpbGR0ZXN0L0phdmFTb3VyY2VKYXJUZXN0 | ||
| LmNsYXNzbVHZSsNAFD1j2yStaW3rvlvX1i0g4osiuKLi8lARfHPaDCWaJiWdit/ji6/6UkHBD/CjxDupIloDucuZO+fMn | ||
| Hn/eHkDsIpCAp3oS6AfAwYGDQwZGNYxkoCmUA2jKozpGNcxwaBtOJ4jNxki+cIFQ3THtwVD17HjidNGtSSCc15yCYlVAi | ||
| Ekw1r++JrfcsvlXsUqysDxKustpCEd19rlUqwX2kcYkkXJyzcnvBYS6sgxJIp+IyiLfUcJ9B3RnhZwxINzUZfLisWEiaS | ||
| OSRNTmGaIn/iBR4SLdHT9QLiur6r43q34Rvv/am83HNcWgYkZzJqYQ54uUfar1h2vclq3uGcHvmNbkiStar2kxsO67UAM | ||
| 6R/ys9K1KP+GWnoMqd9+MBgVIQ+IqR7afEiu81pNeDbD0j92ttv3dQVy0ZD+t0pP/h+fkYN6fvV1gCnvKKaoG6XMKMfmn | ||
| 8GeqKBHpqiFYIRiGpmv0SvaGqW8sthER7rzHkY28oDusMuoLvqAWDZ2+grt8hn6UhPGAv1NxB9DWcWbIk4QYxeyGEc3Rc | ||
| BAJJXc0qmjw4eTvZ9QSwcINzBZxakBAAC1AgAAUEsBAhQAFAAICAgA74Q/TAAAAAACAAAAAAAAAAkABAAAAAAAAAAAAAA | ||
| AAAAAAE1FVEEtSU5GL/7KAABQSwECFAAUAAgICADvhD9Mlldz8EQAAABFAAAAFAAAAAAAAAAAAAAAAAA9AAAATUVUQS1J | ||
| TkYvTUFOSUZFU1QuTUZQSwECFAAUAAgICACzhD9MNzBZxakBAAC1AgAAPAAAAAAAAAAAAAAAAADDAAAAY29tL3hhbWFya | ||
| W4vYW5kcm9pZC90ZXN0L21zYnVpbGR0ZXN0L0phdmFTb3VyY2VKYXJUZXN0LmNsYXNzUEsFBgAAAAADAAMA5wAAANYCAA | ||
| AAAA=="; | ||
|
|
||
| const string Resx = @"<?xml version=""1.0"" encoding=""utf-8""?> | ||
| <root> | ||
| <resheader name=""resmimetype""> | ||
|
|
||
28 changes: 28 additions & 0 deletions
28
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ResourceData.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Xamarin.Android.Build.Tests | ||
| { | ||
| static class ResourceData | ||
| { | ||
| static Lazy<byte[]> javaSourceJarTestJar = new Lazy<byte[]>(() => GetResourceData ("javasourcejartest.jar")); | ||
| static Lazy<byte[]> javaSourceJarTestSourcesJar = new Lazy<byte[]>(() => GetResourceData ("javasourcejartest-sources.jar")); | ||
| static Lazy<byte[]> javaSourceJarTestJavadocJar = new Lazy<byte[]>(() => GetResourceData ("javasourcejartest-javadoc.jar")); | ||
|
|
||
| public static byte[] JavaSourceJarTestJar => javaSourceJarTestJar.Value; | ||
| public static byte[] JavaSourceJarTestSourcesJar => javaSourceJarTestSourcesJar.Value; | ||
| public static byte[] JavaSourceJarTestJavadocJar => javaSourceJarTestJavadocJar.Value; | ||
|
|
||
| static byte[] GetResourceData (string name) | ||
| { | ||
| using var s = typeof (InlineData).Assembly.GetManifestResourceStream (name); | ||
| using var m = new MemoryStream (checked ((int) s.Length)); | ||
| s.CopyTo (m); | ||
| return m.ToArray (); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...in.Android.Build.Tests/java/com/microsoft/android/test/msbuildtest/JavaSourceJarTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.xamarin.android.test.msbuildtest; | ||
|
|
||
| public class JavaSourceJarTest | ||
| { | ||
| /** | ||
| * Returns greeting message. | ||
| * <p> | ||
| * Returns "Morning, ", "Hello, " or "Evening, " with name argument, | ||
| * depending on the argument hour. | ||
| * </p> | ||
| * @param name name to display. | ||
| * @param date time to determine the greeting message. | ||
| * @return the resulting message. | ||
| */ | ||
| public String greet (String name, java.util.Date date) | ||
| { | ||
| String head = date.getHours () < 11 ? "Morning, " : date.getHours () < 17 ? "Hello, " : "Evening, "; | ||
| return head + name; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this file wasn't even being imported in .NET 6. So this is safe to remove.
It is only imported for "legacy" binding projects:
https://github.com/xamarin/xamarin-android/blob/a7413a2389886082c3d3422c50a7e6cc84f43d8f/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Bindings.targets#L154