how to create a task for app bundle in bamboo - bamboo

Does anybody know how to create a script task in bamboo to include the android app bundle.
https://confluence.atlassian.com/bamboo/configuring-tasks-289277036.html Referred this link. Could anyone help

Modify the script to read command line arguments. Then pass the app bundle in as a command line argument.

You can
use a ScriptTask and execute a gradle task (using the gradle wrapper)
buy the Groovy Task for Bamboo plugin
With the ScriptTask just run a gradle task.
For example if you want to build the app-bundle just use:
./gradlew bundleRelease

Related

Execute .kts (kotlin script) from gradle

Scenario:
A gradle project, using the org.jetbrains.kotlin.jvm plugin
The project has some *.kts kotlin script files located inside src/main/kotlin. The scripts do various tasks, for instance there is a script for loading test data from a set of CSV files into a local H2 database, a script for creating a test user in the database etc.
I currently run these scripts using IntelliJ IDEA run configurations
The gradle build file is using kotlinscript (build.gradle.kts)
To make things easier to set up for new developers, I would like to configure gradle so I can run the scripts directly using gradle. That would simplify my README.md, instead of "use IntelliJ to execute the script xxx.kts with arguments yyy and zzz, then nnn.kts", I could write "execute gradle loadTestDataIntoLocalH2Database".
Questions/issues:
Is there a simple way to execute a *.kts script from gradle?
Puzzled my answer together from https://docs.gradle.org/current/userguide/plugins.html#sec:script_plugins , https://kotlinexpertise.com/execute-kotlin-scripts-with-gradle/ and https://stackoverflow.com/a/52139585/9936828
Although I didn't try it, the second link seems like the best solution if you are ok with adding the scripts to your projects package instead of keeping them as loose scripts.
Tested with gradle 7.2.
First option is the most straightforward with no changes to code, but requires you to install the kotlin compiler CLI (kotlinc), gradle can then call it to execute the scripts:
task<Exec>("MyTask") {
commandLine("kotlinc", "-script", "foo.gradle.kts")
}
Then call it with gradle -q MyTask. Or obviously you could also provide the direct instructions to run kotlinc for the user without wrapping it in gradle.
Second option would be to load your script as a plugin. This however causes the kotlinscript annotations such as external imports (#file:Import, etc) to not work.
Wrap your code in your script in a task:
tasks.create("MyTask") {
doLast {
<do your stuff here>
}
}
load as plugin in your build script:
apply(from = "foo.kts")
Then call it with gradle -q MyTask.

Run CMD/Powershell command before the build command?

How I can run a CMD/Powershell before my Java GUI Application will be build and invoked.
I want run the command: sass ANYFILE.scss:ANYFILE.css to compile my scss file first.
In the Run/Debug Configurations I found nothing which helps me at the Before launch option.
Add the External Tool in IDE which will run any command you want, then add it in Before launch section.
There is a PowerShell plugin that provides a run configuration to run powershell scripts. You can add it as Before launch option as well.

gradlew clean deployNodes - QUASAR WARNING: Quasar Java Agent isn't running

When I run "gradlew clean deployNodes" or "gradlew deployNodes", I get a warning on Quasar library:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using another instrumentation method you can ignore this message; otherwise, please refer to the Getting
Started section in the Quasar documentation.
How can i fix this warning ?
I upgraded Corda to 4.1
you'll want to double-check the intellij settings.
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
As mentioned in the comments from manish, make sure to try cleaning the gradle cache as well: ./gradlew clean build deployNodes.
Joel has a good answer for a similar quasar issue on this StackOverflow question: Error when running Corda flow tests from IntelliJ

How to configure/run gradle to build and assemble release type running all unit tests first

When I run
./gradlew clean assembleRelease
my binaries are built, but the unit tests do not run.
When I run
./gradlew clean build
all binaries are built and all unit tests are run, twice... once for debug and once for release.
How can I achieve what 'clean build' does but only for the release buildType?
Context: The main problem I am trying to solve is what is the proper way to configure a jenkins job to build assemble and run all unit tests for the RELEASE buildType only.
The way I have solved this for now is by adding this code block to the bottom of build.gradle in each module of my project:
project.tasks.assembleRelease.dependsOn {
project.tasks.findAll { task ->
task.name.startsWith('testRelease')
}
}
This does what I need it to do, such that when our jenkins server job runs:
clean assembleRelease
All the release unit tests are run and the artifacts are all created.
Not sure if this is the best/cleanest solution.
This worked for me:
gradlew clean check assembleRelease
This cleans and verifies (includes running tests) for all subprojects (even plain java ones) and then assembles only the release buildType, i.e. dexing and signing is only done as specified in the release closure.
I'm not sure if that's the cleanest solution, either. Still, it does not append boilerplate to build.gradle files and its is faster than running the clean build tasks.
A good overview over gradle's anchor tasks assemble, check and build is provided by the Gradle Plugin User Guide.

IntelliJ 14 Gradle task in Test Runner

Upgraded to IntelliJ 14.0.1 One of the big new features I was looking for:
"If you run tests via a Gradle task, the IDE offers you the standard Test Runner instead of the console output." (Source: https://www.jetbrains.com/idea/whatsnew/#buildTools)
I right click on the Gradle Task to run our Integration Tests:
However, I see the results of the test still going to console output, not to the Test Runner:
Has anyone been able to get this new feature in IntelliJ IDEA 14 to work?
Thank you in advance,
Philip
Looks like IntelliJ looks for a task named "test" rather than a task of type Test.
https://github.com/JetBrains/intellij-community/blob/master/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestsExecutionConsoleManager.java#L191
Rename the test task to unitTest and then create a wrapper that runs both:
// Rename test to unitTest
tasks.test.name = "unitTest"
// Wrap and run both
task test(dependsOn:['unitTest', 'integrationTest'])
If you only want to run integration tests, just overwrite it:
task test(overwrite: true, dependsOn: ['integrationTest'])
This allows me to run the integration tests in the test runner successfully (at least it works in IDEA 15 EAP but it should work in 14 as well I would think).
I still get this in IntelliJ 2017.1, but specifically when running tests in the gradle buildSrc directory. After digging a while, it turns out that the Gradle API doesn’t expose the test tasks in the special buildSrc directory to Intellij, so IntelliJ doesn’t recognize it as a test.
Workaround: Open another IntellIJ project for the buildSrc directory directory instead of trying to run tests cleanly inside the root project.