Skip to content

Commit

Permalink
Copy resources per pod (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl authored Oct 14, 2024
1 parent 84d4393 commit e328286
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions server/src/main/java/com/defold/extender/Extender.java
Original file line number Diff line number Diff line change
Expand Up @@ -945,10 +945,10 @@ private List<File> buildPods() throws IOException, InterruptedException, Extende
return outputFiles;
}

LOGGER.info("buildPods");
LOGGER.info("buildPods - compiling pod source files");
Set<File> podSourceLookup = new HashSet<>();
for (PodSpec pod : resolvedPods.pods) {
LOGGER.info("building {}", pod.name);
LOGGER.info("buildPods - compiling pod source files for {}", pod.name);
// The source files of each pod will be compiled and built as a library.
// We use the same mechanism as when building the extension and create a
// manifest context for each pod
Expand Down Expand Up @@ -978,14 +978,24 @@ private List<File> buildPods() throws IOException, InterruptedException, Extende
resourcesBuildDir.mkdir();
List<String> resources = resolvedPods.getAllPodResources(platform);
for (String resource : resources) {
// example:
// source = CocoaPodsService/Pods/YandexMobileAds/PrivacyInfo.xcprivacy
// dest = build/resources/YandexMobileAds/PrivacyInfo.xcprivacy
//
// resourceFile = CocoaPodsService/Pods/YandexMobileAds/PrivacyInfo.xcprivacy
// relativeFile = YandexMobileAds/PrivacyInfo.xcprivacy
// resourceDestFile = build/resources/YandexMobileAds/PrivacyInfo.xcprivacy
File resourceFile = new File(resource);
File relativeFile = resolvedPods.podsDir.toPath().relativize(resourceFile.toPath()).toFile();
if (resourceFile.isFile()) {
File resourceDestFile = new File(resourcesBuildDir, resourceFile.getName());
File resourceDestFile = new File(resourcesBuildDir, relativeFile.toString());
resourceDestFile.getParentFile().mkdirs();
Files.copy(resourceFile.toPath(), resourceDestFile.toPath());
outputFiles.add(resourceDestFile);
}
else {
File resourceDestDir = new File(resourcesBuildDir, resourceFile.getName());
File resourceDestDir = new File(resourcesBuildDir, relativeFile.toString());
resourceDestDir.mkdirs();
FileUtils.copyDirectory(resourceFile, resourceDestDir);
outputFiles.add(resourceDestDir);
}
Expand Down Expand Up @@ -2455,6 +2465,10 @@ private List<File> buildApple(String platform) throws ExtenderException {
LOGGER.info("Building Apple specific code");
List<File> outputFiles = new ArrayList<>();

File resourceDirectory = new File(buildDirectory, "resources");
List<File> resources = ExtenderUtil.listFiles(resourceDirectory, ".*");
outputFiles.addAll(resources);

List<File> privacyManifests = new ArrayList<>();
privacyManifests.addAll(ExtenderUtil.listFilesMatchingRecursive(uploadDirectory, "PrivacyInfo.xcprivacy"));
if (resolvedPods != null) {
Expand Down

0 comments on commit e328286

Please sign in to comment.