Using Bazel monorepo, not able to generate coverage for Kotlin apps - kotlin

My Bazel monorepo, has apps in Kotlin and Golang. In the earlier versions (For Go/Kotlin Bazel rules), the support for code coverage was not there but in the later rules-versions it's supported as per the rules_go and rules_kotlin documentation.
When I run the below command, the code coverage for only the Go apps is generated but not the Kotlin apps. I have upgraded to the latest rules_kotlin.
bazel coverage --combined_report=lcov --nocache_test_results --instrumentation_filter=//apps:<app-name>:<test-name> //...:all
FYI, following versions are used:
Bazel: 5.3.0
Kotlin rules: v1.7.1
Golang rules: v0.25.0

Related

kotlinc-js 1.8 doesn't seem to support IR

When compiling using the kotlin 1.8 sdk, for example :
kotlinc-js -version
One gets the following:
info: kotlinc-js 1.8.0 (JRE 19.0.1)
error: ==========
This project currently uses the Kotlin/JS Legacy compiler backend, which has been deprecated and will be removed in a future release.
Please migrate your project to the new IR-based compiler (https://kotl.in/jsir).
Because your build tool will not support the new Kotlin/JS compiler, you will also need to migrate to Gradle.
You can continue to use the deprecated legacy compiler in the current version of the toolchain by providing the compiler option -Xuse-deprecated-legacy-compiler.
==========
The implication of this seems to be that the IR js compiler can be used from Gradle - which seems a really annoying limitation. Is this really this case?

How to use javaparser plugin of JQAssistant?

I'm trying to use javaparser plugin of JQAssistant using command line. I have done the following:
Copied "jqassistant.plugin.javaparser-1.8.0.jar" to "plugin" folder.
I also noticed plugin has runtime dependency to "com.github.javaparser:javaparser-core:3.6.25". So I copied "javaparser-core-3.6.25.jar" to plugin folder too.
But when I try to scan a Java file I get the following error:
"ANTLR Tool version 4.9.2 used for code generation does not match the current runtime version 4.7.2"
The ANTLR version bundled with JQAssistant is 4.9.2 but plugin is expecting older version 4.7.2.
Has anyone been able to use javaparser plugin?
Some plugins (not only javaparser) indeed depend on JARs bundled with jQAssistant. Sometimes there are version conflicts, that's why it can only be guaranteed that Kontext E plugins with a certain version (let's say 1.8.x) are compatible with jQAssistant with the same major and minor version (so jQA 1.8 in this case). If you use javaparser 1.8.0 with jQAssistant 1.8.0 (which comes with org.antlr-antlr4-runtime-4.7.2), it works.

Kotlin Multiplatform project include cocoapod dependency

Trying to setup cocoapods for my Kotlin MPP:
plugins {
kotlin("multiplatform") version "1.5.10"
kotlin("native.cocoapods") version "1.5.10"
id("com.android.library")
id("maven-publish")
}
Syncing the project ends up in this error:
Execution failed for task ':podspec'.
> this and base files have different roots: C:\Users\user\AppData\Local\Temp\wrap6957loc\gradlew and G:\Workspace\tracking-lib.
I am on windows and always will be. The project should build on Windows and Mac. So I assume basic inclusion of that plugin should work?
What can I do to fix the paths?
This looks like a bug. The plugin should be disabled, but the build should be working fine. Please consider reporting it to https://kotl.in/issue The cocoapods plugin strongly relies on pre-installed components, such as Xcode CLI Tools, cocoapods and cocoapods-generate. All of them are described here. The iOS targets of the Kotlin MPP project themselves can't be built on Windows, this is a restriction of the compiler. See a full list of targets and their availability here.

Hudson integration for Maven projects

I have few maven projects.They have testNG test cases too.Tests run fine.Now I want to integrate the projects with Hudson for getting basic features such as subversion updates, test reports, sending email etc.Projects are built in java 1.5.What is the hudson compatible version for Java 1.5 and also gives the possibility to add maven 2 module, configure subversion.The version I downloaded had some java version issues.Then I replaces the jar which was causing issue but still could not configure the project for svn stuff.Please help me, is there a guide of step by step walk through...Thank you in advance
What is the hudson compatible version for Java 1.5 ?
As you have already figured out, the latest Hudson versions require Java 6. However, the Java JRE that Hudson runs on IS NOT the Java JRE/JDK that your project will use to compile, test, and package itself in Maven.
The version of Java Hudson uses to compile your project is an option you select in the Hudson UI (Manage Hudson). In fact, Hudson can compile and test your Maven project against multiple versions of Java if you wish.
This is a powerful capability of Hudson that is not immediately obvious. See the following screenshot for details:
So the bottom line is this: Use the latest version of Hudson (or Jenkins) and set the JDK installation to v1.5.

Using Jython with Maven

I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code.
I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where to start.
Does anyone have any idea how I can run some .py files that accesses some Java libraries in other packages?
Also, how can I compile it as a .jar file when all is done and good?
Thanks!
Compiling and integrating python
Use the jython-compile-maven-plugin. It allows you to deploy a standalone project that includes jython with libraries.
For demonstration of this plugin, see the demo project and its source code. It shows how to
launch a python console -- look at AbstractInitJython and InitJython on how to launch a python/jython console, how to execute python code snippets, and how to run a python script.
include python libraries -- the plugin also downloads and bundles python libraries (using easy_install) in the package phase, and adds them to the jar. The resulting jar can have all the libraries of the project, all pom dependencies and all the python libraries requested. The demo project shows this with the "nose" python library (see the pom file).
Testing python / jython code
The python-test-maven-plugin allows you to run your python tests alongside the normal junit tests. The demo project (look at the source at source code) shows the use of standard python unit tests (with nose) and BDD (behaviour testing) with the lettuce-clone freshen.
The sourceforge umbrella project is http://mavenjython.sourceforge.net/
Unlike maven-jython-plugin, they don't use the outdated jythonc compiler.
I am now done, and I would like to compile the project as a .jar,
It looks like there is a maven-jython-plugin allowing to compile jython source files to Java class files.
I've kinda figured out my answer to this. I shouldn't have tried to compile it, but instead wrap the python code with Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
The compiler portion of jython, jythonc, is deprecated as of 2.5 -- http://wiki.python.org/jython/ReplaceJythonc -- a replacement is in the works.