Skip to main content

CLI Tool for Sorting Android Studio Changelists

Project description

Changelist Sort

Making Sorting Changelist Files Easy!

  1. Close Android Studio (saves changelists to workspace file)
  2. Open shell from project root directory (or supply workspace file path in arguments)
  3. Run changelist-sort (or cl-sort) add arguments/options if necessary
  4. Reopen Android Studio. Your changelists are sorted.

Note: Add alias to your shell environment to maximize your efficiency.

Project Sorting Configuration

To configure a changelist sorting patterns for your project:

  1. Create Directory .changelists/
  2. Create File sort.xml in Directory
  3. Write Sorting XML Root Tag <sorting></sorting>
  4. Write Changelists Tags <changelist name="" key=""></changelist>
  5. Write File Pattern Tags <files ... />

File Pattern Attributes

For each <files /> tag, apply ONE of the following attributes:

  • file_ext : Match the file extension of the file. Do not include the dot.
  • first_dir : The first directory in the path. Use empty string to match root directory.
  • filename_prefix : The filename startswith this prefix.
  • filename_suffix : The filename endswith this prefix.
  • path_start : The beginning of the parent directory path. It's usually better to exclude unnecessary slash characters.
  • path_end : The end of the parent directory path. It's usually better to exclude unnecessary slash characters.

Sorting Keys

The key attribute inside changelists is required.

  • Sorting Keys are short, simple strings that identify a changelist.
  • More than one Sorting Key can map to one Changelist.
  • Every File pattern is associated with a Sorting Key.

Sorting By Module (default)

Files are sorted by the name of the top level directory they are located in. In Android projects, each directory in the project root is a module, with a few special cases.

Sorting By Source Set (Gradle, Android)

A specialized Module Sort mode that splits changes by their source set. Apply the -s flag to use this sorting mode.

Special Changelists & Directories

There are special Changelists, and special Directories that are handled differently.

  • Build Updates Changelist
  • Root Directory
  • Gradle Directory

Build Updates Changelist: This is a changelist that is used to collect all of the files that affect the project build. This includes all files in the gradle directory, and any file that ends with the .gradle file extension. There are also Gradle files that end in .properties, which are also sorted into the Build Updates Changelist.

Root Directory: The Root directory is special because the file paths are really short and do not contain a module name. Often, Root directory contains .gradle files which are sorted into the Build Updates Changelist. Any non-Gradle files in the Root directory are sorted into a special Changelist that may be called Root or Project Root.

Gradle Directory: The Gradle Directory is a direct descendant of the Root directory, and may contain toml, gradle, or properties files. These are all sorted into the Build Updates Changelist.

Module Names and Sorting Comparisons

Changelist Names The name of the changelist must match the module, ignoring letter case and removing spaces.

Otherwise, a new Changelist will be created that matches the module name.

  • Underscores are replaced with spaces.
  • Each Word in the Name will start with an uppercase letter.

Remove Empty Changelists

You can remove all empty changelists after a sort has completed by adding the -r flag, or --remove-empty argument.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

changelist_sort-0.4.2.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

changelist_sort-0.4.2-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file changelist_sort-0.4.2.tar.gz.

File metadata

  • Download URL: changelist_sort-0.4.2.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for changelist_sort-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0cc4a8c2c2a47bcdf723037ca983a61244b8c960fc69bff306dc22a43db41107
MD5 9e813607255fd672d784811e8354cfe6
BLAKE2b-256 d404a39f52f3e49f6e036faf265ecf476c49f77f88e1c16cc946528f04243bc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for changelist_sort-0.4.2.tar.gz:

Publisher: publish.yml on DK96-OS/changelist-sort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file changelist_sort-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for changelist_sort-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 217c97db5d730bf6dab129433d650e701a25efcddf30d5ca1b44e218516de5cf
MD5 d2c396e14542eb3bfbdbf4734ffda990
BLAKE2b-256 32d3f62d922d3bd7ca17d28caadfee95cb151e44b66edc2e610286701621a3c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for changelist_sort-0.4.2-py3-none-any.whl:

Publisher: publish.yml on DK96-OS/changelist-sort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page