Created
July 15, 2017 23:08
-
-
Save erikerlandson/34f69c305eb224c7d9725566ad8ec190 to your computer and use it in GitHub Desktop.
Add a custom task and dependency to compile .pyc files and install them in the jarfile artifact
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val compilePython = taskKey[Unit]("Compile python files") | |
compilePython := { | |
val s: TaskStreams = streams.value | |
s.log.info("compiling python...") | |
val stat = (Seq("python2", "-m", "compileall", "python/") !) | |
if (stat == 0) { | |
s.log.info("python compile succeeded") | |
} else { | |
throw new IllegalStateException("python compile failed") | |
} | |
} | |
(packageBin in Compile) <<= (packageBin in Compile).dependsOn(compilePython) | |
mappings in (Compile, packageBin) ++= Seq( | |
(baseDirectory.value / "python" / "isarnproject" / "__init__.pyc") -> "isarnproject/__init__.pyc", | |
(baseDirectory.value / "python" / "isarnproject" / "sketches" / "__init__.pyc") -> "isarnproject/sketches/__init__.pyc", | |
(baseDirectory.value / "python" / "isarnproject" / "sketches" / "udaf" / "__init__.pyc") -> "isarnproject/sketches/udaf/__init__.pyc", | |
(baseDirectory.value / "python" / "isarnproject" / "sketches" / "udaf" / "tdigest.pyc") -> "isarnproject/sketches/udaf/tdigest.pyc", | |
(baseDirectory.value / "python" / "isarnproject" / "sketches" / "udt" / "__init__.pyc") -> "isarnproject/sketches/udt/__init__.pyc", | |
(baseDirectory.value / "python" / "isarnproject" / "sketches" / "udt" / "tdigest.pyc") -> "isarnproject/sketches/udt/tdigest.pyc" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment