Skip to content

Commit

Permalink
Upgraded to latest version of JCodeModel to avoid dependency version …
Browse files Browse the repository at this point in the history
…conflicts.
  • Loading branch information
mcoblenz committed Jan 15, 2020
1 parent ad4f35e commit 51aef67
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 70 deletions.
4 changes: 1 addition & 3 deletions .idea/modules/Obsidian.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/sbt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ libraryDependencies += "junit" % "junit" % "4.12" % "test"
libraryDependencies += "com.google.protobuf" % "protobuf-java" % "3.10.0"
libraryDependencies += "org.hyperledger.fabric-chaincode-java" % "fabric-chaincode-shim" % "1.4.4"
libraryDependencies += "org.hyperledger.fabric-chaincode-java" % "fabric-chaincode-protos" % "1.4.4"
libraryDependencies += "com.helger" % "jcodemodel" % "3.0.3"
libraryDependencies += "com.helger" % "jcodemodel" % "3.3.0"
libraryDependencies += "org.apache.commons" % "commons-io" % "1.3.2"

/* settings for assembly */
Expand Down
2 changes: 1 addition & 1 deletion project/assembly.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.4
sbt.version=1.3.6
4 changes: 3 additions & 1 deletion src/main/scala/edu/cmu/cs/obsidian/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.apache.commons.io.FileUtils

import scala.collection.mutable.HashSet
import com.helger.jcodemodel.JCodeModel
import com.helger.jcodemodel.writer.JCMWriter
import edu.cmu.cs.obsidian.codegen._
import edu.cmu.cs.obsidian.parser._
import edu.cmu.cs.obsidian.protobuf._
Expand Down Expand Up @@ -321,7 +322,8 @@ object Main {
return false
}
case Right(javaModel) =>
javaModel.build(srcDir.toFile, srcDir.toFile, null)
val writer = new JCMWriter(javaModel)
writer.build(srcDir.toFile)
}


Expand Down
156 changes: 95 additions & 61 deletions src/main/scala/edu/cmu/cs/obsidian/codegen/CodeGen.scala

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ case class TranslationContext(
* this makes shadowing of this variable impossible */
case (None, GlobalFieldInfo(_)) => body.assign(JExpr._this().ref(name), assignExpr)
case (Some(_), GlobalFieldInfo(_)) => body.assign(contractClass.staticRef("this").ref(name), assignExpr)
case (_, StateSpecificFieldInfo(_, _, setFunc)) => body.invoke(setFunc).arg(assignExpr)
case (_, StateSpecificFieldInfo(_, _, setFunc)) =>
val setFuncInvocation = JExpr.invoke(setFunc).arg(assignExpr)
body.add(setFuncInvocation)
}
}
}
Expand Down

0 comments on commit 51aef67

Please sign in to comment.