diff options
author | Nick Anthony <nickanthony@google.com> | 2020-08-11 14:01:57 +0000 |
---|---|---|
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-08-12 19:07:18 +0000 |
commit | 13294d9e89e9db02892c1d9c4d9ce7029577eded (patch) | |
tree | 583e513d58127ca0276b2ea2112c98d2a097bfbf | |
parent | 8d168616a228d1a6cb76664d89a045cbc6db8530 (diff) | |
download | support-13294d9e89e9db02892c1d9c4d9ce7029577eded.tar.gz |
resolve Coastguard cherrypick merge conflict for change: 1395824 (originally aosp/1226615)
Test: gw bOS
Change-Id: Ie377f824f4e5354bfc2ada3f0804f65e02be4a53
(cherry picked from commit 0edde20aee18ba24dbcabd43b6e8b8e88e99efb7)
-rw-r--r-- | buildSrc/src/main/kotlin/androidx/build/CreateLibraryBuildInfoFileTask.kt | 5 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/androidx/build/gitclient/GitClient.kt | 20 |
2 files changed, 18 insertions, 7 deletions
diff --git a/buildSrc/src/main/kotlin/androidx/build/CreateLibraryBuildInfoFileTask.kt b/buildSrc/src/main/kotlin/androidx/build/CreateLibraryBuildInfoFileTask.kt index 676de5786c6..47f9f64b4b4 100644 --- a/buildSrc/src/main/kotlin/androidx/build/CreateLibraryBuildInfoFileTask.kt +++ b/buildSrc/src/main/kotlin/androidx/build/CreateLibraryBuildInfoFileTask.kt @@ -72,14 +72,15 @@ open class CreateLibraryBuildInfoFileTask : DefaultTask() { * of the build that is released. Thus, we use frameworks/support to get the sha */ private fun getFrameworksSupportCommitShaAtHead(): String { - val commitList: List<Commit> = GitClientImpl(project.rootDir).getGitLog( + val supportRoot = getSupportRoot(project) + val commitList: List<Commit> = GitClientImpl(supportRoot, logger).getGitLog( GitCommitRange( fromExclusive = "", untilInclusive = "HEAD", n = 1 ), keepMerges = true, - fullProjectDir = getSupportRoot(project) + fullProjectDir = supportRoot ) return commitList.first().sha } diff --git a/buildSrc/src/main/kotlin/androidx/build/gitclient/GitClient.kt b/buildSrc/src/main/kotlin/androidx/build/gitclient/GitClient.kt index bcb3f4253ba..157aeaec920 100644 --- a/buildSrc/src/main/kotlin/androidx/build/gitclient/GitClient.kt +++ b/buildSrc/src/main/kotlin/androidx/build/gitclient/GitClient.kt @@ -151,6 +151,7 @@ class GitClientImpl( val bodyDelimiter: String = "_Body:" val localProjectDir: String = fullProjectDir.toString() .removePrefix(gitRoot.toString()) + val relativeProjectDir: String = fullProjectDir.relativeTo(workingDir).toString() var gitLogOptions: String = "--pretty=format:$commitStartDelimiter%n" + @@ -168,10 +169,10 @@ class GitClientImpl( if (gitCommitRange.fromExclusive != "") { gitLogCmd = "$GIT_LOG_CMD_PREFIX $gitLogOptions " + "${gitCommitRange.fromExclusive}..${gitCommitRange.untilInclusive}" + - " -- $fullProjectDir" + " -- ./$relativeProjectDir" } else { gitLogCmd = "$GIT_LOG_CMD_PREFIX $gitLogOptions ${gitCommitRange.untilInclusive} -n " + - "${gitCommitRange.n} -- $fullProjectDir" + "${gitCommitRange.n} -- ./$relativeProjectDir" } val gitLogString: String = commandRunner.execute(gitLogCmd) return parseCommitLogString( @@ -198,12 +199,21 @@ class GitClientImpl( .start() proc.waitFor(1, TimeUnit.MINUTES) - val response = proc + val stdout = proc .inputStream .bufferedReader() .readText() - logger?.info("Response: $response") - return response + val stderr = proc + .errorStream + .bufferedReader() + .readText() + val message = stdout + stderr + if (stderr != "") { + logger?.error("Response: $message") + } else { + logger?.info("Response: $message") + } + return stdout } override fun executeAndParse(command: String): List<String> { val response = execute(command) |