Skip to content

Commit 936c42a

Browse files
authored
Merge pull request #670 from hyoo-ru/mol-build-submodules
$mol_build submodules support
2 parents f9b50bf + 722a214 commit 936c42a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

build/build.node.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,21 @@ namespace $ {
618618

619619
return this.$.$mol_exec( path , 'git', ...args )
620620
}
621-
621+
622+
@ $mol_mem
623+
gitSubmoduleDirs() {
624+
const root = this.root().path()
625+
const output = this.$.$mol_exec( root , 'git', 'submodule', 'status', '--recursive' ).stdout.toString()
626+
627+
const dirs = output.trim()
628+
.split('\n')
629+
.map( str => str.match( /^\s*[^ ]+\s+([^ ]*).*/ )?.[1]?.trim() )
630+
.filter($mol_guard_defined)
631+
.map(str => `${root}/${str}`)
632+
633+
return new Set(dirs)
634+
}
635+
622636
@ $mol_mem_key
623637
modEnsure( path : string ) {
624638

@@ -646,6 +660,12 @@ namespace $ {
646660

647661
return false
648662
}
663+
664+
const is_submodule = this.gitSubmoduleDirs().has( mod.path() )
665+
if ( is_submodule ) {
666+
this.gitPull( mod.path() )
667+
return false
668+
}
649669

650670
for( let repo of mapping.select( 'pack' , mod.name() , 'git' ).kids ) {
651671

0 commit comments

Comments
 (0)