build: fix buildpkg
This commit is contained in:
@@ -254,7 +254,7 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs
|
|||||||
cl.ParsePkgSyntax(ctx.prog, pkg.Types, pkg.Syntax)
|
cl.ParsePkgSyntax(ctx.prog, pkg.Types, pkg.Syntax)
|
||||||
pkg.ExportFile = ""
|
pkg.ExportFile = ""
|
||||||
case cl.PkgLinkIR, cl.PkgLinkExtern, cl.PkgPyModule:
|
case cl.PkgLinkIR, cl.PkgLinkExtern, cl.PkgPyModule:
|
||||||
if isPkgInLLGo(pkg.PkgPath) {
|
if len(pkg.GoFiles) > 0 {
|
||||||
buildPkg(ctx, aPkg, verbose)
|
buildPkg(ctx, aPkg, verbose)
|
||||||
pkg.ExportFile = " " + concatPkgLinkFiles(pkg, verbose) + " " + pkg.ExportFile
|
pkg.ExportFile = " " + concatPkgLinkFiles(pkg, verbose) + " " + pkg.ExportFile
|
||||||
} else {
|
} else {
|
||||||
@@ -648,22 +648,6 @@ func clFile(cFile, expFile string, procFile func(linkFile string), verbose bool)
|
|||||||
procFile(llFile)
|
procFile(llFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
llgoModPath = "github.com/goplus/llgo"
|
|
||||||
)
|
|
||||||
|
|
||||||
func isPkgInLLGo(pkgPath string) bool {
|
|
||||||
return isPkgInMod(pkgPath, llgoModPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isPkgInMod(pkgPath, modPath string) bool {
|
|
||||||
if strings.HasPrefix(pkgPath, modPath) {
|
|
||||||
suffix := pkgPath[len(modPath):]
|
|
||||||
return suffix == "" || suffix[0] == '/'
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func pkgExists(initial []*packages.Package, pkg *packages.Package) bool {
|
func pkgExists(initial []*packages.Package, pkg *packages.Package) bool {
|
||||||
for _, v := range initial {
|
for _, v := range initial {
|
||||||
if v == pkg {
|
if v == pkg {
|
||||||
|
|||||||
Reference in New Issue
Block a user