-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
169 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
# Espresso | ||
*You wouldn't use a sledge hammer to hang a picture, would you?* | ||
# [espresso](https://atc.kerosenelabs.io) | ||
*You wouldn't use a sledgehammer to hang a picture frame, would you?* | ||
|
||
Espresso is a Java build tool for modern development. | ||
|
||
* **Simple:** Build for microservices and non-monoliths | ||
* **Portable:** Built with Go, it can compile for every platform | ||
|
||
## Features | ||
TODO | ||
|
||
## Getting Started | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package internal | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
// GenerateManifest generates a JVM manifest | ||
func GenerateManifest(cfg *ProjectConfig) string { | ||
base := "Manifest-Version: 1.0\n" | ||
base += "Main-Class: " + cfg.BasePackage + ".Main\n" | ||
base += "Created-By: Espresso" | ||
return base | ||
} | ||
|
||
// Write the Manifest to the build directory | ||
func WriteManifest(cfg *ProjectConfig) error { | ||
// get the path where it should live | ||
buildPath, err := GetBuildPath(cfg) | ||
path := *buildPath + "/MANIFEST.MF" | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// open the file | ||
file, err := os.Create(path) | ||
if err != nil { | ||
return err | ||
} | ||
defer file.Close() | ||
|
||
// write the file | ||
content := GenerateManifest(cfg) | ||
_, err = file.WriteString(content) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// PackageClasses creates a .jar of the given classes | ||
func PackageClasses(cfg *ProjectConfig) error { | ||
command := cfg.Toolchain.Path + "/bin/jar" | ||
args := []string{"cfm"} | ||
|
||
// handle jar output path | ||
if IsDebugMode() { | ||
args = append(args, "ESPRESSO_DEBUG/dist/dist.jar") | ||
} else { | ||
args = append(args, "dist/dist.jar") | ||
} | ||
|
||
// write the manifest, include it | ||
WriteManifest(cfg) | ||
if IsDebugMode() { | ||
args = append(args, "ESPRESSO_DEBUG/build/MANIFEST.MF") | ||
} else { | ||
args = append(args, "build/MANIFEST.MF") | ||
} | ||
|
||
// add the class directory | ||
if IsDebugMode() { | ||
args = append(args, "-C", "ESPRESSO_DEBUG/build") | ||
} else { | ||
args = append(args, "-C", "build") | ||
} | ||
args = append(args, ".") | ||
// run the command | ||
fmt.Printf("Running: %s %s\n", command, args) | ||
cmd := exec.Command(command, args...) | ||
output, err := cmd.Output() | ||
if err != nil { | ||
println(string(output)) | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters