You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Xamarin.Android.Build.Tasks] %(JavaArtifact) is a list (#9112)
Fixes: #9013
Context: 4696bf3
Today, our Java Dependency Verification feature (4696bf3) is built
around our recommended practice of one binding library per project.
This is reflected in the fact that `%(JavaArtifact)` and
`%(JavaVersion)` only support a single library:
<PackageReference
Include="Xamarin.Kotlin.StdLib"
Version="1.7.10"
JavaArtifact="org.jetbrains.kotlin:kotlin-stdlib"
JavaVersion="1.7.10"
/>
However a user may choose to place multiple Java libraries into a
single package (or project), and we have no way to express that.
Instead of using `%(JavaArtifact)`/`%(JavaVersion)` to specify a Java
dependency, we will only use `%(JavaArtifact)` and we will update the
specification to include the artifact version, e.g.
`org.jetbrains.kotlin:kotlin-stdlib:1.7.10`.
Additionally, this attribute now allows multiple Java artifacts to be
specified by separating them with a comma, semicolon, or newline.
This change affects `@(PackageReference)`, `@(ProjectReference)`,
`@(AndroidLibrary)`, and `@(AndroidIgnoredJavaDependency)`.
Examples:
<PackageReference
Include="Xamarin.Kotlin.StdLib"
Version="1.7.10"
JavaArtifact="org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
/>
<ProjectReference
Include="..\My.Other.Binding\My.Other.Binding.csproj"
JavaArtifact="my.other.binding:mylib:1.0.0,my.other.binding:helperlib:1.0.0"
/>
<AndroidLibrary
Include="mydependency.jar"
JavaArtifact="my.library:dependency-library:1.0.0"
/>
<AndroidIgnoredJavaDependency
Include="com.google.errorprone:error_prone_annotations:2.15.0"
/>
Existing support for looking at [NuGet package tags][0] to
automatically find Java libraries contained within has also been
updated to support multiple `artifact` tags. Note that separate tags
are expected, not a single tag with multiple artifacts specified:
<PropertyGroup>
<!-- Correct -->
<PackageTags>
artifact=my.other.binding:mylib:1.0.0
artifact=my.other.binding:helperlib:1.0.0
</PackageTags>
<!-- Incorrect -->
<PackageTags>
artifact=my.other.binding:mylib:1.0.0,my.other.binding:helperlib:1.0.0
</PackageTags>
</PropertyGroup>
[0]: https://learn.microsoft.com/en-us/nuget/reference/nuspec#tags
log.LogMessage("Found Java dependency '{0}:{1}' version '{2}' from PackageReference '{3}'",artifact.GroupId,artifact.Id,artifact.Version,task.ItemSpec);
184
183
artifacts.Add(artifact.ArtifactString,artifact);
185
184
@@ -193,13 +192,15 @@ public void AddPackageReferences (ITaskItem []? tasks)
193
192
publicvoidAddProjectReferences(ITaskItem[]?tasks)
194
193
{
195
194
foreach(vartaskintasks.OrEmpty()){
196
-
// See if JavaArtifact/JavaVersion overrides were used
0 commit comments