Skip to content

Commit

Permalink
iOS: Automatically initialize the Framework_Search_Paths for subprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlin committed Sep 12, 2016
1 parent a1afa17 commit f3439c8
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
68 changes: 68 additions & 0 deletions iOS/Sample/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
objectVersion = 46;
objects = {

/* Begin PBXAggregateTarget section */
F8FB32691D8596F700A52286 /* InitSmallProjects */ = {
isa = PBXAggregateTarget;
buildConfigurationList = F8FB326C1D8596F700A52286 /* Build configuration list for PBXAggregateTarget "InitSmallProjects" */;
buildPhases = (
F8FB326D1D85970800A52286 /* Run Script */,
);
dependencies = (
);
name = InitSmallProjects;
productName = InitSmallProjects;
};
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
1BB3946C3661C9F885E56442 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 108ED5151086A43DBA8C30B9 /* Pods_Sample.framework */; };
F8B344F91C5A0712003AA7C3 /* net_wequick_example_small_app_detail.framework in Resources */ = {isa = PBXBuildFile; fileRef = F8B344EC1C5A06ED003AA7C3 /* net_wequick_example_small_app_detail.framework */; };
Expand Down Expand Up @@ -108,6 +122,13 @@
remoteGlobalIDString = F8F023BC1C574A8C002B0A00;
remoteInfo = web.about;
};
F8FB32761D85A32600A52286 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F8E4AD231C51F83400BB6DD4 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F8FB32691D8596F700A52286;
remoteInfo = InitSmallProjects;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -284,6 +305,7 @@
buildRules = (
);
dependencies = (
F8FB32771D85A32600A52286 /* PBXTargetDependency */,
F8B344EE1C5A0700003AA7C3 /* PBXTargetDependency */,
F8B344F01C5A0700003AA7C3 /* PBXTargetDependency */,
F8B344F21C5A0700003AA7C3 /* PBXTargetDependency */,
Expand All @@ -308,6 +330,9 @@
F8E4AD2A1C51F83400BB6DD4 = {
CreatedOnToolsVersion = 7.1;
};
F8FB32691D8596F700A52286 = {
CreatedOnToolsVersion = 7.3.1;
};
};
};
buildConfigurationList = F8E4AD261C51F83400BB6DD4 /* Build configuration list for PBXProject "Sample" */;
Expand Down Expand Up @@ -350,6 +375,7 @@
projectRoot = "";
targets = (
F8E4AD2A1C51F83400BB6DD4 /* Sample */,
F8FB32691D8596F700A52286 /* InitSmallProjects */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -465,6 +491,20 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F8FB326D1D85970800A52286 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./Small-subprojects.rb";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -511,6 +551,11 @@
name = web.about;
targetProxy = F8B344F71C5A0700003AA7C3 /* PBXContainerItemProxy */;
};
F8FB32771D85A32600A52286 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F8FB32691D8596F700A52286 /* InitSmallProjects */;
targetProxy = F8FB32761D85A32600A52286 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -639,6 +684,20 @@
};
name = Release;
};
F8FB326A1D8596F700A52286 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
F8FB326B1D8596F700A52286 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand All @@ -660,6 +719,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F8FB326C1D8596F700A52286 /* Build configuration list for PBXAggregateTarget "InitSmallProjects" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F8FB326A1D8596F700A52286 /* Debug */,
F8FB326B1D8596F700A52286 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F8E4AD231C51F83400BB6DD4 /* Project object */;
Expand Down
29 changes: 29 additions & 0 deletions iOS/Sample/Small-subprojects.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby

require 'xcodeproj'
require 'xcodeproj/project/object/target_dependency'

project_path = "#{Dir.pwd}/#{Dir['*.xcodeproj'][0]}"
project = Xcodeproj::Project.open(project_path)
project.native_targets.each do |target|
target.dependencies.each do |dep|
if (dep.name != nil)
changed = false
sub_project = dep.target_proxy.proxied_object.project
sub_project.native_targets.each do |sub_target|
sub_target.build_configurations.each do |config|
old_fsp = config.build_settings['FRAMEWORK_SEARCH_PATHS']
if (!(old_fsp.include? "$(CONFIGURATION_BUILD_DIR)/**"))
changed = true
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << "$(CONFIGURATION_BUILD_DIR)/**"
puts "Small: Add framework search paths for '#{dep.name}'"
end
end
end

if (changed)
sub_project.save
end
end
end
end

0 comments on commit f3439c8

Please sign in to comment.