-
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
8 changed files
with
154 additions
and
22 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,20 +1,14 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/go | ||
{ | ||
"name": "Go", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"name": "Espresso", | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": {}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker": "latest", | ||
"ghcr.io/devcontainers/features/java": { | ||
"jdkDistro": "amzn", | ||
"version": "21" | ||
} | ||
}, | ||
"remoteEnv": { | ||
"ESPRESSO_DEBUG": "1" | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "curl -s 'https://get.sdkman.io' | bash && source ~/.bashrc" | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} | ||
} |
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,4 @@ | ||
FROM mcr.microsoft.com/devcontainers/go:1-1.22-bookworm AS builder | ||
|
||
# upgrade the container | ||
RUN apt-get update && apt-get upgrade -y |
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 @@ | ||
package project |
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,53 @@ | ||
package project | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
// SourceFIle represents a .java source file on the filesystem | ||
type SourceFile struct { | ||
Path string | ||
Content string | ||
} | ||
|
||
// readSourceFile reads the file at the given path, or returns an error | ||
func readSourceFile(path string) (*SourceFile, error) { | ||
return nil, nil | ||
} | ||
|
||
// IntrospectSourceFiles iterates over the project's base package looking for .java files | ||
// TODO: make this a goroutine? | ||
func DiscoverSourceFiles(cfg *ProjectConfig) ([]SourceFile, error) { | ||
// get the source path | ||
srcPath, err := GetSourcePath(cfg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// iterate recursively over child directories | ||
var files []SourceFile = []SourceFile{} | ||
err = filepath.Walk(*srcPath, func(path string, info fs.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !info.IsDir() && strings.HasSuffix(info.Name(), ".java") { | ||
text, err := os.ReadFile(path) | ||
if err != nil { | ||
return err | ||
} | ||
files = append(files, SourceFile{ | ||
Path: path, | ||
Content: string(text), | ||
}) | ||
} | ||
return nil | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return files, 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
This file was deleted.
Oops, something went wrong.