Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

CompileThriftPhp #6

Merged
merged 2 commits into from Oct 12, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -6,6 +6,7 @@ compile phase. Choose one of these three:


- `CompileThriftFinagle` - create the java bindings with alternative async interfaces for finagle, in `target/gen-java/` - `CompileThriftFinagle` - create the java bindings with alternative async interfaces for finagle, in `target/gen-java/`
- `CompileThriftJava` - create just the java bindings, in `target/gen-java/` - `CompileThriftJava` - create just the java bindings, in `target/gen-java/`
- `CompileThriftPhp` - create just the PHP bindings, in `target/gen-php/`
- `CompileThriftPython` - create just the python bindings, in `target/gen-py/ (or target/gen-py.twisted/)` - `CompileThriftPython` - create just the python bindings, in `target/gen-py/ (or target/gen-py.twisted/)`
- `CompileThriftRuby` - create just the ruby bindings, in `target/gen-ruby/` - `CompileThriftRuby` - create just the ruby bindings, in `target/gen-ruby/`
- `CompileThriftScala` - do `CompileThriftFinagle` and `CompileThriftRuby`, but also generate scala wrappers and implicit conversions in `target/gen-scala/` - `CompileThriftScala` - do `CompileThriftFinagle` and `CompileThriftRuby`, but also generate scala wrappers and implicit conversions in `target/gen-scala/`
Expand Down
21 changes: 21 additions & 0 deletions src/main/scala/com/twitter/sbt/CompileThriftPhp.scala
@@ -0,0 +1,21 @@
package com.twitter.sbt

import _root_.sbt._

/**
* Generate plain-old-php bindings
*/
trait CompileThriftPhp extends CompileThrift {
lazy val compileThriftPhp = compileThriftAction("php")

lazy val autoCompileThriftPhp = task {
if (autoCompileThriftEnabled) {
compileThriftPhp.run
} else {
log.info("%s: not auto-compiling thrift-php; you may need to run compile-thrift-php manually".format(name))
None
}
}

override def compileAction = super.compileAction dependsOn(autoCompileThriftPhp)
}
3 changes: 3 additions & 0 deletions src/main/scala/com/twitter/sbt/GeneratedSources.scala
Expand Up @@ -5,11 +5,13 @@ import _root_.sbt._
trait GeneratedSources extends DefaultProject { trait GeneratedSources extends DefaultProject {
def generatedJavaDirectoryName = "gen-java" def generatedJavaDirectoryName = "gen-java"
def generatedRubyDirectoryName = "gen-rb" def generatedRubyDirectoryName = "gen-rb"
def generatedPhpDirectoryName = "gen-php"
def generatedPythonDirectoryName = "gen-py" def generatedPythonDirectoryName = "gen-py"
def generatedScalaDirectoryName = "gen-scala" def generatedScalaDirectoryName = "gen-scala"


def generatedJavaPath = outputPath / generatedJavaDirectoryName def generatedJavaPath = outputPath / generatedJavaDirectoryName
def generatedRubyPath = outputPath / generatedRubyDirectoryName def generatedRubyPath = outputPath / generatedRubyDirectoryName
def generatedPhpPath = outputPath / generatedPhpDirectoryName
def generatedPythonPath = outputPath / generatedPythonDirectoryName def generatedPythonPath = outputPath / generatedPythonDirectoryName
def generatedScalaPath = outputPath / generatedScalaDirectoryName def generatedScalaPath = outputPath / generatedScalaDirectoryName


Expand All @@ -18,6 +20,7 @@ trait GeneratedSources extends DefaultProject {
lazy val cleanGenerated = ( lazy val cleanGenerated = (
cleanTask(generatedJavaPath) && cleanTask(generatedRubyPath) cleanTask(generatedJavaPath) && cleanTask(generatedRubyPath)
&& cleanTask(generatedPythonPath) && cleanTask(generatedScalaDirectoryName) && cleanTask(generatedPythonPath) && cleanTask(generatedScalaDirectoryName)
&& cleanTask(generatedPhpPath)
) describedAs "Clean generated source folders" ) describedAs "Clean generated source folders"


override def cleanAction = super.cleanAction dependsOn(cleanGenerated) override def cleanAction = super.cleanAction dependsOn(cleanGenerated)
Expand Down