refactor: packages, classes and Res under mobi.giza (fork, Phase 3b)
docs/scripts/giza-rename.sh, run over the moves of Phase 3a:
- com.machankura.bennu.{compose,android,desktop} -> mobi.giza.{...}, in
package lines, imports, fully qualified references, the manifest, mainClass,
the Android namespace (one value with applicationId again), the m3Audit
source path, the six docs/scripts tools, and the source links in docs/;
- Res moves from bennu.composeapp.generated.resources to
mobi.giza.compose.resources, now pinned with packageOfResClass so a later
rename of the root project leaves the imports alone;
- BennuDatabase, BennuTheme and the other eleven Bennu identifiers are Giza*.
The script's search is now the same pattern as its sed expressions, so on a
renamed tree it finds nothing and changes nothing.
Checked against the Phase 0 baseline: jvmTest 1643 run (1642 + AppDirJvmTest),
0 failed, 2 skipped; compileDebugKotlinAndroid passes; m3-audit prints the
baseline report line for line. iOS is not compiled on this Linux host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30d5feaf87
commit
34e802ce6f
921 files changed
+7627
-7613
No files matched your search
@@ -87,9 +87,11 @@ if (( MOVES_ONLY )); then
|
||||
fi
|
||||
|
||||
# Every text file git knows that still names the old packages, Res or identifiers, but for
|
||||
# the two files that name them on purpose.
|
||||
# the two files that name them on purpose. The pattern is the sed expressions' own, so a
|
||||
# renamed tree matches nothing -- `com.machankura.bennu` in prose, with no separator after
|
||||
# it, and the code.sigidli.com/machankura/bennu-kmp URL are left for a person to word.
|
||||
mapfile -t files < <(
|
||||
git grep -lIE 'com[./]machankura[./]bennu|bennu\.composeapp\.generated\.resources|Bennu(Database|Global|Application|App|Converters|NavHost|NavigationSuite|Theme|Shapes)|bennuGlobal|NotYetOnBennu|defaultBennuDir' \
|
||||
git grep -lIE 'com\.machankura\.bennu\.|com/machankura/bennu/|bennu\.composeapp\.generated\.resources|\bBennu(Database|DatabaseConstructor|DatabaseJvmTest|Global|Application|App|Converters|NavHost|NavigationSuite|Theme|Shapes)\b|\bbennuGlobal\b|\bNotYetOnBennu\b|\bdefaultBennuDir\b' \
|
||||
-- . ':!lightning-kmp-app' ':!docs/giza-rebrand.md' ':!docs/scripts/giza-rename.sh' || true
|
||||
)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ set -uo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
|
||||
|
||||
UI=composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui
|
||||
UI=composeApp/src/commonMain/kotlin/mobi/giza/compose/ui
|
||||
THEME="$UI/theme"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -214,9 +214,9 @@ def main():
|
||||
src = src[:start] + f'stringResource(Res.string.{names[fmt]}, {args})' + src[end:]
|
||||
rewritten += 1
|
||||
need = sorted({names[fmt] for *_x, fmt in [(c[0], c[4]) for c in found]})
|
||||
for imp in (['import bennu.composeapp.generated.resources.Res',
|
||||
for imp in (['import mobi.giza.compose.resources.Res',
|
||||
'import org.jetbrains.compose.resources.stringResource']
|
||||
+ [f'import bennu.composeapp.generated.resources.{n}' for n in need]):
|
||||
+ [f'import mobi.giza.compose.resources.{n}' for n in need]):
|
||||
if not has_import(src, imp):
|
||||
lines = src.split('\n')
|
||||
idx = max(i for i, l in enumerate(lines) if l.startswith('import '))
|
||||
|
||||
@@ -17,7 +17,7 @@ Usage:
|
||||
"""
|
||||
import os, re, sys, io, collections
|
||||
|
||||
UI = 'composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui'
|
||||
UI = 'composeApp/src/commonMain/kotlin/mobi/giza/compose/ui'
|
||||
STRINGS = 'composeApp/src/commonMain/composeResources/values/strings.xml'
|
||||
DRY = '--apply' not in sys.argv
|
||||
|
||||
@@ -243,7 +243,7 @@ def main():
|
||||
for start, end, value in reversed(found):
|
||||
src = src[:start] + f'stringResource(Res.string.{names[value]})' + src[end:]
|
||||
if changed:
|
||||
for imp in ('import bennu.composeapp.generated.resources.Res',
|
||||
for imp in ('import mobi.giza.compose.resources.Res',
|
||||
'import org.jetbrains.compose.resources.stringResource'):
|
||||
if not has_import(src, imp):
|
||||
lines = src.split('\n')
|
||||
@@ -256,7 +256,7 @@ def main():
|
||||
lines = src.split('\n')
|
||||
idx = max(i for i, l in enumerate(lines) if l.startswith('import '))
|
||||
for nm in reversed(need):
|
||||
imp = f'import bennu.composeapp.generated.resources.{nm}'
|
||||
imp = f'import mobi.giza.compose.resources.{nm}'
|
||||
if not has_import(src, imp):
|
||||
lines.insert(idx + 1, imp)
|
||||
src = '\n'.join(lines)
|
||||
|
||||
@@ -19,7 +19,7 @@ is a dimension and is left alone.
|
||||
"""
|
||||
import re, sys, io, os
|
||||
|
||||
UI = 'composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui'
|
||||
UI = 'composeApp/src/commonMain/kotlin/mobi/giza/compose/ui'
|
||||
# {"padding": {"8": "compactPadding"}, "gap": {...}, "spacer": {...}, "*": {...}}
|
||||
# A shape-specific entry wins over "*". Shape matters because the same number means
|
||||
# different things in different positions: 8dp of padding is compactPadding, 8dp of gap
|
||||
@@ -131,11 +131,11 @@ def process(path):
|
||||
break
|
||||
lines.insert(idx + 1, 'import androidx.compose.material3.MaterialTheme')
|
||||
text = '\n'.join(lines)
|
||||
if 'import com.machankura.bennu.compose.ui.theme.spacing' not in text and \
|
||||
if 'import mobi.giza.compose.ui.theme.spacing' not in text and \
|
||||
not path.endswith('theme/Spacing.kt'):
|
||||
lines = text.split('\n')
|
||||
idx = max(i for i, l in enumerate(lines) if l.startswith('import '))
|
||||
lines.insert(idx + 1, 'import com.machankura.bennu.compose.ui.theme.spacing')
|
||||
lines.insert(idx + 1, 'import mobi.giza.compose.ui.theme.spacing')
|
||||
text = '\n'.join(lines)
|
||||
if not DRY:
|
||||
io.open(path, 'w', encoding='utf-8').write(text)
|
||||
|
||||
@@ -18,7 +18,7 @@ Usage: m3-spacing-positions.py [--list]
|
||||
"""
|
||||
import os, re, sys
|
||||
|
||||
UI = 'composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui'
|
||||
UI = 'composeApp/src/commonMain/kotlin/mobi/giza/compose/ui'
|
||||
THEME = os.path.join(UI, 'theme')
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Usage: m3-title-case.py [--list]
|
||||
"""
|
||||
import os, re, sys
|
||||
|
||||
UI = 'composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui'
|
||||
UI = 'composeApp/src/commonMain/kotlin/mobi/giza/compose/ui'
|
||||
CATALOGUE = 'composeApp/src/commonMain/composeResources/values/strings.xml'
|
||||
|
||||
SMALL = {'a', 'an', 'the', 'to', 'of', 'for', 'and', 'or', 'via',
|
||||
|
||||
@@ -18,7 +18,7 @@ Usage: m3-touch-targets.py [--list]
|
||||
"""
|
||||
import os, re, sys
|
||||
|
||||
UI = 'composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui'
|
||||
UI = 'composeApp/src/commonMain/kotlin/mobi/giza/compose/ui'
|
||||
|
||||
|
||||
def offenders():
|
||||
|
||||
Reference in new issue
Block a user