Skip to content
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

Revert "[Xamarin.Android.Build.Tasks] fix cases of missing @(Reference) (#7642)" #7726

Merged
merged 2 commits into from
Jan 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _ResolveAssemblies MSBuild target.
</PropertyGroup>

<Target Name="_ComputeFilesToPublishForRuntimeIdentifiers"
DependsOnTargets="BuildOnlySettings;_FixupIntermediateAssembly;ResolveReferences;ComputeFilesToPublish;$(_RunAotMaybe)"
DependsOnTargets="_FixupIntermediateAssembly;ResolveReferences;ComputeFilesToPublish;$(_RunAotMaybe)"
Returns="@(ResolvedFileToPublish)">
<ItemGroup>
<ResolvedFileToPublish Remove="@(_SourceItemsToCopyToPublishDirectory)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1079,67 +1079,6 @@ public void DotNetIncremental ([Values (true, false)] bool isRelease, [Values ("
}
}

[Test]
public void ProjectDependencies ([Values(true, false)] bool projectReference)
{
// Setup dependencies App A -> Lib B -> Lib C
var path = Path.Combine ("temp", TestName);

var libB = new XASdkProject (outputType: "Library") {
ProjectName = "LibraryB",
IsRelease = true,
};
libB.Sources.Clear ();
libB.Sources.Add (new BuildItem.Source ("Foo.cs") {
TextContent = () => @"public class Foo {
public Foo () {
var bar = new Bar();
}
}",
});

var libC = new XASdkProject (outputType: "Library") {
ProjectName = "LibraryC",
IsRelease = true,
};
libC.Sources.Clear ();
libC.Sources.Add (new BuildItem.Source ("Bar.cs") {
TextContent = () => "public class Bar { }",
});

// Add a @(Reference) or @(ProjectReference)
if (projectReference) {
libB.AddReference (libC);
} else {
libB.OtherBuildItems.Add (new BuildItem.Reference ($@"..\{libC.ProjectName}\bin\Release\{libC.TargetFramework}\{libC.ProjectName}.dll"));
}

// Build libraries
var libCBuilder = CreateDotNetBuilder (libC, Path.Combine (path, libC.ProjectName));
Assert.IsTrue (libCBuilder.Build (), $"{libC.ProjectName} should succeed");
var libBBuilder = CreateDotNetBuilder (libB, Path.Combine (path, libB.ProjectName));
Assert.IsTrue (libBBuilder.Build (), $"{libB.ProjectName} should succeed");

var appA = new XASdkProject {
ProjectName = "AppA",
IsRelease = true,
Sources = {
new BuildItem.Source ("Bar.cs") {
TextContent = () => "public class Bar : Foo { }",
}
}
};
appA.AddReference (libB);
var appBuilder = CreateDotNetBuilder (appA, Path.Combine (path, appA.ProjectName));
Assert.IsTrue (appBuilder.Build (), $"{appA.ProjectName} should succeed");

var apkPath = Path.Combine (FullProjectDirectory, appA.OutputPath, $"{appA.PackageName}-Signed.apk");
FileAssert.Exists (apkPath);
var helper = new ArchiveAssemblyHelper (apkPath);
helper.AssertContainsEntry ($"assemblies/{libB.ProjectName}.dll");
helper.AssertContainsEntry ($"assemblies/{libC.ProjectName}.dll");
}

[Test]
public void DotNetDesignTimeBuild ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2006,8 +2006,7 @@ because xbuild doesn't support framework reference assemblies.
DependsOnTargets="_ResolveAssemblies"
>
<ItemGroup>
<!-- In .NET 6+, the .NET SDK locates these files -->
<_AndroidResolvedSatellitePaths Condition=" '$(UsingAndroidNETSdk)' != 'true' " Include="@(ReferenceSatellitePaths)" />
<_AndroidResolvedSatellitePaths Include="@(ReferenceSatellitePaths)" />
<!-- Satellites from the current project, see: https://github.com/microsoft/msbuild/blob/master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L4283-L4299 -->
<_AndroidResolvedSatellitePaths Include="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(Culture)\$(TargetName).resources.dll')" />
</ItemGroup>
Expand Down