Skip to content

Commit

Permalink
Merge pull request #293 from Bedrock-OSS/develop
Browse files Browse the repository at this point in the history
Update 1.4.1
  • Loading branch information
Nusiq authored Aug 27, 2024
2 parents cea0f11 + fd8b410 commit 624d9e7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions local_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go install -ldflags="-X main.commit=$(git rev-parse HEAD)" github.com/Bedrock-OSS/regolith
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,23 @@ func main() {
eval.Init()

// Root command
versionTitle := "Regolith "
if buildSource != "DEV" {
versionTitle += version
} else {
versionTitle += "Dev Build"
}
if commit != "" {
versionTitle += " (#" + commit[0:7]
if date != "" {
versionTitle += " built at " + date
}
versionTitle += ")"
}
var rootCmd = &cobra.Command{
Use: "regolith",
Short: "Addon Compiler for the Bedrock Edition of Minecraft",
Long: regolithDesc,
Long: versionTitle + regolithDesc,
Version: version,
}
subcommands := make([]*cobra.Command, 0)
Expand Down
2 changes: 1 addition & 1 deletion regolith/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func ExportProject(ctx RunContext) error {
var exportedFilterNames []string
for filter := range profile.Filters {
filter := profile.Filters[filter]
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath)
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath, ctx)
if err != nil {
return burrito.WrapErrorf(
err,
Expand Down
4 changes: 2 additions & 2 deletions regolith/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ type FilterRunner interface {

// IsUsingDataExport returns whether the filter wants its data to be
// exported back to the data folder after running the profile.
IsUsingDataExport(dotRegolithPath string) (bool, error)
IsUsingDataExport(dotRegolithPath string, ctx RunContext) (bool, error)
}

func (f *Filter) CopyArguments(parent *RemoteFilter) {
Expand Down Expand Up @@ -256,7 +256,7 @@ func (f *Filter) IsDisabled(ctx RunContext) (bool, error) {
return false, nil
}

func (f *Filter) IsUsingDataExport(_ string) (bool, error) {
func (f *Filter) IsUsingDataExport(_ string, _ RunContext) (bool, error) {
return false, nil
}

Expand Down
18 changes: 18 additions & 0 deletions regolith/filter_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,21 @@ func (f *ProfileFilter) Check(context RunContext) error {
profile, f.Profile, *context.Config, &context,
context.DotRegolithPath)
}

func (f *ProfileFilter) IsUsingDataExport(dotRegolithPath string, ctx RunContext) (bool, error) {
profile := ctx.Config.Profiles[f.Profile]
for filter := range profile.Filters {
filter := profile.Filters[filter]
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath, ctx)
if err != nil {
return false, burrito.WrapErrorf(
err,
"Failed to check if profile is using data export.\n"+
"Profile: %s", f.Profile)
}
if usingDataPath {
return true, nil
}
}
return false, nil
}
2 changes: 1 addition & 1 deletion regolith/filter_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (f *RemoteFilter) GetCachedVersion(dotRegolithPath string) (*string, error)
return &version, nil
}

func (f *RemoteFilter) IsUsingDataExport(dotRegolithPath string) (bool, error) {
func (f *RemoteFilter) IsUsingDataExport(dotRegolithPath string, _ RunContext) (bool, error) {
// Load the filter.json file
filterJsonPath := filepath.Join(f.GetDownloadPath(dotRegolithPath), "filter.json")
file, err := os.ReadFile(filterJsonPath)
Expand Down

0 comments on commit 624d9e7

Please sign in to comment.