gabrielrobert / xavtool

Xplat Automating Version Tool
https://gabrielrobert.github.io/xavtool/
MIT License
35 stars 2 forks source link

Keep data ordered after xavtool actions #1

Open gabrielrobert opened 6 years ago

gabrielrobert commented 6 years ago

We do not keep ordering at the moment. For instance:

<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleName</key>
    <string>xavtool</string>
</dict>

Could become:

<dict>
    <key>CFBundleName</key>
    <string>xavtool</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
</dict>

It's not an issue, just a nice-to-have.

gabrielrobert commented 6 years ago

Only plist files are affected.

jerone commented 6 years ago

+1 As it creates unnecessary and unrecognizable changes in version control.

jerone commented 6 years ago

After some more testing with a real app in real situation, this issue is getting more important for us. There actually 3 issues here:

  1. Reordering of elements and attributes.
  2. Element changes.
  3. Whitespace / line / indenting changes.

Reordering or properties

iOS

First time you run xavtool it will reorder all properties in the plist. This is not a big issue as it is an one-time reordering. Changing the version with VS doesn't result in another ordering. But VS will add new properties at the end of the plist. Running xavtool again will result in another reordering.

Android & UWP

Not tested, because attributes were already sorted.

UWP

The default UWP manifest is written with readability in mind; nicely aligned and most attributes on their own line. Running xavtool will remove all of this. New lines used for readability are also removed.

-<?xml version="1.0" encoding="utf-8"?>
-
-<Package
-  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
-  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
-  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
-  IgnorableNamespaces="uap mp">
-
-  <Identity
-    Name="XXX"
-    Publisher="XXX"
-    Version="1.0.0.0" />
+<?xml version="1.0" encoding="utf-8"?>
+<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
+  <Identity Name="XXX" Publisher="XXX" Version="3.2.1.0"/>

Element changes

Android

It seems to self-close an open element:

-  <application android:label="XXX"></application>
+  <application android:label="XXX"/>

Whitespace / line / indenting changes

Android

Xavtool seems to use 2 spaces for indentation. VS seems to use tabs for indentation.

iOS

Both xavtool & VS seem to use tabs for indentation. But VS indents from <dict>, while xavtool indents from <plist>. Also indenting from <plist> makes more sense, it's not what VS is using.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
-<dict>
-    <key>CFBundleDisplayName</key>
-    <string>XXX</string>
+    <dict>
+        <key>CFBundleDisplayName</key>
+        <string>XXX</string>

UWP

Both xavtool & VS seem to use 2 spaces for indentation. New lines used for readability are removed. Changes in whitespace before closing element:

-    <TargetDeviceFamily MaxVersionTested="10.0.0.0" />
+    <TargetDeviceFamily MaxVersionTested="10.0.0.0"/>

All of this are not breaking changes; our apps work fully! But this conflicts to much with our policy. It creates more changes around the real change, hiding the real change, because of whitespace changes. It also creates extra history and hides other history, because of reordering. And it changes ownership of peaces of code that are not mine.

Keep up the great work. I wish I was skilled in Go, so I could have contributed code 😄