Open marianobntz-silohub opened 2 years ago
actually I see it is not alphabetical, it just goes at the end of the other elements...
Meaning the Gradle file? Then perhaps this needs to support some kind of XPath syntax to specifically target where you want things. Will leave this open, thanks
Yes, the gradle file. android/app/build.gradle (normally). XPath would be nice, it should support preceding-sibling or following-sibling to make it work. Thanks!!! PS: support for editing a value and not just inserting would be nice.
there is replace
for editing. Still while thats clear that editing gradle files is non trivial. This is essential to full automation. I have similar need to add plugins {}
section and insert
just appends while this needs to be earlier - ideally on top.
Currently the only way is to use patch - and I think it would make sense for trapeze to support patch as well
You can insert it at the end of a block that is previous to the target one. Trapeze does not check the validity of the inserted data - this can be used. Example:
Before build.gradle:
android {
defaultConfig {
....
}
buildTypes {
....
}
}
Run:
gradle:
- file: app/build.gradle
target:
android:
defaultConfig:
insert: |
}
signingConfigs {
{
.....
}
After build.gradle:
android {
defaultConfig {
....
}
signingConfigs {
...
}
buildTypes {
....
}
}
The android plugin requires (it is a bug in my opinion) that the signingConfigs element is placed BEFORE the buildTypes element. When I use capacitor/config to create the signingConfigs element it is created after buildTypes (guess it is done in alphabetical order)... This makes it hard to create a valid build configuration. Thanks! it is a great tool!!