Skip to content

Instantly share code, notes, and snippets.

@mochadwi
Last active September 11, 2020 05:25
Show Gist options
  • Save mochadwi/d233e4996f3e498f08f57d073e366c9b to your computer and use it in GitHub Desktop.
Save mochadwi/d233e4996f3e498f08f57d073e366c9b to your computer and use it in GitHub Desktop.

Revisions

  1. mochadwi revised this gist Apr 18, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure:
    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))
    - Support `com.pierfrancescosoffritti.androidyoutubeplayer` migration to androidx
    - Support mapping for themes [see here](https://stackoverflow.com/a/61224261/3763032) or using [Bridge Theme](Bridge Themes), e.g: `Theme.AppCompat.Light` -> `Theme.MaterialComponents.Light.Bridge`
    - Support mapping for themes [see here](https://stackoverflow.com/a/61224261/3763032) or using [Bridge Theme](https://material.io/develop/android/docs/getting-started/), e.g: `Theme.AppCompat.Light` -> `Theme.MaterialComponents.Light.Bridge`

    Run this:
    - `curl -s -L https://git.io/JewSF | bash`
  2. mochadwi revised this gist Apr 18, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure:
    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))
    - Support `com.pierfrancescosoffritti.androidyoutubeplayer` migration to androidx
    - Support mapping for themes [see here](https://stackoverflow.com/a/61224261/3763032) or using [Bridge Theme](Bridge Themes), e.g: `Theme.AppCompat.Light` -> `Theme.MaterialComponents.Light.Bridge`

    Run this:
    - `curl -s -L https://git.io/JewSF | bash`
  3. mochadwi revised this gist Apr 7, 2020. 2 changed files with 3 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions androidx-migrator-class.sh
    Original file line number Diff line number Diff line change
    @@ -26,14 +26,14 @@ do
    done <<< "$(cat $MAPPING_FILE)"

    i=0
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" -o -name "*.jar" -o -name "*.aar" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
    ret=$?
    if (( ! ret )); then
    $GSED -i.bak "$replace" $file
    cmp --silent $file $file.bak
    # cmp --silent $file $file.bak
    ret=$?
    if (( ret ));then
    printf "\nDoing file %s\n" $file
    3 changes: 1 addition & 2 deletions androidx_class_map.csv
    Original file line number Diff line number Diff line change
    @@ -1940,5 +1940,4 @@ android.support.design.widget.AppBarLayout,com.google.android.material.appbar.Ap
    android.support.design.widget.Snackbar,com.google.android.material.snackbar.Snackbar
    android.support.design.widget.BottomSheetBehavior,com.google.android.material.bottomsheet.BottomSheetBehavior
    android.support.design.widget.TextInputEditText,com.google.android.material.textfield.TextInputEditText
    android.support.design.widget.TextInputLayout,com.google.android.material.textfield.TextInputLayout
    com.pierfrancescosoffritti.youtubeplayer,com.pierfrancescosoffritti.androidyoutubeplayer.core
    android.support.design.widget.TextInputLayout,com.google.android.material.textfield.TextInputLayout
  4. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,6 @@ Why this?
    - Use the same script, with additional "artifact" mapping (androidx-migrator-artifact.sh)
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)
    - Support `view binding` please comment if the class mapping is not updated (official from google also still not updated)
    - Support `com.pierfrancescosoffritti.androidyoutubeplayer` migration to androidx

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`
    @@ -27,6 +26,7 @@ cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure:

    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))
    - Support `com.pierfrancescosoffritti.androidyoutubeplayer` migration to androidx

    Run this:
    - `curl -s -L https://git.io/JewSF | bash`
  5. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion androidx_class_map.csv
    Original file line number Diff line number Diff line change
    @@ -1941,4 +1941,4 @@ android.support.design.widget.Snackbar,com.google.android.material.snackbar.Snac
    android.support.design.widget.BottomSheetBehavior,com.google.android.material.bottomsheet.BottomSheetBehavior
    android.support.design.widget.TextInputEditText,com.google.android.material.textfield.TextInputEditText
    android.support.design.widget.TextInputLayout,com.google.android.material.textfield.TextInputLayout
    com.pierfrancescosoffritti.youtubeplayer.player.YouTubePlayerView,com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
    com.pierfrancescosoffritti.youtubeplayer,com.pierfrancescosoffritti.androidyoutubeplayer.core
  6. mochadwi revised this gist Apr 7, 2020. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ Why this?
    - Use the same script, with additional "artifact" mapping (androidx-migrator-artifact.sh)
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)
    - Support `view binding` please comment if the class mapping is not updated (official from google also still not updated)
    - Support `com.pierfrancescosoffritti.androidyoutubeplayer` migration to androidx

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`
    1 change: 1 addition & 0 deletions androidx_class_map.csv
    Original file line number Diff line number Diff line change
    @@ -1941,3 +1941,4 @@ android.support.design.widget.Snackbar,com.google.android.material.snackbar.Snac
    android.support.design.widget.BottomSheetBehavior,com.google.android.material.bottomsheet.BottomSheetBehavior
    android.support.design.widget.TextInputEditText,com.google.android.material.textfield.TextInputEditText
    android.support.design.widget.TextInputLayout,com.google.android.material.textfield.TextInputLayout
    com.pierfrancescosoffritti.youtubeplayer.player.YouTubePlayerView,com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
  7. mochadwi revised this gist Apr 7, 2020. No changes.
  8. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,7 @@ cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure:
    - [many recommends to use `api` instead of `implementation](https://stackoverflow.com/questions/42046732/possible-reason-for-errorcannot-generate-view-binders-java-lang-nullpointerexc/42046733)
    - due to gradle / build cache
    - due to generated code that still using support library
    - using `grep ".support.v7.widget.AppCompatImageView" -R .` to make sure if there's cache/generated class reference that imports


    TODO:
  9. mochadwi revised this gist Apr 7, 2020. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,14 @@ What not?

    Troubleshooting
    - Keep support library, by using `android.jetifier.blacklist` properties, e.g: [`Glide support library`](https://github.com/bumptech/glide/issues/3080#issuecomment-495430590)
    - Strange errors
    ```
    cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.support.v7.widget.AppCompatImageView not found
    ```
    - [many recommends to use `api` instead of `implementation](https://stackoverflow.com/questions/42046732/possible-reason-for-errorcannot-generate-view-binders-java-lang-nullpointerexc/42046733)
    - due to gradle / build cache
    - due to generated code that still using support library


    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))
  10. mochadwi revised this gist Apr 7, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,10 @@ Why this?

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`
    - Generated library/3rd-party library, e.g: Glide, Dagger, etc `must be updated manually`, check for their latest update support an AndroidX or not, otherwise, fork the library and customized it ourself
    - Generated library/3rd-party library, e.g: `Glide`, `Dagger`, etc **must be updated manually**, check for their latest update support an **AndroidX** or not, otherwise, fork the library and customized it ourself

    Troubleshooting
    - Keep support library, by using `android.jetifier.blacklist` properties, e.g: [`Glide support library`](https://github.com/bumptech/glide/issues/3080#issuecomment-495430590)

    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))
  11. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ Why this?

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`
    - Generated library/3rd-party library, e.g: Glide, Dagger, etc `must be updated manually`, check for their latest update support an AndroidX or not, otherwise, fork the library and customized it ourself


    TODO:
  12. mochadwi revised this gist Apr 7, 2020. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@ Inpsired by:
    Why this?
    - Use the same script, with additional "artifact" mapping (androidx-migrator-artifact.sh)
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)
    - Support `view binding` please comment if the class mapping is not updated (official from google also still not updated)

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`
    1 change: 1 addition & 0 deletions androidx_class_map.csv
    Original file line number Diff line number Diff line change
    @@ -305,6 +305,7 @@ android.arch.persistence.room.writer.QueryWriter,androidx.room.writer.QueryWrite
    android.arch.persistence.room.writer.RelationCollectorMethodWriter,androidx.room.writer.RelationCollectorMethodWriter
    android.arch.persistence.room.writer.SQLiteOpenHelperWriter,androidx.room.writer.SQLiteOpenHelperWriter
    android.arch.persistence.room.writer.TableInfoValidationWriter,androidx.room.writer.TableInfoValidationWriter
    android.viewbinding.ViewBinding,androidx.viewbinding.ViewBinding
    android.databinding.adapters.AbsListViewBindingAdapter,androidx.databinding.adapters.AbsListViewBindingAdapter
    android.databinding.adapters.AbsSeekBarBindingAdapter,androidx.databinding.adapters.AbsSeekBarBindingAdapter
    android.databinding.adapters.AbsSpinnerBindingAdapter,androidx.databinding.adapters.AbsSpinnerBindingAdapter
  13. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion androidx-migrator-artifact.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ do
    done <<< "$(cat $MAPPING_FILE)"

    i=0
    (find $PROJECT_DIR \( -name "*.gradle" -o -name "*.gradle.kts" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.gradle" -o -name "*.gradle.kts" -o -name "*.kts" -o -name "*.kt" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' ! -path '**/java/*' ! -path '**/res/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
  14. mochadwi revised this gist Apr 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion androidx-migrator-artifact.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ do
    done <<< "$(cat $MAPPING_FILE)"

    i=0
    (find $PROJECT_DIR \( -name "*.gradle" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.gradle" -o -name "*.gradle.kts" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
  15. mochadwi revised this gist Nov 27, 2019. No changes.
  16. mochadwi revised this gist Nov 12, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,10 @@ Why this?
    - Use the same script, with additional "artifact" mapping (androidx-migrator-artifact.sh)
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)

    What not?
    - Not support version mapping, e.g: `android.support.appcompat:appcompat-v7:28.0.1` -> `androidx.appcompat:appcompat:2.0.0`


    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))

  17. mochadwi revised this gist Nov 12, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -11,4 +11,4 @@ TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))

    Run this:
    - `curl -s -L https://git.io/JewXh | bash`
    - `curl -s -L https://git.io/JewSF | bash`
  18. mochadwi revised this gist Nov 12, 2019. 2 changed files with 8 additions and 4 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ Why this?
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)

    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07)
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07))

    Run this:
    - `curl -s -L https://git.io/JewXh | bash`
    10 changes: 7 additions & 3 deletions executor.sh
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,14 @@

    mkdir -p scripts
    cd scripts
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/34e0d83c37e90b83ea69fe12a7ef6289af872ce5/androidx_class_map.csv

    # download csv class & artifact mapping
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/androidx_class_map.csv
    wget -cq https://developer.android.com/topic/libraries/support-library/downloads/androidx-artifact-mapping.csv
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-artifact.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-class.sh

    # download migrator script
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/androidx-migrator-artifact.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/androidx-migrator-class.sh

    bash androidx-migrator-class.sh
    bash androidx-migrator-artifact.sh
  19. mochadwi revised this gist Nov 12, 2019. 3 changed files with 21 additions and 21 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ Why this?
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)

    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed`
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed` (inspired by [loganj](https://gist.github.com/loganj/7535a13e98be83460f362b63dbd13e07)

    Run this:
    - `curl -s -L https://git.io/JewXh | bash`
    20 changes: 10 additions & 10 deletions androidx-migrator-artifact.sh
    Original file line number Diff line number Diff line change
    @@ -14,19 +14,19 @@ MAPPING_FILE="$SCRIPTS_DIR/androidx-artifact-mapping.csv"
    GSED=$(command -v gsed)

    if [[ -z "$GSED" ]]; then
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi

    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"
    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    i=0
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/demo/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.gradle" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
    20 changes: 10 additions & 10 deletions androidx-migrator-class.sh
    Original file line number Diff line number Diff line change
    @@ -14,19 +14,19 @@ MAPPING_FILE="$SCRIPTS_DIR/androidx_class_map.csv"
    GSED=$(command -v gsed)

    if [[ -z "$GSED" ]]; then
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi

    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"
    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    i=0
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/demo/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
  20. mochadwi revised this gist Nov 12, 2019. 2 changed files with 10 additions and 2 deletions.
    10 changes: 9 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,12 @@ Inpsired by:
    - AbdElraoufSabri: https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05
    - dudeinthemirror: https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d

    Run this: `curl -s -L https://git.io/JewXh | bash`
    Why this?
    - Use the same script, with additional "artifact" mapping (androidx-migrator-artifact.sh)
    - Skip any "build" directory, regardless of module name: app (app/build), abc (abc/build)

    TODO:
    - Use `rg` to replace `find` & `perl` to replace `sed|gsed`

    Run this:
    - `curl -s -L https://git.io/JewXh | bash`
    2 changes: 1 addition & 1 deletion executor.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    mkdir -p scripts
    cd scripts
    wget -cq https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05/raw/androidx_class_map.csv
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/34e0d83c37e90b83ea69fe12a7ef6289af872ce5/androidx_class_map.csv
    wget -cq https://developer.android.com/topic/libraries/support-library/downloads/androidx-artifact-mapping.csv
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-artifact.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-class.sh
  21. mochadwi revised this gist Nov 12, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,4 @@ Inpsired by:
    - AbdElraoufSabri: https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05
    - dudeinthemirror: https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d

    Run this: `curl -s -L https://git.io/JewXg | bash`
    Run this: `curl -s -L https://git.io/JewXh | bash`
  22. mochadwi revised this gist Nov 12, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions executor.sh
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@ mkdir -p scripts
    cd scripts
    wget -cq https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05/raw/androidx_class_map.csv
    wget -cq https://developer.android.com/topic/libraries/support-library/downloads/androidx-artifact-mapping.csv
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/f4c86fc641afebdb4cc2b9223ee8ac55aff614e5/androidx-migrator-class.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/f4c86fc641afebdb4cc2b9223ee8ac55aff614e5/androidx-migrator-artifact.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-artifact.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/094dbb8f6070ab40147a4bcb160cb9cfabbb339a/androidx-migrator-class.sh

    bash androidx-migrator-class.sh
    bash androidx-migrator-artifact.sh
  23. mochadwi revised this gist Nov 12, 2019. 1 changed file with 27 additions and 19 deletions.
    46 changes: 27 additions & 19 deletions androidx-migrator-artifact.sh
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,48 @@
    #! /usr/bin/env bash
    #! /bin/bash
    # shellcheck disable=SC2086
    # shellcheck disable=SC2162

    # inspired from https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d
    # This script provides a workaround for having dependent modules which
    # have not been migrated to AndroidX
    # see: https://developer.android.com/jetpack/androidx/migrate
    # inspired from https://gist.github.com/dlew/5db1b780896bbc6f542e7c00a11db6a0

    SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    PROJECT_DIR="$(cd "${SCRIPTS_DIR}"/.. && pwd)"
    MAPPING_FILE="$SCRIPTS_DIR/androidx_artifact_map.csv"
    MAPPING_FILE="$SCRIPTS_DIR/androidx-artifact-mapping.csv"

    replace=""
    GSED=$(command -v gsed)

    while IFS=, read -r from to
    do
    replace+="s/$from/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"
    if [[ -z "$GSED" ]]; then
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi

    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    echo $replace > replace.sed
    i=0
    (find $PROJECT_DIR \( -name "*.gradle" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/demo/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" "$file" > /dev/null 2>/dev/null
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
    ret=$?
    if (( ! ret )); then
    gsed -i.bak -f replace.sed $file
    cmp --silent "$file" "$file.bak"
    $GSED -i.bak "$replace" $file
    cmp --silent $file $file.bak
    ret=$?
    if (( ret ));then
    printf "\nDoing file %s\n" "$file"
    printf "\nDoing file %s\n" $file
    else
    i=$((i+1))
    printf '\r%2d skipped' $i
    rm -f "$file.bak"
    rm -f $file.bak
    fi
    fi
    done
    echo
    echo
    )

    rm -rf replace.sed
    exit
  24. mochadwi revised this gist Nov 12, 2019. 2 changed files with 30 additions and 18 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,6 @@
    Inpsired by:
    - dlew: https://gist.github.com/dlew/5db1b780896bbc6f542e7c00a11db6a0
    - AbdElraoufSabri: https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05
    - dudeinthemirror: https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d

    Run this: `curl -s -L https://git.io/JewXg | bash`
    44 changes: 26 additions & 18 deletions androidx-migrator-class.sh
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,48 @@
    #! /usr/bin/env bash
    #! /bin/bash
    # shellcheck disable=SC2086
    # shellcheck disable=SC2162

    # inspired from https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d
    # This script provides a workaround for having dependent modules which
    # have not been migrated to AndroidX
    # see: https://developer.android.com/jetpack/androidx/migrate
    # inspired from https://gist.github.com/dlew/5db1b780896bbc6f542e7c00a11db6a0

    SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    PROJECT_DIR="$(cd "${SCRIPTS_DIR}"/.. && pwd)"
    MAPPING_FILE="$SCRIPTS_DIR/androidx_class_map.csv"

    replace=""
    GSED=$(command -v gsed)

    while IFS=, read -r from to
    do
    replace+="s/$from/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"
    if [[ -z "$GSED" ]]; then
    echo "ERROR: you need to install gnu-sed first."
    echo "run: 'brew install gnu-sed'"
    exit 101
    fi

    replace=""
    while IFS=, read -r from to
    do
    replace+="s/\<$from\>/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    echo $replace > replace.sed
    i=0
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/demo/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" "$file" > /dev/null 2>/dev/null
    grep -E "android.arch|android.databinding|android.support" $file > /dev/null 2>/dev/null
    ret=$?
    if (( ! ret )); then
    gsed -i.bak -f replace.sed $file
    cmp --silent "$file" "$file.bak"
    $GSED -i.bak "$replace" $file
    cmp --silent $file $file.bak
    ret=$?
    if (( ret ));then
    printf "\nDoing file %s\n" "$file"
    printf "\nDoing file %s\n" $file
    else
    i=$((i+1))
    printf '\r%2d skipped' $i
    rm -f "$file.bak"
    rm -f $file.bak
    fi
    fi
    done
    echo
    echo
    )

    rm -rf replace.sed
    exit
  25. mochadwi revised this gist Nov 12, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@

    Run this: `curl -s -L https://git.io/JewXg | bash`
  26. mochadwi revised this gist Nov 12, 2019. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions executor.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #! /usr/bin/env bash

    mkdir -p scripts
    cd scripts
    wget -cq https://gist.github.com/AbdElraoufSabri/907163eecbb87e7ca033d01004623c05/raw/androidx_class_map.csv
    wget -cq https://developer.android.com/topic/libraries/support-library/downloads/androidx-artifact-mapping.csv
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/f4c86fc641afebdb4cc2b9223ee8ac55aff614e5/androidx-migrator-class.sh
    wget -cq https://gist.github.com/mochadwi/d233e4996f3e498f08f57d073e366c9b/raw/f4c86fc641afebdb4cc2b9223ee8ac55aff614e5/androidx-migrator-artifact.sh

    bash androidx-migrator-class.sh
    bash androidx-migrator-artifact.sh
  27. mochadwi created this gist Nov 12, 2019.
    40 changes: 40 additions & 0 deletions androidx-migrator-artifact.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #! /usr/bin/env bash

    # inspired from https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d

    SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    PROJECT_DIR="$(cd "${SCRIPTS_DIR}"/.. && pwd)"
    MAPPING_FILE="$SCRIPTS_DIR/androidx_artifact_map.csv"

    replace=""

    while IFS=, read -r from to
    do
    replace+="s/$from/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    echo $replace > replace.sed
    i=0
    (find $PROJECT_DIR \( -name "*.gradle" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" "$file" > /dev/null 2>/dev/null
    ret=$?
    if (( ! ret )); then
    gsed -i.bak -f replace.sed $file
    cmp --silent "$file" "$file.bak"
    ret=$?
    if (( ret ));then
    printf "\nDoing file %s\n" "$file"
    else
    i=$((i+1))
    printf '\r%2d skipped' $i
    rm -f "$file.bak"
    fi
    fi
    done
    echo
    )

    rm -rf replace.sed
    exit
    40 changes: 40 additions & 0 deletions androidx-migrator-class.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #! /usr/bin/env bash

    # inspired from https://gist.github.com/dudeinthemirror/cb4942e0ee5c3df0fcb678d1798e1d4d

    SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    PROJECT_DIR="$(cd "${SCRIPTS_DIR}"/.. && pwd)"
    MAPPING_FILE="$SCRIPTS_DIR/androidx_class_map.csv"

    replace=""

    while IFS=, read -r from to
    do
    replace+="s/$from/$to/g;"
    done <<< "$(cat $MAPPING_FILE)"

    echo $replace > replace.sed
    i=0
    (find $PROJECT_DIR \( -name "*.kt" -o -name "*.java" -o -name "*.xml" \) -type f ! -path '*/\.git*' ! -path '**/android/app/build/*' ! -path '**/\.idea/*' 2>/dev/null |
    while read file
    do
    grep -E "android.arch|android.databinding|android.support" "$file" > /dev/null 2>/dev/null
    ret=$?
    if (( ! ret )); then
    gsed -i.bak -f replace.sed $file
    cmp --silent "$file" "$file.bak"
    ret=$?
    if (( ret ));then
    printf "\nDoing file %s\n" "$file"
    else
    i=$((i+1))
    printf '\r%2d skipped' $i
    rm -f "$file.bak"
    fi
    fi
    done
    echo
    )

    rm -rf replace.sed
    exit
    1,942 changes: 1,942 additions & 0 deletions androidx_class_map.csv
    1,942 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.