Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
1054dad3
Commit
1054dad3
authored
May 31, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove target environment header entirely
parent
9620191c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
0 additions
and
307 deletions
+0
-307
cocoapods.rb
lib/cocoapods.rb
+0
-5
target_environment_header.rb
lib/cocoapods/generator/target_environment_header.rb
+0
-171
aggregate_target_installer.rb
.../installer/target_installer/aggregate_target_installer.rb
+0
-11
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+0
-1
target.rb
lib/cocoapods/target.rb
+0
-8
target_environment_header_spec.rb
spec/unit/generator/target_environment_header_spec.rb
+0
-84
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+0
-12
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+0
-1
library_spec.rb
spec/unit/library_spec.rb
+0
-4
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+0
-4
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+0
-6
No files found.
lib/cocoapods.rb
View file @
1054dad3
...
...
@@ -64,7 +64,6 @@ module Pod
autoload
:InfoPlistFile
,
'cocoapods/generator/info_plist_file'
autoload
:ModuleMap
,
'cocoapods/generator/module_map'
autoload
:PrefixHeader
,
'cocoapods/generator/prefix_header'
autoload
:TargetEnvironmentHeader
,
'cocoapods/generator/target_environment_header'
autoload
:UmbrellaHeader
,
'cocoapods/generator/umbrella_header'
autoload
:XCConfig
,
'cocoapods/generator/xcconfig'
end
...
...
@@ -75,7 +74,3 @@ module Pod
autoload
:PodRepresentation
,
'cocoapods/hooks/pod_representation'
end
end
if
ENV
[
'COCOA_PODS_ENV'
]
==
'development'
# require 'awesome_print'
end
lib/cocoapods/generator/target_environment_header.rb
deleted
100644 → 0
View file @
9620191c
require
'active_support/core_ext/string/strip'
module
Pod
module
Generator
# Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod.
#
# Example output:
#
# #define COCOAPODS_POD_AVAILABLE_ObjectiveSugar 1
# #define COCOAPODS_VERSION_MAJOR_ObjectiveSugar 0
# #define COCOAPODS_VERSION_MINOR_ObjectiveSugar 6
# #define COCOAPODS_VERSION_PATCH_ObjectiveSugar 2
#
# Example usage:
#
# #ifdef COCOAPODS
# #ifdef COCOAPODS_POD_AVAILABLE_ObjectiveSugar
# #import "ObjectiveSugar.h"
# #endif
# #else
# // Non CocoaPods code
# #endif
#
class
TargetEnvironmentHeader
# @return [Hash{String => LocalPod}] the specifications installed for
# the target by build configuration name.
#
attr_reader
:specs_by_configuration
# @param [Array<Specification>] pods @see pods
#
def
initialize
(
specs_by_configuration
)
@specs_by_configuration
=
specs_by_configuration
end
# Generates the file contents.
#
# @return [void]
#
def
generate
result
=
"
\n
#{
notice
}
\n\n
"
common_specs
=
common_specs
(
specs_by_configuration
)
common_specs
.
each
{
|
spec
|
result
<<
spec_defines
(
spec
)
}
c99ext_identifier_method
=
Target
.
new
.
method
(
:c99ext_identifier
)
specs_by_config
=
specs_scoped_by_configuration
(
common_specs
,
specs_by_configuration
)
specs_by_config
.
each
do
|
config
,
specs
|
result
<<
"//
#{
config
}
build configuration
\n
"
result
<<
"#ifdef
#{
c99ext_identifier_method
[
config
].
upcase
}
\n\n
"
specs
.
each
{
|
spec
|
result
<<
spec_defines
(
spec
,
1
)
}
result
<<
"#endif
\n
"
end
result
end
def
save_as
(
path
)
path
.
open
(
'w'
)
{
|
header
|
header
.
write
(
generate
)
}
end
private
# !@group Private Helpers
#-----------------------------------------------------------------------#
# @return [Array<Specification>] The list of the specifications present
# in all build configurations sorted by name.
#
# @param [Hash{String => Array<Specification>}] specs_by_configuration
# The specs grouped by build configuration.
#
def
common_specs
(
specs_by_configuration
)
result
=
specs_by_configuration
.
values
.
flatten
.
uniq
specs_by_configuration
.
values
.
each
do
|
configuration_specs
|
result
&=
configuration_specs
end
result
.
sort_by
(
&
:name
)
end
# @return [Hash{String => Array<Specification>}] The list of the
# specifications not present in all build configurations sorted
# by name and grouped by build configuration name.
#
# @param [Hash{String => Array<Specification>}] specs_by_configuration
# The specs grouped by build configuration.
#
def
specs_scoped_by_configuration
(
common_specs
,
specs_by_configuration
)
result
=
{}
specs_by_configuration
.
each
do
|
configuration
,
all_specs
|
specs
=
all_specs
.
sort_by
(
&
:name
)
-
common_specs
result
[
configuration
]
=
specs
unless
specs
.
empty?
end
result
end
# @return The sanitized name of a specification to make it suitable to be
# used as part of an identifier of a define statement.
#
# @param [String] spec_name
# The name of the spec.
#
def
safe_spec_name
(
spec_name
)
spec_name
.
gsub
(
/[^\w]/
,
'_'
)
end
# @return [String]
#
def
notice
<<-
DOC
.
strip_heredoc
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
DOC
end
# @return [String]
#
def
spec_defines
(
spec
,
indent_count
=
0
)
spec_name
=
safe_spec_name
(
spec
.
name
)
result
=
"//
#{
spec
.
name
}
\n
"
result
<<
"#define COCOAPODS_POD_AVAILABLE_
#{
spec_name
}
\n
"
if
spec
.
version
.
semantic?
result
<<
semantic_version_defines
(
spec
)
else
result
<<
non_semantic_version_notice
(
spec
)
end
result
<<
"
\n
"
indent
(
result
,
indent_count
)
end
def
indent
(
string
,
indent_count
)
indent
=
' '
*
(
indent_count
*
2
)
lines
=
string
.
lines
.
map
do
|
line
|
if
line
==
"
\n
"
line
else
"
#{
indent
}#{
line
}
"
end
end
lines
.
join
end
# @return [String]
#
def
semantic_version_defines
(
spec
)
spec_name
=
safe_spec_name
(
spec
.
name
)
<<-
DOC
.
strip_heredoc
#define COCOAPODS_VERSION_MAJOR_
#{
spec_name
}
#{
spec
.
version
.
major
}
#define COCOAPODS_VERSION_MINOR_
#{
spec_name
}
#{
spec
.
version
.
minor
}
#define COCOAPODS_VERSION_PATCH_
#{
spec_name
}
#{
spec
.
version
.
patch
}
DOC
end
# @return [String]
#
def
non_semantic_version_notice
(
spec
)
<<-
DOC
.
strip_heredoc
// This library does not follow semantic-versioning,
// so we were not able to define version macros.
// Please contact the author.
// Version:
#{
spec
.
version
}
.
DOC
end
#-----------------------------------------------------------------------#
end
end
end
lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
View file @
1054dad3
...
...
@@ -20,7 +20,6 @@ module Pod
create_umbrella_header
create_embed_frameworks_script
end
create_target_environment_header
create_bridge_support_file
create_copy_resources_script
create_acknowledgements
...
...
@@ -73,16 +72,6 @@ module Pod
end
end
# Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod.
#
def
create_target_environment_header
path
=
target
.
target_environment_header_path
generator
=
Generator
::
TargetEnvironmentHeader
.
new
(
target
.
specs_by_build_configuration
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
# Generates the bridge support metadata if requested by the {Podfile}.
#
# @note The bridge support metadata is added to the resources of the
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
1054dad3
...
...
@@ -174,7 +174,6 @@ module Pod
def
create_prefix_header
path
=
target
.
prefix_header_path
generator
=
Generator
::
PrefixHeader
.
new
(
target
.
file_accessors
,
target
.
platform
)
generator
.
imports
<<
target
.
target_environment_header_path
.
basename
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
...
...
lib/cocoapods/target.rb
View file @
1054dad3
...
...
@@ -167,14 +167,6 @@ module Pod
support_files_dir
+
"
#{
label
}
.modulemap"
end
# @return [Pathname] the absolute path of the header file which contains
# the information about the installed pods.
#
def
target_environment_header_path
name
=
target_definition
.
label
sandbox
.
target_support_files_dir
(
name
)
+
"
#{
name
}
-environment.h"
end
# @return [Pathname] the absolute path of the prefix header file.
#
def
prefix_header_path
...
...
spec/unit/generator/target_environment_header_spec.rb
deleted
100644 → 0
View file @
9620191c
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Generator
::
TargetEnvironmentHeader
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@gen
=
Pod
::
Generator
::
TargetEnvironmentHeader
.
new
(
'Debug'
=>
[
spec
])
end
it
'generates a header files which include macro definitions for installed Pods'
do
file
=
temporary_directory
+
'Pods-environment.h'
@gen
.
save_as
(
file
)
file
.
read
.
should
==
<<-
EOS
.
strip_heredoc
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// BananaLib
#define COCOAPODS_POD_AVAILABLE_BananaLib
#define COCOAPODS_VERSION_MAJOR_BananaLib 1
#define COCOAPODS_VERSION_MINOR_BananaLib 0
#define COCOAPODS_VERSION_PATCH_BananaLib 0
EOS
end
it
'handles specifications with special characters'
do
name
=
@gen
.
send
(
:safe_spec_name
,
'AppleCoreAudioUtilityClasses@thehtb'
)
name
.
should
==
'AppleCoreAudioUtilityClasses_thehtb'
end
it
'includes conditional statements for specifications not present in all build configurations'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
debug_spec
=
stub
(
:name
=>
'DebugPod'
,
:version
=>
Pod
::
Version
.
new
(
'1.2.3'
))
specs_by_configuration
=
{
'Debug'
=>
[
spec
,
debug_spec
],
'Release'
=>
[
spec
],
}
@gen
=
Pod
::
Generator
::
TargetEnvironmentHeader
.
new
(
specs_by_configuration
)
@gen
.
generate
.
should
==
<<-
EOS
.
strip_heredoc
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// BananaLib
#define COCOAPODS_POD_AVAILABLE_BananaLib
#define COCOAPODS_VERSION_MAJOR_BananaLib 1
#define COCOAPODS_VERSION_MINOR_BananaLib 0
#define COCOAPODS_VERSION_PATCH_BananaLib 0
// Debug build configuration
#ifdef DEBUG
// DebugPod
#define COCOAPODS_POD_AVAILABLE_DebugPod
#define COCOAPODS_VERSION_MAJOR_DebugPod 1
#define COCOAPODS_VERSION_MINOR_DebugPod 2
#define COCOAPODS_VERSION_PATCH_DebugPod 3
#endif
EOS
end
it
'normalizes the name of the build configuration'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
specs_by_configuration
=
{
'Debug'
=>
[],
'build configuration copy'
=>
[
spec
],
'build-_config@copy'
=>
[
spec
],
'1 - Develop'
=>
[
spec
],
}
@gen
=
Pod
::
Generator
::
TargetEnvironmentHeader
.
new
(
specs_by_configuration
)
@gen
.
generate
.
should
.
include
'BUILD_CONFIGURATION_COPY'
@gen
.
generate
.
should
.
include
'BUILD__CONFIG_COPY'
@gen
.
generate
.
should
.
include
'_1___DEVELOP'
end
end
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
1054dad3
...
...
@@ -47,7 +47,6 @@ module Pod
'Pods-acknowledgements.markdown'
,
'Pods-acknowledgements.plist'
,
'Pods-dummy.m'
,
'Pods-environment.h'
,
'Pods-resources.sh'
,
'Pods.appstore.xcconfig'
,
'Pods.debug.xcconfig'
,
...
...
@@ -117,17 +116,6 @@ module Pod
xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}/Pods'
end
it
'creates a header for the target which contains the information about the installed Pods'
do
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
file
=
support_files_dir
+
'Pods-environment.h'
contents
=
file
.
read
contents
.
should
.
include?
(
'#define COCOAPODS_POD_AVAILABLE_BananaLib'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MAJOR_BananaLib 1'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MINOR_BananaLib 0'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_PATCH_BananaLib 0'
)
end
it
'creates a bridge support file'
do
Podfile
.
any_instance
.
stubs
(
:generate_bridge_support?
=>
true
)
Generator
::
BridgeSupport
.
any_instance
.
expects
(
:save_as
).
once
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
1054dad3
...
...
@@ -149,7 +149,6 @@ module Pod
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"
#import "BlocksKit.h"
#import <BananaTree/BananaTree.h>
EOS
...
...
spec/unit/library_spec.rb
View file @
1054dad3
...
...
@@ -42,10 +42,6 @@ module Pod
@lib
.
copy_resources_script_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-resources.sh'
)
end
it
'returns the absolute path of the target header file'
do
@lib
.
target_environment_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-environment.h'
)
end
it
'returns the absolute path of the prefix header file'
do
@lib
.
prefix_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-prefix.pch'
)
end
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
1054dad3
...
...
@@ -55,10 +55,6 @@ module Pod
@target
.
embed_frameworks_script_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-frameworks.sh'
)
end
it
'returns the absolute path of the target header file'
do
@target
.
target_environment_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-environment.h'
)
end
it
'returns the absolute path of the prefix header file'
do
@target
.
prefix_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-prefix.pch'
)
end
...
...
spec/unit/target/pod_target_spec.rb
View file @
1054dad3
...
...
@@ -94,12 +94,6 @@ module Pod
)
end
it
'returns the absolute path of the target header file'
do
@pod_target
.
target_environment_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods/Pods-environment.h'
,
)
end
it
'returns the absolute path of the prefix header file'
do
@pod_target
.
prefix_header_path
.
to_s
.
should
.
include?
(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-prefix.pch'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment