cxxproject 0.6.29 → 0.6.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/README.md +195 -65
  2. data/lib/cxxproject/buildingblocks/building_block.rb +1 -1
  3. data/lib/cxxproject/buildingblocks/executable.rb +3 -0
  4. data/lib/cxxproject/buildingblocks/has_dependencies_mixin.rb +5 -5
  5. data/lib/cxxproject/buildingblocks/has_sources_mixin.rb +30 -16
  6. data/lib/cxxproject/buildingblocks/single_source.rb +0 -1
  7. data/lib/cxxproject/ext/rake_listener.rb +11 -13
  8. data/lib/cxxproject/plugin_context.rb +6 -4
  9. data/lib/cxxproject/toolchain/colorizing_formatter.rb +8 -5
  10. data/lib/cxxproject/utils/printer.rb +6 -6
  11. data/lib/cxxproject/version.rb +1 -1
  12. data/lib/cxxproject.rb +0 -1
  13. metadata +37 -145
  14. data/.gitignore +0 -18
  15. data/.rvmrc +0 -1
  16. data/Gemfile +0 -6
  17. data/Gemfile.lock +0 -35
  18. data/Rakefile.rb +0 -125
  19. data/cxxproject.gemspec +0 -22
  20. data/example/.gitignore +0 -1
  21. data/example/Rakefile.rb +0 -35
  22. data/example/big_project/.gitignore +0 -2
  23. data/example/big_project/Rakefile_generator.rb +0 -80
  24. data/example/big_project/fak.h +0 -9
  25. data/example/custom/.gitignore +0 -1
  26. data/example/custom/Rakefile.rb +0 -12
  27. data/example/custom/foo.cpp +0 -5
  28. data/example/custom/project.rb +0 -27
  29. data/example/dependency_tests/Rakefile.rb +0 -3
  30. data/example/dependency_tests/help1.h +0 -12
  31. data/example/dependency_tests/help2.h +0 -10
  32. data/example/dependency_tests/main.cpp +0 -6
  33. data/example/dependency_tests/project.rb +0 -3
  34. data/example/generator/Rakefile.rb +0 -12
  35. data/example/generator/main/main.cpp +0 -3
  36. data/example/generator/main/project/project.rb +0 -3
  37. data/example/oneFileOnly/Rakefile.rb +0 -3
  38. data/example/oneFileOnly/config.h +0 -2
  39. data/example/oneFileOnly/main.cpp +0 -8
  40. data/example/oneFileOnly/project_compile.rb +0 -3
  41. data/example/protobuf/.gitignore +0 -4
  42. data/example/protobuf/Rakefile.rb +0 -70
  43. data/example/protobuf/addressbook/addressbook.proto +0 -24
  44. data/example/protobuf/addressbook/addressbook_read.cc +0 -67
  45. data/example/protobuf/addressbook/addressbook_write.cc +0 -93
  46. data/example/protobuf/addressbook/project.rb +0 -16
  47. data/example/protobuf/protobuf.files +0 -37
  48. data/example/protobuf/protobuf_project.rb +0 -9
  49. data/example/simpleUnitTest/Rakefile.rb +0 -4
  50. data/example/simpleUnitTest/atest.cpp +0 -16
  51. data/example/simpleUnitTest/atest.h +0 -11
  52. data/example/simpleUnitTest/project.rb +0 -5
  53. data/example/simpleUnitTest/test.cpp +0 -13
  54. data/example/strange_dirs/Rakefile.rb +0 -4
  55. data/example/strange_dirs/lazyLib/project.rb +0 -5
  56. data/example/strange_dirs/main/main.cpp +0 -5
  57. data/example/strange_dirs/main/project.rb +0 -5
  58. data/example/strange_dirs/src/test.cpp +0 -4
  59. data/example/test.rb +0 -10
  60. data/example/three_tests/Rakefile.rb +0 -5
  61. data/example/three_tests/allsuites/project.rb +0 -4
  62. data/example/three_tests/main/main.cpp +0 -13
  63. data/example/three_tests/main/project.rb +0 -5
  64. data/example/three_tests/suite1/project.rb +0 -6
  65. data/example/three_tests/suite1/suite1.cpp +0 -3
  66. data/example/three_tests/suite1/suite1.h +0 -28
  67. data/example/three_tests/suite2/project.rb +0 -6
  68. data/example/three_tests/suite2/suite2.cpp +0 -3
  69. data/example/three_tests/suite2/suite2.h +0 -29
  70. data/junit.rb +0 -91
  71. data/lib/cxxproject/ext/string.rb +0 -9
  72. data/plugins/tmp/.rvmrc +0 -1
  73. data/plugins/tmp/BuildDir/objects/testme/test.o +0 -0
  74. data/plugins/tmp/BuildDir/objects/testme/test.o.d +0 -1
  75. data/plugins/tmp/BuildDir/testme.exe +0 -0
  76. data/plugins/tmp/Rakefile.rb +0 -6
  77. data/plugins/tmp/project.rb +0 -6
  78. data/plugins/tmp/reinstall/Rakefile.rb +0 -15
  79. data/plugins/tmp/test.cpp +0 -7
  80. data/rake_helper/perftools.rb +0 -34
  81. data/rake_helper/spec.rb +0 -65
  82. data/roodi.yml +0 -8
  83. data/spec/building_block_spec.rb +0 -103
  84. data/spec/file_ext_spec.rb +0 -30
  85. data/spec/ide_interface_spec.rb +0 -41
  86. data/spec/plugin_context_spec.rb +0 -57
  87. data/spec/provider_spec.rb +0 -39
  88. data/spec/rake_listener_ext_spec.rb +0 -58
  89. data/spec/spec_helper.rb +0 -18
  90. data/spec/string_spec.rb +0 -11
  91. data/spec/testdata/basic/exe12/help.cpp +0 -5
  92. data/spec/testdata/basic/exe12/help.h +0 -6
  93. data/spec/testdata/basic/exe12/main.cpp +0 -10
  94. data/spec/testdata/basic/exe12/project.rb +0 -5
  95. data/spec/testdata/basic/lib1/lib1.cpp +0 -7
  96. data/spec/testdata/basic/lib1/lib1.h +0 -8
  97. data/spec/testdata/basic/lib1/project.rb +0 -5
  98. data/spec/testdata/basic/lib2/lib2.cpp +0 -17
  99. data/spec/testdata/basic/lib2/lib2.h +0 -6
  100. data/spec/testdata/basic/lib2/project.rb +0 -8
  101. data/spec/testdata/multiple_levels/libs/lib1/lib1.cpp +0 -7
  102. data/spec/testdata/multiple_levels/libs/lib1/lib1.h +0 -8
  103. data/spec/testdata/multiple_levels/libs/lib1/project.rb +0 -5
  104. data/spec/testdata/multiple_levels/libs/lib2/lib2.cpp +0 -21
  105. data/spec/testdata/multiple_levels/libs/lib2/lib2.h +0 -6
  106. data/spec/testdata/multiple_levels/libs/lib2/project.rb +0 -19
  107. data/spec/testdata/multiple_levels/mainproject/basic/help.cpp +0 -5
  108. data/spec/testdata/multiple_levels/mainproject/basic/help.h +0 -6
  109. data/spec/testdata/multiple_levels/mainproject/basic/main.cpp +0 -10
  110. data/spec/testdata/multiple_levels/mainproject/basic/project.rb +0 -8
  111. data/spec/testdata/onlyOneHeader/.gitignore +0 -1
  112. data/spec/testdata/onlyOneHeader/Rakefile.rb +0 -4
  113. data/spec/testdata/onlyOneHeader/help.cpp +0 -5
  114. data/spec/testdata/onlyOneHeader/help.h +0 -7
  115. data/spec/testdata/onlyOneHeader/main.cpp +0 -8
  116. data/spec/testdata/onlyOneHeader/project.rb +0 -4
  117. data/spec/testdata/onlyOneHeader/testin.c +0 -0
  118. data/spec/toolchain_spec.rb +0 -29
@@ -1,5 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
- require 'cxxproject'
3
- BuildDir='build'
4
- CxxProject2Rake.new(Dir.glob('**/*project.rb'), BuildDir, "gcc")
5
-
@@ -1,4 +0,0 @@
1
- cxx_configuration do
2
- exe "allsuites",
3
- :dependencies => ['suite1_lib', 'suite2_lib', 'main']
4
- end
@@ -1,13 +0,0 @@
1
- #include <cassert>
2
-
3
- #include <cppunit/TestCase.h>
4
- #include <cppunit/ui/text/TestRunner.h>
5
- #include <cppunit/extensions/TestFactoryRegistry.h>
6
-
7
- int main( int argc, char **argv) {
8
- CppUnit::TextUi::TestRunner runner;
9
- CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
10
- runner.addTest( registry.makeTest() );
11
- bool wasSuccessful = runner.run( );
12
- return wasSuccessful ? 0 : 1;
13
- }
@@ -1,5 +0,0 @@
1
- cxx_configuration do
2
- source_lib "main",
3
- :sources => ['main.cpp'],
4
- :dependencies => [BinaryLibrary.new('cppunit')]
5
- end
@@ -1,6 +0,0 @@
1
- cxx_configuration do
2
- exe "suite1",
3
- :dependencies => ['suite1_lib', 'main']
4
- source_lib "suite1_lib",
5
- :sources => FileList.new('**/*.cpp')
6
- end
@@ -1,3 +0,0 @@
1
- #include "suite1.h"
2
-
3
- CPPUNIT_TEST_SUITE_REGISTRATION( Suite1 );
@@ -1,28 +0,0 @@
1
- #ifndef suite1_h_
2
- #define suite1_h_
3
-
4
- #include <cppunit/TestCase.h>
5
- #include <cppunit/extensions/HelperMacros.h>
6
-
7
- class Suite1 : public CppUnit::TestFixture {
8
-
9
- public:
10
-
11
- void setUp() {
12
- }
13
-
14
-
15
- void tearDown() {
16
- }
17
-
18
- void test1() {
19
- CPPUNIT_ASSERT_MESSAGE( "hat geklappt", true );
20
- }
21
-
22
- CPPUNIT_TEST_SUITE( Suite1 );
23
- CPPUNIT_TEST( test1 );
24
- CPPUNIT_TEST_SUITE_END();
25
-
26
- };
27
-
28
- #endif
@@ -1,6 +0,0 @@
1
- cxx_configuration do
2
- exe "suite2",
3
- :dependencies => ['suite2_lib', 'main']
4
- source_lib "suite2_lib",
5
- :sources => FileList.new('**/*.cpp')
6
- end
@@ -1,3 +0,0 @@
1
- #include "suite2.h"
2
-
3
- CPPUNIT_TEST_SUITE_REGISTRATION( Suite2 );
@@ -1,29 +0,0 @@
1
- #ifndef suite2_h_
2
- #define suite2_h_
3
-
4
- #include <cppunit/TestCase.h>
5
- #include <cppunit/extensions/HelperMacros.h>
6
-
7
- class Suite2 : public CppUnit::TestFixture {
8
-
9
- public:
10
-
11
- void setUp() {
12
- }
13
-
14
-
15
- void tearDown() {
16
- }
17
-
18
- void test2() {
19
- printf("inside test2\n");
20
- CPPUNIT_ASSERT_MESSAGE( "hat auch geklappt", true );
21
- }
22
-
23
- CPPUNIT_TEST_SUITE( Suite2 );
24
- CPPUNIT_TEST( test2 );
25
- CPPUNIT_TEST_SUITE_END();
26
-
27
- };
28
-
29
- #endif
data/junit.rb DELETED
@@ -1,91 +0,0 @@
1
- =begin
2
-
3
- Copyright (c) 2012, Nathaniel Ritmeyer
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice,
10
- this list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name Nathaniel Ritmeyer nor the names of contributors to
17
- this software may be used to endorse or promote products derived from this
18
- software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
21
- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
-
32
- =end
33
-
34
- require 'time'
35
- require 'builder'
36
- require 'rspec/core/formatters/base_formatter'
37
-
38
- class JUnit < RSpec::Core::Formatters::BaseFormatter
39
- def initialize output
40
- super output
41
- @test_results = []
42
- end
43
-
44
- def example_passed example
45
- @test_results << example
46
- end
47
-
48
- def example_failed example
49
- @test_results << example
50
- end
51
-
52
- def example_pending example
53
- @test_results << example
54
- end
55
-
56
- def failure_details_for example
57
- exception = example.metadata[:execution_result][:exception]
58
- exception.nil? ? "" : "#{exception.message}\n#{format_backtrace(exception.backtrace, example).join("\n")}"
59
- end
60
-
61
- def full_name_for example
62
- test_name = ""
63
- current_example_group = example.metadata[:example_group]
64
- until current_example_group.nil? do
65
- test_name = "#{current_example_group[:description]}." + test_name
66
- current_example_group = current_example_group[:example_group]
67
- end
68
- test_name << example.metadata[:description]
69
- end
70
-
71
- def dump_summary duration, example_count, failure_count, pending_count
72
- builder = Builder::XmlMarkup.new :indent => 2
73
- builder.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
74
- builder.testsuite :errors => 0, :failures => failure_count, :skipped => pending_count, :tests => example_count, :time => duration, :timestamp => Time.now.iso8601 do
75
- builder.properties
76
- @test_results.each do |test|
77
- builder.testcase :classname => full_name_for(test), :name => test.metadata[:full_description], :time => test.metadata[:execution_result][:run_time] do
78
- case test.metadata[:execution_result][:status]
79
- when "failed"
80
- builder.failure :message => "failed #{test.metadata[:full_description]}", :type => "failed" do
81
- builder.cdata! failure_details_for test
82
- end
83
- when "pending" then builder.skipped
84
- end
85
- end
86
- end
87
- end
88
- output.puts builder.target!
89
- end
90
- end
91
-
@@ -1,9 +0,0 @@
1
- class String
2
- def remove_from_start(text)
3
- if index(text) == 0
4
- self[text.size..-1]
5
- else
6
- self
7
- end
8
- end
9
- end
data/plugins/tmp/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@cxxgcctoolchaintest --create
@@ -1 +0,0 @@
1
- --- []
Binary file
@@ -1,6 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
- require 'cxxproject'
3
- BuildDir = "BuildDir"
4
-
5
- dependent_projects = ['./project.rb']
6
- CxxProject2Rake.new(dependent_projects, BuildDir, "clang", './')
@@ -1,6 +0,0 @@
1
- cxx_configuration do
2
- exe "testme",
3
- :sources => FileList['**/*.cpp'],
4
- :includes => ['.'],
5
- :dependencies => []
6
- end
@@ -1,15 +0,0 @@
1
- require 'rake/clean'
2
-
3
- desc 'reinstall plugins'
4
- task :reinstall do
5
- toolchainpath="../../../plugins/"
6
- plugins = ["gcc","clang","diab"]
7
- plugins.each do |p|
8
- plugin = "cxxproject_#{p}toolchain"
9
- sh "gem uninstall #{plugin}"
10
- cd "#{toolchainpath}toolchain#{p}" do
11
- sh "gem build #{p}.gemspec"
12
- sh "gem install #{plugin}"
13
- end
14
- end
15
- end
data/plugins/tmp/test.cpp DELETED
@@ -1,7 +0,0 @@
1
- #include <stdio.h>
2
-
3
- int main(int argc, const char *argv[])
4
- {
5
- printf("hello world\n");
6
- return 0;
7
- }
@@ -1,34 +0,0 @@
1
- begin
2
- require 'perftools'
3
- namespace :perftools do
4
- def my_cd
5
- cd('example/big_project', :verbose => false) do
6
- yield
7
- end
8
- end
9
- task :clean_big_project do
10
- my_cd do
11
- require 'fileutils'
12
- FileUtils.rm_rf('build')
13
- FileUtils.rm_rf('gen')
14
- end
15
- end
16
- task :generate_big_project => [:clean_big_project] do
17
- my_cd do
18
- sh 'rake -f Rakefile_generator.rb'
19
- end
20
- end
21
- task :big_project => [:generate_big_project] do
22
- my_cd do
23
- sh 'CPUPROFILE=./test.profile RUBYOPT="-r`gem which perftools | tail -1`" ruby gen/Rakefile.rb'
24
- end
25
- end
26
- desc 'Show perftools profile'
27
- task :show_profile => [:big_project] do
28
- my_cd do
29
- sh 'pprof.rb --web profile'
30
- end
31
- end
32
- end
33
- rescue LoadError => e
34
- end
data/rake_helper/spec.rb DELETED
@@ -1,65 +0,0 @@
1
- SPEC_PATTERN ='spec/**/*_spec.rb'
2
- require './lib/cxxproject/utils/optional'
3
- def rcov_for_18
4
- use_rcov = true
5
- begin
6
- gem "rcov"
7
- rescue LoadError
8
- warn "rcov not installed...code coverage will not be measured!"
9
- use_rcov = false
10
- end
11
- use_rcov
12
- end
13
-
14
-
15
- def coverage
16
- load_rcov = lambda do
17
- require 'rcov'
18
- RSpec::Core::RakeTask.new(:coverage) do |t|
19
- t.pattern = SPEC_PATTERN
20
- t.rcov = true
21
- t.rcov_opts = ['--exclude', '.*/gems/.*']
22
- end
23
- end
24
- simple_cov_or_nothing = lambda do
25
- load_simplecov = lambda do
26
- require 'simplecov'
27
- task :coverage do
28
- ENV['COVERAGE'] = 'yes'
29
- Rake::Task['spec:spec'].invoke
30
- end
31
- end
32
- could_not_define_rcov_or_simplecov = lambda do
33
- task :coverage do
34
- puts "Please install coverage tools with\n\"gem install simplecov\" for ruby 1.9 or\n\"gem install rcov\" for ruby 1.8"
35
- end
36
- end
37
- Cxxproject::Utils::optional_package(load_simplecov, could_not_define_rcov_or_simplecov)
38
- end
39
- Cxxproject::Utils::optional_package(load_rcov, simple_cov_or_nothing)
40
- end
41
-
42
- def new_rspec
43
- require 'rspec/core/rake_task'
44
- desc "Run examples"
45
- RSpec::Core::RakeTask.new() do |t|
46
- t.pattern = SPEC_PATTERN
47
- if ENV['BUILD_SERVER']
48
- t.rspec_opts = '-r ./junit.rb -f JUnit -o build/test_details.xml'
49
- end
50
- end
51
-
52
- desc 'Run examples with coverage'
53
- coverage
54
- CLOBBER.include('coverage')
55
- end
56
-
57
- namespace :spec do
58
- new_rspec
59
- end
60
-
61
- task :spec do
62
- puts 'Please use spec:spec or spec:coverage'
63
- end
64
-
65
- task :gem => [:spec]
data/roodi.yml DELETED
@@ -1,8 +0,0 @@
1
- CaseMissingElseCheck: { }
2
- CyclomaticComplexityBlockCheck: { complexity: 9 }
3
- CyclomaticComplexityMethodCheck: { complexity: 10 }
4
- #MethodLineCountCheck: { line_count: 100 }
5
- MethodNameCheck: { pattern: !ruby/regexp /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ }
6
- ModuleLineCountCheck: { line_count: 300 }
7
- ModuleNameCheck: { pattern: !ruby/regexp /^[A-Z][a-zA-Z0-9]*$/ }
8
- ParameterNumberCheck: { parameter_count: 6 }
@@ -1,103 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'rspec'
4
- require 'cxxproject'
5
- require 'cxxproject/utils/cleanup'
6
-
7
- describe Cxxproject::BuildingBlock do
8
- compiler = 'gcc'
9
-
10
- before(:each) do
11
- Cxxproject::Utils.cleanup_rake
12
- end
13
-
14
- after(:each) do
15
- Cxxproject::Utils.cleanup_rake
16
- end
17
-
18
- it 'should collect the dependencies for a single lib' do
19
- lib1 = Cxxproject::SourceLibrary.new('1')
20
- lib1.collect_dependencies().should == [lib1]
21
- end
22
-
23
- it 'should collect the dependencies for a single lib with one dep' do
24
- lib1 = Cxxproject::SourceLibrary.new('1')
25
- lib2 = Cxxproject::SourceLibrary.new('2').set_dependencies(['1'])
26
- lib2.collect_dependencies().should == [lib2, lib1]
27
- end
28
-
29
- it 'should build the right dependency-chain' do
30
- lib1 = Cxxproject::SourceLibrary.new('1').set_dependencies(['2'])
31
- lib2 = Cxxproject::SourceLibrary.new('2')
32
- lib3 = Cxxproject::SourceLibrary.new('3').set_dependencies(['2', '1'])
33
- lib3.collect_dependencies().should == [lib3, lib1, lib2]
34
- end
35
-
36
- it 'should build the right dependency-chain for custom blocks' do
37
- lib1 = Cxxproject::SourceLibrary.new('1')
38
- lib2 = Cxxproject::SourceLibrary.new('2').set_dependencies(['1'])
39
- lib3 = Cxxproject::SourceLibrary.new('3').set_dependencies(['1', '2'])
40
- lib4 = Cxxproject::SourceLibrary.new('4').set_dependencies(['1', '2', '3'])
41
- lib4.collect_dependencies().should == [lib4, lib3, lib2, lib1]
42
- end
43
-
44
- it 'should generate an error if building block names conflict' do
45
- expect {
46
- Cxxproject::SourceLibrary.new('1')
47
- Cxxproject::SourceLibrary.new('1')
48
- }.should raise_exception
49
- end
50
-
51
- it 'should be possible to give several binary libs with the same name' do
52
- Cxxproject::BinaryLibrary.new('1')
53
- Cxxproject::BinaryLibrary.new('1')
54
- end
55
-
56
- it 'should be an error if the same name is used for different kinds of building blocks' do
57
- expect {
58
- Cxxproject::BinaryLibrary.new('1')
59
- Cxxproject::SourceLibrary.new('1')
60
- }.should raise_exception
61
- end
62
-
63
- it 'should handle whole archive' do
64
- # TODO ... clean up api and also this test
65
- l1 = Cxxproject::SourceLibrary.new('1', true)
66
- l1.output_dir = 'out'
67
- l1.complete_init
68
- l2 = Cxxproject::SourceLibrary.new('2', true)
69
- l2.output_dir = 'out'
70
- l2.complete_init
71
- exe = Cxxproject::Executable.new('test')
72
- deps = ['1', '2']
73
- exe.set_dependencies(deps)
74
- exe.complete_init
75
- exe.linker_lib_string({:START_OF_WHOLE_ARCHIVE => 'start', :END_OF_WHOLE_ARCHIVE => 'end'}).should == ['start', 'out/lib2.a', 'end', 'start', 'out/lib1.a', 'end']
76
- # TODO add a test for recursive whole archive libs a lib that should be whole and that has dependencies to whole libs
77
- end
78
-
79
- =begin
80
- it 'should have the right output-directory' do
81
- lib1 = Cxxproject::SourceLibrary.new('lib1').set_sources(['test.cc'])
82
- lib1.set_project_dir(File.join(Dir.pwd, 'lib1'))
83
-
84
- lib2 = Cxxproject::SourceLibrary.new('lib2').set_sources(['test.cc']).set_output_dir('build2')
85
- lib2.set_project_dir(File.join(Dir.pwd, 'lib2'))
86
-
87
- cxx = CxxProject2Rake.new([], 'build', compiler)
88
-
89
- cxx.prepare_block(lib1, Provider[compiler], "build")
90
- cxx.prepare_block(lib2, Provider[compiler], "build")
91
-
92
- lib1.complete_output_dir.should eq(File.join(Dir.pwd, 'build'))
93
- lib2.complete_output_dir.should eq(File.join(Dir.pwd, 'lib2', 'build2'))
94
- end
95
-
96
- it 'should raise exception if building block cannot be resolved' do
97
- expect do
98
- lib1 = Cxxproject::SourceLibrary.new('1').set_dependencies(['unresolved'])
99
- cxx = CxxProject2Rake.new([], 'build', compiler)
100
- end.to raise_exception(RuntimeError, 'Error: while reading config file for 1: dependent building block "unresolved" was specified but not found!')
101
- end
102
- =end
103
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- require 'cxxproject'
3
-
4
- describe File do
5
-
6
- it 'should calc if a pathname is absolute' do
7
- File.is_absolute?('/test').should eq(true)
8
- File.is_absolute?('a:test').should eq(true)
9
- File.is_absolute?('test').should eq(false)
10
- end
11
-
12
- it 'should find a good relative directory for subdirectories' do
13
- File.rel_from_to_project('x/main/a', 'x/main/b').should eq('../b/')
14
- File.rel_from_to_project('x/main/a/b', 'x/main').should eq('../../')
15
- File.rel_from_to_project('x/main', 'x/main/a/b').should eq('a/b/')
16
- File.rel_from_to_project('x/main', 'x/main').should eq('')
17
- File.rel_from_to_project('x/main', nil).should eq(nil)
18
- File.rel_from_to_project(nil, 'x/main').should eq(nil)
19
- File.rel_from_to_project('x/a', 'y/b').should eq("../../y/b/")
20
- File.rel_from_to_project('x/x', 'x/x').should eq('')
21
- end
22
-
23
- it 'add prefix only if file is not absolute' do
24
- File.add_prefix('abc/', '/usr/local').should eq('/usr/local')
25
- File.add_prefix('abc/', 'nix/usr/local').should eq('abc/nix/usr/local')
26
- File.add_prefix('abc/', 'c:/usr/local').should eq('c:/usr/local')
27
- File.add_prefix('abc/', 'c:\\usr/local').should eq('c:\\usr/local')
28
- end
29
-
30
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
- require 'cxxproject/ide_interface'
3
- require 'cxxproject/utils/utils'
4
- require 'cxxproject/errorparser/error_parser'
5
-
6
- def check_long(e, l)
7
- e.next.should eq(l)
8
- e.next.should eq(0)
9
- e.next.should eq(0)
10
- e.next.should eq(0)
11
- end
12
- def check_string(e, s)
13
- s.bytes do |i|
14
- e.next.should eq(i)
15
- end
16
- end
17
-
18
- describe Cxxproject::IDEInterface do
19
-
20
- it 'should create a correct package from an error-array' do
21
- ide = Cxxproject::IDEInterface.new
22
- error = Cxxproject::ErrorDesc.new
23
- error.severity = 2
24
- error.line_number = 10
25
- error.file_name = 'filename'
26
- error.message = 'error'
27
- packet = ide.create_error_packet(error)
28
-
29
- if not Cxxproject::Utils.old_ruby? # in Ruby 1.8.6 there is no bytes methods...
30
- e = packet.bytes
31
- e.next.should eq(1)
32
- check_long(e, 22)
33
- check_long(e, 8)
34
- check_string(e, 'filename')
35
- check_long(e, 10)
36
- e.next.should eq(2)
37
- check_string(e, 'error')
38
- end
39
- end
40
-
41
- end
@@ -1,57 +0,0 @@
1
- require 'cxxproject/plugin_context'
2
-
3
-
4
- describe Cxxproject::PluginContext do
5
- it "should copy cpp settings to c settings" do
6
- toolchain = {:COMPILER => {
7
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
8
- :C => { :BASED_ON => :CPP, :COMMAND => "clang" }
9
- }}
10
- expected = {:COMPILER => {
11
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
12
- :C => { :DEFINE_FLAG => "-D", :COMMAND => "clang" }
13
- }}
14
- Cxxproject::PluginContext.expand(toolchain).should == expected
15
- end
16
-
17
- it "should fully resolve all :BASED_ON sections" do
18
- toolchain = {:COMPILER => {
19
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
20
- :C => { :BASED_ON => :CPP, :COMMAND => "clang" },
21
- :ASM => { :BASED_ON => :C }
22
- }}
23
- expected = {:COMPILER => {
24
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
25
- :C => { :DEFINE_FLAG => "-D", :COMMAND => "clang" },
26
- :ASM => { :DEFINE_FLAG => "-D", :COMMAND => "clang" }
27
- }}
28
- Cxxproject::PluginContext.expand(toolchain).should == expected
29
- end
30
-
31
- it "should find out if extension is needed" do
32
- toolchain = {:COMPILER => {
33
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
34
- :C => { :BASED_ON => :CPP, :COMMAND => "clang" } }}
35
- toolchain2 = {:COMPILER => {
36
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
37
- :C => { :COMMAND => "clang" } }}
38
- Cxxproject::PluginContext.needs_expansion(toolchain).should == true
39
- Cxxproject::PluginContext.needs_expansion(toolchain2).should == false
40
- end
41
-
42
- it "should find a toolchain to expand" do
43
- toolchain = {:COMPILER => {
44
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
45
- :C => { :BASED_ON => :CPP, :COMMAND => "clang" }
46
- }}
47
- Cxxproject::PluginContext.find_toolchain_subhash(toolchain).should == toolchain[:COMPILER][:C]
48
- end
49
-
50
- it "should find a toolchain element by name" do
51
- toolchain = {:COMPILER => {
52
- :CPP => { :DEFINE_FLAG => "-D", :COMMAND => "clang++" },
53
- :C => { :BASED_ON => :CPP, :COMMAND => "clang" }
54
- }}
55
- Cxxproject::PluginContext.find_toolchain_element(toolchain, :CPP).should == toolchain[:COMPILER][:CPP]
56
- end
57
- end
@@ -1,39 +0,0 @@
1
- require 'rspec'
2
- require 'cxxproject/toolchain/provider'
3
-
4
- describe Cxxproject::Toolchain::Provider do
5
-
6
- it 'should merge without overwrite' do
7
- cpp = { :DEFINE_FLAG => "-D", :COMMAND => "clang++" }
8
- c = { :COMMAND => "clang" }
9
- expected = { :DEFINE_FLAG => "-D", :COMMAND => "clang" }
10
- Cxxproject::Toolchain::Provider.merge(c, cpp, false).should == expected
11
- end
12
-
13
- it 'should merge two simple hashes' do
14
- hashA = { :a => 1, :b => 2 }
15
- hashB = { :a => 3, :c => 2 }
16
- merged = Cxxproject::Toolchain::Provider.merge(hashA, hashB)
17
- merged.should == { :a => 3, :b => 2, :c => 2 }
18
- end
19
-
20
- it 'should merge nested hashes' do
21
- hashA = { :n => { :a => 1, :b => 2 }}
22
- hashB = { :n => { :a => 3, :c => 2 }}
23
- merged = Cxxproject::Toolchain::Provider.merge(hashA, hashB)
24
- merged.should == { :n => { :a => 3, :b => 2, :c => 2 }}
25
- end
26
-
27
- it 'should merge multiple level nested hashes' do
28
- hashA = {:COMPILER => {
29
- :CPP => {:COMMAND => "",:DEFINE_FLAG => "",:SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"]}}}
30
- hashB = {:COMPILER =>
31
- {:CPP => { :COMMAND => "clang++", :SOURCE_FILE_ENDINGS => [".cxx", ".cpp"]}}}
32
- merged = Cxxproject::Toolchain::Provider.merge(hashA, hashB)
33
- expected = {:COMPILER =>
34
- {:CPP => { :COMMAND => "clang++", :DEFINE_FLAG => "", :SOURCE_FILE_ENDINGS => [".cxx", ".cpp"]}}}
35
- merged.should == expected
36
- end
37
-
38
- end
39
-