xcake 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/xcake.rb +1 -0
- data/lib/xcake/context/xcodeproj_context.rb +8 -1
- data/lib/xcake/dsl/build_phase/copy_files_build_phase.rb +28 -0
- data/lib/xcake/dsl/target/sugar.rb +18 -0
- data/lib/xcake/generator/scheme_generator.rb +9 -4
- data/lib/xcake/version.rb +1 -1
- data/lib/xcake/xcodeproj_ext/PBXNativeTarget.rb +9 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1802f2f635b1f4daca3fec198198529c86bd504f
         | 
| 4 | 
            +
              data.tar.gz: cddcd4405e47645d29258fe2cf924351869fac4f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c3d64333621cee9c34d8fc7cefb9a01e8567ac40b55c0f83316dfc9d973d5c7f7cdfaaf65dd7060131a74187bdf2e3cdaac94d7decb86c7e762d5448764e3291
         | 
| 7 | 
            +
              data.tar.gz: b1cf9bd3bd3306d997e40a6be0324f4cff88fff6b9ef7b460f2323b810283fdb0fa013bdaddc15b2caf546748fa1525df1bafd79008e329ed73ce5d805c6ce81
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,9 @@ | |
| 1 | 
            +
            v0.8.8
         | 
| 2 | 
            +
            ======
         | 
| 3 | 
            +
            - Adds Copy Files build phase
         | 
| 4 | 
            +
            - Clears project before recreating it to prevent any errors
         | 
| 5 | 
            +
            - Fixes xcode prompting for "reccomended defaults"
         | 
| 6 | 
            +
             | 
| 1 7 | 
             
            v0.8.7
         | 
| 2 8 | 
             
            ======
         | 
| 3 9 | 
             
            - Adds ability to specify shell script build phase before all other build phases.
         | 
    
        data/lib/xcake.rb
    CHANGED
    
    | @@ -48,6 +48,7 @@ require 'xcake/dsl/target/configurable' | |
| 48 48 | 
             
            require 'xcake/dsl/build_phase'
         | 
| 49 49 | 
             
            require 'xcake/dsl/build_phase/headers_build_phase'
         | 
| 50 50 | 
             
            require 'xcake/dsl/build_phase/shell_script_build_phase'
         | 
| 51 | 
            +
            require 'xcake/dsl/build_phase/copy_files_build_phase'
         | 
| 51 52 |  | 
| 52 53 | 
             
            module Xcake
         | 
| 53 54 | 
             
            end
         | 
| @@ -27,7 +27,14 @@ module Xcake | |
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 | 
             
                def create_object_for_project(project)
         | 
| 30 | 
            -
                   | 
| 30 | 
            +
                  
         | 
| 31 | 
            +
                  project_path = "./#{project.name}.xcodeproj"
         | 
| 32 | 
            +
                  
         | 
| 33 | 
            +
                  if File.exist?(project_path)
         | 
| 34 | 
            +
                    FileUtils.remove_dir(project_path)
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  @project = Xcode::Project.new(project_path, true)
         | 
| 31 38 | 
             
                  @project.setup_for_xcake
         | 
| 32 39 | 
             
                  @project
         | 
| 33 40 | 
             
                end
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            module Xcake
         | 
| 2 | 
            +
              # This class is used to represent a copy files build phase
         | 
| 3 | 
            +
              #
         | 
| 4 | 
            +
              class CopyFilesBuildPhase < BuildPhase
         | 
| 5 | 
            +
                # The name of the build phase as shown in Xcode
         | 
| 6 | 
            +
                attr_accessor :name
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                # The name of files to copy
         | 
| 9 | 
            +
                attr_accessor :files
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def build_phase_type
         | 
| 12 | 
            +
                  Xcodeproj::Project::Object::PBXCopyFilesBuildPhase
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def configure_native_build_phase(native_build_phase, _context)
         | 
| 16 | 
            +
                  native_build_phase.name = name
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  @files.each do |file|
         | 
| 19 | 
            +
                    file_reference = context.file_reference_for_path(file)
         | 
| 20 | 
            +
                    native_build_phase.add_file_reference(file_reference)
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def to_s
         | 
| 25 | 
            +
                  "BuildPhase<#{name}>"
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| @@ -2,6 +2,24 @@ require 'xcodeproj' | |
| 2 2 |  | 
| 3 3 | 
             
            module Xcake
         | 
| 4 4 | 
             
              class Target
         | 
| 5 | 
            +
                # Creates a new Copy Files build phase for the
         | 
| 6 | 
            +
                # target
         | 
| 7 | 
            +
                #
         | 
| 8 | 
            +
                # @param   [String] name
         | 
| 9 | 
            +
                #          the name to use for the build phase
         | 
| 10 | 
            +
                #
         | 
| 11 | 
            +
                # @param   [Proc] block
         | 
| 12 | 
            +
                #          an optional block that configures the build phase through the DSL.
         | 
| 13 | 
            +
                #
         | 
| 14 | 
            +
                # @return [CopyFilesBuildPhase] the new xcode build phase
         | 
| 15 | 
            +
                #
         | 
| 16 | 
            +
                def copy_files_build_phase(name, &block)
         | 
| 17 | 
            +
                  phase = CopyFilesBuildPhase.new(&block)
         | 
| 18 | 
            +
                  phase.name = name
         | 
| 19 | 
            +
                  build_phases << phase
         | 
| 20 | 
            +
                  phase
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 5 23 | 
             
                # Creates a new Copy Headers build phase for the
         | 
| 6 24 | 
             
                # target
         | 
| 7 25 | 
             
                #
         | 
| @@ -15,12 +15,11 @@ module Xcake | |
| 15 15 |  | 
| 16 16 | 
             
                  target.schemes.each do |scheme| 
         | 
| 17 17 |  | 
| 18 | 
            -
             | 
| 18 | 
            +
                      scheme_list.supress_autocreation_of_target(native_target)
         | 
| 19 19 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 20 | 
            +
                      native_scheme = @context.native_object_for(scheme)
         | 
| 21 | 
            +
                      native_scheme.name = scheme.name
         | 
| 22 22 |  | 
| 23 | 
            -
                      #TODO: Find multiple testing targets, move this into the DSL ?
         | 
| 24 23 | 
             
                      native_project = @context.native_object_for(@project)
         | 
| 25 24 | 
             
                      native_unit_test_target = native_project.find_unit_test_target_for_target(target)
         | 
| 26 25 |  | 
| @@ -28,6 +27,12 @@ module Xcake | |
| 28 27 | 
             
                        scheme_list.supress_autocreation_of_target(native_unit_test_target)
         | 
| 29 28 | 
             
                      end
         | 
| 30 29 |  | 
| 30 | 
            +
                      # TODO: Spec
         | 
| 31 | 
            +
                      if native_target.library_target_type?
         | 
| 32 | 
            +
                        build_action = native_scheme.build_action
         | 
| 33 | 
            +
                        build_action.build_for_running(true)
         | 
| 34 | 
            +
                      end
         | 
| 35 | 
            +
             | 
| 31 36 | 
             
                      native_scheme.configure_with_targets(native_target, native_unit_test_target)
         | 
| 32 37 | 
             
                      native_scheme.test_action.build_configuration = scheme.test_configuration
         | 
| 33 38 | 
             
                      native_scheme.launch_action.build_configuration = scheme.launch_configuration
         | 
    
        data/lib/xcake/version.rb
    CHANGED
    
    
| @@ -7,6 +7,15 @@ module Xcodeproj | |
| 7 7 | 
             
                    def build_phase_by_class(phase_class)
         | 
| 8 8 | 
             
                      find_or_create_build_phase_by_class(phase_class)
         | 
| 9 9 | 
             
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def library_target_type?
         | 
| 12 | 
            +
                      case symbol_type
         | 
| 13 | 
            +
                      when :framework, :dynamic_library, :static_library 
         | 
| 14 | 
            +
                        true
         | 
| 15 | 
            +
                      else
         | 
| 16 | 
            +
                        false
         | 
| 17 | 
            +
                      end
         | 
| 18 | 
            +
                    end
         | 
| 10 19 | 
             
                  end
         | 
| 11 20 | 
             
               end
         | 
| 12 21 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: xcake
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 4 | 
            +
              version: 0.8.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Campbell
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-02-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: claide
         | 
| @@ -236,6 +236,7 @@ files: | |
| 236 236 | 
             
            - lib/xcake/dependency.rb
         | 
| 237 237 | 
             
            - lib/xcake/dependency_provider.rb
         | 
| 238 238 | 
             
            - lib/xcake/dsl/build_phase.rb
         | 
| 239 | 
            +
            - lib/xcake/dsl/build_phase/copy_files_build_phase.rb
         | 
| 239 240 | 
             
            - lib/xcake/dsl/build_phase/headers_build_phase.rb
         | 
| 240 241 | 
             
            - lib/xcake/dsl/build_phase/shell_script_build_phase.rb
         | 
| 241 242 | 
             
            - lib/xcake/dsl/configurable.rb
         |