Comparing version 0.8.0 to 0.9.0
@@ -79,2 +79,8 @@ | ||
/** @return {string} */ | ||
ProtoDescriptor.prototype.getFilePath = function () { | ||
return this._filePath | ||
} | ||
ProtoDescriptor.prototype.setPackage = function (package) { | ||
@@ -81,0 +87,0 @@ this._package = package |
@@ -28,2 +28,5 @@ | ||
/** @private {?} */ | ||
this._additionalCompilerOptions = null | ||
/** | ||
@@ -131,3 +134,13 @@ * Look for protos starting at the specified path. Defaults to cwd and default includes. | ||
/** | ||
* Set additional compiler options (these are merged onto the default SoyCompiler options). | ||
* @param {?} additionalCompilerOptions these merge onto the default {@link SoyOptions} | ||
* @return {Project} | ||
*/ | ||
Project.prototype.setAdditionalCompilerOptions = function (options) { | ||
this._additionalCompilerOptions = options | ||
return this | ||
} | ||
/** | ||
@@ -367,2 +380,5 @@ * Sets the output directory to use for each suffix. If no suffix is passed in, sets the default outDir. | ||
}) | ||
if (this._additionalCompilerOptions) { | ||
compiler.setOptions(this._additionalCompilerOptions) | ||
} | ||
@@ -375,10 +391,11 @@ return kew.nfcall(compiler.compileTemplates.bind(compiler, this._templateDir)).then(function () { | ||
var descriptor = this.getProtos(job.proto)[0] | ||
var baseFileName = descriptor.getName() | ||
var filePath = descriptor.getFilePath() | ||
if (job.suffix == '.java' && descriptor.getOption('java_outer_classname')) { | ||
baseFileName = descriptor.getOption('java_outer_classname') | ||
filePath = path.join(path.dirname(filePath), descriptor.getOption('java_outer_classname')) | ||
} else if ((job.suffix == '.h' || job.suffix == '.m') && descriptor.getOption('ios_classname')) { | ||
baseFileName = descriptor.getOption('ios_classname') | ||
filePath = path.join(path.dirname(filePath), descriptor.getOption('ios_classname')) | ||
} | ||
var outDir = (job.suffix && this._outDirs[job.suffix]) ? this._outDirs[job.suffix] : this._outDir | ||
var fileName = path.join(outDir, baseFileName + (job.suffix || this._defaultSuffix)) | ||
var relativeFilePath = path.relative(this._basePath, filePath) | ||
var fileName = path.join(outDir, relativeFilePath + (job.suffix || this._defaultSuffix)) | ||
var contents = compiler.render(job.template, descriptor.toTemplateObject()) | ||
@@ -385,0 +402,0 @@ promises.push(this._outputFn(descriptor, fileName, contents)) |
{ | ||
"name": "pbnj", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"keywords": ["protocol", "buffer", "proto", "protobuf", "parser", "codegen"], | ||
@@ -5,0 +5,0 @@ "description": "JavaScript protocol buffer schema parser and template based code generator", |
2000
105721
26