Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Merge requests
  • !1318

Fix incorrect RDotTextEntry sorting

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/paveldudka/wrong_r_dot_java_sorting into master May 03, 2017
  • Overview 9
  • Commits 7
  • Pipelines 0
  • Changes 7

Created by: paveldudka

It turns out that currently RDotTxtEntry sorting logic doesn't handle one of the corner cases which produces invalid R.java. That's basically the reason why we had bunch of test failures after we integrated #879

Consider following example:

<declare-styleable name="AnchorLayout">
  <attr name="anchorInner" format="reference" />
</declare-styleable>

<declare-styleable name="AnchorLayout_Layout">
  <attr name="somethingElse"/>
</declare-styleable>

This should result in something like this:

   int[] styleable AnchorLayout { 0x7F010101 }
   int styleable AnchorLayout_anchorInner 0

   int[] styleable AnchorLayout_Layout { 0x7F010102 }
   int styleable AnchorLayout_Layout_somethingElse 0

However, current sorting send AnchorLayout_anchorInner all the way to the botton (since AnchorLayout_anchorInner > AnchorLayout_Layout) which breaks assumptions made in MergeAndroidResourcesStep, so here is what we currently get:

   int[] styleable AnchorLayout { }

   int[] styleable AnchorLayout_Layout { 0x7F010102 }
   int styleable AnchorLayout_Layout_somethingElse 0

   ....
   int styleable AnchorLayout_anchorInner 0x7F010101	

which is a complete nonesence.

Approach:

Since we need to group our styleable attributes based on their parent and it is impossible to correctly detect parent name from styleable attr name (consider something like this int styleable A_B_C 0 where it can be attr B_C which belongs to styleable A or attr C which belongs to styleable A_B :)), we decided to introduce "parent" field to styleable attributes, so it carries information about its parent, so we can properly group them.

@raviagarwal7 , since you last touched this logic, it does make sense if you are up-to-speed with these changes

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/paveldudka/wrong_r_dot_java_sorting