Merge pull request #2 from arosenberger/master
Add `make` as a compile task in the generator project, remove capnpc-jav...
This commit is contained in:
commit
c43f7a33fd
3 changed files with 26 additions and 19 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@ project/target
|
||||||
.idea
|
.idea
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
capnpc-java
|
||||||
|
generated/
|
4
Makefile
4
Makefile
|
@ -5,11 +5,10 @@ CAPNPC_JAVA_SOURCES=generator/src/main/cpp/compiler/capnpc-java.c++
|
||||||
|
|
||||||
.PHONY: all clean addressbook
|
.PHONY: all clean addressbook
|
||||||
|
|
||||||
all : capnpc-java addressbook
|
all : capnpc-java
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm capnpc-java
|
rm capnpc-java
|
||||||
sbt clean
|
|
||||||
|
|
||||||
capnpc-java : $(CAPNPC_JAVA_SOURCES)
|
capnpc-java : $(CAPNPC_JAVA_SOURCES)
|
||||||
$(CXX) $(CAPNPC_JAVA_SOURCES) $(CXX_FLAGS) -g -o capnpc-java
|
$(CXX) $(CAPNPC_JAVA_SOURCES) $(CXX_FLAGS) -g -o capnpc-java
|
||||||
|
@ -18,4 +17,3 @@ addressbook : capnpc-java
|
||||||
PWD=pwd
|
PWD=pwd
|
||||||
mkdir -p examples/src/main/generated
|
mkdir -p examples/src/main/generated
|
||||||
capnp compile -I$(PWD)/generator/src/main/cpp/compiler --src-prefix=examples/src/main/schema -o./capnpc-java:examples/src/main/generated examples/src/main/schema/addressbook.capnp
|
capnp compile -I$(PWD)/generator/src/main/cpp/compiler --src-prefix=examples/src/main/schema -o./capnpc-java:examples/src/main/generated examples/src/main/schema/addressbook.capnp
|
||||||
sbt examples/"compile"
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt._
|
import sbt._
|
||||||
import org.sbtidea.SbtIdeaPlugin._
|
|
||||||
|
|
||||||
object Build extends sbt.Build {
|
object Build extends sbt.Build {
|
||||||
|
|
||||||
|
@ -9,30 +8,25 @@ object Build extends sbt.Build {
|
||||||
id = "capnproto-java",
|
id = "capnproto-java",
|
||||||
base = file(".")
|
base = file(".")
|
||||||
).aggregate(generator, examples)
|
).aggregate(generator, examples)
|
||||||
|
.settings(cleanFiles <+= baseDirectory { base => base / "capnpc-java"})
|
||||||
|
|
||||||
lazy val generator =
|
lazy val generator =
|
||||||
project(
|
project(
|
||||||
id = "generator",
|
id = "generator",
|
||||||
base = file("generator")
|
base = file("generator")
|
||||||
).settings(Defaults.itSettings: _*)
|
).settings(Defaults.itSettings: _*)
|
||||||
.settings(compile <<= compile in Compile dependsOn(compile in Test, compile in IntegrationTest))
|
.settings(makeCppTask)
|
||||||
|
.settings(compile <<= compile in Compile dependsOn makeCpp)
|
||||||
|
|
||||||
lazy val examples =
|
lazy val examples =
|
||||||
project(
|
project(
|
||||||
id = "examples",
|
id = "examples",
|
||||||
base = file("examples")
|
base = file("examples")
|
||||||
).dependsOn(generator)
|
).dependsOn(generator)
|
||||||
|
.settings(makeExamplesTask)
|
||||||
|
.settings(compile <<= compile in Compile dependsOn makeExamples)
|
||||||
.settings(unmanagedSourceDirectories in Compile += sourceDirectory.value / "main" / "generated")
|
.settings(unmanagedSourceDirectories in Compile += sourceDirectory.value / "main" / "generated")
|
||||||
.settings(publish := {})
|
.settings(cleanFiles += sourceDirectory.value / "main" / "generated")
|
||||||
.settings(publishLocal := {})
|
|
||||||
.settings(fork in run := true)
|
|
||||||
.settings(outputStrategy := Some(StdoutOutput))
|
|
||||||
.settings(javaOptions in run ++= Seq(
|
|
||||||
"-ms2g",
|
|
||||||
"-mx2g",
|
|
||||||
"-XX:+AlwaysPreTouch",
|
|
||||||
"-XX:+TieredCompilation"
|
|
||||||
))
|
|
||||||
|
|
||||||
def project(id: String, base: File) =
|
def project(id: String, base: File) =
|
||||||
Project(
|
Project(
|
||||||
|
@ -43,6 +37,19 @@ object Build extends sbt.Build {
|
||||||
Shared.settings ++
|
Shared.settings ++
|
||||||
Seq(libraryDependencies ++= Shared.testDeps)
|
Seq(libraryDependencies ++= Shared.testDeps)
|
||||||
).configs(IntegrationTest)
|
).configs(IntegrationTest)
|
||||||
|
|
||||||
|
val makeCpp = taskKey[Unit]("Run make against the C++ code to create the Java code generator")
|
||||||
|
val makeCppTask = makeCpp := {
|
||||||
|
val makeResult = "make".!!
|
||||||
|
println(s"**** C++ Build Started\n$makeResult\n**** C++ Build Complete")
|
||||||
|
}
|
||||||
|
|
||||||
|
val makeExamples = taskKey[Unit]("Run capnp-java compiler against the addressbook schema")
|
||||||
|
val makeExamplesTask = makeExamples := {
|
||||||
|
Thread.sleep(1000)
|
||||||
|
val makeResult = "make addressbook".!!
|
||||||
|
println(s"**** CodeGen for Addressbook Started\n$makeResult\n**** CodeGen for Addressbook Complete")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Shared {
|
object Shared {
|
||||||
|
|
Loading…
Reference in a new issue