本文整理汇总了Golang中github.com/bitrise-io/go-utils/log.Detail函数的典型用法代码示例。如果您正苦于以下问题:Golang Detail函数的具体用法?Golang Detail怎么用?Golang Detail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Detail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- GradleFile: %s", configs.GradleFile)
log.Detail("- UnitTestTasks: %s", configs.UnitTestTasks)
log.Detail("- GradlewPath: %s", configs.GradlewPath)
log.Detail("- UnitTestFlags: %s", configs.UnitTestFlags)
log.Detail("- DeployDir: %s", configs.DeployDir)
}
示例2: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- CarthageCommand: %s", configs.CarthageCommand)
log.Detail("- CarthageOptions: %s", configs.CarthageOptions)
log.Detail("- GithubAccessToken: %s", configs.GithubAccessToken)
fmt.Println()
}
示例3: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Nunit Configs:")
log.Detail("- CustomOptions: %s", configs.CustomOptions)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
示例4: runXcodeBuildCmd
func runXcodeBuildCmd(useStdOut bool, args ...string) (string, int, error) {
// command
buildCmd := cmd.CreateXcodebuildCmd(args...)
// output buffer
var outBuffer bytes.Buffer
// additional output writers, like StdOut
outWritters := []io.Writer{}
if useStdOut {
outWritters = append(outWritters, os.Stdout)
}
// unify as a single writer
outWritter := cmd.CreateBufferedWriter(&outBuffer, outWritters...)
// and set the writer
buildCmd.Stdin = nil
buildCmd.Stdout = outWritter
buildCmd.Stderr = outWritter
buildCmd.Env = append(os.Environ(), xcodeCommandEnvs...)
cmdArgsForPrint := cmd.PrintableCommandArgsWithEnvs(buildCmd.Args, xcodeCommandEnvs)
log.Detail("$ %s", cmdArgsForPrint)
err := buildCmd.Run()
if err != nil {
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus, ok := exitError.Sys().(syscall.WaitStatus)
if !ok {
return outBuffer.String(), 1, errors.New("Failed to cast exit status")
}
return outBuffer.String(), waitStatus.ExitStatus(), err
}
return outBuffer.String(), 1, err
}
return outBuffer.String(), 0, nil
}
示例5: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- JSONKeyPath: %s", secureInput(configs.JSONKeyPath))
log.Detail("- PackageName: %s", configs.PackageName)
log.Detail("- ApkPath: %s", configs.ApkPath)
log.Detail("- Track: %s", configs.Track)
log.Detail("- UserFraction: %s", configs.UserFraction)
log.Detail("- WhatsnewsDir: %s", configs.WhatsnewsDir)
log.Info("Deprecated Configs:")
log.Detail("- ServiceAccountEmail: %s", secureInput(configs.ServiceAccountEmail))
log.Detail("- P12KeyPath: %s", secureInput(configs.P12KeyPath))
}
示例6: print
func (configs ConfigsModel) print() {
fmt.Println()
log.Info("Configs:")
log.Detail(" - CertificateURL: %s", secureInput(configs.CertificateURL))
log.Detail(" - CertificatePassphrase: %s", secureInput(configs.CertificatePassphrase))
log.Detail(" - ProvisioningProfileURL: %s", secureInput(configs.ProvisioningProfileURL))
log.Detail(" - DefaultCertificateURL: %s", secureInput(configs.DefaultCertificateURL))
log.Detail(" - DefaultCertificatePassphrase: %s", secureInput(configs.DefaultCertificatePassphrase))
log.Detail(" - DefaultProvisioningProfileURL: %s", secureInput(configs.DefaultProvisioningProfileURL))
log.Detail(" - KeychainPath: %s", configs.KeychainPath)
log.Detail(" - KeychainPassword: %s", secureInput(configs.KeychainPassword))
}
示例7: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Xamarin UITest Configs:")
log.Detail("- TestToRun: %s", configs.TestToRun)
log.Detail("- SimulatorDevice: %s", configs.SimulatorDevice)
log.Detail("- SimulatorOsVersion: %s", configs.SimulatorOsVersion)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
示例8: BootSimulator
// BootSimulator ...
func BootSimulator(simulator models.SimInfoModel, xcodebuildVersion models.XcodebuildVersionModel) error {
simulatorApp := "Simulator"
if xcodebuildVersion.MajorVersion == 6 {
simulatorApp = "iOS Simulator"
}
xcodeDevDirPth, err := getXcodeDeveloperDirPath()
if err != nil {
return fmt.Errorf("Failed to get Xcode Developer Directory - most likely Xcode.app is not installed")
}
simulatorAppFullPath := filepath.Join(xcodeDevDirPth, "Applications", simulatorApp+".app")
openCmd := exec.Command("open", simulatorAppFullPath, "--args", "-CurrentDeviceUDID", simulator.SimID)
log.Detail("$ %s", cmd.PrintableCommandArgs(openCmd.Args))
out, err := openCmd.CombinedOutput()
outStr := string(out)
if err != nil {
return fmt.Errorf("failed to start simulators (%s), output: %s, error: %s", simulator.SimID, outStr, err)
}
return nil
}
示例9: runPrettyXcodeBuildCmd
func runPrettyXcodeBuildCmd(useStdOut bool, xcprettyArgs []string, xcodebuildArgs []string) (string, int, error) {
//
buildCmd := cmd.CreateXcodebuildCmd(xcodebuildArgs...)
prettyCmd := cmd.CreateXcprettyCmd(xcprettyArgs...)
//
var buildOutBuffer bytes.Buffer
//
pipeReader, pipeWriter := io.Pipe()
//
// build outputs:
// - write it into a buffer
// - write it into the pipe, which will be fed into xcpretty
buildOutWriters := []io.Writer{pipeWriter}
buildOutWriter := cmd.CreateBufferedWriter(&buildOutBuffer, buildOutWriters...)
//
var prettyOutWriter io.Writer
if useStdOut {
prettyOutWriter = os.Stdout
}
// and set the writers
buildCmd.Stdin = nil
buildCmd.Stdout = buildOutWriter
buildCmd.Stderr = buildOutWriter
//
prettyCmd.Stdin = pipeReader
prettyCmd.Stdout = prettyOutWriter
prettyCmd.Stderr = prettyOutWriter
//
buildCmd.Env = append(os.Environ(), xcodeCommandEnvs...)
log.Detail("$ set -o pipefail && %s | %v",
cmd.PrintableCommandArgsWithEnvs(buildCmd.Args, xcodeCommandEnvs),
cmd.PrintableCommandArgs(prettyCmd.Args))
fmt.Println()
if err := buildCmd.Start(); err != nil {
return buildOutBuffer.String(), 1, err
}
if err := prettyCmd.Start(); err != nil {
return buildOutBuffer.String(), 1, err
}
defer func() {
if err := pipeWriter.Close(); err != nil {
log.Warn("Failed to close xcodebuild-xcpretty pipe, error: %s", err)
}
if err := prettyCmd.Wait(); err != nil {
log.Warn("xcpretty command failed, error: %s", err)
}
}()
if err := buildCmd.Wait(); err != nil {
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus, ok := exitError.Sys().(syscall.WaitStatus)
if !ok {
return buildOutBuffer.String(), 1, errors.New("Failed to cast exit status")
}
return buildOutBuffer.String(), waitStatus.ExitStatus(), err
}
return buildOutBuffer.String(), 1, err
}
return buildOutBuffer.String(), 0, nil
}
示例10: main
//.........这里部分代码省略.........
// Artifacts
resultLog := ""
for testProjectName, testProjectOutput := range testProjectOutputMap {
if len(testProjectOutput.ReferredProjectNames) == 0 {
log.Warn("Test project (%s) does not refers to any project, skipping...", testProjectName)
continue
}
for _, projectName := range testProjectOutput.ReferredProjectNames {
projectOutput, ok := projectOutputMap[projectName]
if !ok {
continue
}
appPth := ""
for _, output := range projectOutput.Outputs {
if output.OutputType == constants.OutputTypeAPP {
appPth = output.Pth
}
}
if appPth == "" {
log.Error("No app generated for project: %s", projectName)
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
os.Exit(1)
}
// Set APP_BUNDLE_PATH env to let the test know which .app file should be tested
// This env is used in the Xamarin.UITest project to refer to the .app path
if err := os.Setenv("APP_BUNDLE_PATH", appPth); err != nil {
log.Error("Failed to set APP_BUNDLE_PATH environment, without this env test will fail, error: %s", err)
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
os.Exit(1)
}
// Run test
fmt.Println()
log.Info("Testing (%s) against (%s)", testProjectName, projectName)
log.Detail("test dll: %s", testProjectOutput.Output.Pth)
log.Detail("app: %s", appPth)
nunitConsole.SetDLLPth(testProjectOutput.Output.Pth)
nunitConsole.SetTestToRun(configs.TestToRun)
fmt.Println()
log.Info("Running Xamarin UITest")
log.Done("$ %s", nunitConsole.PrintableCommand())
fmt.Println()
err := nunitConsole.Run()
testLog, readErr := testResultLogContent(resultLogPth)
if readErr != nil {
log.Warn("Failed to read test result, error: %s", readErr)
}
resultLog = testLog
if err != nil {
log.Error("Test failed, error: %s", err)
if errorMsg, err := parseErrorFromResultLog(resultLog); err != nil {
log.Warn("Failed to parse error message from result log, error: %s", err)
} else if errorMsg != "" {
log.Error("%s", errorMsg)
}
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
if resultLog != "" {
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", resultLog); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", err)
}
}
os.Exit(1)
}
}
}
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "succeeded"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
if resultLog != "" {
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", resultLog); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", err)
}
}
}
示例11: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
fmt.Println()
log.Error("Issue with input: %s", err)
os.Exit(1)
}
//
// Create client
fmt.Println()
log.Info("Authenticateing")
jwtConfig := new(jwt.Config)
if configs.JSONKeyPath != "" {
jsonKeyPth := ""
if strings.HasPrefix(configs.JSONKeyPath, "file://") {
jsonKeyPth = strings.TrimPrefix(configs.JSONKeyPath, "file://")
} else {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__google-play-deploy__")
if err != nil {
log.Error("Failed to create tmp dir, error: %s", err)
os.Exit(1)
}
jsonKeyPth = filepath.Join(tmpDir, "key.json")
if err := downloadFile(configs.JSONKeyPath, jsonKeyPth); err != nil {
log.Error("Failed to download json key file, error: %s", err)
os.Exit(1)
}
}
authConfig, err := jwtConfigFromJSONKeyFile(jsonKeyPth)
if err != nil {
log.Error("Failed to create auth config from json key file, error: %s", err)
os.Exit(1)
}
jwtConfig = authConfig
} else {
p12KeyPath := ""
if strings.HasPrefix(configs.P12KeyPath, "file://") {
p12KeyPath = strings.TrimPrefix(configs.P12KeyPath, "file://")
} else {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__google-play-deploy__")
if err != nil {
log.Error("Failed to create tmp dir, error: %s", err)
os.Exit(1)
}
p12KeyPath = filepath.Join(tmpDir, "key.p12")
if err := downloadFile(configs.P12KeyPath, p12KeyPath); err != nil {
log.Error("Failed to download p12 key file, error: %s", err)
os.Exit(1)
}
}
authConfig, err := jwtConfigFromP12KeyFile(p12KeyPath, configs.ServiceAccountEmail)
if err != nil {
log.Error("Failed to create auth config from p12 key file, error: %s", err)
os.Exit(1)
}
jwtConfig = authConfig
}
client := jwtConfig.Client(oauth2.NoContext)
service, err := androidpublisher.New(client)
if err != nil {
log.Error("Failed to create publisher service, error: %s", err)
os.Exit(1)
}
log.Done("Authenticated client created")
// ---
//
// Create insert edit
fmt.Println()
log.Info("Create new edit")
editsService := androidpublisher.NewEditsService(service)
editsInsertCall := editsService.Insert(configs.PackageName, nil)
appEdit, err := editsInsertCall.Do()
if err != nil {
log.Error("Failed to perform edit insert call, error: %s", err)
os.Exit(1)
}
log.Detail(" editID: %s", appEdit.Id)
//.........这里部分代码省略.........
示例12: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Xamarin Test Cloud Configs:")
log.Detail("- User: %s", configs.User)
log.Detail("- APIKey: %s", configs.APIKey)
log.Detail("- Devices: %s", configs.Devices)
log.Detail("- IsAsync: %s", configs.IsAsync)
log.Detail("- Series: %s", configs.Series)
log.Detail("- Parallelization: %s", configs.Parallelization)
log.Detail("- CustomOptions: %s", configs.CustomOptions)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
示例13: print
func (configs ConfigsModel) print() {
fmt.Println()
log.Info("Project Parameters:")
log.Detail("- ProjectPath: %s", configs.ProjectPath)
log.Detail("- Scheme: %s", configs.Scheme)
fmt.Println()
log.Info("Simulator Configs:")
log.Detail("- SimulatorPlatform: %s", configs.SimulatorPlatform)
log.Detail("- SimulatorDevice: %s", configs.SimulatorDevice)
log.Detail("- SimulatorOsVersion: %s", configs.SimulatorOsVersion)
fmt.Println()
log.Info("Test Run Configs:")
log.Detail("- OutputTool: %s", configs.OutputTool)
log.Detail("- IsCleanBuild: %s", configs.IsCleanBuild)
log.Detail("- IsSingleBuild: %s", configs.IsSingleBuild)
log.Detail("- ShouldBuildBeforeTest: %s", configs.ShouldBuildBeforeTest)
log.Detail("- ShouldRetryTestOnFail: %s", configs.ShouldRetryTestOnFail)
log.Detail("- GenerateCodeCoverageFiles: %s", configs.GenerateCodeCoverageFiles)
log.Detail("- ExportUITestArtifacts: %s", configs.ExportUITestArtifacts)
log.Detail("- TestOptions: %s", configs.TestOptions)
log.Detail("- XcprettyTestOptions: %s", configs.XcprettyTestOptions)
log.Detail("- WaitForSimulatorBoot: %s", configs.WaitForSimulatorBoot)
}
示例14: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
fail("Issue with input: %s", err)
}
customOptions := []string{}
if configs.CarthageOptions != "" {
options, err := shellquote.Split(configs.CarthageOptions)
if err != nil {
fail("Failed to shell split CarthageOptions (%s), error: %s", configs.CarthageOptions)
}
customOptions = options
}
//
// Exit if bootstrap is cached
log.Info("Check if cache is available")
hasCachedItems, err := isCacheAvailable(configs.SourceDir)
if err != nil {
fail("Failed to check cached files, error: %s", err)
}
log.Detail("has cahched items: %v", hasCachedItems)
if configs.CarthageCommand == "bootstrap" && hasCachedItems {
log.Done("Using cached dependencies for bootstrap command. If you would like to force update your dependencies, select `update` as CarthageCommand and re-run your build.")
os.Exit(0)
}
fmt.Println()
// ---
//
// Run carthage command
log.Info("Running Carthage command")
args := append([]string{configs.CarthageCommand}, customOptions...)
cmd := cmdex.NewCommand("carthage", args...)
if configs.GithubAccessToken != "" {
log.Detail("Appending GITHUB_ACCESS_TOKEN to process environments")
cmd.AppendEnvs([]string{fmt.Sprintf("GITHUB_ACCESS_TOKEN=%s", configs.GithubAccessToken)})
}
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Done("$ %s", cmdex.PrintableCommandArgs(false, cmd.GetCmd().Args))
fmt.Println()
if err := cmd.Run(); err != nil {
fail("Carthage command failed, error: %s", err)
}
// ---
//
// Create cache
if configs.CarthageCommand == "bootstrap" {
fmt.Println()
log.Info("Creating cache")
cacheFilePth := filepath.Join(configs.SourceDir, carthageDirName, cacheFileName)
swiftVersion, err := swiftVersion()
if err != nil {
fail("Failed to get swift version, error: %s", err)
}
resolvedFilePath := filepath.Join(configs.SourceDir, resolvedFileName)
resolved, err := contentsOfCartfileResolved(resolvedFilePath)
if err != nil {
fail("Failed to get resolved file content, error: %s", err)
}
cacheContent := fmt.Sprintf("--Swift version: %s --Swift version \n --%s: %s --%s", swiftVersion, resolvedFileName, resolved, resolvedFileName)
carthageDir := filepath.Join(configs.SourceDir, carthageDirName)
if exist, err := pathutil.IsPathExists(carthageDir); err != nil {
fail("Failed to check if dir exists at (%s), error: %s", carthageDir, err)
} else if !exist {
if err := os.Mkdir(carthageDir, 0777); err != nil {
fail("Failed to create dir (%s), error: %s", carthageDir, err)
}
}
if err := fileutil.WriteStringToFile(cacheFilePth, cacheContent); err != nil {
fail("Failed to write cahe file, error: %s", err)
}
log.Done("Cachefile: %s", cacheFilePth)
}
// ---
}
示例15: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
registerFail("Issue with input: %s", err)
}
//
// Determining calabash-android version
fmt.Println()
log.Info("Determining calabash-android version...")
rubyCommand, err := rubycmd.NewRubyCommandModel()
if err != nil {
registerFail("Failed to create ruby command, err: %s", err)
}
calabashAndroidVersion := ""
useBundler := false
if configs.GemFilePath != "" {
if exist, err := pathutil.IsPathExists(configs.GemFilePath); err != nil {
registerFail("Failed to check if Gemfile exists at (%s) exist, error: %s", configs.GemFilePath, err)
} else if exist {
log.Detail("Gemfile exists at: %s", configs.GemFilePath)
gemfileDir := filepath.Dir(configs.GemFilePath)
gemfileLockPth := filepath.Join(gemfileDir, "Gemfile.lock")
if exist, err := pathutil.IsPathExists(gemfileLockPth); err != nil {
registerFail("Failed to check if Gemfile.lock exists at (%s), error: %s", gemfileLockPth, err)
} else if exist {
log.Detail("Gemfile.lock exists at: %s", gemfileLockPth)
version, err := calabashAndroidVersionFromGemfileLock(gemfileLockPth)
if err != nil {
registerFail("Failed to get calabash-android version from Gemfile.lock, error: %s", err)
}
log.Detail("calabash-android version in Gemfile.lock: %s", version)
calabashAndroidVersion = version
useBundler = true
} else {
log.Warn("Gemfile.lock doest no find with calabash-android gem at: %s", gemfileLockPth)
}
} else {
log.Warn("Gemfile doest no find with calabash-android gem at: %s", configs.GemFilePath)
}
}
if configs.CalabashAndroidVersion != "" {
log.Detail("calabash-android version in configs: %s", configs.CalabashAndroidVersion)
calabashAndroidVersion = configs.CalabashAndroidVersion
useBundler = false
}
if calabashAndroidVersion == "" {
log.Done("using calabash-android latest version")
} else {
log.Done("using calabash-android version: %s", calabashAndroidVersion)
}
// ---
//
// Intsalling calabash-android gem
fmt.Println()
log.Info("Installing calabash-android gem...")
calabashAndroidArgs := []string{}
// If Gemfile given with calabash-android and calabash_android_version input does not override calabash-android version
// Run `bundle install`
// Run calabash-android with `bundle exec`
if useBundler {
bundleInstallArgs := []string{"bundle", "install", "--jobs", "20", "--retry", "5"}
// bundle install
bundleInstallCmd, err := rubyCommand.Command(false, bundleInstallArgs)
if err != nil {
registerFail("Failed to create command, error: %s", err)
}
bundleInstallCmd.AppendEnvs([]string{"BUNDLE_GEMFILE=" + configs.GemFilePath})
log.Detail("$ %s", cmdex.PrintableCommandArgs(false, bundleInstallArgs))
if err := bundleInstallCmd.Run(); err != nil {
registerFail("bundle install failed, error: %s", err)
}
// ---
calabashAndroidArgs = []string{"bundle", "exec"}
}
calabashAndroidArgs = append(calabashAndroidArgs, "calabash-android")
//.........这里部分代码省略.........