mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-30 03:48:49 +00:00
Fixed nib2cib importing of external custom frameworks and added bundle types.
Reviewed by me.
This commit is contained in:
1 parent
f1601d01ea
commit
3bd28b28ab
6 files changed
+45
-50
No files matched your search
@@ -27,6 +27,7 @@ ObjectiveJ::BundleTask.new(:AppKit) do |t|
|
||||
t.build_path = $BUILD_PATH
|
||||
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
|
||||
t.platforms = [ObjectiveJ::Platform::Browser, ObjectiveJ::Platform::Rhino]
|
||||
t.type = ObjectiveJ::Bundle::Type::Framework
|
||||
end
|
||||
|
||||
# It would be nice to just have ENVIRONMENT_PRODUCT depend on THEME_PRODUCT,
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'rake'
|
||||
require '../../../common'
|
||||
require 'objective-j'
|
||||
require 'objective-j/bundletask'
|
||||
|
||||
|
||||
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'BlendKit')
|
||||
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'BlendKit')
|
||||
|
||||
ObjectiveJ::BundleTask.new(:BlendKit) do |t|
|
||||
t.name = 'BlendKit'
|
||||
t.identifier = 'com.280n.BlendKit'
|
||||
t.version = '0.6.5'
|
||||
t.author = '280 North, Inc.'
|
||||
t.email = 'feedback @nospam@ 280north.com'
|
||||
t.summary = 'BlendKit classes for Cappuccino'
|
||||
t.sources = FileList['*.j']
|
||||
t.resources = FileList['Resources/*'].to_a
|
||||
t.license = ObjectiveJ::License::LGPL_v2_1
|
||||
t.build_path = $BUILD_PATH
|
||||
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
|
||||
end
|
||||
|
||||
#Framework in environment directory
|
||||
file_d $ENVIRONMENT_PRODUCT => [:BlendKit] do
|
||||
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT)
|
||||
end
|
||||
|
||||
task :build => [:BlendKit, $ENVIRONMENT_PRODUCT]
|
||||
|
||||
CLOBBER.include($ENVIRONMENT_PRODUCT)
|
||||
@@ -23,6 +23,7 @@ ObjectiveJ::BundleTask.new(:Foundation) do |t|
|
||||
t.license = ObjectiveJ::License::LGPL_v2_1
|
||||
t.build_path = $BUILD_PATH
|
||||
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
|
||||
t.type = ObjectiveJ::Bundle::Type::Framework
|
||||
end
|
||||
|
||||
#Framework in environment directory
|
||||
|
||||
@@ -51,6 +51,28 @@ module ObjectiveJ
|
||||
|
||||
end
|
||||
|
||||
module ObjectiveJ
|
||||
|
||||
class Bundle
|
||||
|
||||
class Type
|
||||
|
||||
Application = :Application
|
||||
Framework = :Framework
|
||||
|
||||
CODE_STRINGS =
|
||||
{
|
||||
Application => '280N',
|
||||
Framework => 'FMWK'
|
||||
}
|
||||
|
||||
def Type.code_string(type)
|
||||
return CODE_STRINGS[type] || type.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def file_d(*args, &block)
|
||||
|
||||
fileTask = Rake::FileTask.define_task(*args, &block)
|
||||
|
||||
@@ -191,6 +191,7 @@ module ObjectiveJ
|
||||
required_attribute :summary
|
||||
required_attribute :identifier
|
||||
required_attribute :platforms, [Platform::ObjJ]
|
||||
required_attribute :type, Bundle::Type::Application
|
||||
|
||||
# ------------------------- OPTIONAL gemspec attributes.
|
||||
|
||||
@@ -200,7 +201,7 @@ module ObjectiveJ
|
||||
# attribute :platform, Gem::Platform::RUBY
|
||||
|
||||
array_attribute :authors
|
||||
array_attribute :sources
|
||||
attributes :sources
|
||||
array_attribute :resources
|
||||
array_attribute :flags
|
||||
# array_attribute :test_files
|
||||
@@ -407,7 +408,7 @@ module ObjectiveJ
|
||||
end
|
||||
|
||||
info_plist_path = build_path + '/Info.plist'
|
||||
info_plist = { 'CPBundleName' => name, 'CPBundleIdentifier' => identifier, 'CPBundleInfoDictionaryVersion' => 6.0, 'CPBundleVersion' => version }
|
||||
info_plist = { 'CPBundleName' => name, 'CPBundleIdentifier' => identifier, 'CPBundleInfoDictionaryVersion' => 6.0, 'CPBundleVersion' => version, 'CPBundlePackageType' => Bundle::Type.code_string(type) }
|
||||
|
||||
info_plist['CPBundlePlatforms'] = platforms;
|
||||
|
||||
@@ -446,7 +447,10 @@ module ObjectiveJ
|
||||
# Yes its unfortunate that we need to regenerate the whole executable if the Info.plist changes. Oh well.
|
||||
file_d executable_path => info_plist_path
|
||||
|
||||
sources.each do |source|
|
||||
platform_sources = sources
|
||||
platform_sources = sources[platform] if sources.class == Hash
|
||||
|
||||
platform_sources.each do |source|
|
||||
|
||||
# This needs to be way better.
|
||||
if File.basename(source) == 'index.html'
|
||||
|
||||
+14
-14
@@ -164,14 +164,6 @@ function readPlist(/*File*/ aFile)
|
||||
return new CPPropertyListCreateFromData(data);
|
||||
}
|
||||
|
||||
function importFiles(filePaths, aCallback)
|
||||
{
|
||||
if (filePaths.length === 0)
|
||||
aCallback();
|
||||
else
|
||||
objj_import(new File(filePaths.shift()).getCanonicalPath(), YES, function() { importFiles(filePaths, aCallback) });
|
||||
}
|
||||
|
||||
function loadFrameworks(frameworkPaths, aCallback)
|
||||
{
|
||||
if (frameworkPaths.length === 0)
|
||||
@@ -191,18 +183,26 @@ function loadFrameworks(frameworkPaths, aCallback)
|
||||
|
||||
if ([infoDictionary objectForKey:@"CPBundlePackageType"] !== "FMWK")
|
||||
{
|
||||
java.lang.System.out.println("'" + frameworkPath + "' is not a framework .");
|
||||
java.lang.System.out.println("'" + frameworkPath + "' is not a framework.");
|
||||
java.lang.System.exit(1);
|
||||
}
|
||||
|
||||
var files = [infoDictionary objectForKey:@"CPBundleReplacedFiles"],
|
||||
index = 0,
|
||||
count = files.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
files[index] = frameworkPath + '/' + files[index];
|
||||
|
||||
importFiles(files, function() { loadFrameworks(frameworkPaths, aCallback) });
|
||||
if (count)
|
||||
{
|
||||
var context = new objj_context();
|
||||
|
||||
context.didCompleteCallback = function() { loadFrameworks(frameworkPaths, aCallback) };
|
||||
|
||||
while (count--)
|
||||
context.pushFragment(fragment_create_file(frameworkPath + '/' + files[count], new objj_bundle(""), YES, NULL));
|
||||
|
||||
context.evaluate();
|
||||
}
|
||||
else
|
||||
loadFrameworks(frameworkPaths, aCallback);
|
||||
}
|
||||
|
||||
function main()
|
||||
|
||||
Reference in new issue
Block a user