|
| 1 | +# A fork of ASM for the Scala Compiler |
| 2 | + |
| 3 | +[<img src="https://img.shields.io/travis/scala/scala-asm.svg"/>](https://travis-ci.org/scala/scala-asm) |
| 4 | +[<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-asm.svg"/>](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-asm) |
| 5 | + |
| 6 | +This repository contains a fork of the ASM Java bytecode manipulation and analysis framework for the Scala compiler. |
| 7 | + |
| 8 | +The package name is changed to `scala.tools.asm`. |
| 9 | +There is a small number of other patches applied to the original sources. |
| 10 | +Note that this fork only contains a subset of the source files of the ASM repository. |
| 11 | + |
| 12 | +## Keeping in Synch |
| 13 | + |
| 14 | +When upgrading to a new ASM release, we always import the unmodified source files and re-apply all our patches on top. |
| 15 | +This makes it easy to see how our fork differs from the official release. |
| 16 | + |
| 17 | +## Current Version |
| 18 | + |
| 19 | +The current sources are based on the following version of ASM ([browse tags here](http://websvn.ow2.org/listing.php?repname=asm&path=%2Ftags%2F&rev=1748&peg=1748)): |
| 20 | + |
| 21 | +``` |
| 22 | +Version 5.0.3, SVN r1748, tags/ASM_5_0_3 |
| 23 | +``` |
| 24 | + |
| 25 | +## Upgrading ASM |
| 26 | + |
| 27 | +Start by deleting all source files and copy the ones from the latest ASM release. |
| 28 | + |
| 29 | +The original ASM sources are in an SVN repository, which is mirrored here: https://github.com/lrytz/asm. |
| 30 | +You can use this mirror, your own git-svn mirror, or the original SVN repository to grab the sources of a new ASM version. |
| 31 | +A description how to work with the git-svn clone is here: https://github.com/lrytz/asm/issues/1. |
| 32 | + |
| 33 | +*The below will change once a first is done in the new `scala/scala-asm` repository.* |
| 34 | +*In the new repository, it probably makes sense to only squash the "Re-packaging and cosmetic changes".* |
| 35 | +*The "actual changes" can then stay in the commit history.* |
| 36 | + |
| 37 | +Check the commit history of `src/asm`: https://github.com/scala/scala/commits/2.11.x/src/asm. |
| 38 | +Find the previous commit that upgraded ASM and take a look at its commit message. |
| 39 | +It should be a squashed version of a pull request that shows the precise procedure how the last upgrade was made. |
| 40 | + |
| 41 | +Excluded Files (don't copy): |
| 42 | + * `package.html` files |
| 43 | + * `org/objectweb/asm/commons`, but keep `CodeSizeEvaluator.java` |
| 44 | + * `org/objectweb/asm/optimizer` |
| 45 | + * `org/objectweb/asm/xml` |
| 46 | + |
| 47 | +Re-packaging and cosmetic changes: |
| 48 | + * convert line endings (there are some `CRLF`) |
| 49 | + `find src/asm/scala/tools/asm -name '*.java' | xargs dos2unix` |
| 50 | + * change package clauses |
| 51 | + `find src/asm/scala/tools/asm -name '*.java' | xargs sed -i '' -e 's/package org\.objectweb\.asm/package scala.tools.asm/'` |
| 52 | + * update imports |
| 53 | + `find src/asm/scala/tools/asm -name '*.java' | xargs sed -i '' -e 's/import org\.objectweb\.asm/import scala.tools.asm/'` |
| 54 | + * update `@links`, `@associates` |
| 55 | + `find src/asm/scala/tools/asm -name '*.java' | xargs sed -i '' -e 's/@link org\.objectweb\.asm/@link scala.tools.asm/'` |
| 56 | + `find src/asm/scala/tools/asm -name '*.java' | xargs sed -i '' -e 's/@associates org\.objectweb\.asm/@associates scala.tools.asm/'` |
| 57 | + * remove trailing whitespace |
| 58 | + `find src/asm/scala/tools/asm -name '*.java' | xargs sed -i '' -e 's/[ ]*$//'` |
| 59 | + |
| 60 | +Include the actual changes that we have in our repostiory |
| 61 | + * Include the commits labelled `[asm-cherry-pick]` in the non-squashed PR of the previous upgrade |
| 62 | + * Include the changes that were added to src/asm since the last upgrade and label them `[asm-cherry-pick]` |
0 commit comments