Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Studio Chipmunk injected property breaks mirakle executeOnRemote #121

Open
jt416 opened this issue Aug 4, 2022 · 11 comments
Open

Comments

@jt416
Copy link

jt416 commented Aug 4, 2022

My Android studio is passing this property (note the spaces):

--project-prop
"android.injected.studio.version=2021.2.1 Patch 1"

Same behavior with Mirakle 1.5.1 and 1.5.2:

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'Patch' not found in root project 'example'.

  • Try:

Run gradlew tasks to get a list of available tasks.
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 1s

@jt416
Copy link
Author

jt416 commented Aug 4, 2022

Have a workaround (though I'm sure there is a more elegant way to do it):

taskGraph.whenReady { taskGraph ->
    if (taskGraph.hasTask(":executeOnRemote")) {
        gradle.rootProject.executeOnRemote.doFirst {
            def newArgs = rootProject.executeOnRemote.args.collect {
                it.startsWith('"android.injected') ? it.replace(" ", "") : it
            }
            println("============ORIG REMOTE GRADLE ARGUMENTS===============")
            println(rootProject.executeOnRemote.args.drop(2).join("\n"))
            println("============MOD REMOTE GRADLE ARGUMENTS===============")
            println(newArgs.drop(2).join("\n"))
            println("============REMOTE GRADLE ARGUMENTS===============")
            rootProject.executeOnRemote.args = newArgs
        }
    }
}

@skrugly
Copy link
Owner

skrugly commented Aug 5, 2022

Could you check please io.github.adambl4:mirakle:1.5.3-RC-7

@jt416
Copy link
Author

jt416 commented Aug 5, 2022

No joy. I have tried with Android Studio and with this simple tasks command. Notice that no REMOTE GRADLE ARGUMENTS are printed.

$ ./gradlew tasks --project-prop "android.injected.studio.version=foo bar"

> Configure project :
Here's Mirakle 1.5.3-RC-7. All tasks will be executed on ubuntu-32534-jthi.

> Task :uploadToRemote

Number of files: 472 (reg: 325, dir: 147)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 61,048,355 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.006 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 14,029
Total bytes received: 173

sent 14,029 bytes  received 173 bytes  5,680.80 bytes/sec
total size is 61,048,355  speedup is 4,298.57

> Task :executeOnRemote
============REMOTE GRADLE ARGUMENTS===============

============REMOTE GRADLE ARGUMENTS===============

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bar' not found in root project 'SlnkLogger'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

> Task :downloadFromRemote

Number of files: 30,201 (reg: 23,945, dir: 6,256)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 479,951,158 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 345,062
File list generation time: 0.019 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 6,739
Total bytes received: 1,163,587

sent 6,739 bytes  received 1,163,587 bytes  156,043.47 bytes/sec
total size is 479,951,158  speedup is 410.10

> Task :mirakle FAILED
Total time : 13.574 secs
Task uploadToRemote took : 2.603 secs
Task executeOnRemote took : 3.214 secs
Task downloadFromRemote took : 7.664 secs
4 actionable tasks: 4 executed

@skrugly
Copy link
Owner

skrugly commented Aug 6, 2022

I see, working on a fix

@skrugly
Copy link
Owner

skrugly commented Aug 7, 2022

Could you remove your workaround and try again with 1.5.3-RC-7
Such way of modifying executeOnRemote args will not work in the new version.

@jt416
Copy link
Author

jt416 commented Aug 8, 2022

I have commented out the entire taskGraph.whenReady block. Note, in these examples I am running from Cygwin terminal. The behavior appears to match running from Android Studio.

First run 1.5.3-RC-7 with spacy property fails because it wants to "bar" to be a task:

$ ./gradlew tasks --project-prop "android.injected.studio.version=foo bar"

> Configure project :
Here's Mirakle 1.5.3-RC-7. All tasks will be executed on ubuntu-32534-jthi.

> Task :executeOnRemote

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bar' not found in root project 'UcmClient'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

> Task :mirakle FAILED
Total time : 9.192 secs
Task uploadToRemote took : 2.731 secs
Task executeOnRemote took : 3.223 secs
Task downloadFromRemote took : 3.147 secs
4 actionable tasks: 4 executed

Next, remove space from property, and it runs successfully:

$ ./gradlew tasks --project-prop "android.injected.studio.version=foobar"

> Configure project :
Here's Mirakle 1.5.3-RC-7. All tasks will be executed on ubuntu-32534-jthi.

> Task :executeOnRemote

> Task :tasks

------------------------------------------------------------
Tasks runnable from root project 'UcmClient'
------------------------------------------------------------

Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.

Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildKotlinToolingMetadata - Build metadata json file containing information about the used Kotlin tooling
buildNeeded - Assembles and tests this project and all projects it depends on.
bundle - Assemble bundles for all the variants.
clean - Deletes the build directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
extractDebugAnnotations - Extracts Android annotations for the debug variant into the archive file
extractReleaseAnnotations - Extracts Android annotations for the release variant into the archive file

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'UcmClient'.
dependencies - Displays all dependencies declared in root project 'UcmClient'.
dependencyInsight - Displays the insight into a specific dependency in root project 'UcmClient'.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'UcmClient'.
projects - Displays the sub-projects of root project 'UcmClient'.
properties - Displays the properties of root project 'UcmClient'.
tasks - Displays the tasks runnable from root project 'UcmClient' (some of the displayed tasks may belong to subprojects).

Install tasks
-------------
installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
installRelease - Installs the Release build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build.

Verification tasks
------------------
check - Runs all checks.
checkJetifier - Checks whether Jetifier is needed for the current project
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on the default variant.
lintAnalyzeDebug - Run lint analysis on the debug variant
lintAnalyzeRelease - Run lint analysis on the release variant
lintDebug - Print text output from the corresponding lint report task
lintFix - Runs lint on the default variant and applies any safe suggestions to the source code.
lintFixDebug - Fix lint on the debug variant
lintFixRelease - Fix lint on the release variant
lintRelease - Print text output from the corresponding lint report task
lintReportDebug - Run lint on the debug variant
lintReportRelease - Run lint on the release variant
lintVitalAnalyzeRelease - Run lint analysis with only the fatal issues enabled on the release variant
lintVitalRelease - Print text output from the corresponding lint report task
lintVitalReportRelease - Run lint with only the fatal issues enabled on the release variant
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.

To see all tasks and more detail, run gradlew tasks --all

To see more detail about a task, run gradlew help --task <task>

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Total time : 9.268 secs
Task uploadToRemote took : 2.515 secs
Task executeOnRemote took : 3.472 secs
Task downloadFromRemote took : 3.244 secs
4 actionable tasks: 4 executed

@skrugly
Copy link
Owner

skrugly commented Aug 8, 2022

Add this lines to mirakle_init.gradle and show the output after running
./gradlew tasks --project-prop "android.injected.studio.version=foo bar"

taskGraph.whenReady { taskGraph ->
    if (taskGraph.hasTask(":executeOnRemote")) {
        gradle.rootProject.executeOnRemote.doLast {
            println("============REMOTE COMMAND===============")
            println(rootProject.executeOnRemote.commandLine)
            println("============REMOTE COMMAND===============")
        }
    }
}

@jt416
Copy link
Author

jt416 commented Aug 8, 2022

> Task :executeOnRemote

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bar' not found in root project 'UcmClient'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 976ms
============REMOTE COMMAND===============
[ssh, ubuntu-32534-jthi, echo 'set -e  && cd "Code/mirakle/UcmClient" && ./gradlew -Pmirakle.build.on.remote=true "tasks" "--project-prop" "android.injected.studio.version=foo bar"' | bash]
============REMOTE COMMAND===============

@skrugly
Copy link
Owner

skrugly commented Aug 15, 2022

Could you check please 1.5.3-RC-9

@jt416
Copy link
Author

jt416 commented Sep 7, 2022

Sorry for the delay. Still failing.

$ ./gradlew tasks --project-prop "android.injected.studio.version=foo bar"

> Configure project :
Here's Mirakle 1.5.3-RC-9. All tasks will be executed on ubuntu-32534-jthi.

> Task :executeOnRemote
Remote bash command = [ssh, ubuntu-32534-jthi, echo 'set -e  && export LANG=C.UTF-8 && export LC_CTYPE=C.UTF-8 && cd Code/mirakle/SlnkSip && ./gradlew -Pmirakle.build.on.remote=true "tasks" "--project-prop" "android.injected.studio.version=foo bar"' | bash]

> Configure project :pjapi
[runNativeBuildCMake]: Using the latest installed cmake version: 3.18.1

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bar' not found in root project 'SlnkSip'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
============REMOTE COMMAND===============
[ssh, ubuntu-32534-jthi, echo 'set -e  && export LANG=C.UTF-8 && export LC_CTYPE=C.UTF-8 && cd Code/mirakle/SlnkSip && ./gradlew -Pmirakle.build.on.remote=true "tasks" "--project-prop" "android.injected.studio.version=foo bar"' | bash]
============REMOTE COMMAND===============

> Task :mirakle FAILED
Total time : 11.646 secs
Task uploadToRemote took : 3.087 secs
Task executeOnRemote took : 4.456 secs
Task downloadFromRemote took : 3.989 secs
4 actionable tasks: 4 executed

@skrugly
Copy link
Owner

skrugly commented Sep 16, 2022

I just noticed that you are running it from cygwin terminal.
I see a bunch of reports in Google saying cygwin is removing escape quotes
I'm sorry but I can't help you here since I don't have a windows machine to debug it.

The easiest solution for now is to remove that property in mirakle_init.gradle before applying mirakle plugin.

def modified = new HashMap<>(gradle.startParameter.projectProperties)
modified.remove("android.injected.studio.version")
gradle.startParameter.projectProperties = modified 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants