guardian / mobile-n10n

n10n for nOTIFICATIOn
Apache License 2.0
26 stars 4 forks source link

Remove unused dependencies #1083

Closed waisingyiu closed 1 year ago

waisingyiu commented 1 year ago

What does this change?

We attempted to bump some dependencies in #1018 , but the football lambda failed to be deployed because it hit the maximum size of AWS Java lambda archive, which is 250MB.

This PR aims to reduce the size of the football lambda.

Before the changes, the archive is around 250MB and the biggest bundles are:

Bundle Size Remark
AWS EC2 SDK 40.7MB Transitive dependency via simple-configuration
Scala runtime 55.1MB Indispensible
Cats library 34.2 MB Transitive dependency via scanamo
scalatest 20.4 MB Transitive dependency via scanamo
AWS SSM SDK 14.9 MB Transitive dependency via simple-configuration

Apparently the EC2 SDK is not really required by simple-configuration after guardian/simple-configuration#8 and the library can compile without the EC2 SDK dependency.

The library scanamo also has a patch version bump which moved scalatest dependency to test scope.

This PR makes the following changes:

  1. bump scanamo so that the scalatest is not included in the Java archive
  2. explicitly exclude AWS EC2 SDK from football
  3. remove some unused direct dependencies of football

After the changes, the compressed output JAR is 71 MB and after decompression it is 187.6 MB

How to test

I made use of football-time-machine to play back a football, registered for notifications on the football team on Android simulator, and enabled the football lambda schedule on CODE

I was able to receive the notifications:

Logs were also made properly:

How can we measure success?

The football lambda archive is reduced in size significantly, and it is working properly.

Have we considered potential risks?

The AWS EC2 SDK may be needed by other dependencies. To mitigate the risk, I checked the dependency tree to confirm that it was depended on by simple-configuration only. I also ran a test to validate the football lambda.