Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset Pipeline 40x larger file size - 4.3.0 requires and additional 55.81 MB compared to 3.4.7 #328

Closed
codeconsole opened this issue Aug 15, 2023 · 7 comments

Comments

@codeconsole
Copy link
Contributor

Are all these dependencies necessary in the production jar? If not, what is the best way to exclude them?

Asset Pipeline 4.3.0

+--- com.bertramlabs.plugins:asset-pipeline-grails:4.3.0
    \--- com.bertramlabs.plugins:asset-pipeline-core:4.3.0
         +--- org.graalvm.sdk:graal-sdk:22.0.0.2
         +--- org.graalvm.js:js:22.0.0.2
         |    +--- org.graalvm.regex:regex:22.0.0.2
         |    |    \--- org.graalvm.truffle:truffle-api:22.0.0.2
         |    |         \--- org.graalvm.sdk:graal-sdk:22.0.0.2
         |    +--- org.graalvm.truffle:truffle-api:22.0.0.2 (*)
         |    \--- org.graalvm.sdk:graal-sdk:22.0.0.2
        +--- org.graalvm.js:js-scriptengine:22.0.0.2
         |    \--- org.graalvm.sdk:graal-sdk:22.0.0.2
         \--- org.slf4j:slf4j-api:1.7.28 -> 1.7.36

Asset Pipeline 3.4.7

+--- com.bertramlabs.plugins:asset-pipeline-grails:3.4.7
    \--- com.bertramlabs.plugins:asset-pipeline-core:3.4.7
         \--- org.slf4j:slf4j-api:1.7.28 -> 1.7.36
@rlconst
Copy link

rlconst commented Nov 30, 2023

The problem is in 1d9ac7f

Probably https://github.com/oracle/graaljs should be enough instead of full graal development kit designed for building languages and native compilation. These documents https://www.graalvm.org/latest/reference-manual/js/#interoperability-with-java ans https://www.graalvm.org/latest/reference-manual/js/RunOnJDK/ show different dependencies required to execute js

Also relevant discussing oracle/graal#287

We can consider using rhino which is ~1mb dependency https://github.com/mozilla/rhino or ~2mb https://github.com/openjdk/nashorn

@davydotcom
Copy link
Contributor

neither rhino nor nashorn are viable on more modern jdks and babel.js will not run within them. graal is necessary. graal-sdk is there for older versions of java runtime (i.e. java8)

@codeconsole
Copy link
Contributor Author

@davydotcom if the assets are compiled at build time, why are all these dependencies needed during runtime on a production jar?

+--- com.bertramlabs.plugins:asset-pipeline-grails:4.3.0
|    \--- com.bertramlabs.plugins:asset-pipeline-core:4.3.0
|         +--- org.graalvm.sdk:graal-sdk:22.0.0.2
|         +--- org.graalvm.js:js:22.0.0.2
|         |    +--- org.graalvm.regex:regex:22.0.0.2
|         |    |    \--- org.graalvm.truffle:truffle-api:22.0.0.2
|         |    |         \--- org.graalvm.sdk:graal-sdk:22.0.0.2
|         |    +--- org.graalvm.truffle:truffle-api:22.0.0.2 (*)
|         |    \--- org.graalvm.sdk:graal-sdk:22.0.0.2
|         +--- org.graalvm.js:js-scriptengine:22.0.0.2
|         |    \--- org.graalvm.sdk:graal-sdk:22.0.0.2
|         \--- org.slf4j:slf4j-api:1.7.28 -> 1.7.36

These 2 dependencies add 57M to the final jar.

8.5M	truffle-api-22.0.0.2.jar
 48M	js-22.0.0.2.jar

@codeconsole
Copy link
Contributor Author

codeconsole commented Jul 25, 2024

Here is my workaround which should not be necessary:

configurations {
    //  ...
    runtimeOnly.exclude group: "org.graalvm.js"
    runtimeOnly.exclude group: "org.graalvm.sdk"    
}

Which takes down website.jar from 146M to 86M

@rlconst
Copy link

rlconst commented Jul 26, 2024

@davydotcom I agree with @codeconsole. Full graal SDK should be excluded from runtime, it's unnecessary bloat for grails app runtime

@rlconst
Copy link

rlconst commented Jul 26, 2024

@codeconsole to make grails runnable in dev mode I had to include

bootRun { task ->
    dependencies {
        implementation "org.graalvm.polyglot:polyglot:24.0.2"
        implementation "org.graalvm.polyglot:js:24.0.2"
    }
}

@davydotcom
Copy link
Contributor

@rlconst i think i fixed this. the gradle plugin was not up to date in the gradle plugin publish. asset-pipeline-gradle:4.5.1 should fix it. This auto injects those dependencies on the bootRunt ask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants