Skip to content

Commit b9f7b8d

Browse files
committed
Prepare for Maven support
Issue spring-iogh-11
1 parent 120fd85 commit b9f7b8d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/partial-build-extension.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ module.exports.register = function ({ config = {} }) {
2222
if (!version) {
2323
const { rawgitUrl = 'https://raw.githubusercontent.com' } = config
2424
const repositoryPath = await getRepositoryPath(this.require('isomorphic-git'), playbook.dir)
25-
const propertiesUrl = `${rawgitUrl}/${repositoryPath}/${refname}/gradle.properties`
26-
version = await download(get, propertiesUrl).then((contents) => extractVersion(contents, refname))
25+
const baseUrl = `${rawgitUrl}/${repositoryPath}/${refname}`
26+
version = await getGradleVersion(get, baseUrl, refname)
2727
}
2828
if (isBranch && version.endsWith('-SNAPSHOT')) version = version.slice(0, -9)
2929
const versionsInManifest = Object.values(siteManifestData.components)[0].versions
@@ -53,7 +53,12 @@ function download (get, url) {
5353
)
5454
}
5555

56-
function extractVersion (contents, fallback) {
56+
function getGradleVersion (get, baseUrl, refname) {
57+
const gradlePropertiesUrl = `${baseUrl}/gradle.properties`
58+
return download(get, gradlePropertiesUrl).then((contents) => extractGradleVersion(contents, refname))
59+
}
60+
61+
function extractGradleVersion (contents, fallback) {
5762
for (const line of (contents.toString().trimEnd() + `\nversion=${fallback}`).split('\n')) {
5863
if (line.startsWith('version=')) return line.slice(8)
5964
}

0 commit comments

Comments
 (0)