Skip to content

Conversation

@radekdoulik
Copy link
Member

Context: https://github.com/xamarin/xamarin-android/projects/14
Context: #4191

And use it to produce .apkdesc files. These files will be later used
instead of the size reference files we have now. They contain more
detailed size information and also improve the readability compared to
the .csv files.

The .apkdesc files look like:

{
  "Comment": "HEAD/master: cdc04224edcb876ae6607693ea4011fee8c76893",
  "PackageSize": 75817581,
  "Entries": {
    "AndroidManifest.xml": {
      "Size": 5428
    },
    "res/drawable/android_button.xml": {
      "Size": 588
    },
...
}

Context: https://github.com/xamarin/xamarin-android/projects/14
Context: dotnet#4191

And use it to produce `.apkdesc` files. These files will be later used
instead of the size reference files we have now. They contain more
detailed size information and also improve the readability compared to
the `.csv` files.

The `.apkdesc` files look like:
    {
      "Comment": "HEAD/master: cdc04224edcb876ae6607693ea4011fee8c76893",
      "PackageSize": 75817581,
      "Entries": {
        "AndroidManifest.xml": {
          "Size": 5428
        },
        "res/drawable/android_button.xml": {
          "Size": 588
        },
    ...
    }
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I think about it, should all new projects be SDK style?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Do we have a migration tool available on Mac or do I need to do it by hand?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radekdoulik I found they are so short you can type them now:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
</Project>

It has a bunch of conventions based on the csproj file name. You can also delete Properties\AssemblyInfo.cs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I did similar thing here radekdoulik/apkdiff@8608ae3

I guess I will need to modify the OutputPath in addition to that in XA.

@radekdoulik
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonpryor
Copy link
Contributor

jonpryor commented Feb 6, 2020

"Silly" question: do we really want .apkdesc files to be JSON, and not XML? Yes, there's lots of XML hatred going around, but vast swaths of our toolchain are XML based, and I can't think of anything offhand in our toolchain which uses JSON.

@radekdoulik
Copy link
Member Author

"Silly" question: do we really want .apkdesc files to be JSON, and not XML? Yes, there's lots of XML hatred going around, but vast swaths of our toolchain are XML based, and I can't think of anything offhand in our toolchain which uses JSON.

The choice is motivated mostly by better readability.

</PropertyGroup>
<Exec
Condition=" Exists('$(ApkDiffPath)') "
Command="&quot;$(ApkDiffPath)&quot; -v -c &quot;HEAD/`git branch --show-current`: `git rev-parse HEAD`&quot; -s &quot;%(_AllArchives.Identity)&quot;;mv &quot;%(_AllArchives.RelativeDir)\%(_AllArchives.Filename).apkdesc&quot; &quot;%(_AllArchives.RelativeDir)\%(_AllArchives.Filename)-$(Configuration)-$(TestsFlavor).apkdesc&quot;"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that -$(TestsFlavor) can instead be $(TestsFlavor).

Right now the xa-test-results-10.2.99.215_739a18a-Darwin-Release.zip file contains filenames such as:

% find . -iname \*.apkd\*
./Xamarin.Android.EmbeddedDSO_Test-Signed-Release-.apkdesc
./Mono.Android_Tests-Signed-Release--Profiled-Aot.apkdesc
./Xamarin.Forms_Performance_Integration-Signed-Release-.apkdesc
./Xamarin.Forms_Performance_Integration-Signed-Release--Bundle.apkdesc
./Mono.Android_Tests-Signed-Release-.apkdesc
./Mono.Android_Tests-Signed-Release--Aot.apkdesc
./Xamarin.Forms_Performance_Integration-Signed-Release--Aot.apkdesc
./Xamarin.Android.Locale_Tests-Signed-Release-.apkdesc
./Mono.Android_Tests-Signed-Release--Bundle.apkdesc
./Xamarin.Android.JcwGen_Tests-Signed-Release-.apkdesc
./Xamarin.Android.Locale_Tests-Signed-Release--Aot.apkdesc
./Xamarin.Forms_Performance_Integration-Signed-Release--Profiled-Aot.apkdesc
./Mono.Android_TestsMultiDex-Signed-Release-.apkdesc
./Xamarin.Android.Locale_Tests-Signed-Release--Profiled-Aot.apkdesc

Note that many filenames have a trailing -, e.g. Xamarin.Android.JcwGen_Tests-Signed-Release-.apkdesc, or have --, e.g. Xamarin.Android.Locale_Tests-Signed-Release--Aot.apkdesc. I believe using just $(TestsFlavor) would fix this.

jonpryor and others added 3 commits February 6, 2020 16:53
Visual Studio for Mac has a tendency to "re-format" `.csproj` files, e.g. if you add a new project to the `.sln`, it'll reformat *every* `.csproj` referenced by the `.sln`, and this "reformatting" invariably removes all "useful" whitespace, resulting in this "wonderful" fragment:

```xml
<Target Name="CopyNewtonsoftJsonLicense" AfterTargets="Build">
  <Copy SourceFiles="..\..\packages\newtonsoft.json\12.0.3\LICENSE.md" DestinationFiles="$(OutputPath)\Newtonsoft.Json-LICENSE.md" />
</Target>
```

To which I say NO.  Custom targets do *not* go into the .csproj, precisely because VSMac will (eventually) screw it up.

Move CopyNewtonsoftJsonLicense into `apkdiff.targets`, and then `<Import/>` apkdiff.targets.
@jonpryor jonpryor merged commit 2e28f2e into dotnet:master Feb 7, 2020
jonpryor pushed a commit that referenced this pull request Feb 9, 2020
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3452921&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=1a8bc9f1-aacc-59ec-6634-323d2bcb90ae

Shortly `apkdiff` was added (2e28f2e), some PR builds started showing
errors around its execution:

	RecordApkSizes:
	  "/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/apkdiff" -v -c "HEAD/`git branch --show-current`: `git rev-parse HEAD`" -s "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed.aab";mv "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed.apkdesc" "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed-Release.apkdesc"
	EXEC : error : apkdiff: Unknown file extension '.aab'
	  mv: rename ../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed.apkdesc to ../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed-Release.apkdesc: No such file or directory
	…/build-tools/scripts/TestApks.targets(354,5): error MSB3073: The command "
	  "/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/apkdiff" -v -c "HEAD/`git branch --show-current`: `git rev-parse HEAD`" -s "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed.aab";mv "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed.apkdesc" "../../bin/TestRelease/Mono.Android_TestsAppBundle-Signed-Release.apkdesc"
	" exited with code 1.

This error was likely overlooked in PR #4221 because PR builds are
currently "noisy", with lots of "ignorable" errors occurring.

Update `apkdiff` so that it will also process `.aab` files, thus
avoiding the above error.
@radekdoulik radekdoulik mentioned this pull request Feb 11, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants