Added standard compiler plugins

This commit is contained in:
Erik C. Thauvin 2023-11-13 12:38:18 -08:00
parent 971de30902
commit 11c0b2b582
3 changed files with 58 additions and 8 deletions

View file

@ -83,9 +83,8 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
}
return Collections.emptyList();
} else {
var dir_abs = directory.getAbsoluteFile();
return FileUtils.getFileList(dir_abs, KOTLIN_FILE_PATTERN, null).stream().map((file) ->
new File(dir_abs, file)).toList();
return FileUtils.getFileList(directory, KOTLIN_FILE_PATTERN, null).stream().map((file) ->
new File(directory, file)).toList();
}
}
@ -427,6 +426,20 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
return this;
}
/**
* Provides compiler plugins.
*
* @param directory the directory containing the plugin JARs
* @param plugins one or more plugins
* @return this class instance
*/
public CompileKotlinOperation plugins(File directory, CompileKotlinPlugin... plugins) {
for (var plugin : plugins) {
plugins_.addAll(CompileKotlinOperation.getJarList(directory, plugin.label));
}
return this;
}
// Combine Kotlin sources
private Collection<File> sources(Collection<File> files, Collection<File> directories) {
var sources = new ArrayList<>(files);

View file

@ -0,0 +1,34 @@
/*
* Copyright 2023 the original author or authors.
*
* 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
*
* https://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 rife.bld.extension;
public enum CompileKotlinPlugin {
ALL_OPEN("^allopen-compiler-plugin-.*$"),
ASSIGNMENT("^assignment-compiler-plugin-.*$"),
KOTLIN_IMPORTS_DUMPER("^kotlin-imports-dumper-compiler-plugin-.*$"),
KOTLIN_SERIALIZATION("^kotlin-serialization-compiler-plugin-.*$"),
KOTLINX_SERIALIZATION("^kotlinx-serialization-compiler-plugin-.*$"),
LOMBOK("^lombok-compiler-plugin-.*$"),
NOARG("^noarg-compiler-plugin-.*$"),
SAM_WITH_RECEIVER("^sam-with-receiver-compiler-plugin-.*$");
public final String label;
CompileKotlinPlugin(String label) {
this.label = label;
}
}