Skip to content

Commit

Permalink
[msbuild] fix for JavaSourceJar and test (dotnet#1420)
Browse files Browse the repository at this point in the history
Context: d46abe8

The test `BindingBuildTest.JavaSourceJar` appears to pass under
`xbuild`, but fails under `msbuild`. This seems be true for macOS
or Windows.

Under further inspection, I noticed the `BuildDocumentation` target
was never running under `msbuild`: it was being skipped due to the
Outputs being up-to-date in comparison to the Inputs. To fix the
skipped target,I was able to add an additional input in
`Xamarin.Android.Bindings.targets`.

The line:

    <Copy
        SourceFiles="@(IntermediateAssembly->'$(IntermediateOutputPath)%(filename).xml')"
        DestinationFiles="@(IntermediateAssembly->'$(OutputPath)%(filename).xml')"
        SkipUnchangedFiles="true" />

Implies that this should also be an Input:

    `@(IntermediateAssembly->'$(IntermediateOutputPath)%(filename).xml')`

Additionally, there was some stuff in the test that seemed incorrect:

  * The return value of `bindingBuilder.Build` should have an
    assertion that it is true
  * For some reason the text from `GetIntermediaryAsText()` was being
    passed to `Path.Combine()`. I think this was a typo that wasn't
    intentional.
  • Loading branch information
jonathanpeppers authored and jonpryor committed Mar 15, 2018
1 parent e73b18e commit 069c65a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ public String greet (String name, java.util.Date date)
binding.OtherBuildItems.Add (new BuildItem ("JavaSourceJar", "javasourcejartest-sources.jar") {
BinaryContent = () => Convert.FromBase64String (sourcesJarBase64)
});
bindingBuilder.Build (binding);
string xml = Path.Combine (bindingBuilder.Output.GetIntermediaryAsText ("docs/Com.Xamarin.Android.Test.Msbuildtest/JavaSourceJarTest.xml"));
Assert.IsTrue (bindingBuilder.Build (binding), "binding build should have succeeded");
string xml = bindingBuilder.Output.GetIntermediaryAsText ("docs/Com.Xamarin.Android.Test.Msbuildtest/JavaSourceJarTest.xml");
Assert.IsTrue (xml.Contains ("<param name=\"name\"> - name to display.</param>"), "missing doc");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ Copyright (C) 2012 Xamarin Inc. All rights reserved.
</Target>

<Target Name="BuildDocumentation"
Inputs="@(JavaDocIndex)"
Inputs="@(JavaDocIndex);@(IntermediateAssembly->'$(IntermediateOutputPath)%(filename).xml')"
Outputs="@(IntermediateAssembly->'$(OutputPath)%(filename).xml')"
Condition="'@(JavaDocIndex)' != ''">
<MDoc
Expand Down

0 comments on commit 069c65a

Please sign in to comment.