Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: fix(android): Fix deprecated left shift usage (support was removed in Gradle 5) #472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/android/build-extras.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@
ext.postBuildExtras = {
def inAssetsDir = file("assets")
def outAssetsDir = inAssetsDir
outAssetsDir.mkdirs()
def outFile = new File(outAssetsDir, "cdvasset.manifest")

def newTask = task("cdvCreateAssetManifest") << {
def contents = new HashMap()
def sizes = new HashMap()
contents[""] = inAssetsDir.list()
def tree = fileTree(dir: inAssetsDir)
tree.visit { fileDetails ->
if (fileDetails.isDirectory()) {
contents[fileDetails.relativePath.toString()] = fileDetails.file.list()
} else {
sizes[fileDetails.relativePath.toString()] = fileDetails.file.length()
def newTask = task("cdvCreateAssetManifest") {
doLast {
def contents = new HashMap()
def sizes = new HashMap()
contents["test"] = inAssetsDir.list()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been 2 years since I created this PR so I don't remember the rationale, but this doesn't seem correct... especialyl since its being changed from contents[""] = ...

def tree = fileTree(dir: inAssetsDir)
tree.visit { fileDetails ->
if (fileDetails.isDirectory()) {
contents[fileDetails.relativePath.toString()] = fileDetails.file.list()
} else {
sizes[fileDetails.relativePath.toString()] = fileDetails.file.length()
}
}
}

outAssetsDir.mkdirs()
outFile.withObjectOutputStream { oos ->
oos.writeObject(contents)
oos.writeObject(sizes)
outFile.withObjectOutputStream { oos ->
oos.writeObject(contents)
oos.writeObject(sizes)
}
}
}
newTask.inputs.dir inAssetsDir
Expand Down