Opened 16 months ago

Closed 7 weeks ago

#6757 closed change (rejected)

Static assets automation in metadata.chrome

Reported by: agiammarchi Assignee:
Priority: Unknown Milestone:
Module: Automation Keywords:
Cc: greiner, saroyanm, sebastian, tlucas, erikvold, geo Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by agiammarchi)

Background

Beside logic oriented files such .js, .css, or even .html, we are manually maintaining, and updating, with needs for synchronization, all static assets that ABP web extension needs to publish.

Not only this is potentially error prone (forgotten asset, not caught by the meta file but failing in production), this also requires needlessly more effort.

What to change

Generate the metadata.chrome file on features freeze through a template and an automation for at least ABP UI assets.

Example, given the following bash script:

#!/usr/bin/env bash

outputMeta() {
  local file
  local index
  local path
  local folder="$1"
  local startfrom="$2"
  local length=${#startfrom}
  cd $folder > /dev/null
  for file in $(ls $folder); do
    if [ -d $folder/$file ]; then
      outputMeta $folder/$file $startfrom
    elif [[ ! "$file" =~ \.js$|\.css$|\.html$ ]]; then
      index=$(strindex "$folder/$file" "$startfrom")
      path="$folder/$file"
      echo "${path:($index + $length + 1)} = ${path:($index)}"
    fi
  done
  cd - > /dev/null
}

strindex() { 
  x="${1%%$2*}"
  [[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
}

# outputMeta ~/git/adblockplusui/skin adblockplusui
outputMeta $1 $2

it is possible to generate all skin related assets in output, after a chmod a+x skin.sh, via:

./skin.sh ~/git/adblockplusui/skin adblockplus

passing where is the current/desired adblockplusui/skin folder, and outputting automatically the list of assets.

Change History (7)

comment:1 Changed 16 months ago by tlucas

  • Cc greiner saroyanm sebastian kzar tlucas added

comment:2 Changed 16 months ago by kzar

  • Cc kzar removed

comment:3 Changed 16 months ago by agiammarchi

  • Description modified (diff)

comment:4 Changed 16 months ago by agiammarchi

  • Description modified (diff)

comment:5 Changed 16 months ago by agiammarchi

  • Description modified (diff)

comment:6 Changed 11 months ago by erikvold

  • Cc erikvold added

comment:7 Changed 7 weeks ago by sebastian

  • Cc geo added
  • Resolution set to rejected
  • Status changed from new to closed

Maybe we can discover assets in automatically with our new build suite, Geo is working on. But as our legacy buildtools are on the way out, we won't address it there for the time being.

Note: See TracTickets for help on using tickets.