-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
1b891fa3.a6b88130.js
1 lines (1 loc) · 5.78 KB
/
1b891fa3.a6b88130.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{119:function(e,n,t){"use strict";t.d(n,"a",(function(){return u})),t.d(n,"b",(function(){return m}));var a=t(0),r=t.n(a);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var p=r.a.createContext({}),s=function(e){var n=r.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},u=function(e){var n=s(e.components);return r.a.createElement(p.Provider,{value:n},e.children)},b={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=s(t),d=a,m=u["".concat(l,".").concat(d)]||u[d]||b[d]||o;return t?r.a.createElement(m,c(c({ref:n},p),{},{components:t})):r.a.createElement(m,c({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=d;var c={};for(var i in n)hasOwnProperty.call(n,i)&&(c[i]=n[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var p=2;p<o;p++)l[p]=t[p];return r.a.createElement.apply(null,l)}return r.a.createElement.apply(null,t)}d.displayName="MDXCreateElement"},76:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return c})),t.d(n,"metadata",(function(){return i})),t.d(n,"toc",(function(){return p})),t.d(n,"default",(function(){return u}));var a=t(3),r=t(7),o=(t(0),t(119)),l=["components"],c={sidebar_label:"Installation",title:"Installing ScalaPB"},i={unversionedId:"installation",id:"installation",isDocsHomePage:!1,title:"Installing ScalaPB",description:"Installing in SBT (Recommended!)",source:"@site/../docs/target/mdoc/installation.md",slug:"/installation",permalink:"/docs/installation",version:"current",sidebar_label:"Installation",sidebar:"someSidebar",previous:{title:"ScalaPB: Scala Protocol Buffer Compiler",permalink:"/docs/"},next:{title:"Protocol Buffer Tutorial: Scala",permalink:"/docs/getting-started"}},p=[{value:"Installing in SBT (Recommended!)",id:"installing-in-sbt-recommended",children:[]},{value:"Running Standalone Using scalapbc",id:"running-standalone-using-scalapbc",children:[]},{value:"Running from Maven",id:"running-from-maven",children:[]},{value:"Next:",id:"next",children:[]}],s={toc:p};function u(e){var n=e.components,t=Object(r.a)(e,l);return Object(o.b)("wrapper",Object(a.a)({},s,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"installing-in-sbt-recommended"},"Installing in SBT (Recommended!)"),Object(o.b)("p",null,"To automatically generate Scala case classes for your messages add ScalaPB's\nsbt plugin to your project. Create a file named ",Object(o.b)("inlineCode",{parentName:"p"},"project/scalapb.sbt")," containing the following lines:"),Object(o.b)("pre",null,Object(o.b)("code",{parentName:"pre",className:"language-scala"},'addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")\n\nlibraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.11"\n')),Object(o.b)("p",null,"Add the following line to your ",Object(o.b)("inlineCode",{parentName:"p"},"build.sbt"),":"),Object(o.b)("pre",null,Object(o.b)("code",{parentName:"pre",className:"language-scala"},'Compile / PB.targets := Seq(\n scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"\n)\n\n// (optional) If you need scalapb/scalapb.proto or anything from\n// google/protobuf/*.proto\nlibraryDependencies ++= Seq(\n "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"\n)\n')),Object(o.b)("p",null,"ScalaPB will look for protocol buffer (",Object(o.b)("inlineCode",{parentName:"p"},".proto"),") files under ",Object(o.b)("inlineCode",{parentName:"p"},"src/main/protobuf"),", which can be customized. Running the ",Object(o.b)("inlineCode",{parentName:"p"},"compile")," command in sbt will generate Scala\nsources for your protos and compile them."),Object(o.b)("p",null,"For additional configuration options, see\n",Object(o.b)("a",{parentName:"p",href:"/docs/sbt-settings"},"ScalaPB SBT Settings"),"."),Object(o.b)("h2",{id:"running-standalone-using-scalapbc"},"Running Standalone Using scalapbc"),Object(o.b)("p",null,"If you would like to compile protocol buffers into Scala outside SBT, you can\nuse scalapbc (ScalaPB compiler)."),Object(o.b)("p",null,"See ",Object(o.b)("a",{parentName:"p",href:"/docs/scalapbc"},"ScalaPBC"),"."),Object(o.b)("h2",{id:"running-from-maven"},"Running from Maven"),Object(o.b)("p",null,"Using ScalaPBC, you can get maven to generate the code for you.\nCheck out the ",Object(o.b)("a",{parentName:"p",href:"https://github.com/thesamet/scalapb-maven-example"},"ScalaPB Maven example"),"."),Object(o.b)("h2",{id:"next"},"Next:"),Object(o.b)("p",null,"Read about the ",Object(o.b)("a",{parentName:"p",href:"/docs/generated-code"},"Generated Code"),"."))}u.isMDXComponent=!0}}]);