kotlin-maven-plugin: avoid adding sourceroots to read-only freeArgs list

This commit is contained in:
Ilya Gorbunov
2019-07-06 06:46:43 +03:00
parent 5d12603d73
commit 103e16c40f
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2017 JetBrains s.r.o. * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.maven; package org.jetbrains.kotlin.maven;
@@ -231,9 +220,11 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
A arguments, A arguments,
List<File> sourceRoots List<File> sourceRoots
) throws MojoExecutionException { ) throws MojoExecutionException {
ArrayList<String> freeArgs = new ArrayList<>(arguments.getFreeArgs());
for (File sourceRoot : sourceRoots) { for (File sourceRoot : sourceRoots) {
arguments.getFreeArgs().add(sourceRoot.getPath()); freeArgs.add(sourceRoot.getPath());
} }
arguments.setFreeArgs(freeArgs);
return compiler.exec(messageCollector, Services.EMPTY, arguments); return compiler.exec(messageCollector, Services.EMPTY, arguments);
} }