ionic-team / trapeze

The mobile project configuration toolbox. Manage native iOS, Android, Ionic/Capacitor, React Native, and Flutter apps through a simple YAML format.
https://trapeze.dev
Other
328 stars 40 forks source link

Update gradle.properties #198

Open Ali-H888 opened 1 year ago

Ali-H888 commented 1 year ago

Hello

I'm using "@trapezedev/configure": "^7.0.10" and I want to update the gradle.properties in android

Is there an option to update the variables inside it?

marioshtika commented 9 months ago

Hey @Ali-H888 did you find a way to do this?

I think at some point this was possible (https://github.com/ionic-team/trapeze/issues/56) but I can not find it how to make it work.

Ali-H888 commented 9 months ago

Hello @marioshtika, what I did was to replace the gradle.properties file with one of my own

platforms:
    android:
       ....
        copy:
            -   src: ../configuration/android/gradle.properties
                dest: gradle.properties
marioshtika commented 9 months ago

Hey @Ali-H888 thank you for your response, I was thinking of the same workaround.

I checked the repository and I saw that the properties operator exists in here And the interface also exists in here

So something like this should have worked

platforms:
  android:
    properties:
      - file: gradle.properties
        entries: 
          android.enableJetifier: true

I followed the logic and it looks like it is working but it is not writing it back to the file

I am getting the below error message

Fatal error: Error running command
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received [Object: null prototype]

@mlynch can you take a look at this and check if this is a bug.

Ali-H888 commented 9 months ago

@marioshtika Yeah, same here. I didn't check it since a while now, but you got me interested in finding why, and I think I did :)

If you check here you will find that they are passing data to the write file argument instead of the serialized string and that's what is causing the error. I tried changing it locally on my project and it worked when I replaced the data argument with the serialized variable.

marioshtika commented 9 months ago

Hey @Ali-H888 you were right. I also tested this on my local machine and it worked.

I created a pull request for this and hopefully someone will merge it on the main branch.

@mlynch ^

Thank you in advance.