This PR makes the IJ plugin run in K2 mode with the new Analysis APIs,
instead of the old K1 APIs. It also includes cleaning up a bunch of
compiler warnings, and some mistakes I saw when migrating to K2.
---------
Co-authored-by: Victor Kropp <victor.kropp@jetbrains.com>
This PR prepares the IJ plugin to be fixed/improved upon by a follow-up
PR, by:
1. Migrating to IJP Gradle plugin 2.1
2. Upgrading Gradle to 8.10
3. Bumping IJ target to 2024.2.1
4. Cleaning up after migration
---------
Co-authored-by: Victor Kropp <victor.kropp@jetbrains.com>
* Set 2022.1.1 as base IJ version
Stable AS is based on 2022.1.1 now,
so we can drop supporting 2021.3
* Update IDE plugin target bytecode version to 11
When 2022.1 is used as a base for IDE plugin,
inline functions from the platform
& the bundled Kotlin plugin cannot be used
unless target bytecode version is set to 11.
* Update Intellij SDK Gradle plugin
* Check editor is not disposed before showing preview toolbar
#2663
* Add preview caret listener only to main editor
Previously we unset until-build in DSL.
However, Intellij SDK Gradle plugin DSL
does not support setting only since-build,
while omitting until-build.
So we effectively made the plugin
compatible with a single version of Intellij.
This change fixes that by disabling patching
since-build/until-build from DSL and setting
since-build version directly in plugin.xml
* Update Intellij Gradle plugin
* Drop support for Intellij < 2021.3
The latest stable Android Studio (Dolphin) is based on 2021.3,
so we can drop support for older versions.
* Remove usages of deprecated Intellij APIs
* Remove upper Intellij version limit
* Update Gradle used in tooling subprojects
* Update Kotlin in Compose Gradle plugin
* Decrease verbosity of Gradle plugin tests
* Disable mac sign test
* Add workflow to test Gradle plugin
* Fix custom jdk tests on Linux
* Make Compose Gradle plugin build compatible with Configuration cache
* Print tests summary
* Remove unused code
* Refactor tests configuration
* Turn off parallel execution
* Try adding windows runner
* Turn off fail fast
* Fix Windows test issues
#2368
* Adjust default proguard rules
The following rule is needed to fix tests on Windows:
```
-dontwarn org.graalvm.compiler.core.aarch64.AArch64NodeMatchRules_MatchStatementSet*
```
Other rules are just to make builds less noisy.
Kotlin's `*.internal` packages often contain
bytecode, which triggers ProGuard's notes.
However, these notes are not actionable for
most users, so we can ignore notes by default.
#2393
IDEA doesn't provide backward compatibility policy, and breaking changes can happen in any version, without prior deprecation:
https://plugins.jetbrains.com/docs/intellij/api-changes-list.html
~~Because of that, we can't remove `plugin.until.build`, and have to build Compose plugin for each new version of IDEA separately~~ (see Update)
~~Update 1:
I removed plugin.until.build anyway. In most cases there won't be a broken plugin. And if it will be broken, we will know it during IDEA EAP. Considering this, better when users don't wait the new version, and use already available one.~~
Update 2:
If we omit plugin.until.build, then it has default value +8. Returned, but made the default value big enough.
What we should do after that commit, is make sure, that we don't forget to check this compatibility. And ship a new stable version for every new stable IDEA.
The ideal way is to run `runPluginVerifier` on CI for the latest version, which will fail the build, if our plugin isn't compatible.
But for some reason, there is no EAP for IDEA 2022.3 here:
https://jb.gg/intellij-platform-builds-list
Using one version of Gradle improves build
performance and dev experience by
reusing Gradle daemons, using less storage
& copying for Gradle cache, etc
Remove:
```
__LATEST_COMPOSE_RELEASE_VERSION__
__KOTLIN_COMPOSE_VERSION__
System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION")
```
They pollute templates/examples.
Now, all paths where we need to change the version are hardcoded in the script.
Usage:
```
./replace.sh 1.0.0-rc6
```
This script is planned to run on CI
In the future I will add support for changing Kotlin version
* Fix compatibility with Intellij 2021.3
Resolves#1373
* Use Java reflection
* Set Java source & target compatibility for build helpers
Otherwise, Gradle might set Gradle metadata attributes in such way,
that transitive dependencies of published modules are not resolved
* Configure shadow jar manually
Applying plugin configures additional publication,
so that both .jar and -shadow.jar are published,
and additional configurations are added to Gradle metadata.
To avoid unexpected metadata resolution results,
ShadowJar task is now configured manually
* Fix closeStagingRepo JSON request
* Update publishing build-helpers in compose
* Activate preview toolwindow on receiving preview configuration
* Don't show preview toolwindow until a preview is requested
* Add icon to preview toolwindow
* Replace usage of 'de.fuerstenau.buildconfig'
with a custom replacement, because the plugin
does not support Gradle 7.0+ and
there has not been any commit activity in 5 years
(https://github.com/mfuerstenau/gradle-buildconfig-plugin);
* Update 'com.github.johnrengelman.shadow' to 7.0.0
The build `0.4.0-build182` upgrades
`kotlinx-collections-immutable` library
(which is used by the compose runtime) to 0.3.4,
which was published to maven central,
so most usages of sunsetting jcenter repo
can be removed now.
Resolves#557