scala/scala-asm

Rebase on ASM 6.2

retronym opened this issue · 12 comments

$ git remote add upstream-asm https://gitlab.ow2.org/asm/asm
$ git fetch upstream-asm --tags
$ git push origin ASM_6_2

ASM_6_0...ASM_6_2

$ git log  --oneline ASM_6_0..v6.0.0-scala-1
fdb06854 (tag: v6.0.0-scala-1, origin/s-6.0) [asm-cherry-pick] Fill exception message for max String literal length
ea125bd4 [asm-cherry-pick] Fix findItemByIndex in case of hash collisions
0e5b0ab9 [asm-cherry-pick] Call interpreter.copyInstruction consistently
3210f654 [asm-cherry-pick] Multiple methods for initializing analysis values
41733544 [asm-cherry-pick] Allow setting stack values in analysis frames
75c9cfb8 [asm-cherry-pick] Clarify the doc of MethodInsnNode.owner
8f28b7f2 [asm-cherry-pick] Fix typos
f71d8867 [asm-cherry-pick] Use MethodWriter to compute maxLocals / maxStack
84e71cf2 [asm-cherry-pick] Log names on method size overflow
6665e1ff [asm-cherry-pick] Associate LabelNodes with their corresponding label
958c576a [asm-cherry-pick] Ensure instructions belong only to one list
4f7acc2e [asm-cherry-pick] asm.CustomAttribute class
145c8595 [asm-cherry-pick] Build infrastructure
665ea289 Remove trailing whitespace
937747f7 Update `@links`, `@associates`
7a11f0df Update imports
1ae83b79 Update package clauses
794b6628 Move sources to src/main/java/scala/tools/asm
273fcf82 Convert all line endings to unix
8e73bfa4 Remove unused files
000a5395 [asm-cherry-pick] Script for deleting unused files and preparing sources
$ git cherry-pick 679bfd52
[s-6.2 d324049b] [asm-cherry-pick] Script for deleting unused files and preparing sources

$ bash -x scripts/selectAndPrepareSources

$ git push --set-upstream retronym s-6.2

$ git cherry-pick 145c8595
[s-6.2 ef09c20b] [asm-cherry-pick] Build infrastructure
[success] Total time: 0 s, completed 30/05/2018 8:38:07 PM
[warn] MiMa will NOT run because no mimaPreviousVersion is provided.
[info] Compiling 94 Java sources to /Users/jz/code/scala-asm/target/classes...
[warn] bootstrap class path not set in conjunction with -source 1.5
[warn] source value 1.5 is obsolete and will be removed in a future release
[warn] -options.
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:40: package aQute.bnd.header does not exist
[error] import aQute.bnd.header.Attrs;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:41: package aQute.bnd.header does not exist
[error] import aQute.bnd.header.Parameters;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:42: package aQute.bnd.osgi does not exist
[error] import aQute.bnd.osgi.Analyzer;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:43: package aQute.bnd.osgi does not exist
[error] import aQute.bnd.osgi.Constants;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:44: package aQute.bnd.osgi does not exist
[error] import aQute.bnd.osgi.EmbeddedResource;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:45: package aQute.bnd.osgi does not exist
[error] import aQute.bnd.osgi.Jar;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:46: package aQute.bnd.service does not exist
[error] import aQute.bnd.service.AnalyzerPlugin;
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:48: cannot find symbol
[error]   symbol: class AnalyzerPlugin
[error] public class ModuleInfoBndPlugin implements AnalyzerPlugin {
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:56: cannot find symbol
[error]   symbol:   class Analyzer
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]   public boolean analyzeJar(Analyzer analyzer) throws Exception {
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:57: cannot find symbol
[error]   symbol:   variable Constants
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     String moduleName = analyzer.getProperty(MODULE_NAME, analyzer.getProperty(Constants.BUNDLE_SYMBOLICNAME));
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:58: cannot find symbol
[error]   symbol:   variable Constants
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     String moduleVersion =  analyzer.getProperty(MODULE_VERSION, analyzer.getProperty(Constants.BUNDLE_VERSION));
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:60: cannot find symbol
[error]   symbol:   variable Constants
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     String exportPackages = analyzer.getProperty(MODULE_EXPORTS, analyzer.getProperty(Constants.EXPORT_PACKAGE));
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:75: cannot find symbol
[error]   symbol:   class Parameters
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]       Parameters requireParams = analyzer.parseHeader(requireModules);
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:77: cannot find symbol
[error]   symbol:   class Attrs
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]         Attrs attrs = requireParams.get(requireName);
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:86: cannot find symbol
[error]   symbol:   class Parameters
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]       Parameters exportParams = analyzer.parseHeader(exportPackages);
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:104: cannot find symbol
[error]   symbol:   class Jar
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     Jar jar = analyzer.getJar();
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:105: cannot find symbol
[error]   symbol:   class EmbeddedResource
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     EmbeddedResource moduleInfo = new EmbeddedResource(bytecode, System.currentTimeMillis());
[error] /Users/jz/code/scala-asm/src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java:105: cannot find symbol
[error]   symbol:   class EmbeddedResource
[error]   location: class scala.tools.asm.tools.ModuleInfoBndPlugin
[error]     EmbeddedResource moduleInfo = new EmbeddedResource(bytecode, System.currentTimeMillis());
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] Total time: 1 s, completed 30/05/2018 8:38:08 PM
/code/scala-asm on s-6.2*
$ git commit -a -m "Remove unneeded parts of asm: ModuleInfoBndPlugin / Retrofitter"
[s-6.2 048c0792] Remove unneeded parts of asm: ModuleInfoBndPlugin / Retrofitter
 3 files changed, 398 deletions(-)
 delete mode 100644 src/main/java/scala/tools/asm/tools/ModuleInfoBndPlugin.java
 delete mode 100644 src/main/java/scala/tools/asm/tools/Retrofitter.java
 delete mode 100644 src/main/java/scala/tools/asm/tools/jdk1.5.0.12.txt.gz

$ git commit -a -m "Disable javadoc linting"
[s-6.2 0a56eca7] Disable javadoc linting
 1 file changed, 1 insertion(+), 1 deletion(-)

$ git cherry-pick 145c8595..fdb06854

$ git rebase -i 257c4b95 # squash `-Xdoclint:none` change into `Build infrastructure"
$ git diff head
diff --git a/versions.properties b/versions.properties
index ad86745dd7..d8dc24c899 100644
--- a/versions.properties
+++ b/versions.properties
@@ -7,5 +7,5 @@ starr.version=2.13.0-M4
 # Other usages:
 #  - scala-asm: jar content included in scala-compiler
 #  - jline: shaded with JarJar and included in scala-compiler
-scala-asm.version=6.0.0-scala-1
+scala-asm.version=6.0-22-gdbf7433
 jline.version=2.14.6

$ git co 2.13.x; sbt 'partest --pos --neg --run --terse'
...
[success] Total time: 437 s, completed 30/05/2018 9:05:35 PM

@lrytz It's the first time I've done this. Thanks for the great instructions. Could you check I've followed them correctly? I haven't done the work of reviewing the diff in ASM in full yet, I remember you'd started that process.

My branch is at https://github.com/retronym/scala-asm/tree/s-6.2

lrytz commented

Could you replace the commit retronym@7299c39 by an update to scripts/gitignoreSelectFiles in retronym@d324049 ?

lrytz commented

Wow are there really 532 comits between 6.0 and 6.2 !?!

lrytz commented

Something looks wrong; your branch seems to build on top of https://github.com/scala/scala-asm/tree/ASM_6_0, not 6_2.

lrytz commented

The scripts will need some updating, because the repository structure changed quite a bit between 6.0 and 6.2

I've redone the rebase, updating the gitignore and scripts and merging the asm-cherry-pick commits.

The branch still needs a round of cleanup, and a few changes in scala/scala, but it looks to be passing the test suite.

The upstream code has been through a reformat, so just about every patch required some manual work. Above that, there have been some renames and some structural changes that required some careful merging.

@lrytz This branch is ready for a final round of review. scala/scala#6733 contains the compiler changes.

lrytz commented

Looks good, thank you for solving all the conflicts! The script changes can be squashed.

mkurz commented

Maybe it's time to try to get all the patches into the official asm repo?

@lrytz I tried to cut tag and release, but ran into a problem with the release script: https://travis-ci.org/scala/scala-asm/builds/389051634

$ jdk_switcher use openjdk6
Switching to OpenJDK6 (java-1.6.0-openjdk-amd64), JAVA_HOME will be set to /usr/lib/jvm/java-6-openjdk-amd64
update-java-alternatives: directory does not exist: /usr/lib/jvm/java-1.6.0-openjdk-amd64
...
...

17.77s$ sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install openjdk-6-jdk
Reading package lists...

In the last released build, jdk_switcher has the same error, and also preceded the apt-get, but JDK6 seemed to be on the path by the time the build ran.

scala-asm 6.2.0-scala-2 is now released. I worked around the JDK6 problem on Travis by using JDK8 to build.