Skip to content

Commit

Permalink
Work on the ios refactor. Started fixing bug with 9 patch splash scre…
Browse files Browse the repository at this point in the history
…ens on Android.
  • Loading branch information
cb1kenobi committed Oct 29, 2013
1 parent c085725 commit 5148936
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
4 changes: 2 additions & 2 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1955,8 +1955,8 @@ AndroidBuilder.prototype.copyResources = function copyResources(next) {
to = path.join(dest, name.replace(/[^a-z0-9_]/g, '_').substring(0, 80) + '_' + hash(name).substring(0, 10) + ext);
}
} else if (/^default(\.9)?\.(png|jpg)$/.test(relPath)) {
dest = this.buildResDrawableDir;
to = path.join(this.buildResDrawableDir, filename.replace('default.', 'background.'));
dest = path.join(this.buildResDir, 'drawable-nodpi');
to = path.join(this.buildResDir, 'drawable-nodpi', filename.replace('default.', 'background.'));
}

// if the destination directory does not exists, create it
Expand Down
43 changes: 40 additions & 3 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ iOSBuilder.prototype.run = function (logger, config, cli, finished) {
this.logger.info(__('Invoking xcodebuild'));
this.xcodePrecompilePhase(function () {
this.invokeXcodeBuild(next);
});
}.bind(this));
} else {
this.logger.info(__('Skipping xcodebuild'));
next();
Expand Down Expand Up @@ -2709,12 +2709,49 @@ iOSBuilder.prototype.compileJsFile = function compileJsFile(id, file) {
iOSBuilder.prototype.xcodePrecompilePhase = function xcodePrecompilePhase(finished) {
this.logger.info(__('Initiating Xcode pre-compile phase'));

series(this, [
'copyResources'
], function () {
finished();
});
};

iOSBuilder.prototype.copyResources = function copyResources(finished) {
this.tiModules = [];
this.symbols = {
$: ['USE_TI_ANALYTICS', 'USE_TI_NETWORK', 'USE_TI_PLATFORM', 'USE_TI_UI', 'USE_TI_API']
};
this.jsFilesToPrepare = [];

var tasks = [
// first task is to copy all files in the Resources directory, but ignore
// any directory that is the name of a known platform
function (cb) {
copyDir.call(this, {
src: path.join(this.projectDir, 'Resources'),
dest: this.buildBinAssetsResourcesDir,
ignoreRootDirs: ti.availablePlatformsNames
}, cb);
},

// next copy all files from the iOS specific Resources directory
function (cb) {
copyDir.call(this, {
src: path.join(this.projectDir, 'Resources', 'iphone'),
dest: this.buildBinAssetsResourcesDir
}, cb);
},

function (cb) {
copyDir.call(this, {
src: path.join(this.projectDir, 'Resources', 'ios'),
dest: this.buildBinAssetsResourcesDir
}, cb);
}
];



this.compileResources(path.join(this.projectDir, 'Resources'), this.xcodeAppDir, function () {
parallel(this, [
'compileJSS',
Expand All @@ -2734,10 +2771,10 @@ iOSBuilder.prototype.xcodePrecompilePhase = function xcodePrecompilePhase(finish
this.compileResources(path.join(this.projectDir, 'Resources', 'iphone'), this.xcodeAppDir, next);
},
function (next) {
this.compileResources(path.join(this.projectDir, 'platform', 'ios'), this.xcodeAppDir, next);
this.compileResources(path.join(this.projectDir, 'platform', 'ios'), this.buildDir, next);
},
function (next) {
this.compileResources(path.join(this.projectDir, 'platform', 'iphone'), this.xcodeAppDir, next);
this.compileResources(path.join(this.projectDir, 'platform', 'iphone'), this.buildDir, next);
},
function (next) {
this.detectModules(function () {
Expand Down

1 comment on commit 5148936

@farfromrefug
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Chris,
This change broke a behaviour when working on your app. Resources are only copied in xcodePrecompilePhase, so on the first build.
Consequently if you add a js file after that, you have to clean and recompile.

Before you could just recompile and it would copy the necessary files

Please sign in to comment.