Skip to content

Instantly share code, notes, and snippets.

@mping-exo
Created December 2, 2021 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mping-exo/df47bd1df89032f4764bf0189cce6cba to your computer and use it in GitHub Desktop.
Save mping-exo/df47bd1df89032f4764bf0189cce6cba to your computer and use it in GitHub Desktop.
fix-idea.sh
#!/bin/bash
xml='<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/checkouts" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>'
# doesnt work
# find modules -name 'sos-proxy.iml' | xargs perl -0777 -p -e 's/<content.*\/content>/$xml/igs' | less
find modules -name '*.iml' | xargs perl -0777 -pi -e 's/<content.*\/content>/<content url="file:\/\/\$MODULE_DIR\$"><sourceFolder url="file:\/\/\$MODULE_DIR\$\/src" isTestSource="false" \/><sourceFolder url="file:\/\/\$MODULE_DIR\$\/java" isTestSource="false" \/><sourceFolder url="file:\/\/\$MODULE_DIR\$\/test" isTestSource="true" \/><sourceFolder url="file:\/\/\$MODULE_DIR\$\/resources" type="java-resource" \/><excludeFolder url="file:\/\/\$MODULE_DIR\$\/checkouts" \/><excludeFolder url="file:\/\/\$MODULE_DIR\$\/target" \/><\/content>/igs'
# TODO
# - sos-metastore also depends on sos-protobuf:
# - <orderEntry type="module" module-name="sos-protobuf" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment