01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.dev.jjs;
17:
18: /**
19: * Controls options for the {@link JavaToJavaScriptCompiler}.
20: */
21: public class JJSOptions {
22:
23: private boolean aggressivelyOptimize = true;
24: private JsOutputOption output = JsOutputOption.OBFUSCATED;
25: private boolean validateOnly = false;
26:
27: public JJSOptions() {
28: }
29:
30: public JJSOptions(JJSOptions other) {
31: copyFrom(other);
32: }
33:
34: public void copyFrom(JJSOptions other) {
35: this .aggressivelyOptimize = other.aggressivelyOptimize;
36: this .output = other.output;
37: this .validateOnly = other.validateOnly;
38: }
39:
40: /**
41: * Returns the output format setting.
42: */
43: public JsOutputOption getOutput() {
44: return output;
45: }
46:
47: /**
48: * Returns true if the compiler should aggressively optimize.
49: */
50: public boolean isAggressivelyOptimize() {
51: return aggressivelyOptimize;
52: }
53:
54: /**
55: * Returns true if the compiler should run in validation mode, not producing
56: * any output.
57: */
58: public boolean isValidateOnly() {
59: return validateOnly;
60: }
61:
62: /**
63: * Sets whether or not the compiler should aggressively optimize.
64: */
65: public void setAggressivelyOptimize(boolean aggressivelyOptimize) {
66: this .aggressivelyOptimize = aggressivelyOptimize;
67: }
68:
69: /**
70: * Sets the compiler output option.
71: */
72: public void setOutput(JsOutputOption output) {
73: this .output = output;
74: }
75:
76: /**
77: * Sets whether or not the compiler should run in validation mode.
78: */
79: public void setValidateOnly(boolean validateOnly) {
80: this.validateOnly = validateOnly;
81: }
82: }
|