Skip to content

Commit 77aae1d

Browse files
committed
More
1 parent a258051 commit 77aae1d

File tree

5 files changed

+42
-35
lines changed

5 files changed

+42
-35
lines changed

README.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
11
![Image of GradleKotlinConverter](logo.png)
22

3-
Gradle Kotlin DSL converter
4-
=================
3+
# Gradle Kotlin DSL Converter
54

6-
Welcome! After a lot of pain trying to migrate from Gradle's Groovy to Kotlin DSL on Android Studio, I developed this tool to solve most migration issues and reduce the amount of work you need in order to make things ready.
5+
A powerful tool to simplify the migration from Gradle's Groovy DSL to Kotlin DSL for Android projects.
76

8-
Please see this tool as a helper, a first resource like Android Studio's Java converter to Kotlin: it won't make a _perfect_ conversion, but it helps a lot in reducing the time you would spend on repetitive tasks.
7+
[![Image of website](web-screenshot.png)](https://gradle-kotlin-converter.vercel.app/)
98

9+
Visit https://gradle-kotlin-converter.vercel.app/ to use the converter.
1010

11-
💻 Getting Started
12-
---------------
13-
The script was written in Kotlin and depends on JVM (for File access). If you need to install Kotlin for command line access, [check here](https://kotlinlang.org/docs/tutorials/command-line.html) (`brew install kotlin` or `scoop install kotlin -g` on windows with [Scoop](https://scoop.sh/)).
11+
## Overview
1412

15-
```
16-
File mode:
17-
$ ./gradlekotlinconverter.kts build.gradle
18-
$ kotlinc -script gradlekotlinconverter.kts build.gradle
13+
The Gradle Kotlin DSL Converter is designed to streamline the process of transitioning from Gradle's Groovy DSL to Kotlin DSL in Android Studio. This tool automates many of the repetitive tasks involved in the migration, significantly reducing the time and effort required to update your build scripts.
1914

20-
Clipboard mode:
21-
$ ./gradlekotlinconverter.kts
22-
```
15+
While it may not produce a perfect conversion in all cases, it serves as an invaluable first step in the migration process, similar to Android Studio's Java to Kotlin converter.
2316

24-
**Motivation**: on my own apps, I've used apostrophes \' instead of quotation marks \" since forever, so it wasn't fun when I discovered I would need to modify more than 100 lines of code to make Kotlin DSL work. Besides this, the tool also solves a few common issues that might appear, like the ```task clean(type: Delete)``` that becomes a completely different thing.
17+
## Features
2518

19+
- Converts Groovy-style Gradle scripts to Kotlin DSL format
20+
- Handles common syntax differences and idiomatic changes
21+
- Supports both file-based and clipboard-based conversion
22+
- Addresses numerous edge cases and common migration challenges
2623

27-
📋 Clipboard mode
28-
---------------
29-
Sometimes you just want to copy and paste. Just copy whatever you want, run the script, then paste on your IDE.
30-
The GIF showcases how simple it is:
24+
## Getting Started
3125

32-
![GIF](/clipboard_mode.gif?raw=true)
26+
### Web Interface
3327

28+
Visit our [web-based converter](https://gradle-kotlin-converter.vercel.app/) for an easy-to-use interface that doesn't require any local setup.
3429

35-
😱 Things it can do
36-
---------------
30+
## Conversion Capabilities
31+
32+
The converter handles a wide range of Gradle script elements, including:
33+
34+
- String delimiter conversion (apostrophes to quotation marks)
35+
- Variable declaration updates (`def` to `val`)
36+
- Plugin application syntax
37+
- Dependency declaration format
38+
- Repository and Maven configurations
39+
- SDK version and build type declarations
40+
- ProGuard file configurations
41+
- Kotlin-specific dependency declarations
42+
- And more:
43+
44+
---
3745

3846
<table>
3947
<th>Description</th>
@@ -165,30 +173,29 @@ When applying on `build.gradle`, the script will create, for example, `build.gra
165173
When applying on a file that already ends in `.kts`, the script will overrite the file.
166174
In that case, please make sure you are using git or have a backup, in case things turn out wrong.
167175

168-
😨 Things it still can't do
169-
-------
176+
## Things it still can't do
177+
170178
- If you find anything, just tell me.
171179

172-
Issue Tracking
173-
-------
180+
## Issue Tracking
181+
174182
Found a bug? Have an idea for an improvement? Feel free to [add an issue](../../issues).
175183

176-
License
177-
-------
184+
## License
178185

179186
Copyright 2018 Bernardo Ferrari.
180187

181188
Licensed to the Apache Software Foundation (ASF) under one or more contributor
182-
license agreements. See the NOTICE file distributed with this work for
183-
additional information regarding copyright ownership. The ASF licenses this
189+
license agreements. See the NOTICE file distributed with this work for
190+
additional information regarding copyright ownership. The ASF licenses this
184191
file to you under the Apache License, Version 2.0 (the "License"); you may not
185-
use this file except in compliance with the License. You may obtain a copy of
192+
use this file except in compliance with the License. You may obtain a copy of
186193
the License at
187194

188195
http://www.apache.org/licenses/LICENSE-2.0
189196

190197
Unless required by applicable law or agreed to in writing, software
191198
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
192-
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
199+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
193200
License for the specific language governing permissions and limitations under
194-
the License.
201+
the License.
File renamed without changes.
File renamed without changes.

web-screenshot.png

1.35 MB
Loading

web/app/code-editors.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function CodeEditors() {
3939
const kotlinEditorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(
4040
null
4141
)
42-
const { theme } = useTheme()
42+
const { resolvedTheme } = useTheme()
4343
const [conversionSuccess, setConversionSuccess] = useState(false)
4444
const [copyButtonClicked, setCopyButtonClicked] = useState(false)
4545

@@ -179,7 +179,7 @@ export default function CodeEditors() {
179179
lineNumbers: "on",
180180
scrollBeyondLastLine: false,
181181
fontSize: 14,
182-
theme: theme === "dark" ? "vs-dark" : "vs-light",
182+
theme: resolvedTheme === "dark" ? "vs-dark" : "vs-light",
183183
}}
184184
/>
185185
</div>

0 commit comments

Comments
 (0)