Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16871] Android: iOS: JavaScript files are not being symlinked

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-14T17:08:10.000+0000
Affected Version/sRelease 3.3.0
Fix Version/s2014 Sprint 09, 2014 Sprint 09 Tooling, Release 3.3.0
ComponentsAndroid, iOS, Tooling
Labelsqe-closed-3.3.0, qe-testadded
ReporterChris Barber
AssigneeChris Barber
Created2014-04-21T05:40:46.000+0000
Updated2014-07-22T08:12:19.000+0000

Description

When building Android or iOS app, JavaScript flies are not being symlinked. They should be symlinked whenever the JS files are not being minified. The change needs to take place at line 20 below:
// parse the AST
var r = jsanalyze.analyzeJsFile(from, { minify: this.minifyJS });

// we want to sort by the "to" filename so that we correctly handle file overwriting
this.tiSymbols[to] = r.symbols;

var dir = path.dirname(to);
fs.existsSync(dir) || wrench.mkdirSyncRecursive(dir);

if (this.minifyJS) {
	this.logger.debug(__('Copying and minifying %s => %s', from.cyan, to.cyan));

	this.cli.createHook('build.android.compileJsFile', this, function (r, from, to, cb2) {
		fs.writeFile(to, r.contents, cb2);
	})(r, from, to, cb);
} else {
	this.logger.debug(__('Copying %s => %s', from.cyan, to.cyan));

	// CHANGE THIS TO USE copyFile()!
	fs.writeFile(to, r.contents, cb);
}

Comments

  1. Chris Barber 2014-04-21

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5633 To test: 1) Create an app 2) Build for iOS Simulator 3) Observe output that app.js is now symlinked and not copied 4) Confirm directory listing: ls -l build/iphone/build/Debug-iphonesimulator/testapp.app 5) Build for Android emulator 6) Observe output that app.js is now symlinked and not copied 7) Confirm directory listing: ls -l build/android/bin/assets/Resources
  2. Tim Poulsen 2014-05-09

    All steps work as described. Passes.
  3. Paras Mishra 2014-05-13

    Javascript files are getting copied but not being symlinked. Verified for both android and iOS platoform, so reopening the issue. Verified the issue on: iOS simulator: 7.1 Android emulator: 2.3 SDK: 3.3.0.v20140512162513 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-dev ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201405121247 titanium-code-processor: 1.1.1 XCode : 5.1.1
  4. Chris Barber 2014-05-14

    I retested this and it works fine:
       [INFO]  Processing JavaScript files
       [DEBUG] Symlinking /Users/chris/appc/workspace/testapp/Resources/app.js => /Users/chris/appc/workspace/testapp/build/iphone/build/Debug-iphonesimulator/testapp.app/app.js
       
  5. Paras Mishra 2014-05-15

    Hi chris, Javascript files are being symlinked, problem was caused by this bug TIMOB-16951 as sdk changes to tiapp.xml were not reflected. Closing the issue. Verified the fix on: SDK: 3.3.0.v20140512162513 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-Alpha ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201405121247 titanium-code-processor: 1.1.1 XCode : 5.1.1

JSON Source