Exemplo n.º 1
0
Arquivo: init.go Projeto: benlau/qpm
func (ic InitCommand) GenerateBoilerplate() error {

	module := struct {
		Package   *common.PackageWrapper
		PriFile   string
		QrcFile   string
		QrcPrefix string
	}{
		Package:   ic.Pkg,
		PriFile:   ic.Pkg.PriFile(),
		QrcFile:   ic.Pkg.QrcFile(),
		QrcPrefix: ic.Pkg.QrcPrefix(),
	}

	if err := core.WriteTemplate(module.PriFile, modulePri, module); err != nil {
		return err
	}
	if err := core.WriteTemplate(module.QrcFile, moduleQrc, module); err != nil {
		return err
	}
	if err := core.WriteTemplate("qmldir", qmldir, module); err != nil {
		return err
	}
	return nil
}
Exemplo n.º 2
0
// Generates a vendor.pri inside vendorDir using the information contained in the package file
// and the dependencies
func GenerateVendorPri(vendorDir string, pkg *common.PackageWrapper) error {
	depMap, err := common.LoadPackages(vendorDir)
	if err != nil {
		return err
	}

	var deps []*common.PackageWrapper
	for _, dep := range depMap {
		deps = append(deps, dep)
	}

	vendorPriFile := filepath.Join(vendorDir, core.Vendor+".pri")

	data := struct {
		VendorDir    string
		Package      *common.PackageWrapper
		Dependencies []*common.PackageWrapper
	}{
		vendorDir,
		pkg,
		deps,
	}

	return core.WriteTemplate(vendorPriFile, vendorPri, data)
}