Skip to content

Commit

Permalink
Merge pull request #50 from HashLoad/development
Browse files Browse the repository at this point in the history
Adjusted internal update and messages
  • Loading branch information
snakeice authored Sep 1, 2019
2 parents e26018b + a35c15d commit ff6c60e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 17 deletions.
3 changes: 1 addition & 2 deletions consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const FileBplOrder = "bpl_order.txt"
const FileExtensionBpl = ".bpl"
const FileExtensionDcp = ".dcp"
const FileExtensionDpk = ".dpk"
const FileExtensionDproj = ".dproj"

const FilePackageLockOld = "boss.lock"
const FolderDependencies = "modules"
Expand Down Expand Up @@ -38,7 +37,7 @@ const XmlTagNamePropertyAttribute string = "Condition"
const XmlTagNamePropertyAttributeValue string = "'$(Base)'!=''"

const XmlTagNameLibraryPath string = "DCC_UnitSearchPath"
const Version string = "v3.0.0-alpha13"
const Version string = "v3.0.0"

const BossInternalDir = "internal."
const BossInternalDirOld = "{internal}"
Expand Down
5 changes: 3 additions & 2 deletions core/compiler/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func compile(dprojPath string, dep *models.Dependency, rootLock models.PackageLo

readFileStr += "\n@SET DCC_UnitSearchPath=%DCC_UnitSearchPath%;" + filepath.Join(env.GetModulesDir(), consts.DcuFolder) +
";" + filepath.Join(env.GetModulesDir(), consts.DcpFolder) //+ ";" + getNewPathsDep(dep, abs) + " "

readFileStr += "\n@SET PATH=%PATH%;" + filepath.Join(env.GetModulesDir(), consts.BplFolder) + ";"
for _, value := range []string{"Win32"} {
readFileStr += " \n msbuild \"" + project + "\" /p:Configuration=Debug " + getCompilerParameters(env.GetModulesDir(), dep, value)
Expand Down Expand Up @@ -90,7 +91,7 @@ func compile(dprojPath string, dep *models.Dependency, rootLock models.PackageLo
}
}

func getNewPathsDep(dep *models.Dependency, basePath string) string {
func _(dep *models.Dependency, basePath string) string {
if graphDep, err := loadOrderGraphDep(dep); err == nil {
var result = filepath.Join(env.GetModulesDir(), consts.DcpFolder) + ";"
for {
Expand Down Expand Up @@ -145,7 +146,7 @@ func getPaths(path string, basePath string) string {
return strings.Join(paths, ";") + ";"
}

func buildDCU_(path string) {
func buildDCU(path string) {
msg.Info(" Building %s", filepath.Base(path))
var unitScopes = "-NSWinapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web" +
";Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell"
Expand Down
1 change: 0 additions & 1 deletion core/gitWrapper/git_embedded.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func CloneCacheEmbedded(dep models.Dependency) *git.Repository {
}

func UpdateCacheEmbedded(dep models.Dependency) *git.Repository {
msg.Info("Updating dependency %s", dep.GetName())
storageCache := makeStorageCache(dep)
repository, err := git.Open(storageCache, memfs.New())
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion core/gitWrapper/git_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func CloneCacheNative(dep models.Dependency) *git2.Repository {
}

func UpdateCacheNative(dep models.Dependency) *git2.Repository {
msg.Info("Updating dependency %s", dep.GetName())
getWrapperFetch(dep)
return GetRepository(dep)
}
Expand Down
4 changes: 3 additions & 1 deletion core/installer/vsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ var updatedDependencies []string

func GetDependency(dep models.Dependency) {
if utils.Contains(updatedDependencies, dep.GetHashName()) {
msg.Debug("Using cached of %s", dep.Repository)
msg.Debug("Using cached of %s", dep.GetName())
return
} else {
msg.Info("Updating cache of dependency %s", dep.GetName())
}

updatedDependencies = append(updatedDependencies, dep.GetHashName())
Expand Down
2 changes: 1 addition & 1 deletion env/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Configuration struct {
path string
Key string `json:"id"`
Auth map[string]*Auth `json:"auth"`
PurgeTime int `json:"purgeAfter"`
PurgeTime int `json:"purge_after"`
InternalRefreshRate int `json:"internal_refresh_rate"`
LastPurge time.Time `json:"last_purge_cache"`
LastInternalUpdate time.Time `json:"last_internal_update"`
Expand Down
25 changes: 21 additions & 4 deletions setup/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package setup

import (
"github.com/hashload/boss/consts"
"github.com/hashload/boss/core/installer"
"github.com/hashload/boss/env"
"github.com/hashload/boss/models"
"github.com/hashload/boss/msg"
"github.com/hashload/boss/utils"
"os"
"path/filepath"
"time"
)

func incVersion() {
env.GlobalConfiguration.ConfigVersion++
func updateVersion(newVersion int64) {
env.GlobalConfiguration.ConfigVersion = newVersion
env.GlobalConfiguration.SaveConfiguration()
}

Expand All @@ -23,7 +25,7 @@ func executeUpdate(version int64, update func()) {
if needUpdate(version) {
msg.Debug("\t\tRunning update to version %d", version)
update()
incVersion()
updateVersion(version)
} else {
msg.Debug("\t\tUpdate to version %d already performed", version)
}
Expand All @@ -49,7 +51,22 @@ func migration() {
env.GlobalConfiguration.GitEmbedded = true
})

executeUpdate(4, func() {
executeUpdate(5, func() {
env.Internal = false
env.GlobalConfiguration.LastInternalUpdate = time.Now().AddDate(-1000, 0, 0)
modulesDir := filepath.Join(env.GetBossHome(), consts.FolderDependencies, env.HashDelphiPath())
if _, err := os.Stat(modulesDir); os.IsNotExist(err) {
return
}

err := os.Remove(filepath.Join(modulesDir, consts.FilePackageLock))
utils.HandleError(err)
modules, err := models.LoadPackage(false)
if err != nil {
return
}

installer.GlobalInstall([]string{}, modules, false)
env.Internal = true
})
}
7 changes: 3 additions & 4 deletions setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ func installModules(modules []string) {

installer.GlobalInstall(modules, pkg, false)
moveBptIdentifier()

}

func moveBptIdentifier() {
Expand Down Expand Up @@ -155,9 +154,9 @@ func initializeDelphiVersion() {
return
}

byRegisty := dcc32.GetDelphiPathsByRegisty()
if len(byRegisty) != 0 {
env.GlobalConfiguration.DelphiPath = byRegisty[len(byRegisty)-1]
byRegistry := dcc32.GetDelphiPathsByRegisty()
if len(byRegistry) != 0 {
env.GlobalConfiguration.DelphiPath = byRegistry[len(byRegistry)-1]
env.GlobalConfiguration.SaveConfiguration()
return
}
Expand Down
2 changes: 1 addition & 1 deletion utils/librarypath/globalUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func updateGlobalLibraryPath() {
utils.HandleError(err)
paths, _, err := delphiPlatform.GetStringValue(SearchPathRegistry)
if err != nil {
msg.Warn("Failed to update library path from platform %s with delphi %s", platform, ideVersion)
msg.Debug("Failed to update library path from platform %s with delphi %s", platform, ideVersion)
continue
}

Expand Down

0 comments on commit ff6c60e

Please sign in to comment.