ionic-team / ionic-team/trapeze

Issues when adding entries to build.gradle

Open
#210 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
377
Forks
50
Avg merge
1m
Merged PRs (30d)
1

Description

I'm using the @capacitor-community/photoviewer plugin and trying to automatically insert entries into the build.gradle file.

I'm trying to insert the following row into the 'buildscript' block:

```
ext.kotlin_version = '1.8.20'
```

The Yaml code i'm using is:
```
- file: build.gradle
target:
buildscript:
inserType: 'variable'
insert:
- extkotlin_version: "'1.8.20'"
```

The result is that the row is inserted but each time i run Trapeze it inserts another row.

I'm also trying to insert a classpath to the buildscript/dependencies block:
```
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
```

The Yaml code i'm using is:

```
- file: build.gradle
target:
buildscript:
dependencies:
insert:
- classpath: '"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"'
```

The result is that this row is also inserted each time i run Trapeze. But also the `$kotlin_version` postfix is removed. I tried to escape the $ sign but to no avail.

The final result after running Trapeze 3 times is:

![image](https://github.com/ionic-team/trapeze/assets/8666514/1e25cb73-3e29-48a9-b547-fe213f5b200c)

I've tried to us the 'replace' function instead of 'insert' but to no avail.

Can anyone tell me what I'm doing wrong or is what I'm trying to achieve simply not possible?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.