-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added optional configuration param 'translationsFile' that can be use… #149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an integration test that confirms that this works, possibly building more than one locale if convenient.
build-caching/src/main/java/com/vertispan/j2cl/build/PropertyTrackingConfig.java
Outdated
Show resolved
Hide resolved
hmm, looks like i have to revert my last commit (useFileConfig fix) coz it leads to:
and it doesn't matter where i put MyTranslationBundle.xtb |
That error comes when a) the string is first used as a set of maven coords, and if that fails, b) the string is used as a path to pick out a local file. The idea is that you might want to point at an external artifact
Probably you need to specify |
|
||
TranslationService.format = function () { | ||
return MSG_SOMETHING_HAPPENED; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolon, trailing newline
j2cl-maven-plugin/src/it/translation/src/main/webapp/WEB-INF/web.xml
Outdated
Show resolved
Hide resolved
*/ | ||
goog.provide('holder'); | ||
/** @define {string} */ | ||
holder.value = goog.define('holder.value', 'unknown'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing newline, copyright notice not required (following current repo conventions anyway - i might be wrong about it, but i'm not going to object if this file is copied without permission).
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not required to put this in (and you seem inconsistent about where you add these?)
<module>pom_default.xml</module> | ||
<module>pom_cz.xml</module> | ||
<module>pom_fr.xml</module> | ||
</modules> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider one more project with three blocks, one for each test, each with its own block to specify the expected file, path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I'm talking about, more than one execution in the same pom file, with different xtb file and local specified per execution - so that the user doesnt have to copy the whole pom file, just the execution.
build-caching/src/main/java/com/vertispan/j2cl/build/PropertyTrackingConfig.java
Outdated
Show resolved
Hide resolved
…d to pass XTB translation file to closure compiler
* removed useless elemental2-dom * packages renamed to example.test * translation folder renamed to translationsFile * fixed typos * added more test cases
edb6ef3
to
6378930
Compare
@Override | ||
public Optional<File> getTranslationsFile() { | ||
ConfigValueProvider.ConfigNode node = config.findNode("translationsFile"); | ||
if (node == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your call here, but you could drop the null check if you just used ofNullable below ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old school, forever old school :)
|
||
<build> | ||
<resources> | ||
<resource> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont understand what purpose this serves? might be necessary if you put the translations file into a jar, but not requires in this project right?
@@ -54,6 +54,7 @@ public Task resolve(Project project, Config config) { | |||
Collections.emptyList(), | |||
Collections.emptyMap(), | |||
Collections.emptyList(), | |||
config.getTranslationsFile(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work I think, it should error out actually - did you confirm that BUNDLE_JAR behaves when there is a translations file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So two notes, first of all you can never make calls on config
inside the lambda - it should error out (and i'm surprised it doesn't even with a non-empty translations file... worth looking into, that means nulls don't affect the cache), and second this is a BUNDLE so you should just give it Optional.empty()
@@ -96,6 +96,7 @@ public Task resolve(Project project, Config config) { | |||
Collections.emptyList(), | |||
Collections.emptyMap(), | |||
Collections.emptyList(),//TODO actually pass these in when we can restrict and cache them sanely | |||
config.getTranslationsFile(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as with JsZipBundleTask this shouldnt work, replace with Optional.empty()
@@ -244,6 +244,9 @@ | |||
@Parameter(defaultValue = "false") | |||
protected boolean enableSourcemaps; | |||
|
|||
@Parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs? can follow up in a later release, but it should be the same as BuildMojo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically this property should be added to WatchMojo too, so that it is doc'd correctly, and can be set at the parent - see how languageOut, checkAssertions, rewritePolyfills are all declared but unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to run WatchMojo in advanced mode ? anyway, i ll add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a thing, I'm not going to tell people they can't do it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading it now, it looks like you did miss WatchMojo?
@@ -112,6 +114,15 @@ public boolean compile( | |||
jscompArgs.add(extern); | |||
} | |||
|
|||
translationsFile.ifPresent(file -> { | |||
if(compilationLevel.equals(CompilationLevel.ADVANCED_OPTIMIZATIONS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stupid question perhaps, but are we sure this doesnt work with other modes?
...with that said, I dont think WHITESPACE_ONLY works at all right now, and I think SIMPLE is broken on windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niloc132 in this case we should create a check list of available modes and test PR againt them. I think, we can allow translationFiles to work with ADVANCED mode only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, defer it to another issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i think so
I approved this, but please be sure to file that issue. |
…ertispan#149) Closure-library offers some i18n features that closure-compiler will support at compile time by replacing strings based on the selected locale. This patch passes the required .xtb file to the closure compiler so that projects which use this feature can be specialized per-locale. With Vertispan#119, this could get more efficient, by optionally breaking up stage 3 closure compiler work into its own task.
…ertispan#149) Closure-library offers some i18n features that closure-compiler will support at compile time by replacing strings based on the selected locale. This patch passes the required .xtb file to the closure compiler so that projects which use this feature can be specialized per-locale. With Vertispan#119, this could get more efficient, by optionally breaking up stage 3 closure compiler work into its own task.
…d to pass XTB translation file to closure compiler