Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable interpolation for the distribution picked into the jvm platform argumetns #2396

Closed
ericzundel opened this issue Oct 19, 2015 · 0 comments

Comments

@ericzundel
Copy link
Member

We are currently using pants 0.0.53

Here's what we currently do to specify bootclasspath:

[jvm-platform]
default_platform: 1.8
platforms: {
    '1.7': {'source': '1.7', 'target': '1.7', 'args': ["-C-Xbootclasspath:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/classes", "-C-Xlint:cast", "-C-Xlint:deprecation", "-C-Xlint:empty", "-C-Xlint:finally"] },
    '1.8': {'source': '1.8', 'target': '1.8', 'args': ["-C-Xbootclasspath:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/classes", "-C-Xlint:cast", "-C-Xlint:deprecation", "-C-Xlint:empty", "-C-Xlint:finally"] },
  }

[jvm-distributions]
paths: {
    "mac os x": ["/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home", "/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home"],
    "linux": ["/usr/java/jdk1.8.0_45", "/usr/java/jdk1.7.0_80"],
  }

In practice, we generate this file. Currently , it generates linux paths for -Xbootclasspath: on Linux and mac paths when you exec pants on a mac. What would be better is the ability to do some kind of string interpolation inside one of the 'args' variables for the platforms setting.

Something like:

[jvm-platform]
default_platform: 1.8
platforms: {
    '1.7': {'source': '1.7', 'target': '1.7', 'args': ["-C-Xbootclasspath:(%distribution)/jre/lib/resources.jar:(%distribution)/jre/lib/rt.jar:(%distribution)/jre/lib/sunrsasign.jar:(%distribution)/jre/lib/jsse.jar:(%distribution)/jre/lib/jce.jar:(%distribution)/jre/lib/charsets.jar:(%distribution)/jre/lib/jfr.jar:(%distribution)/jre/classes", "-C-Xlint:cast", "-C-Xlint:deprecation", "-C-Xlint:empty", "-C-Xlint:finally"] },
...
stuhood pushed a commit that referenced this issue Jan 12, 2016
Users building with JDK 8 with `-target 7` can hit various problems due to pants' lack of `-bootclasspath` (#2396). Until that exists, it's useful to be able to force a specific JDK version.

Testing Done:
https://travis-ci.org/pantsbuild/pants/builds/101124263

Bugs closed: 2776

Reviewed at https://rbcommons.com/s/twitter/r/3310/
@benjyw benjyw closed this as completed Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants