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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _ResolveAssemblies MSBuild target.
</PropertyGroup>

<Target Name="_ComputeFilesToPublishForRuntimeIdentifiers"
DependsOnTargets="_FixupIntermediateAssembly;ResolveReferences;ComputeFilesToPublish;$(_RunAotMaybe)"
DependsOnTargets="BuildOnlySettings;_FixupIntermediateAssembly;ResolveReferences;ComputeFilesToPublish;$(_RunAotMaybe)"
Returns="@(ResolvedFileToPublish)">
<ItemGroup>
<ResolvedFileToPublish Remove="@(_SourceItemsToCopyToPublishDirectory)" />
Expand Down Expand Up @@ -90,6 +90,7 @@ _ResolveAssemblies MSBuild target.
<_AdditionalProperties>
_ComputeFilesToPublishForRuntimeIdentifiers=true
;AppendRuntimeIdentifierToOutputPath=true
;ResolveAssemblyReferencesFindRelatedSatellites=false
;SkipCompilerExecution=true
;_OuterIntermediateAssembly=@(IntermediateAssembly)
;_OuterOutputPath=$(OutputPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,82 @@ 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 { }",
});
libC.Sources.Add (new BuildItem ("EmbeddedResource", "Foo.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancel</value></data>")
});
libC.Sources.Add (new BuildItem ("EmbeddedResource", "Foo.es.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancelar</value></data>")
});

// 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 { }",
},
new BuildItem ("EmbeddedResource", "Foo.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancel</value></data>")
},
new BuildItem ("EmbeddedResource", "Foo.es.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancelar</value></data>")
},
}
};
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/{appA.ProjectName}.dll");
helper.AssertContainsEntry ($"assemblies/{libB.ProjectName}.dll");
helper.AssertContainsEntry ($"assemblies/{libC.ProjectName}.dll");
helper.AssertContainsEntry ($"assemblies/es/{appA.ProjectName}.resources.dll");
helper.AssertContainsEntry ($"assemblies/es/{libC.ProjectName}.resources.dll");
}

[Test]
public void DotNetDesignTimeBuild ()
{
Expand Down