You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Christofer Dutz <ch...@c-ware.de> on 2016/06/01 15:21:39 UTC

AW: AW: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Hi Alex,


I have to admit that I had problems following your second last email ... I am sure the patch isn't 100% as I noticed some regexp replacing had changed in Ant since I migrated them to Maven. Another reason why I like the Patch approach :-)


So do I understand you correctly? I need to run externc (-js–root set) to process the JavaScripts, then I need to apply the patches, and then I run externc again to generate the ActionScript? Oh gee ... I think what I did when migrating was to look at the original and compare that with the final version and to make regexps that convert the on into the other, probably doing both the externc and regexp stuff in one go. But I'm not 100% sure on this. If these two steps are/were needed, which of the following is true:


- the patch contains both the changes from externc and the ones of the regexp

- the javascript sources need to be modified by the patch and then by externc

- the javascript sources need to be modified by externc and then by the patch


I would like to keep the patching as one operation in order to keep the build simple.


I also just noticed that I needed to install a version of "patch" in order to run the maven build on windows ... not quite satisfied with this approach. Eventually it would help to contribute to the project to use a pure Java implementation. Will look into this.


Chris






________________________________
Von: Alex Harui <ah...@adobe.com>
Gesendet: Dienstag, 31. Mai 2016 23:12:54
An: Christofer Dutz
Cc: dev@flex.apache.org
Betreff: Re: AW: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Somehow dev@ keeps falling of the recipients list…

Anyway, an update:

Using my Mac and the command line Gnu patch (not Git or Maven patch plug-in), I am able to reproduce what you reported:  The patch I generated from Git does not apply correctly to those four files and using the –l (ignore whitespace) option doesn't help.  But, I just discovered that by getting Ant to run fixcrlf on the downloaded files, then Gnu patch can correctly apply the patch.  I guess that means that it is a line ending issue.  Git must be more tolerant that Gnu patch about EOL in the source files.

I also tried generating the patch from diff (instead of Git) and it wouldn't apply either, so I don't think it is the way Git diff vs Mac diff work, I think it is that the ExternC with js-root option rewrites the .JS files with, in this case, Mac EOL and those four files have DOS EOL in them.  I suppose we could try tweaking ExternC to remember the EOL in the input file and use it during output, but would it be possible to run the equivalent of fixcrlf from Maven somehow?

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Date: Tuesday, May 31, 2016 at 1:02 PM
To: Christofer Dutz <ch...@c-ware.de>>
Subject: Re: AW: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

I think I correctly applied your patch in the Ant build and when testing the results in an app, I got tons of warnings.  In looking at the proposed patches, it appears that the patch isn't "complete".  The Ant patch is working with JS files that have been processed with ExternC with -js–root to strip out function bodies and otherwise prepare the JS files to look like real externs to the Google Closure Compiler.  I think we had a miscommunication there.

I've updated the flex-asjs/examples/flexjs/CreateJSExample to properly use the createjs.swc from flex-falcon.  Before my latest update, building that example was resulting in about 7 warnings like:


WARNING - 'createjs.Stage' used but not goog.require'd

(There are some other non-CreateJS warnings, but less ignore those for this discussion).  That's because the createjs.swc, with its .js files packed in it wasn't being included as an external SWC.  With my change to the build.xml in flex-asjs/examples/flexjs/CreateJS, it now uses the createjs.swc and the results using the Ant-built version cause those warnings to go away (but unfortunately, they are replaced by about 10 warnings about toString which we'll have to fix at some point).

Those warnings about "used but not required" go away because part of building an externs SWC is to make sure you have .js files that fit the externs format that GCC expects.  But GCC is pickier when parsing externs than when otherwise parsing JS files.  It doesn't seem to like function bodies and other stuff.  That's why I added the -js–root option to ExternC:  we can use the less-picky GCC parsing to take the CreateJS source files and build an AST, then generate the .AS files from that AST as well as generate a set of externs-like JS files for GCC, so when GCC later tries to parse the JS files it doesn't output tons of warnings.

So, I think we do need to do more surgery on the CreateJS source files than I think the Maven preprocessing is currently doing, and currently that is enough changes that Git diff seems to treat it much like a "delete and new".  It might be possible to upgrade ExternC to try to retain the whitespace and line numbering of the input files, but I think I'd like to explore more about why Maven can't apply a big patch like that.  So that's what I'm off to experiment with now.

-Alex


From: Christofer Dutz <ch...@c-ware.de>>
Date: Tuesday, May 31, 2016 at 9:53 AM
To: Alex Harui <ah...@adobe.com>>
Subject: AW: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Hi Alex,

The format is the same. I was able to apply the other patches. Just the one didn't.

Looking at the patch itself it seemed as if it replaced the entire file content instead of just applying a few changes. So the problem is just creating the patch not applying it. Perhaps investigating problems in the patch creation helps.

Chris



Von meinem Samsung Galaxy Smartphone gesendet.


-------- Ursprüngliche Nachricht --------
Von: Alex Harui <ah...@adobe.com>>
Datum: 31.05.16 18:42 (GMT+01:00)
An: Christofer Dutz <ch...@c-ware.de>>, dev@flex.apache.org<ma...@flex.apache.org>
Betreff: Re: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Bummer.  I picked Git because everyone already had to have it installed.  I wasn't sure about diff and patch on Windows machines.  I'll be around my Windows machine on Wednesday.  Or maybe I can figure out how to get Git to generate and consume the same patch format.  I think I tried it earlier and was unsuccessful.  I'll look into it.

-Alex

From: Christofer Dutz <ch...@c-ware.de>>
Date: Tuesday, May 31, 2016 at 2:41 AM
To: Alex Harui <ah...@adobe.com>>, "dev@flex.apache.org<ma...@flex.apache.org>" <de...@flex.apache.org>>
Subject: AW: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks


Hi Alex,


I am using a Mac and I tried what you suggested. Nothing worked :-(


So I had a look at the patch files and noticed that they seem to create and delete most of the files. So I manually created a patch using:


diff -ur../target/downloads/TweenJS-0.6.2/src/TweenJS-0.6.2/src/ > tweenjs2.patch


And the patch created this way looked completely different. I was able to apply the patch created this way without any problems. So maybe using git to create the patch isn't ideal. I added my versions as tweenjs2.patch and easeljs2.patch and updated the maven build to use these ... could you please try and update your workflow to generate the patch files differently.


Chris

________________________________
Von: Alex Harui <ah...@adobe.com>>
Gesendet: Freitag, 27. Mai 2016 18:08:30
An: Christofer Dutz; dev@flex.apache.org<ma...@flex.apache.org>
Betreff: Re: AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Are you on a Mac or Windows machine?

I removed the ignore whitespace option from the ant build and the same 4 files failed so I still suspect a line ending problem.  I noticed the whitespace option in the plugin defaults to true so not sure why it doesn't work for you.

Can you try applying the patch manually and running unix2dos and or dos2unix on the 4 files and the patch files?  That may not be a final solution but will prove it is a line ending issue.

I also used a byte viewer to see that the patch and source had different line ending.

Sent from my LG G3, an AT&T 4G LTE smartphone

------ Original message------
From: Christofer Dutz
Date: Fri, May 27, 2016 1:35 AM
To: dev@flex.apache.org<ma...@flex.apache.org>;
Subject:AW: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

Hi Alex,

well I think I was blind and overlooked the "strip" option cause almost every Maven plugin has a "skip" option and this one doesn't ... but using strip=7 I was able to apply the patches, but still the 4 files still don't work correctly ... even with "ignoreWhitespace" option turned on.

Chris



________________________________________
Von: Alex Harui <ah...@adobe.com>>
Gesendet: Donnerstag, 26. Mai 2016 18:50:59
An: dev@flex.apache.org<ma...@flex.apache.org>
Betreff: Re: AW: AW: [FalconJX] Extern builds use patch files instead of replace tasks

On 5/26/16, 9:15 AM, "Christofer Dutz" <ch...@c-ware.de>> wrote:

>
>Hi Alex,
>
>I had a look and the plugin doesn't offer this ... the paths seem to be
>invalid ones anyway ... it seems that you copied the originals to a
>directory "a" and the patched ones to one called "b" and created the
>patch from that. After fixing this path-problem, I was able to apply most
>of the patch. The only files that weren't able to be patched were:
>- createjs/events/EventDispatcher.js
>- easeljs/display/Container.js
>- easeljs/display/DisplayObject.js
>- easeljs/utils/SpriteSheetUtils.js
>
>When applying this manually IntelliJ complained about part of the patch
>already being applied. Any ideas?

I am using git to create and apply patches.  They seem to start paths with
"a" and "b".  Not sure why.  Every patch/diff I've worked with seems to
have that.

I found this page:
http://maven.apache.org/plugins/maven-patch-plugin/apply-mojo.html

It lists a "skip" option which I think matches the -p option that should
cut directories of the paths.

It also lists an "ignore-whitespace" option which the Ant build is using
because EventDispatcher.js has different line endings (CRLF) than the
other files.  The other 3 files you mentioned may have the same issue.

Is it possible for you to use those two options?

-Alex