Skip to content

Commit

Permalink
compiling works
Browse files Browse the repository at this point in the history
  • Loading branch information
hlafaille committed Sep 16, 2024
1 parent ccd8742 commit af88476
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package internal
import (
"fmt"
"os"
"sync"

"github.com/spf13/cobra"
"hlafaille.xyz/espresso/v0/toolchain"
)

// GetProjectCommand returns the pre-built Cobra Command 'project'
func GetProjectCommand() *cobra.Command {
var root = &cobra.Command{
Use: "project",
Expand All @@ -33,10 +34,16 @@ func GetProjectCommand() *cobra.Command {
fmt.Printf("Discovered %d source file(s)\n", len(files))

// run the compiler on each source file
var wg sync.WaitGroup
for _, value := range files {
println("Compiling: " + value.Path)
CompileSourceFile(cfg, &value)
wg.Add(1)
go func(f *SourceFile) {
defer wg.Done()
println("Compiling: " + f.Path)
CompileSourceFile(cfg, &value)
}(&value)
}
wg.Wait()

// package the project
println("Done")
Expand All @@ -53,7 +60,7 @@ func GetProjectCommand() *cobra.Command {
var basePackage, _ = cmd.Flags().GetString("package")

// ensure JAVA_HOME is set
javaHome, err := toolchain.GetJavaHome()
javaHome, err := GetJavaHome()
if err != nil {
fmt.Println("JAVA_HOME is not set, do you have Java installed?")
}
Expand Down Expand Up @@ -107,6 +114,7 @@ func GetProjectCommand() *cobra.Command {
return root
}

// GetDependencyCommand returns the pre build Cobra Command 'dependency'
func GetDependencyCommand() *cobra.Command {
var root = &cobra.Command{
Use: "dependency",
Expand Down

0 comments on commit af88476

Please sign in to comment.