jdtc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-12-18
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,8 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/jdtc.rb
7
+ bin/jdtc
8
+ compiler/ecj-3.4.1.jar
@@ -0,0 +1,5 @@
1
+ To call the JDT compiler, type jdtc in the command line, followed by the usual javac arguments.
2
+
3
+ For more information on jdtc, see http://jdtc.rubyforge.org
4
+
5
+
@@ -0,0 +1,254 @@
1
+ = JDTc
2
+
3
+ http://jdtc.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ JDTc provides a wrapper around eclipse's java compiler, this makes it a dropin replacement for sun's javac. This would be used to later build eclipse based plugins using rake/buildr using buildr4eclipse (http://buildr4eclipse.googlecode.com/)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ Provides a command line command to compile Java code.
12
+
13
+ == SYNOPSIS:
14
+
15
+ jdtc -classpath rt.jar Hello.java src/main/java
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * In development mode, JDTc requires the gem newgem, and you will need to install the latest JDT compiler by calling rake get_ecj[url_of_compiler_download]
20
+
21
+ == INSTALL:
22
+
23
+ sudo gem install jdtc
24
+
25
+ == LICENSE:
26
+
27
+ <p align=center><b>Eclipse Public License - v 1.0</b></p>
28
+
29
+ <p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
30
+ PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE, REPRODUCTION OR
31
+ DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
32
+ AGREEMENT.</p>
33
+
34
+ <p><b>1. DEFINITIONS</b></p>
35
+
36
+ <p>&quot;Contribution&quot; means:</p>
37
+
38
+ <p class="list">a) in the case of the initial Contributor, the initial
39
+ code and documentation distributed under this Agreement, and</p>
40
+ <p class="list">b) in the case of each subsequent Contributor:</p>
41
+ <p class="list">i) changes to the Program, and</p>
42
+ <p class="list">ii) additions to the Program;</p>
43
+ <p class="list">where such changes and/or additions to the Program
44
+ originate from and are distributed by that particular Contributor. A
45
+ Contribution 'originates' from a Contributor if it was added to the
46
+ Program by such Contributor itself or anyone acting on such
47
+ Contributor's behalf. Contributions do not include additions to the
48
+ Program which: (i) are separate modules of software distributed in
49
+ conjunction with the Program under their own license agreement, and (ii)
50
+ are not derivative works of the Program.</p>
51
+
52
+ <p>&quot;Contributor&quot; means any person or entity that distributes
53
+ the Program.</p>
54
+
55
+ <p>&quot;Licensed Patents&quot; mean patent claims licensable by a
56
+ Contributor which are necessarily infringed by the use or sale of its
57
+ Contribution alone or when combined with the Program.</p>
58
+
59
+ <p>&quot;Program&quot; means the Contributions distributed in accordance
60
+ with this Agreement.</p>
61
+
62
+ <p>&quot;Recipient&quot; means anyone who receives the Program under
63
+ this Agreement, including all Contributors.</p>
64
+
65
+ <p><b>2. GRANT OF RIGHTS</b></p>
66
+
67
+ <p class="list">a) Subject to the terms of this Agreement, each
68
+ Contributor hereby grants Recipient a non-exclusive, worldwide,
69
+ royalty-free copyright license to reproduce, prepare derivative works
70
+ of, publicly display, publicly perform, distribute and sublicense the
71
+ Contribution of such Contributor, if any, and such derivative works, in
72
+ source code and object code form.</p>
73
+
74
+ <p class="list">b) Subject to the terms of this Agreement, each
75
+ Contributor hereby grants Recipient a non-exclusive, worldwide,
76
+ royalty-free patent license under Licensed Patents to make, use, sell,
77
+ offer to sell, import and otherwise transfer the Contribution of such
78
+ Contributor, if any, in source code and object code form. This patent
79
+ license shall apply to the combination of the Contribution and the
80
+ Program if, at the time the Contribution is added by the Contributor,
81
+ such addition of the Contribution causes such combination to be covered
82
+ by the Licensed Patents. The patent license shall not apply to any other
83
+ combinations which include the Contribution. No hardware per se is
84
+ licensed hereunder.</p>
85
+
86
+ <p class="list">c) Recipient understands that although each Contributor
87
+ grants the licenses to its Contributions set forth herein, no assurances
88
+ are provided by any Contributor that the Program does not infringe the
89
+ patent or other intellectual property rights of any other entity. Each
90
+ Contributor disclaims any liability to Recipient for claims brought by
91
+ any other entity based on infringement of intellectual property rights
92
+ or otherwise. As a condition to exercising the rights and licenses
93
+ granted hereunder, each Recipient hereby assumes sole responsibility to
94
+ secure any other intellectual property rights needed, if any. For
95
+ example, if a third party patent license is required to allow Recipient
96
+ to distribute the Program, it is Recipient's responsibility to acquire
97
+ that license before distributing the Program.</p>
98
+
99
+ <p class="list">d) Each Contributor represents that to its knowledge it
100
+ has sufficient copyright rights in its Contribution, if any, to grant
101
+ the copyright license set forth in this Agreement.</p>
102
+
103
+ <p><b>3. REQUIREMENTS</b></p>
104
+
105
+ <p>A Contributor may choose to distribute the Program in object code
106
+ form under its own license agreement, provided that:</p>
107
+
108
+ <p class="list">a) it complies with the terms and conditions of this
109
+ Agreement; and</p>
110
+
111
+ <p class="list">b) its license agreement:</p>
112
+
113
+ <p class="list">i) effectively disclaims on behalf of all Contributors
114
+ all warranties and conditions, express and implied, including warranties
115
+ or conditions of title and non-infringement, and implied warranties or
116
+ conditions of merchantability and fitness for a particular purpose;</p>
117
+
118
+ <p class="list">ii) effectively excludes on behalf of all Contributors
119
+ all liability for damages, including direct, indirect, special,
120
+ incidental and consequential damages, such as lost profits;</p>
121
+
122
+ <p class="list">iii) states that any provisions which differ from this
123
+ Agreement are offered by that Contributor alone and not by any other
124
+ party; and</p>
125
+
126
+ <p class="list">iv) states that source code for the Program is available
127
+ from such Contributor, and informs licensees how to obtain it in a
128
+ reasonable manner on or through a medium customarily used for software
129
+ exchange.</p>
130
+
131
+ <p>When the Program is made available in source code form:</p>
132
+
133
+ <p class="list">a) it must be made available under this Agreement; and</p>
134
+
135
+ <p class="list">b) a copy of this Agreement must be included with each
136
+ copy of the Program.</p>
137
+
138
+ <p>Contributors may not remove or alter any copyright notices contained
139
+ within the Program.</p>
140
+
141
+ <p>Each Contributor must identify itself as the originator of its
142
+ Contribution, if any, in a manner that reasonably allows subsequent
143
+ Recipients to identify the originator of the Contribution.</p>
144
+
145
+ <p><b>4. COMMERCIAL DISTRIBUTION</b></p>
146
+
147
+ <p>Commercial distributors of software may accept certain
148
+ responsibilities with respect to end users, business partners and the
149
+ like. While this license is intended to facilitate the commercial use of
150
+ the Program, the Contributor who includes the Program in a commercial
151
+ product offering should do so in a manner which does not create
152
+ potential liability for other Contributors. Therefore, if a Contributor
153
+ includes the Program in a commercial product offering, such Contributor
154
+ (&quot;Commercial Contributor&quot;) hereby agrees to defend and
155
+ indemnify every other Contributor (&quot;Indemnified Contributor&quot;)
156
+ against any losses, damages and costs (collectively &quot;Losses&quot;)
157
+ arising from claims, lawsuits and other legal actions brought by a third
158
+ party against the Indemnified Contributor to the extent caused by the
159
+ acts or omissions of such Commercial Contributor in connection with its
160
+ distribution of the Program in a commercial product offering. The
161
+ obligations in this section do not apply to any claims or Losses
162
+ relating to any actual or alleged intellectual property infringement. In
163
+ order to qualify, an Indemnified Contributor must: a) promptly notify
164
+ the Commercial Contributor in writing of such claim, and b) allow the
165
+ Commercial Contributor to control, and cooperate with the Commercial
166
+ Contributor in, the defense and any related settlement negotiations. The
167
+ Indemnified Contributor may participate in any such claim at its own
168
+ expense.</p>
169
+
170
+ <p>For example, a Contributor might include the Program in a commercial
171
+ product offering, Product X. That Contributor is then a Commercial
172
+ Contributor. If that Commercial Contributor then makes performance
173
+ claims, or offers warranties related to Product X, those performance
174
+ claims and warranties are such Commercial Contributor's responsibility
175
+ alone. Under this section, the Commercial Contributor would have to
176
+ defend claims against the other Contributors related to those
177
+ performance claims and warranties, and if a court requires any other
178
+ Contributor to pay any damages as a result, the Commercial Contributor
179
+ must pay those damages.</p>
180
+
181
+ <p><b>5. NO WARRANTY</b></p>
182
+
183
+ <p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
184
+ PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS
185
+ OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
186
+ ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
187
+ OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
188
+ responsible for determining the appropriateness of using and
189
+ distributing the Program and assumes all risks associated with its
190
+ exercise of rights under this Agreement , including but not limited to
191
+ the risks and costs of program errors, compliance with applicable laws,
192
+ damage to or loss of data, programs or equipment, and unavailability or
193
+ interruption of operations.</p>
194
+
195
+ <p><b>6. DISCLAIMER OF LIABILITY</b></p>
196
+
197
+ <p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
198
+ NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
199
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
200
+ WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
201
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
202
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
203
+ DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
204
+ HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
205
+
206
+ <p><b>7. GENERAL</b></p>
207
+
208
+ <p>If any provision of this Agreement is invalid or unenforceable under
209
+ applicable law, it shall not affect the validity or enforceability of
210
+ the remainder of the terms of this Agreement, and without further action
211
+ by the parties hereto, such provision shall be reformed to the minimum
212
+ extent necessary to make such provision valid and enforceable.</p>
213
+
214
+ <p>If Recipient institutes patent litigation against any entity
215
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
216
+ Program itself (excluding combinations of the Program with other
217
+ software or hardware) infringes such Recipient's patent(s), then such
218
+ Recipient's rights granted under Section 2(b) shall terminate as of the
219
+ date such litigation is filed.</p>
220
+
221
+ <p>All Recipient's rights under this Agreement shall terminate if it
222
+ fails to comply with any of the material terms or conditions of this
223
+ Agreement and does not cure such failure in a reasonable period of time
224
+ after becoming aware of such noncompliance. If all Recipient's rights
225
+ under this Agreement terminate, Recipient agrees to cease use and
226
+ distribution of the Program as soon as reasonably practicable. However,
227
+ Recipient's obligations under this Agreement and any licenses granted by
228
+ Recipient relating to the Program shall continue and survive.</p>
229
+
230
+ <p>Everyone is permitted to copy and distribute copies of this
231
+ Agreement, but in order to avoid inconsistency the Agreement is
232
+ copyrighted and may only be modified in the following manner. The
233
+ Agreement Steward reserves the right to publish new versions (including
234
+ revisions) of this Agreement from time to time. No one other than the
235
+ Agreement Steward has the right to modify this Agreement. The Eclipse
236
+ Foundation is the initial Agreement Steward. The Eclipse Foundation may
237
+ assign the responsibility to serve as the Agreement Steward to a
238
+ suitable separate entity. Each new version of the Agreement will be
239
+ given a distinguishing version number. The Program (including
240
+ Contributions) may always be distributed subject to the version of the
241
+ Agreement under which it was received. In addition, after a new version
242
+ of the Agreement is published, Contributor may elect to distribute the
243
+ Program (including its Contributions) under the new version. Except as
244
+ expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
245
+ rights or licenses to the intellectual property of any Contributor under
246
+ this Agreement, whether expressly, by implication, estoppel or
247
+ otherwise. All rights in the Program not expressly granted under this
248
+ Agreement are reserved.</p>
249
+
250
+ <p>This Agreement is governed by the laws of the State of New York and
251
+ the intellectual property laws of the United States of America. No party
252
+ to this Agreement will bring a legal action under this Agreement more
253
+ than one year after the cause of action arose. Each party waives its
254
+ rights to a jury trial in any resulting litigation.</p>
@@ -0,0 +1,37 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/jdtc'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('jdtc', Jdtc::VERSION) do |p|
7
+ p.developer('Ketan Padegaonkar', 'ketanpadegaonkar@gmail.com')
8
+ p.developer('Antoine Toulme', 'antoine@lunar-ocean.com')
9
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
11
+ p.rubyforge_name = p.name # TODO this is default value
12
+ # p.extra_deps = [
13
+ # ['activesupport','>= 2.0.2'],
14
+ # ]
15
+ p.extra_dev_deps = [
16
+ ['newgem', ">= #{::Newgem::VERSION}"]
17
+ ]
18
+
19
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
21
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
22
+ p.rsync_args = '-av --delete --ignore-errors'
23
+ end
24
+
25
+ require 'newgem/tasks' # load /tasks/*.rake
26
+ Dir['tasks/**/*.rake'].each { |t| load t }
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ # task :default => [:spec, :features]
30
+
31
+ desc "Download the compiler"
32
+ task :get_ecj, :url do |t, args|
33
+ require 'open-uri'
34
+ require File.dirname(__FILE__) + '/lib/jdtc.rb'
35
+ system("mkdir #{File.dirname __FILE__}/compiler")
36
+ open("compiler/ecj-#{Jdtc::CURRENT_JDT_COMPILER}.jar","w").write(open(args.url).read)
37
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if ($*.include? "-h" or $*.include? "--help" or $*.include? "-help")
4
+ puts <<-HELP
5
+ jdtc - a wrapper for the JDT Batch compiler.
6
+ USAGE: jdtc <javac arguments>
7
+ HELP
8
+ exit
9
+ end
10
+
11
+ require "#{File.dirname __FILE__}/../lib/jdtc.rb"
12
+
13
+ include Jdtc
14
+
15
+ jdtc($*)
Binary file
@@ -0,0 +1,24 @@
1
+
2
+ module Jdtc
3
+ VERSION = '0.0.1'
4
+ CURRENT_JDT_COMPILER = '3.4.1'
5
+
6
+ def java_home
7
+ @home ||= ENV['JAVA_HOME']
8
+ end
9
+
10
+ def ecj_location
11
+ File.expand_path File.dirname(__FILE__) + "/../compiler/ecj-#{CURRENT_JDT_COMPILER}.jar"
12
+ end
13
+
14
+ def jdtc(args = [])
15
+ java_call = "java"
16
+ if (!java_home)
17
+ warn 'JAVA_HOME not set, defaulting on the java executable in the path if there is one.'
18
+ else
19
+ java_call = "$JAVA_HOME/bin/java"
20
+ end
21
+ puts "#{java_call} -classpath #{ecj_location} org.eclipse.jdt.internal.compiler.batch.Main #{args.join(" ")}"
22
+ system("#{java_call} -classpath #{ecj_location} org.eclipse.jdt.internal.compiler.batch.Main #{args.join(" ")}") or fail "Compilation failed"
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/jdtc'
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestJdtc < Test::Unit::TestCase
4
+ include Jdtc
5
+ def setup
6
+ end
7
+
8
+ def test_can_compile_a_hello_class
9
+
10
+
11
+ assert_nothing_raised do
12
+ jdtc([File.expand_path File.dirname(__FILE__) + "/java/Hello.java"])
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jdtc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ketan Padegaonkar
8
+ - Antoine Toulme
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-12-18 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: newgem
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.2.1
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: hoe
28
+ type: :development
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.8.0
35
+ version:
36
+ description: JDTc provides a wrapper around eclipse's java compiler, this makes it a dropin replacement for sun's javac. This would be used to later build eclipse based plugins using rake/buildr using buildr4eclipse (http://buildr4eclipse.googlecode.com/)
37
+ email:
38
+ - ketanpadegaonkar@gmail.com
39
+ - antoine@lunar-ocean.com
40
+ executables:
41
+ - jdtc
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - History.txt
46
+ - Manifest.txt
47
+ - PostInstall.txt
48
+ - README.rdoc
49
+ files:
50
+ - History.txt
51
+ - Manifest.txt
52
+ - PostInstall.txt
53
+ - README.rdoc
54
+ - Rakefile
55
+ - lib/jdtc.rb
56
+ - bin/jdtc
57
+ - compiler/ecj-3.4.1.jar
58
+ has_rdoc: true
59
+ homepage: http://jdtc.rubyforge.org
60
+ post_install_message: PostInstall.txt
61
+ rdoc_options:
62
+ - --main
63
+ - README.rdoc
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ requirements: []
79
+
80
+ rubyforge_project: jdtc
81
+ rubygems_version: 1.2.0
82
+ signing_key:
83
+ specification_version: 2
84
+ summary: JDTc provides a wrapper around eclipse's java compiler, this makes it a dropin replacement for sun's javac
85
+ test_files:
86
+ - test/test_helper.rb
87
+ - test/test_jdtc.rb