recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.
APACHE-2.0 License
recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose. It can be used on the command line, as IntelliJ / Android Studio plugin or as a library in custom code.
The plugin does not get published yet. If you want to try them then you'll have to build them from code. Use the Gradle task runIde
to run a test IDE with the plugin installed or create an installable plugin with the buildPlugin
task. The plugin zip will be placed in recompose-idea/build/distributions/
. To learn how to install it, read the Install plugin from disk section in the IntelliJ docs.
Like the plugin, the command-line interface does not get published yet. You can run it directly from Gradle via
./gradlew recompose-cli:run --args="list file paths.."
. Alternatively you can run the assembleDist
which will place
a zip/tar containing a binary into recompose-cli/build/distributions/
.
Usage: recompose [OPTIONS] INPUT...
Options:
-o, --output PATH Output directory for Kotlin code
-h, --help Show this message and exit
Arguments:
INPUT Layout XML files to convert to Kotlin
Either import the project into IntelliJ IDEA or use Gradle on
the command line (via the provided gradlew
wrapper).
Composable
Kotlin code.Composable
Kotlin code.recompose-idea/build/distributions
.The Parser (recompose-parser
) takes the input XML and transforms it into an
Abstract Syntax Tree (recompose-ast
). The Composer (recompose-composer
)
takes the AST and translates it into Kotlin code calling Composables.
The IntelliJ / Android Studio plugin (recompose-idea
) uses that to perform the translation when pasting copied XML code. And the CLI (recompose-cli
) uses it to translate files.
Yes, absolutely. There are a ton of View
s and attributes to support. The list of issues labeled with good first issue are a good place to start. An issue from the list labeled with help wanted may be a good follow-up. Just comment on any issue that interests you.
Copyright 2020 Sebastian Kaspari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.