Make side of converting refreshmod to a shell script

Bug: 340648588
Test: refreshmod
Change-Id: Iedbdd31f9a58cb609a826dfe8066c9eff8aa5904
diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk
index aa695eb..07e2d19 100644
--- a/core/tasks/module-info.mk
+++ b/core/tasks/module-info.mk
@@ -52,6 +52,8 @@
 	$(PRIVATE_MERGE_JSON_OBJECTS) -o $@ $(PRIVATE_SOONG_MODULE_INFO) $@.tmp
 	rm $@.tmp
 
+.PHONY: module-info
+module-info: $(MODULE_INFO_JSON)
 
 droidcore-unbundled: $(MODULE_INFO_JSON)
 
diff --git a/envsetup.sh b/envsetup.sh
index dd545c6..b20c83f 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1195,22 +1195,6 @@
     \cd $T/$pathname
 }
 
-function refreshmod() {
-    if [ ! "$ANDROID_PRODUCT_OUT" ]; then
-        echo "No ANDROID_PRODUCT_OUT. Try running 'lunch' first." >&2
-        return 1
-    fi
-
-    echo "Refreshing modules (building module-info.json). Log at $ANDROID_PRODUCT_OUT/module-info.json.build.log." >&2
-
-    # for the output of the next command
-    mkdir -p $ANDROID_PRODUCT_OUT || return 1
-
-    # Note, can't use absolute path because of the way make works.
-    m $(get_build_var PRODUCT_OUT)/module-info.json \
-        > $ANDROID_PRODUCT_OUT/module-info.json.build.log 2>&1
-}
-
 # Verifies that module-info.txt exists, returning nonzero if it doesn't.
 function verifymodinfo() {
     if [ ! "$ANDROID_PRODUCT_OUT" ]; then
@@ -1578,6 +1562,7 @@
 unset tomlgrep
 unset treegrep
 unset syswrite
+unset refreshmod
 
 
 validate_current_shell