Add scala support.
(cherry picked from commit 95053efde478ca5253addc3608270f32960b7f24)