diff --git a/.github/workflows/presubmit.yaml b/.github/workflows/presubmit.yaml index 17763b9aa..87afa6d65 100644 --- a/.github/workflows/presubmit.yaml +++ b/.github/workflows/presubmit.yaml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - version: [2024.1, 2024.2, 2024.3] + version: [2024.1, 2024.2, 2024.3, 2025.1] steps: - name: checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 diff --git a/build.gradle.kts b/build.gradle.kts index 6f6455c20..34c3334e1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,7 @@ plugins { id("org.jetbrains.kotlin.jvm") version "2.1.0" } +// TODO(mossmana) These properties are duplicated in flutter-idea/build.gradle.kts and flutter-studio/build.gradle.kts. Should be consolidated. val flutterPluginVersion = providers.gradleProperty("flutterPluginVersion").get() val ideaProduct = providers.gradleProperty("ideaProduct").get() val ideaVersion = providers.gradleProperty("ideaVersion").get() @@ -45,6 +46,7 @@ val dartPluginVersion = providers.gradleProperty("dartPluginVersion").get() val androidPluginVersion = providers.gradleProperty("androidPluginVersion").get() val sinceBuildInput = providers.gradleProperty("sinceBuild").get() val untilBuildInput = providers.gradleProperty("untilBuild").get() +val javaVersion = providers.gradleProperty("javaVersion").get() group = "io.flutter" // For debugging purposes: @@ -55,15 +57,24 @@ println("dartPluginVersion: $dartPluginVersion") println("androidPluginVersion: $androidPluginVersion") println("sinceBuild: $sinceBuildInput") println("untilBuild: $untilBuildInput") +println("javaVersion: $javaVersion") println("group: $group") +var jvmVersion = JvmTarget.JVM_17 +if (javaVersion == "21") { + jvmVersion = JvmTarget.JVM_21 +} kotlin { compilerOptions { apiVersion.set(KotlinVersion.KOTLIN_1_9) - jvmTarget = JvmTarget.JVM_17 + jvmTarget = jvmVersion } } -val javaCompatibilityVersion = JavaVersion.VERSION_17 + +var javaCompatibilityVersion = JavaVersion.VERSION_17 +if (javaVersion == "21") { + javaCompatibilityVersion = JavaVersion.VERSION_21 +} java { sourceCompatibility = javaCompatibilityVersion targetCompatibility = javaCompatibilityVersion @@ -71,16 +82,16 @@ java { dependencies { intellijPlatform { - // Documentation on the create(...) methods: - // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#custom-target-platforms + // Documentation on the default target platform methods: + // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms if (ideaProduct == "android-studio") { - create(IntelliJPlatformType.AndroidStudio, ideaVersion) - } else {//if (ide == "ideaIC") { - create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion) + androidStudio(ideaVersion) + } else { // if (ideaProduct == "IC") { + intellijIdeaCommunity(ideaVersion) } testFramework(TestFrameworkType.Platform) - // Plugin dependnecy documentation: + // Plugin dependency documentation: // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins val bundledPluginList = mutableListOf( "com.intellij.java", @@ -90,8 +101,11 @@ dependencies { "org.jetbrains.kotlin", "org.jetbrains.plugins.gradle", "org.intellij.intelliLang", - "com.google.tools.ij.aiplugin", - ) + "org.intellij.intelliLang") + // TODO(mossman) - this check should be removed when 2025.1 supports the Gemini Code Assist plugin (https://github.com/flutter/flutter-intellij/issues/7965) + if (ideaVersion.startsWith("225.")) { + bundledPluginList.add("com.google.tools.ij.aiplugin") + } if (ideaProduct == "android-studio") { bundledPluginList.add("org.jetbrains.android") bundledPluginList.add("com.android.tools.idea.smali") diff --git a/flutter-idea/build.gradle.kts b/flutter-idea/build.gradle.kts index dcc97121c..305b5c598 100644 --- a/flutter-idea/build.gradle.kts +++ b/flutter-idea/build.gradle.kts @@ -35,32 +35,42 @@ val dartPluginVersion = providers.gradleProperty("dartPluginVersion").get() val androidPluginVersion = providers.gradleProperty("androidPluginVersion").get() val sinceBuildInput = providers.gradleProperty("sinceBuild").get() val untilBuildInput = providers.gradleProperty("untilBuild").get() +val javaVersion = providers.gradleProperty("javaVersion").get() group = "io.flutter" +var jvmVersion = JvmTarget.JVM_17 +if (javaVersion == "21") { + jvmVersion = JvmTarget.JVM_21 +} kotlin { compilerOptions { apiVersion.set(KotlinVersion.KOTLIN_1_9) - jvmTarget = JvmTarget.JVM_17 + jvmTarget = jvmVersion } } -val javaCompatibilityVersion = JavaVersion.VERSION_17 + +var javaCompatibilityVersion = JavaVersion.VERSION_17 +if (javaVersion == "21") { + javaCompatibilityVersion = JavaVersion.VERSION_21 +} java { sourceCompatibility = javaCompatibilityVersion targetCompatibility = javaCompatibilityVersion } + dependencies { intellijPlatform { - // Documentation on the create(...) methods: - // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#custom-target-platforms + // Documentation on the default target platform methods: + // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms if (ideaProduct == "android-studio") { - create(IntelliJPlatformType.AndroidStudio, ideaVersion) + androidStudio(ideaVersion) } else { // if (ideaProduct == "IC") { - create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion) + intellijIdeaCommunity(ideaVersion) } testFramework(TestFrameworkType.Platform) - // Plugin dependnecy documentation: + // Plugin dependency documentation: // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins val bundledPluginList = mutableListOf( "com.intellij.java", @@ -69,9 +79,11 @@ dependencies { "Git4Idea", "org.jetbrains.kotlin", "org.jetbrains.plugins.gradle", - "org.intellij.intelliLang", - "com.google.tools.ij.aiplugin", - ) + "org.intellij.intelliLang") + // TODO(mossman) - this check should be removed when 2025.1 supports the Gemini Code Assist plugin (https://github.com/flutter/flutter-intellij/issues/7965) + if (ideaVersion.startsWith("225.")) { + bundledPluginList.add("com.google.tools.ij.aiplugin") + } if (ideaProduct == "android-studio") { bundledPluginList.add("org.jetbrains.android") bundledPluginList.add("com.android.tools.idea.smali") diff --git a/flutter-studio/build.gradle.kts b/flutter-studio/build.gradle.kts index 1925d40d1..ab766137f 100644 --- a/flutter-studio/build.gradle.kts +++ b/flutter-studio/build.gradle.kts @@ -36,15 +36,24 @@ val dartPluginVersion = providers.gradleProperty("dartPluginVersion").get() val androidPluginVersion = providers.gradleProperty("androidPluginVersion").get() val sinceBuildInput = providers.gradleProperty("sinceBuild").get() val untilBuildInput = providers.gradleProperty("untilBuild").get() +val javaVersion = providers.gradleProperty("javaVersion").get() group = "io.flutter" +var jvmVersion = JvmTarget.JVM_17 +if (javaVersion == "21") { + jvmVersion = JvmTarget.JVM_21 +} kotlin { compilerOptions { apiVersion.set(KotlinVersion.KOTLIN_1_9) - jvmTarget = JvmTarget.JVM_17 + jvmTarget = jvmVersion } } -val javaCompatibilityVersion = JavaVersion.VERSION_17 + +var javaCompatibilityVersion = JavaVersion.VERSION_17 +if (javaVersion == "21") { + javaCompatibilityVersion = JavaVersion.VERSION_21 +} java { sourceCompatibility = javaCompatibilityVersion targetCompatibility = javaCompatibilityVersion @@ -52,12 +61,17 @@ java { dependencies { intellijPlatform { + // Documentation on the default target platform methods: + // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms if (ideaProduct == "android-studio") { - create(IntelliJPlatformType.AndroidStudio, ideaVersion) + androidStudio(ideaVersion) } else { // if (ideaProduct == "IC") { - create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion) + intellijIdeaCommunity(ideaVersion) } testFramework(TestFrameworkType.Platform) + + // Plugin dependency documentation: + // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins val bundledPluginList = mutableListOf( "com.intellij.java", "com.intellij.properties", @@ -66,8 +80,11 @@ dependencies { "org.jetbrains.kotlin", "org.jetbrains.plugins.gradle", "org.intellij.intelliLang", - "com.google.tools.ij.aiplugin", - ) + "org.intellij.intelliLang") + // TODO(mossman) - this check should be removed when 2025.1 supports the Gemini Code Assist plugin (https://github.com/flutter/flutter-intellij/issues/7965) + if (ideaVersion.startsWith("225.")) { + bundledPluginList.add("com.google.tools.ij.aiplugin") + } if (ideaProduct == "android-studio") { bundledPluginList.add("org.jetbrains.android") bundledPluginList.add("com.android.tools.idea.smali") diff --git a/product-matrix.json b/product-matrix.json index c51522b2e..90bcecbf0 100644 --- a/product-matrix.json +++ b/product-matrix.json @@ -13,7 +13,8 @@ "androidPluginVersion": "", "sinceBuild": "241", "untilBuild": "241.*", - "isUnitTestTarget": "false" + "isUnitTestTarget": "false", + "javaVersion": "17" }, { "channel": "stable", @@ -28,7 +29,8 @@ "androidPluginVersion": "", "sinceBuild": "242", "untilBuild": "242.*", - "isUnitTestTarget": "false" + "isUnitTestTarget": "false", + "javaVersion": "17" }, { "channel": "stable", @@ -39,11 +41,28 @@ "ideaProduct": "android-studio", "ideaVersion": "2024.3.1.10", "baseVersion": "243.22562.59", - "dartPluginVersion": " 243.21565.120", + "dartPluginVersion": "243.21565.120", "androidPluginVersion": "", "sinceBuild": "243", "untilBuild": "253.*", - "isUnitTestTarget": "true" + "isUnitTestTarget": "true", + "javaVersion": "17" + }, + { + "channel": "stable", + "comments": "IntelliJ 2025.1 Beta, Android Studio Meerkat 2024.3 EAP", + "name": "2025.1", + "version": "2025.1", + "ijVersion": "2025.1", + "ideaProduct": "IC", + "ideaVersion": "251.23774.16", + "baseVersion": "251.23774.16", + "dartPluginVersion": "251.23774.16", + "androidPluginVersion": "251.23774.16", + "sinceBuild": "243", + "untilBuild": "253.*", + "isUnitTestTarget": "true", + "javaVersion": "21" } ] } \ No newline at end of file diff --git a/tool/github.bat b/tool/github.bat index f913ee690..81949e1aa 100755 --- a/tool/github.bat +++ b/tool/github.bat @@ -21,7 +21,7 @@ call dart pub get --no-precompile cd ..\.. echo "run tests" -set JAVA_HOME=%JAVA_HOME_11_X64% +set JAVA_HOME=%JAVA_HOME_21_X64% echo "JAVA_HOME=%JAVA_HOME%" dart tool\plugin\bin\main.dart test diff --git a/tool/github.sh b/tool/github.sh index 305f2eb66..814db0d6f 100755 --- a/tool/github.sh +++ b/tool/github.sh @@ -7,7 +7,18 @@ # Fast fail the script on failures. set -e -export JAVA_HOME=$JAVA_HOME_17_X64 +# Log Java information that can be used whenever Java needs to be updated +echo "ls /usr/lib/jvm" +ls /usr/lib/jvm +echo "System Java version:" +java --version +echo "export JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-amd64" +export JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-amd64 +echo "ls $JAVA_HOME" +ls $JAVA_HOME +# Path is not used by the build, only by java --version +echo "export PATH=$JAVA_HOME/bin:\$PATH" +export PATH=$JAVA_HOME/bin:$PATH # Clone and configure Flutter to the latest stable release git clone --depth 1 https://github.com/flutter/flutter.git ../flutter @@ -16,6 +27,8 @@ flutter config --no-analytics flutter doctor export FLUTTER_SDK=`pwd`/../flutter +echo "IDEA_VERSION=$IDEA_VERSION" +# TODO(mossmana): https://github.com/flutter/flutter-intellij/issues/7967 if [ "$IDEA_VERSION" = "4.0" -o "$IDEA_VERSION" = "4.1" ] ; then # Install Java 8 if running on 4.0 or 4.1. @@ -26,7 +39,8 @@ if [ "$IDEA_VERSION" = "4.0" -o "$IDEA_VERSION" = "4.1" ] ; then fi -java -version +echo "java --version" +java --version # Get packages for the top-level grind script utilities. echo "pub get `pwd`" diff --git a/tool/kokoro/setup.sh b/tool/kokoro/setup.sh index 2ac1cc21f..4af2b2ebd 100644 --- a/tool/kokoro/setup.sh +++ b/tool/kokoro/setup.sh @@ -9,15 +9,28 @@ setup() { # that no confidential information is displayed. # set -x + # Set to 0 to use the system java, 1 to download/install a different version of java + export USE_CUSTOM_JAVA=0 + + echo "System Java version:" + java --version + # JAVA_HOME_OLD is used by runner.dart export JAVA_HOME_OLD=$JAVA_HOME - curl https://download.oracle.com/java/17/archive/jdk-17.0.4.1_macos-x64_bin.tar.gz > ../java.tar.gz - (cd ..; tar fx java.tar.gz) + echo "export JAVA_HOME_OLD=$JAVA_HOME" + + if [ "$USE_CUSTOM_JAVA" = 1 ] ; then + echo "curl https://download.oracle.com/java/17/archive/jdk-17.0.4.1_macos-x64_bin.tar.gz > ../java.tar.gz" + curl https://download.oracle.com/java/17/archive/jdk-17.0.4.1_macos-x64_bin.tar.gz > ../java.tar.gz + (cd ..; tar fx java.tar.gz) + echo "Custom java version:" + java --version + + export JAVA_HOME=`pwd`/../jdk-17.0.4.1.jdk/Contents/Home + echo "JAVA_HOME=$JAVA_HOME" + export PATH=$PATH:$JAVA_HOME/bin + fi - export JAVA_HOME=`pwd`/../jdk-17.0.4.1.jdk/Contents/Home - export PATH=$PATH:$JAVA_HOME/bin export JAVA_OPTS=" -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true" - echo "JAVA_HOME=$JAVA_HOME" - java -version # Clone and configure Flutter to the latest stable release git clone --depth 1 https://github.com/flutter/flutter.git ../flutter diff --git a/tool/plugin/lib/build_spec.dart b/tool/plugin/lib/build_spec.dart index d9671e496..13286680f 100644 --- a/tool/plugin/lib/build_spec.dart +++ b/tool/plugin/lib/build_spec.dart @@ -23,6 +23,7 @@ class BuildSpec { final String ideaVersion; final String androidPluginVersion; final String dartPluginVersion; + final String javaVersion; // TODO (jwren) can baseVersion be removed? final String baseVersion; @@ -50,7 +51,8 @@ class BuildSpec { untilBuild = json['untilBuild'] as String, filesToSkip = json['filesToSkip'] as List? ?? [], isUnitTestTarget = json['isUnitTestTarget'] == 'true', - isTestTarget = json['isTestTarget'] == 'true'; + isTestTarget = json['isTestTarget'] == 'true', + javaVersion = json['javaVersion'] as String; bool get copyIjVersion => isAndroidStudio && ijVersion != null; @@ -106,6 +108,7 @@ class BuildSpec { 'ideaVersion: $ideaVersion, ' 'baseVersion: $baseVersion, ' 'dartPluginVersion: $dartPluginVersion, ' + 'javaVersion: $javaVersion, ' 'since: $sinceBuild, ' 'until: $untilBuild, ' 'version: "$release")'; diff --git a/tool/plugin/lib/runner.dart b/tool/plugin/lib/runner.dart index 0e4442490..0887dad1a 100644 --- a/tool/plugin/lib/runner.dart +++ b/tool/plugin/lib/runner.dart @@ -73,6 +73,7 @@ androidPluginVersion=${spec.androidPluginVersion} sinceBuild=${spec.sinceBuild} untilBuild=${spec.untilBuild} testing=$testing +javaVersion=${spec.javaVersion} kotlin.stdlib.default.dependency=false org.gradle.parallel=true org.gradle.jvmargs=-Xms1024m -Xmx4048m