Skip to content

Commit

Permalink
feat(builders): improve autoconfiguration for gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
xizhao committed Mar 3, 2018
1 parent b954112 commit 6801f94
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion builders/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func runInDir(dir string, name string, arg ...string) (string, string, error) {
// Utilities for debug logging
func runLogged(logger *logging.Logger, dir string, name string, arg ...string) (string, string, error) {
cmd := strings.Join(append([]string{name}, arg...), " ")
logger.Debugf("Running `%s`...", cmd)
logger.Debugf("Running `%s` in dir `%s`...", cmd, dir)
stdout, stderr, err := runInDir(dir, name, arg...)
if err != nil {
logger.Debugf("Running `%s` failed: %#v %#v", cmd, err, stderr)
Expand Down
4 changes: 2 additions & 2 deletions builders/gradle.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (builder *GradleBuilder) DiscoverModules(dir string) ([]config.ModuleConfig
gradleTask := strings.Split(trimmed, " - ")[0]
gradleLogger.Debugf("found gradle dependencies task: %s", gradleTask)
moduleConfigurations = append(moduleConfigurations, config.ModuleConfig{
Name: strings.Split(gradleTask, ":")[0], // Name is the gradle task name
Name: strings.Split(gradleTask, ":")[0] + ":compile", // Name is the gradle task name + ":" + configuraiton (default to compile)
Path: "build.gradle",
Type: "gradle",
})
Expand All @@ -144,7 +144,7 @@ func (builder *GradleBuilder) DiscoverModules(dir string) ([]config.ModuleConfig
// Fall back to "app" as default task, even though technically it would be "" (root)
return []config.ModuleConfig{
config.ModuleConfig{
Name: "app",
Name: "app:compile",
Path: "build.gradle",
Type: "gradle",
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/fossa/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func makeAPIRequest(method, endpoint, apiKey string, payload []byte) ([]byte, er
defer resp.Body.Close()

if resp.StatusCode == http.StatusForbidden {
return nil, fmt.Errorf("invalid API key %#v (try setting $FOSSA_API_KEY)", apiKey)
return nil, fmt.Errorf("invalid API key %#v (try setting $FOSSA_API_KEY); get one at https://fossa.io", apiKey)
} else if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("bad server response: %d", resp.StatusCode)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/fossa/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func doUpload(conf config.CLIConfig, results []normalizedModule) (string, error)
responseStr := string(responseBytes)

if resp.StatusCode == http.StatusForbidden {
return "", fmt.Errorf("invalid API key (check the $FOSSA_API_KEY environment variable)")
return "", fmt.Errorf("invalid API key (check the $FOSSA_API_KEY environment variable); get one at https://fossa.io")
} else if resp.StatusCode == http.StatusPreconditionRequired {
// TODO: handle "Managed Project" workflow
return "", fmt.Errorf("invalid project or revision; make sure this version is published and FOSSA has access to your repo. To submit a custom project, set Fetcher to `custom` in `.fossa.yml`")
Expand Down

0 comments on commit 6801f94

Please sign in to comment.