From 9f737b3d0f1b577cd1153e11fd58fbd98a98d085 Mon Sep 17 00:00:00 2001 From: NetoDevel Date: Thu, 23 Sep 2021 21:28:04 -0300 Subject: [PATCH 1/2] Adds filter to file module-info.class --- .../pkg/steps/JarResultBuildStep.java | 262 +++++++++--------- 1 file changed, 132 insertions(+), 130 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index f1f4cc7af7f8e..61c5b5202d470 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -87,14 +87,14 @@ /** * This build step builds both the thin jars and uber jars. - * + *

* The way this is built is a bit convoluted. In general we only want a single one built, * as determined by the {@link PackageConfig} (unless the config explicitly asks for both of them) - * + *

* However we still need an extension to be able to ask for a specify one of these despite the config, * e.g. if a serverless environment needs an uberjar to build its deployment package then we need * to be able to provide this. - * + *

* To enable this we have two build steps that strongly produce the respective artifact type build * items, but not a {@link ArtifactResultBuildItem}. We then * have another two build steps that only run if they are configured too that consume these explicit @@ -201,21 +201,21 @@ ArtifactResultBuildItem jarOutput(JarBuildItem jarBuildItem) { @BuildStep public JarBuildItem buildRunnerJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - ClassLoadingConfig classLoadingConfig, - List generatedClasses, - List generatedResources, - List uberJarRequired, - List uberJarMergedResourceBuildItems, - List uberJarIgnoredResourceBuildItems, - List legacyJarRequired, - QuarkusBuildCloseablesBuildItem closeablesBuildItem, - List additionalApplicationArchiveBuildItems, - MainClassBuildItem mainClassBuildItem, Optional appCDS) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + ClassLoadingConfig classLoadingConfig, + List generatedClasses, + List generatedResources, + List uberJarRequired, + List uberJarMergedResourceBuildItems, + List uberJarIgnoredResourceBuildItems, + List legacyJarRequired, + QuarkusBuildCloseablesBuildItem closeablesBuildItem, + List additionalApplicationArchiveBuildItems, + MainClassBuildItem mainClassBuildItem, Optional appCDS) throws Exception { if (appCDS.isPresent()) { handleAppCDSSupportFileGeneration(transformedClasses, generatedClasses, appCDS.get()); @@ -247,7 +247,7 @@ public JarBuildItem buildRunnerJar(CurateOutcomeBuildItem curateOutcomeBuildItem // the idea here is to just dump the class names of the generated and transformed classes into a file // that is read at runtime when AppCDS generation is requested private void handleAppCDSSupportFileGeneration(TransformedClassesBuildItem transformedClasses, - List generatedClasses, AppCDSRequestedBuildItem appCDS) throws IOException { + List generatedClasses, AppCDSRequestedBuildItem appCDS) throws IOException { Path appCDsDir = appCDS.getAppCDSDir(); Path generatedClassesFile = appCDsDir.resolve("generatedAndTransformed.lst"); try (BufferedWriter writer = Files.newBufferedWriter(generatedClassesFile, StandardOpenOption.CREATE)) { @@ -273,17 +273,17 @@ private void handleAppCDSSupportFileGeneration(TransformedClassesBuildItem trans } private JarBuildItem buildUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergeResources, - List ignoredResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergeResources, + List ignoredResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws Exception { //we use the -runner jar name, unless we are building both types Path runnerJar = outputTargetBuildItem.getOutputDirectory() @@ -319,18 +319,18 @@ private String suffixToClassifier(String suffix) { } private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergedResources, - List ignoredResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig, - Path runnerJar) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergedResources, + List ignoredResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig, + Path runnerJar) throws Exception { try (FileSystem runnerZipFs = ZipUtils.newZip(runnerJar)) { log.info("Building fat jar: " + runnerJar); @@ -393,8 +393,10 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem, for (Map.Entry> entry : duplicateCatcher.entrySet()) { if (entry.getValue().size() > 1) { if (explained.add(entry.getValue())) { - log.warn("Dependencies with duplicate files detected. The dependencies " + entry.getValue() - + " contain duplicate files, e.g. " + entry.getKey()); + if (!"module-info.class".endsWith(entry.getKey())) { + log.warn("Dependencies with duplicate files detected. The dependencies " + entry.getValue() + + " contain duplicate files, e.g. " + entry.getKey()); + } } } } @@ -417,12 +419,12 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem, *

  • The optional dependencies to include are absent
  • * * - * @param appDep the dependency to test. + * @param appDep the dependency to test. * @param optionalDependencies the optional dependencies to include into the final package. * @return {@code true} if the dependency should be included, {@code false} otherwise. */ private static boolean includeAppDep(AppDependency appDep, Optional> optionalDependencies, - Set removedArtifacts) { + Set removedArtifacts) { if (!"jar".equals(appDep.getArtifact().getType())) { return false; } @@ -437,9 +439,9 @@ private static boolean includeAppDep(AppDependency appDep, Optional seen, - Map> duplicateCatcher, Map> concatenatedEntries, - Set finalIgnoredEntries, AppDependency appDep, Set existingEntries, - Set mergeResourcePaths) throws IOException { + Map> duplicateCatcher, Map> concatenatedEntries, + Set finalIgnoredEntries, AppDependency appDep, Set existingEntries, + Set mergeResourcePaths) throws IOException { final Path metaInfDir = root.resolve("META-INF"); Files.walkFileTree(root, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor() { @@ -490,15 +492,15 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) } private JarBuildItem buildLegacyThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws Exception { Path runnerJar = outputTargetBuildItem.getOutputDirectory() .resolve(outputTargetBuildItem.getBaseName() + packageConfig.runnerSuffix + ".jar"); @@ -522,16 +524,16 @@ private JarBuildItem buildLegacyThinJar(CurateOutcomeBuildItem curateOutcomeBuil } private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ClassLoadingConfig classLoadingConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List additionalApplicationArchiveBuildItems, - MainClassBuildItem mainClassBuildItem) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ClassLoadingConfig classLoadingConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List additionalApplicationArchiveBuildItems, + MainClassBuildItem mainClassBuildItem) throws Exception { boolean rebuild = outputTargetBuildItem.isRebuild(); @@ -810,7 +812,7 @@ public void accept(Path path) { * @return a {@code Set} containing the key of the artifacts to load from the parent ClassLoader first. */ private Set getParentFirstKeys(CurateOutcomeBuildItem curateOutcomeBuildItem, - ClassLoadingConfig classLoadingConfig) { + ClassLoadingConfig classLoadingConfig) { final Set parentFirstKeys = new HashSet<>( curateOutcomeBuildItem.getEffectiveModel().getRunnerParentFirstArtifacts()); classLoadingConfig.parentFirstArtifacts.ifPresent( @@ -840,7 +842,7 @@ private boolean downloadFernflowerJar(PackageConfig packageConfig, Path fernflow String downloadURL = String.format("https://jitpack.io/com/github/fesh0r/fernflower/%s/fernflower-%s.jar", packageConfig.fernflower.hash, packageConfig.fernflower.hash); try (BufferedInputStream in = new BufferedInputStream(new URL(downloadURL).openStream()); - FileOutputStream fileOutputStream = new FileOutputStream(fernflowerJar.toFile())) { + FileOutputStream fileOutputStream = new FileOutputStream(fernflowerJar.toFile())) { byte[] dataBuffer = new byte[1024]; int bytesRead; while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) { @@ -889,9 +891,9 @@ private boolean decompile(Path fernflowerJar, Path decompiledOutputDir, Path jar } private void copyDependency(Set parentFirstArtifacts, OutputTargetBuildItem outputTargetBuildItem, - Map> runtimeArtifacts, Path libDir, Path baseLib, List jars, - boolean allowParentFirst, StringBuilder classPath, AppDependency appDep, - TransformedClassesBuildItem transformedClasses, Set removedDeps) + Map> runtimeArtifacts, Path libDir, Path baseLib, List jars, + boolean allowParentFirst, StringBuilder classPath, AppDependency appDep, + TransformedClassesBuildItem transformedClasses, Set removedDeps) throws IOException { final AppArtifact depArtifact = appDep.getArtifact(); @@ -966,19 +968,19 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) */ @BuildStep public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List generatedClasses, - List nativeImageResources, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - List uberJarRequired, - List mergeResources, - ClassLoadingConfig classLoadingConfig, - List ignoreResources) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List generatedClasses, + List nativeImageResources, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + List uberJarRequired, + List mergeResources, + ClassLoadingConfig classLoadingConfig, + List ignoreResources) throws Exception { Path targetDirectory = outputTargetBuildItem.getOutputDirectory() .resolve(outputTargetBuildItem.getBaseName() + "-native-image-source-jar"); IoUtils.createOrEmptyDir(targetDirectory); @@ -1013,16 +1015,16 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem } private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List allClasses, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - Path targetDirectory, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List allClasses, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + Path targetDirectory, + ClassLoadingConfig classLoadingConfig) throws Exception { copyJsonConfigFiles(applicationArchivesBuildItem, targetDirectory); Path runnerJar = targetDirectory @@ -1043,18 +1045,18 @@ private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuild } private NativeImageSourceJarBuildItem buildNativeImageUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergeResources, - List ignoreResources, - MainClassBuildItem mainClassBuildItem, - Path targetDirectory, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergeResources, + List ignoreResources, + MainClassBuildItem mainClassBuildItem, + Path targetDirectory, + ClassLoadingConfig classLoadingConfig) throws Exception { //we use the -runner jar name, unless we are building both types Path runnerJar = targetDirectory .resolve(outputTargetBuildItem.getBaseName() + packageConfig.runnerSuffix + ".jar"); @@ -1103,17 +1105,17 @@ public void accept(Path jsonPath) { } private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List generatedResources, - Path libDir, - List allClasses, - FileSystem runnerZipFs, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List generatedResources, + Path libDir, + List allClasses, + FileSystem runnerZipFs, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws IOException { final Map seen = new HashMap<>(); final StringBuilder classPath = new StringBuilder(); @@ -1138,9 +1140,9 @@ private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuild } private void copyLibraryJars(FileSystem runnerZipFs, OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, Path libDir, - StringBuilder classPath, List appDeps, Map> services, - Set ignoredEntries, Set removedDependencies) throws IOException { + TransformedClassesBuildItem transformedClasses, Path libDir, + StringBuilder classPath, List appDeps, Map> services, + Set ignoredEntries, Set removedDependencies) throws IOException { for (AppDependency appDep : appDeps) { final AppArtifact depArtifact = appDep.getArtifact(); @@ -1199,10 +1201,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) } private void copyCommonContent(FileSystem runnerZipFs, Map> concatenatedEntries, - ApplicationArchivesBuildItem appArchives, TransformedClassesBuildItem transformedClassesBuildItem, - List generatedClasses, - List generatedResources, Map seen, - Set ignoredEntries) + ApplicationArchivesBuildItem appArchives, TransformedClassesBuildItem transformedClassesBuildItem, + List generatedClasses, + List generatedResources, Map seen, + Set ignoredEntries) throws IOException { //TODO: this is probably broken in gradle @@ -1317,8 +1319,8 @@ private void filterZipFile(Path resolvedDep, Path targetPath, Set transf * Otherwise this manifest manipulation will be useless. */ private void generateManifest(FileSystem runnerZipFs, final String classPath, PackageConfig config, AppArtifact appArtifact, - String mainClassName, - ApplicationInfoBuildItem applicationInfo) + String mainClassName, + ApplicationInfoBuildItem applicationInfo) throws IOException { final Path manifestPath = runnerZipFs.getPath("META-INF", "MANIFEST.MF"); final Manifest manifest = new Manifest(); @@ -1372,8 +1374,8 @@ private void generateManifest(FileSystem runnerZipFs, final String classPath, Pa /** * Copy files from {@code dir} to {@code fs}, filtering out service providers into the given map. * - * @param dir the source directory - * @param fs the destination filesystem + * @param dir the source directory + * @param fs the destination filesystem * @param services the services map * @throws IOException if an error occurs */ From 251542acfe24f278f9dbd0b1ef04ac516285bbf8 Mon Sep 17 00:00:00 2001 From: NetoDevel Date: Thu, 23 Sep 2021 21:38:34 -0300 Subject: [PATCH 2/2] Fixs indentation --- .../pkg/steps/JarResultBuildStep.java | 256 +++++++++--------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 61c5b5202d470..e24d3ff3a666d 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -87,14 +87,14 @@ /** * This build step builds both the thin jars and uber jars. - *

    + * * The way this is built is a bit convoluted. In general we only want a single one built, * as determined by the {@link PackageConfig} (unless the config explicitly asks for both of them) - *

    + * * However we still need an extension to be able to ask for a specify one of these despite the config, * e.g. if a serverless environment needs an uberjar to build its deployment package then we need * to be able to provide this. - *

    + * * To enable this we have two build steps that strongly produce the respective artifact type build * items, but not a {@link ArtifactResultBuildItem}. We then * have another two build steps that only run if they are configured too that consume these explicit @@ -201,21 +201,21 @@ ArtifactResultBuildItem jarOutput(JarBuildItem jarBuildItem) { @BuildStep public JarBuildItem buildRunnerJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - ClassLoadingConfig classLoadingConfig, - List generatedClasses, - List generatedResources, - List uberJarRequired, - List uberJarMergedResourceBuildItems, - List uberJarIgnoredResourceBuildItems, - List legacyJarRequired, - QuarkusBuildCloseablesBuildItem closeablesBuildItem, - List additionalApplicationArchiveBuildItems, - MainClassBuildItem mainClassBuildItem, Optional appCDS) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + ClassLoadingConfig classLoadingConfig, + List generatedClasses, + List generatedResources, + List uberJarRequired, + List uberJarMergedResourceBuildItems, + List uberJarIgnoredResourceBuildItems, + List legacyJarRequired, + QuarkusBuildCloseablesBuildItem closeablesBuildItem, + List additionalApplicationArchiveBuildItems, + MainClassBuildItem mainClassBuildItem, Optional appCDS) throws Exception { if (appCDS.isPresent()) { handleAppCDSSupportFileGeneration(transformedClasses, generatedClasses, appCDS.get()); @@ -247,7 +247,7 @@ public JarBuildItem buildRunnerJar(CurateOutcomeBuildItem curateOutcomeBuildItem // the idea here is to just dump the class names of the generated and transformed classes into a file // that is read at runtime when AppCDS generation is requested private void handleAppCDSSupportFileGeneration(TransformedClassesBuildItem transformedClasses, - List generatedClasses, AppCDSRequestedBuildItem appCDS) throws IOException { + List generatedClasses, AppCDSRequestedBuildItem appCDS) throws IOException { Path appCDsDir = appCDS.getAppCDSDir(); Path generatedClassesFile = appCDsDir.resolve("generatedAndTransformed.lst"); try (BufferedWriter writer = Files.newBufferedWriter(generatedClassesFile, StandardOpenOption.CREATE)) { @@ -273,17 +273,17 @@ private void handleAppCDSSupportFileGeneration(TransformedClassesBuildItem trans } private JarBuildItem buildUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergeResources, - List ignoredResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergeResources, + List ignoredResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws Exception { //we use the -runner jar name, unless we are building both types Path runnerJar = outputTargetBuildItem.getOutputDirectory() @@ -319,18 +319,18 @@ private String suffixToClassifier(String suffix) { } private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergedResources, - List ignoredResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig, - Path runnerJar) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergedResources, + List ignoredResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig, + Path runnerJar) throws Exception { try (FileSystem runnerZipFs = ZipUtils.newZip(runnerJar)) { log.info("Building fat jar: " + runnerJar); @@ -419,12 +419,12 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem, *

  • The optional dependencies to include are absent
  • * * - * @param appDep the dependency to test. + * @param appDep the dependency to test. * @param optionalDependencies the optional dependencies to include into the final package. * @return {@code true} if the dependency should be included, {@code false} otherwise. */ private static boolean includeAppDep(AppDependency appDep, Optional> optionalDependencies, - Set removedArtifacts) { + Set removedArtifacts) { if (!"jar".equals(appDep.getArtifact().getType())) { return false; } @@ -439,9 +439,9 @@ private static boolean includeAppDep(AppDependency appDep, Optional seen, - Map> duplicateCatcher, Map> concatenatedEntries, - Set finalIgnoredEntries, AppDependency appDep, Set existingEntries, - Set mergeResourcePaths) throws IOException { + Map> duplicateCatcher, Map> concatenatedEntries, + Set finalIgnoredEntries, AppDependency appDep, Set existingEntries, + Set mergeResourcePaths) throws IOException { final Path metaInfDir = root.resolve("META-INF"); Files.walkFileTree(root, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor() { @@ -492,15 +492,15 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) } private JarBuildItem buildLegacyThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws Exception { Path runnerJar = outputTargetBuildItem.getOutputDirectory() .resolve(outputTargetBuildItem.getBaseName() + packageConfig.runnerSuffix + ".jar"); @@ -524,16 +524,16 @@ private JarBuildItem buildLegacyThinJar(CurateOutcomeBuildItem curateOutcomeBuil } private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ClassLoadingConfig classLoadingConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List additionalApplicationArchiveBuildItems, - MainClassBuildItem mainClassBuildItem) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ClassLoadingConfig classLoadingConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List additionalApplicationArchiveBuildItems, + MainClassBuildItem mainClassBuildItem) throws Exception { boolean rebuild = outputTargetBuildItem.isRebuild(); @@ -812,7 +812,7 @@ public void accept(Path path) { * @return a {@code Set} containing the key of the artifacts to load from the parent ClassLoader first. */ private Set getParentFirstKeys(CurateOutcomeBuildItem curateOutcomeBuildItem, - ClassLoadingConfig classLoadingConfig) { + ClassLoadingConfig classLoadingConfig) { final Set parentFirstKeys = new HashSet<>( curateOutcomeBuildItem.getEffectiveModel().getRunnerParentFirstArtifacts()); classLoadingConfig.parentFirstArtifacts.ifPresent( @@ -842,7 +842,7 @@ private boolean downloadFernflowerJar(PackageConfig packageConfig, Path fernflow String downloadURL = String.format("https://jitpack.io/com/github/fesh0r/fernflower/%s/fernflower-%s.jar", packageConfig.fernflower.hash, packageConfig.fernflower.hash); try (BufferedInputStream in = new BufferedInputStream(new URL(downloadURL).openStream()); - FileOutputStream fileOutputStream = new FileOutputStream(fernflowerJar.toFile())) { + FileOutputStream fileOutputStream = new FileOutputStream(fernflowerJar.toFile())) { byte[] dataBuffer = new byte[1024]; int bytesRead; while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) { @@ -891,9 +891,9 @@ private boolean decompile(Path fernflowerJar, Path decompiledOutputDir, Path jar } private void copyDependency(Set parentFirstArtifacts, OutputTargetBuildItem outputTargetBuildItem, - Map> runtimeArtifacts, Path libDir, Path baseLib, List jars, - boolean allowParentFirst, StringBuilder classPath, AppDependency appDep, - TransformedClassesBuildItem transformedClasses, Set removedDeps) + Map> runtimeArtifacts, Path libDir, Path baseLib, List jars, + boolean allowParentFirst, StringBuilder classPath, AppDependency appDep, + TransformedClassesBuildItem transformedClasses, Set removedDeps) throws IOException { final AppArtifact depArtifact = appDep.getArtifact(); @@ -968,19 +968,19 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) */ @BuildStep public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List generatedClasses, - List nativeImageResources, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - List uberJarRequired, - List mergeResources, - ClassLoadingConfig classLoadingConfig, - List ignoreResources) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List generatedClasses, + List nativeImageResources, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + List uberJarRequired, + List mergeResources, + ClassLoadingConfig classLoadingConfig, + List ignoreResources) throws Exception { Path targetDirectory = outputTargetBuildItem.getOutputDirectory() .resolve(outputTargetBuildItem.getBaseName() + "-native-image-source-jar"); IoUtils.createOrEmptyDir(targetDirectory); @@ -1015,16 +1015,16 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem } private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List allClasses, - List generatedResources, - MainClassBuildItem mainClassBuildItem, - Path targetDirectory, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List allClasses, + List generatedResources, + MainClassBuildItem mainClassBuildItem, + Path targetDirectory, + ClassLoadingConfig classLoadingConfig) throws Exception { copyJsonConfigFiles(applicationArchivesBuildItem, targetDirectory); Path runnerJar = targetDirectory @@ -1045,18 +1045,18 @@ private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuild } private NativeImageSourceJarBuildItem buildNativeImageUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - PackageConfig packageConfig, - ApplicationInfoBuildItem applicationInfo, - List generatedClasses, - List generatedResources, - List mergeResources, - List ignoreResources, - MainClassBuildItem mainClassBuildItem, - Path targetDirectory, - ClassLoadingConfig classLoadingConfig) throws Exception { + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + PackageConfig packageConfig, + ApplicationInfoBuildItem applicationInfo, + List generatedClasses, + List generatedResources, + List mergeResources, + List ignoreResources, + MainClassBuildItem mainClassBuildItem, + Path targetDirectory, + ClassLoadingConfig classLoadingConfig) throws Exception { //we use the -runner jar name, unless we are building both types Path runnerJar = targetDirectory .resolve(outputTargetBuildItem.getBaseName() + packageConfig.runnerSuffix + ".jar"); @@ -1105,17 +1105,17 @@ public void accept(Path jsonPath) { } private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuildItem, - OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, - ApplicationArchivesBuildItem applicationArchivesBuildItem, - ApplicationInfoBuildItem applicationInfo, - PackageConfig packageConfig, - List generatedResources, - Path libDir, - List allClasses, - FileSystem runnerZipFs, - MainClassBuildItem mainClassBuildItem, - ClassLoadingConfig classLoadingConfig) + OutputTargetBuildItem outputTargetBuildItem, + TransformedClassesBuildItem transformedClasses, + ApplicationArchivesBuildItem applicationArchivesBuildItem, + ApplicationInfoBuildItem applicationInfo, + PackageConfig packageConfig, + List generatedResources, + Path libDir, + List allClasses, + FileSystem runnerZipFs, + MainClassBuildItem mainClassBuildItem, + ClassLoadingConfig classLoadingConfig) throws IOException { final Map seen = new HashMap<>(); final StringBuilder classPath = new StringBuilder(); @@ -1140,9 +1140,9 @@ private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuild } private void copyLibraryJars(FileSystem runnerZipFs, OutputTargetBuildItem outputTargetBuildItem, - TransformedClassesBuildItem transformedClasses, Path libDir, - StringBuilder classPath, List appDeps, Map> services, - Set ignoredEntries, Set removedDependencies) throws IOException { + TransformedClassesBuildItem transformedClasses, Path libDir, + StringBuilder classPath, List appDeps, Map> services, + Set ignoredEntries, Set removedDependencies) throws IOException { for (AppDependency appDep : appDeps) { final AppArtifact depArtifact = appDep.getArtifact(); @@ -1201,10 +1201,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) } private void copyCommonContent(FileSystem runnerZipFs, Map> concatenatedEntries, - ApplicationArchivesBuildItem appArchives, TransformedClassesBuildItem transformedClassesBuildItem, - List generatedClasses, - List generatedResources, Map seen, - Set ignoredEntries) + ApplicationArchivesBuildItem appArchives, TransformedClassesBuildItem transformedClassesBuildItem, + List generatedClasses, + List generatedResources, Map seen, + Set ignoredEntries) throws IOException { //TODO: this is probably broken in gradle @@ -1319,8 +1319,8 @@ private void filterZipFile(Path resolvedDep, Path targetPath, Set transf * Otherwise this manifest manipulation will be useless. */ private void generateManifest(FileSystem runnerZipFs, final String classPath, PackageConfig config, AppArtifact appArtifact, - String mainClassName, - ApplicationInfoBuildItem applicationInfo) + String mainClassName, + ApplicationInfoBuildItem applicationInfo) throws IOException { final Path manifestPath = runnerZipFs.getPath("META-INF", "MANIFEST.MF"); final Manifest manifest = new Manifest(); @@ -1374,8 +1374,8 @@ private void generateManifest(FileSystem runnerZipFs, final String classPath, Pa /** * Copy files from {@code dir} to {@code fs}, filtering out service providers into the given map. * - * @param dir the source directory - * @param fs the destination filesystem + * @param dir the source directory + * @param fs the destination filesystem * @param services the services map * @throws IOException if an error occurs */