-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$mol_build check mam submodule and do not init #727
base: master
Are you sure you want to change the base?
Changes from 5 commits
b67343a
d6edfd4
066a8c8
ffde329
baacb72
e9c60f8
5dec846
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,20 +50,49 @@ namespace $ { | |
return git_dir.exists() && git_dir.type() === 'dir' | ||
} | ||
|
||
@ $mol_mem | ||
protected submodules() { | ||
const dir = this.root().path() | ||
if (! this.is_git( dir ) ) return new Set<string>() | ||
|
||
const command = 'git submodule status --recursive' | ||
const output = this.$.$mol_run.spawn({ command, dir }).stdout.toString().trim() | ||
@ $mol_action | ||
protected submodule_dirs(opts: { dir: string, recursive?: boolean }) { | ||
const output = this.$.$mol_run.spawn({ | ||
command: ['git', 'submodule', 'status', ...( opts.recursive ? ['--recursive'] : [] ) ], | ||
dir: opts.dir, | ||
}).stdout.toString().trim() | ||
|
||
const dirs = output | ||
.split('\n') | ||
.map( str => str.match( /^\s*[^ ]+\s+([^ ]*).*/ )?.[1]?.trim() ) | ||
.filter($mol_guard_defined) | ||
|
||
return dirs | ||
} | ||
|
||
@ $mol_mem | ||
protected root_is_submodule() { | ||
const dir = this.root().path() | ||
if (this.is_git(dir)) return false | ||
|
||
const parent = this.root().parent().path() | ||
|
||
try { | ||
const dirs = this.submodule_dirs({ dir: parent }) | ||
|
||
return dirs.some(str => str && dir.endsWith('/' + str)) | ||
} catch (e) { | ||
if ($mol_promise_like(e)) $mol_fail_hidden(e) | ||
console.error(e) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А чего не $mol_fail_log? |
||
return false | ||
} | ||
} | ||
|
||
@ $mol_mem | ||
protected submodules() { | ||
const dir = this.root().path() | ||
if (! this.is_git( dir ) ) return new Set<string>() | ||
|
||
const dirs = this.submodule_dirs({ dir, recursive: true }) | ||
.map(str => `${dir}/${str}`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Есть же апишка для резолвинга путей, к чему тут ручное склеивание? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а зачем усложнять, тут же str - 100% кусок пути относительно dir There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. как то это все усложняет код с виду, тогда надо dir передавать не строкой, а объектом, либо в submodule_dirs mol_file.absolute вызывать либо вообще все на объекты переделывать, но мало где нужен именно $mol_file, со строкой проще отлаживать |
||
|
||
if (this.root_is_submodule()) dirs.push(dir) | ||
|
||
return new Set(dirs) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ namespace $ { | |
@ $mol_action | ||
protected update_safe(dir: string) { | ||
if (this.update_disabled) return false | ||
if ( this.$.$mol_env()['MOL_BUILD_VSC_UPDATE_DISABLE'] ) return false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вот так вот поотключают обновления, а потом мучаются с устаревшим кодом. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну с докером по-другому не сделать воспроизводимых билдов, а все хотят docker compose up и получить на другой машине такой же билд, пусть отключат для CI, если очень надо. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Зачем фронтенд каждый раз собирать из исходников? Один раз собрали, проверили, положили в контейнер и поднимай в докере этот снепшот хоть до скончания времён. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это не будет работать, если одну строчку надо поправить, конфиг какой-нить, а все новое прилетит |
||
|
||
try { | ||
return this.$.$mol_file.unwatched(() => this.update(dir), dir) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Грязная проверка, может случайно совпасть не с тем. лучше явно отрезолвить абсолютный путь.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а как?