Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…dle-dependency-submission into online-photo-submission-main
  • Loading branch information
mikepenz committed Jul 14, 2023
2 parents 17b7613 + 701b0df commit d30d8e8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
34 changes: 24 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gradle-dependency-submission",
"version": "0.8.2",
"version": "v1.0.1",
"private": true,
"description": "Gradle Dependency Submission",
"main": "lib/main.js",
Expand Down
26 changes: 19 additions & 7 deletions src/gradle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function singlePropertySupport(useGradlew: boolean, gradleProjectPa
return true
} else {
core.warning(
`The current gradle version does not support retrieving a single property. Found version: ${version}. At least required: 7.5.0`
`The current gradle version does not support retrieving a single property. Found version: ${version}.`
)
return false
}
Expand Down Expand Up @@ -156,14 +156,19 @@ async function retrieveGradleProperty(
gradleBuildModule: string,
property: string
): Promise<string | undefined> {
if (!(await singlePropertySupport(useGradlew, gradleProjectPath))) {
return undefined
}
const singlePropertySupported = await singlePropertySupport(useGradlew, gradleProjectPath)

const command = retrieveGradleCLI(useGradlew)
const module = verifyModule(gradleBuildModule)

const propertyOutput = await exec.getExecOutput(command, [`${module}:properties`, '-q', '--property', property], {
let commandArgs = []
if (singlePropertySupported) {
commandArgs = [`${module}:properties`, '-q', '--property', property]
} else {
commandArgs = [`${module}:properties`, '-q']
}

const propertyOutput = await exec.getExecOutput(command, commandArgs, {
cwd: gradleProjectPath,
silent: !core.isDebug(),
ignoreReturnCode: true
Expand All @@ -175,9 +180,16 @@ async function retrieveGradleProperty(
}

const output = propertyOutput.stdout
const matched = output.match(new RegExp(`[\\S\\s]*?(${property}: )(.+)\n`))

if (matched != null) {
let matched = null

if (singlePropertySupported) {
matched = output.match(new RegExp(`[\\S\\s]*?(${property}: )(.+)\n`))
} else {
matched = output.split('\n').map(it => it.match(new RegExp(`[\\S\\s]*?(${property}: )(.+)`))).find(it=>it !== null)
}

if (matched !== null && matched !== undefined) {
return matched[2]
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function run(): Promise<void> {
{
name: 'mikepenz/gradle-dependency-submission',
url: 'https://github.com/mikepenz/gradle-dependency-submission',
version: '0.8.2'
version: 'v1.0.1'
},
github.context,
{
Expand Down

0 comments on commit d30d8e8

Please sign in to comment.