Skip to content

Commit

Permalink
[FLINK-20845] Drop Scala 2.11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
NickBurkard authored Sep 30, 2021
1 parent 6b58562 commit d80d487
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 175 deletions.
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ stages:
vmImage: 'ubuntu-20.04'
e2e_pool_definition:
vmImage: 'ubuntu-20.04'
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.11"
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.12"
run_end_to_end: false
container: flink-build-container
jdk: 8
Expand All @@ -93,5 +93,5 @@ stages:
- template: tools/azure-pipelines/build-python-wheels.yml
parameters:
stage_name: cron_python_wheels
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.11"
environment: PROFILE="-Dhadoop.version=2.8.3 -Dinclude_hadoop_aws -Dscala-2.12"
container: flink-build-container
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This will be replaced by the maven artifact for flink-streaming-java that users
```xml
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.11</artifactId>
<artifactId>flink-streaming-java_2.12</artifactId>
<version><!-- current flink version --></version>
</dependency>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pygmentsUseClasses = true
TrainingExercises = "//github.com/apache/flink-training"

# This suffix is appended to the Scala-dependent Maven artifact names
ScalaVersion = "_2.11"
ScalaVersion = "_2.12"

ProjectHomepage = "//flink.apache.org"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Images for each supported combination of Flink and Scala versions are available,
For example, you can use the following aliases:
* `flink:latest``flink:<latest-flink>-scala_<latest-scala>`
* `flink:1.11``flink:1.11.<latest-flink-1.11>-scala_2.11`
* `flink:1.11``flink:1.11.<latest-flink-1.11>-scala_2.12`
<span class="label label-info">Note</span> It is recommended to always use an explicit version tag of the docker image that specifies both the needed Flink and Scala
versions (for example `flink:1.11-scala_2.12`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ For that reason, Flink for Scala 2.11 cannot be used with an application that us
Scala 2.12.

All Flink dependencies that (transitively) depend on Scala are suffixed with the
Scala version that they are built for, for example `flink-streaming-scala_2.11`.
Scala version that they are built for, for example `flink-streaming-scala_2.12`.

Developers that only use Java can pick any Scala version, Scala developers need to
pick the Scala version that matches their application's Scala version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Images for each supported combination of Flink and Scala versions are available,
For example, you can use the following aliases:
* `flink:latest``flink:<latest-flink>-scala_<latest-scala>`
* `flink:1.11``flink:1.11.<latest-flink-1.11>-scala_2.11`
* `flink:1.11``flink:1.11.<latest-flink-1.11>-scala_2.12`
<span class="label label-info">Note</span> It is recommended to always use an explicit version tag of the docker image that specifies both the needed Flink and Scala
versions (for example `flink:1.11-scala_2.12`).
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/dev/datastream/project-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ For that reason, Flink for Scala 2.11 cannot be used with an application that us
Scala 2.12.

All Flink dependencies that (transitively) depend on Scala are suffixed with the
Scala version that they are built for, for example `flink-streaming-scala_2.11`.
Scala version that they are built for, for example `flink-streaming-scala_2.12`.

Developers that only use Java can pick any Scala version, Scala developers need to
pick the Scala version that matches their application's Scala version.
Expand Down
9 changes: 0 additions & 9 deletions flink-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,6 @@ under the License.
</dependencies>

<profiles>
<profile>
<id>scala-2.11</id>
<activation>
<property>
<name>!scala-2.12</name>
</property>
</activation>
</profile>

<profile>
<!-- Creates/Removes the 'build-target' symlink in the root directory (only Unix systems) -->
<id>symlink-build-target</id>
Expand Down
11 changes: 5 additions & 6 deletions flink-dist/src/main/resources/META-INF/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project bundles the following dependencies under the Apache Software Licens
- com.ververica:frocksdbjni:6.20.3-ververica-1.0
- com.google.code.findbugs:jsr305:1.3.9
- com.twitter:chill-java:0.7.6
- com.twitter:chill_2.11:0.7.6
- com.twitter:chill_2.12:0.7.6
- commons-cli:commons-cli:1.4
- commons-collections:commons-collections:3.2.2
- commons-io:commons-io:2.11.0
Expand All @@ -29,11 +29,10 @@ See bundled license files for details.

The following dependencies all share the same BSD license which you find under licenses/LICENSE.scala.

- org.scala-lang:scala-compiler:2.11.12
- org.scala-lang:scala-library:2.11.12
- org.scala-lang:scala-reflect:2.11.12
- org.scala-lang.modules:scala-parser-combinators_2.11:1.1.1
- org.scala-lang.modules:scala-xml_2.11:1.0.5
- org.scala-lang:scala-compiler:2.12.7
- org.scala-lang:scala-library:2.12.7
- org.scala-lang:scala-reflect:2.12.7
- org.scala-lang.modules:scala-xml_2.12:1.0.6

This project bundles the following dependencies under the MIT/X11 license.
See bundled license files for details.
Expand Down
19 changes: 2 additions & 17 deletions flink-end-to-end-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ under the License.
<module>flink-python-test</module>
<module>flink-end-to-end-tests-hbase</module>
<module>flink-end-to-end-tests-pulsar</module>
<module>flink-glue-schema-registry-avro-test</module>
<module>flink-glue-schema-registry-json-test</module>
</modules>

<dependencyManagement>
Expand Down Expand Up @@ -171,23 +173,6 @@ under the License.
<e2e.exclude.org.apache.flink.testutils.junit.FailsOnJava11>true</e2e.exclude.org.apache.flink.testutils.junit.FailsOnJava11>
</properties>
</profile>

<profile>
<id>scala-2.12</id>
<properties>
<scala.version>2.12.7</scala.version>
<scala.binary.version>2.12</scala.binary.version>
</properties>
<activation>
<property>
<name>scala-2.12</name>
</property>
</activation>
<modules>
<module>flink-glue-schema-registry-avro-test</module>
<module>flink-glue-schema-registry-json-test</module>
</modules>
</profile>
</profiles>

<build>
Expand Down
6 changes: 1 addition & 5 deletions flink-end-to-end-tests/run-nightly-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,7 @@ LOG4J_PROPERTIES=${END_TO_END_DIR}/../tools/ci/log4j.properties

MVN_LOGGING_OPTIONS="-Dlog.dir=${DEBUG_FILES_OUTPUT_DIR} -DlogBackupDir=${DEBUG_FILES_OUTPUT_DIR} -Dlog4j.configurationFile=file://$LOG4J_PROPERTIES"
MVN_COMMON_OPTIONS="-Dflink.forkCount=2 -Dflink.forkCountTestPackage=2 -Dfast -Pskip-webui-build"
if [[ ${PROFILE} != *"scala-2.12"* ]]; then
e2e_modules=$(find flink-end-to-end-tests -mindepth 2 -maxdepth 5 -name 'pom.xml' -not -path '*glue-schema-registry*' -printf '%h\n' | sort -u | tr '\n' ',')
else
e2e_modules=$(find flink-end-to-end-tests -mindepth 2 -maxdepth 5 -name 'pom.xml' -printf '%h\n' | sort -u | tr '\n' ',')
fi
e2e_modules=$(find flink-end-to-end-tests -mindepth 2 -maxdepth 5 -name 'pom.xml' -printf '%h\n' | sort -u | tr '\n' ',')
e2e_modules="${e2e_modules},$(find flink-walkthroughs -mindepth 2 -maxdepth 2 -name 'pom.xml' -printf '%h\n' | sort -u | tr '\n' ',')"

PROFILE="$PROFILE -Pe2e-travis1 -Pe2e-travis2 -Pe2e-travis3 -Pe2e-travis4 -Pe2e-travis5 -Pe2e-travis6"
Expand Down
6 changes: 0 additions & 6 deletions flink-end-to-end-tests/test-scripts/test_quickstarts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ sed -i -e "s/org.apache.flink.quickstart.StreamingJob/org.apache.flink.quickstar

case $PROFILE in
*"scala-2.12"*)
echo "Changing scala version"
sed -i -e "s/scala.binary.version>2.11<\/scala.binary/scala.binary.version>2.12<\/scala.binary/" pom.xml
# for flink-quickstart-scala, also change scala version
sed -i -e "s/scala.version>2.11.12<\/scala.ver/scala.version>2.12.7<\/scala.ver/" pom.xml
;;
*"scala-2.11"*)
# all good
;;
*"scala-"*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public void testAvroRecovery() throws Exception {
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-hadoop-compatibility_2.11</artifactId>
<artifactId>flink-hadoop-compatibility_2.12</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
Expand Down
19 changes: 2 additions & 17 deletions flink-formats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ under the License.
<module>flink-orc-nohive</module>
<module>flink-hadoop-bulk</module>
<module>flink-format-common</module>
<module>flink-avro-glue-schema-registry</module>
<module>flink-json-glue-schema-registry</module>
</modules>

<!-- override these root dependencies as 'provided', so they don't end up
Expand Down Expand Up @@ -86,23 +88,6 @@ under the License.
<module>flink-sql-avro-confluent-registry</module>
</modules>
</profile>

<profile>
<id>scala-2.12</id>
<properties>
<scala.version>2.12.7</scala.version>
<scala.binary.version>2.12</scala.binary.version>
</properties>
<activation>
<property>
<name>scala-2.12</name>
</property>
</activation>
<modules>
<module>flink-avro-glue-schema-registry</module>
<module>flink-json-glue-schema-registry</module>
</modules>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>@project.version@</flink.version>
<target.java.version>@target.java.version@</target.java.version>
<scala.binary.version>2.11</scala.binary.version>
<scala.binary.version>2.12</scala.binary.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
<log4j.version>@log4j.version@</log4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>@project.version@</flink.version>
<target.java.version>@target.java.version@</target.java.version>
<scala.binary.version>2.11</scala.binary.version>
<scala.version>2.11.12</scala.version>
<scala.binary.version>2.12</scala.binary.version>
<scala.version>2.12.7</scala.version>
<log4j.version>@log4j.version@</log4j.version>
</properties>

Expand Down
5 changes: 5 additions & 0 deletions flink-rpc/flink-rpc-akka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ under the License.
<artifactId>scala-reflect</artifactId>
<version>${akka.scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-parser-combinators_${scala.binary.version}</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ object ClosureCleaner {

val LOG = LoggerFactory.getLogger(this.getClass)

private val isScala2_11 = scala.util.Properties.versionString.contains("2.11")

// Get an ASM class reader for a given class from the JAR that loaded it
private[scala] def getClassReader(cls: Class[_]): ClassReader = {
// Copy data over, before delegating to ClassReader - else we can run out of open file handles.
Expand Down Expand Up @@ -174,9 +172,6 @@ object ClosureCleaner {
* @param closure the closure to check.
*/
private def getSerializedLambda(closure: AnyRef): Option[SerializedLambda] = {
if (isScala2_11) {
return None
}
val isClosureCandidate =
closure.getClass.isSynthetic &&
closure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This project bundles the following dependencies under the Apache Software Licens
- org.apache.calcite:calcite-core:1.26.0
- org.apache.calcite:calcite-linq4j:1.26.0
- org.apache.calcite.avatica:avatica-core:1.17.0
- org.scala-lang.modules:scala-parser-combinators_2.11:1.1.1
- org.scala-lang.modules:scala-parser-combinators_2.12:1.1.1
- commons-codec:commons-codec:1.15
- commons-io:commons-io:2.11.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,28 @@ import scala.collection.JavaConverters._
*/
object JavaScalaConversionUtil {

// most of these methods are not necessary once we upgraded to Scala 2.12

def toJava[T](option: Option[T]): Optional[T] = option match {
case Some(v) => Optional.of(v)
case None => Optional.empty()
}

def toScala[T](option: Optional[T]): Option[T] = Option(option.orElse(null.asInstanceOf[T]))

def toJava[T](func: (T) => Unit): Consumer[T] = new Consumer[T] {
override def accept(t: T): Unit = {
func.apply(t)
}
}
def toJava[T](func: T => Unit): Consumer[T] =
func(_)

def toJava[K, V](func: (K, V) => Unit): BiConsumer[K, V] = new BiConsumer[K, V] {
override def accept(k: K, v: V): Unit = {
func.apply(k ,v)
}
}
def toJava[K, V](func: (K, V) => Unit): BiConsumer[K, V] =
func(_, _)

def toJava[I, O](func: (I) => O): Function[I, O] = new Function[I, O] {
override def apply(in: I): O = {
func.apply(in)
}
}
def toJava[I, O](func: I => O): Function[I, O] =
func(_)

def toJava[T0, T1](tuple: (T0, T1)): JTuple2[T0, T1] = {
def toJava[T0, T1](tuple: (T0, T1)): JTuple2[T0, T1] =
new JTuple2[T0, T1](tuple._1, tuple._2)
}

def toJava[T](seq: Seq[T]): JList[T] = {
def toJava[T](seq: Seq[T]): JList[T] =
seq.asJava
}

def toScala[T](list: JList[T]): Seq[T] = {
def toScala[T](list: JList[T]): Seq[T] =
list.asScala
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>@project.version@</flink.version>
<target.java.version>1.8</target.java.version>
<scala.binary.version>2.11</scala.binary.version>
<scala.binary.version>2.12</scala.binary.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
<log4j.version>@log4j.version@</log4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ under the License.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>@project.version@</flink.version>
<scala.binary.version>2.11</scala.binary.version>
<scala.version>2.11.12</scala.version>
<scala.binary.version>2.12</scala.binary.version>
<scala.version>2.12.7</scala.version>
<log4j.version>@log4j.version@</log4j.version>
</properties>

Expand Down
Loading

0 comments on commit d80d487

Please sign in to comment.