8035063: Option handling in sjavac needs to be rewritten

Option handling code rewritten. Exclusion / inclusion patterns changed from package to directories.

Reviewed-by: jjg, jfranck
This commit is contained in:
Andreas Lundblad 2014-04-22 16:51:10 +02:00
parent a50db59b59
commit 06f651942c
28 changed files with 2427 additions and 907 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,15 +25,16 @@
package com.sun.tools.sjavac;
import java.io.PrintStream;
import java.net.URI;
import java.util.Arrays;
import java.util.Random;
import java.util.Set;
import java.util.Map;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.server.JavacServer;
import com.sun.tools.sjavac.server.SysInfo;
import java.io.PrintStream;
/**
* This transform compiles a set of packages containing Java sources.
@ -54,13 +55,12 @@ public class CompileJavaPackages implements Transformer {
// We hope to improve this in the future.
final static int limitOnConcurrency = 3;
String serverSettings;
Options args;
public void setExtra(String e) {
serverSettings = e;
}
String[] args;
public void setExtra(String[] a) {
public void setExtra(Options a) {
args = a;
}
@ -82,14 +82,14 @@ public class CompileJavaPackages implements Transformer {
boolean concurrentCompiles = true;
// Fetch the id.
String id = Util.extractStringOption("id", serverSettings);
String id = Util.extractStringOption("id", args.getServerConf());
if (id == null || id.equals("")) {
// No explicit id set. Create a random id so that the requests can be
// grouped properly in the server.
id = "id"+(((new Random()).nextLong())&Long.MAX_VALUE);
}
// Only keep portfile and sjavac settings..
String psServerSettings = Util.cleanSubOptions("--server:", Util.set("portfile","sjavac","background","keepalive"), serverSettings);
String psServerSettings = Util.cleanSubOptions(Util.set("portfile","sjavac","background","keepalive"), args.getServerConf());
// Get maximum heap size from the server!
SysInfo sysinfo = JavacServer.connectGetSysInfo(psServerSettings, out, err);
@ -223,7 +223,7 @@ public class CompileJavaPackages implements Transformer {
@Override
public void run() {
rn[ii] = JavacServer.useServer(cleanedServerSettings,
Main.removeWrapperArgs(args),
args.prepJavacArgs(),
cc.srcs,
fvisible_sources,
fvisible_classes,