2014-03-25 00:20:23 -04:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership.
|
|
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
* (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2014-07-10 14:03:37 -04:00
|
|
|
import sbt._
|
|
|
|
import sbt.Keys.version
|
|
|
|
|
2014-06-11 13:47:06 -04:00
|
|
|
import com.typesafe.tools.mima.core._
|
|
|
|
import com.typesafe.tools.mima.core.MissingClassProblem
|
|
|
|
import com.typesafe.tools.mima.core.MissingTypesProblem
|
2014-06-01 20:27:05 -04:00
|
|
|
import com.typesafe.tools.mima.core.ProblemFilters._
|
2014-03-25 00:20:23 -04:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaKeys.{binaryIssueFilters, previousArtifact}
|
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
|
2014-07-10 14:03:37 -04:00
|
|
|
|
2014-03-25 00:20:23 -04:00
|
|
|
|
|
|
|
object MimaBuild {
|
2014-06-11 13:47:06 -04:00
|
|
|
|
|
|
|
def excludeMember(fullName: String) = Seq(
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem](fullName),
|
2014-11-19 00:24:18 -05:00
|
|
|
// Sometimes excluded methods have default arguments and
|
2014-09-16 00:14:00 -04:00
|
|
|
// they are translated into public methods/fields($default$) in generated
|
2014-10-16 21:38:45 -04:00
|
|
|
// bytecode. It is not possible to exhaustively list everything.
|
2014-09-16 00:14:00 -04:00
|
|
|
// But this should be okay.
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem](fullName+"$default$2"),
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem](fullName+"$default$1"),
|
2014-06-11 13:47:06 -04:00
|
|
|
ProblemFilters.exclude[MissingFieldProblem](fullName),
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem](fullName),
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem](fullName),
|
|
|
|
ProblemFilters.exclude[IncompatibleFieldTypeProblem](fullName)
|
|
|
|
)
|
|
|
|
|
2014-06-01 20:27:05 -04:00
|
|
|
// Exclude a single class and its corresponding object
|
2014-06-11 13:47:06 -04:00
|
|
|
def excludeClass(className: String) = Seq(
|
2014-06-01 20:27:05 -04:00
|
|
|
excludePackage(className),
|
|
|
|
ProblemFilters.exclude[MissingClassProblem](className),
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem](className),
|
|
|
|
excludePackage(className + "$"),
|
|
|
|
ProblemFilters.exclude[MissingClassProblem](className + "$"),
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem](className + "$")
|
|
|
|
)
|
2014-06-11 13:47:06 -04:00
|
|
|
|
2014-06-01 20:27:05 -04:00
|
|
|
// Exclude a Spark class, that is in the package org.apache.spark
|
|
|
|
def excludeSparkClass(className: String) = {
|
|
|
|
excludeClass("org.apache.spark." + className)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exclude a Spark package, that is in the package org.apache.spark
|
|
|
|
def excludeSparkPackage(packageName: String) = {
|
|
|
|
excludePackage("org.apache.spark." + packageName)
|
|
|
|
}
|
2014-03-25 00:20:23 -04:00
|
|
|
|
2014-07-10 14:03:37 -04:00
|
|
|
def ignoredABIProblems(base: File, currentSparkVersion: String) = {
|
2014-03-25 00:20:23 -04:00
|
|
|
|
|
|
|
// Excludes placed here will be used for all Spark versions
|
|
|
|
val defaultExcludes = Seq()
|
|
|
|
|
|
|
|
// Read package-private excludes from file
|
2014-06-11 13:47:06 -04:00
|
|
|
val classExcludeFilePath = file(base.getAbsolutePath + "/.generated-mima-class-excludes")
|
|
|
|
val memberExcludeFilePath = file(base.getAbsolutePath + "/.generated-mima-member-excludes")
|
|
|
|
|
2014-05-30 04:13:51 -04:00
|
|
|
val ignoredClasses: Seq[String] =
|
2014-06-11 13:47:06 -04:00
|
|
|
if (!classExcludeFilePath.exists()) {
|
2014-03-25 00:20:23 -04:00
|
|
|
Seq()
|
|
|
|
} else {
|
2014-06-11 13:47:06 -04:00
|
|
|
IO.read(classExcludeFilePath).split("\n")
|
2014-03-25 00:20:23 -04:00
|
|
|
}
|
|
|
|
|
2014-06-11 13:47:06 -04:00
|
|
|
val ignoredMembers: Seq[String] =
|
|
|
|
if (!memberExcludeFilePath.exists()) {
|
|
|
|
Seq()
|
|
|
|
} else {
|
|
|
|
IO.read(memberExcludeFilePath).split("\n")
|
|
|
|
}
|
2014-04-21 22:04:49 -04:00
|
|
|
|
2014-06-11 13:47:06 -04:00
|
|
|
defaultExcludes ++ ignoredClasses.flatMap(excludeClass) ++
|
2014-07-10 14:03:37 -04:00
|
|
|
ignoredMembers.flatMap(excludeMember) ++ MimaExcludes.excludes(currentSparkVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
def mimaSettings(sparkHome: File, projectRef: ProjectRef) = {
|
|
|
|
val organization = "org.apache.spark"
|
2015-03-20 14:43:57 -04:00
|
|
|
val previousSparkVersion = "1.3.0"
|
2014-07-10 14:03:37 -04:00
|
|
|
val fullId = "spark-" + projectRef.project + "_2.10"
|
2014-11-19 00:24:18 -05:00
|
|
|
mimaDefaultSettings ++
|
2014-07-10 14:03:37 -04:00
|
|
|
Seq(previousArtifact := Some(organization % fullId % previousSparkVersion),
|
|
|
|
binaryIssueFilters ++= ignoredABIProblems(sparkHome, version.value))
|
2014-03-25 00:20:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|