NOISSUE fix issue with the narrator feature by splitting java and native libraries

This commit is contained in:
Petr Mrázek 2017-04-06 23:31:23 +02:00
parent dddc5cedf3
commit 8e58d61150
6 changed files with 49 additions and 20 deletions

View File

@ -29,15 +29,16 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
return out.absoluteFilePath();
};
if(m_mojangDownloads)
{
if(!isNative())
{
if(m_mojangDownloads->artifact)
{
auto artifact = m_mojangDownloads->artifact;
jar += actualPath(artifact->path);
}
if(!isNative())
return;
if(m_nativeClassifiers.contains(system))
}
else if(m_nativeClassifiers.contains(system))
{
auto nativeClassifier = m_nativeClassifiers[system];
if(nativeClassifier.contains("${arch}"))

View File

@ -234,7 +234,7 @@ slots:
auto test = readMojangJson("data/lib-native.json");
QStringList jar, native, native32, native64;
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
QCOMPARE(jar, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar"));
QCOMPARE(jar, QStringList());
QCOMPARE(native, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar"));
QCOMPARE(native32, {});
QCOMPARE(native64, {});

View File

@ -491,20 +491,29 @@ void MinecraftProfile::applyLibrary(LibraryPtr library)
{
return;
}
QList<LibraryPtr> * list = &m_libraries;
if(library->isNative())
{
list = &m_nativeLibraries;
}
auto libraryCopy = Library::limitedCopy(library);
// find the library by name.
const int index = findLibraryByName(m_libraries, library->rawName());
const int index = findLibraryByName(*list, library->rawName());
// library not found? just add it.
if (index < 0)
{
m_libraries.append(Library::limitedCopy(library));
list->append(libraryCopy);
return;
}
auto existingLibrary = m_libraries.at(index);
auto existingLibrary = list->at(index);
// if we are higher it means we should update
if (Version(library->version()) > Version(existingLibrary->version()))
{
auto libraryCopy = Library::limitedCopy(library);
m_libraries.replace(index, libraryCopy);
list->replace(index, libraryCopy);
}
}
@ -581,6 +590,11 @@ const QList<LibraryPtr> & MinecraftProfile::getLibraries() const
return m_libraries;
}
const QList<LibraryPtr> & MinecraftProfile::getNativeLibraries() const
{
return m_nativeLibraries;
}
void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath) const
{
QStringList native32, native64;
@ -590,6 +604,10 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList&
{
lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath);
}
for (auto lib : getNativeLibraries())
{
lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath);
}
if(architecture == "32")
{
nativeJars.append(native32);

View File

@ -115,6 +115,7 @@ public: /* getters for profile variables */
const QStringList & getTweakers() const;
const QList<JarmodPtr> & getJarMods() const;
const QList<LibraryPtr> & getLibraries() const;
const QList<LibraryPtr> & getNativeLibraries() const;
void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars, const QString & overridePath) const;
QString getMainJarUrl() const;
bool hasTrait(const QString & trait) const;
@ -169,6 +170,9 @@ private: /* data */
/// the list of libraries
QList<LibraryPtr> m_libraries;
/// the list of libraries
QList<LibraryPtr> m_nativeLibraries;
/// traits, collected from all the version files (version files can only add)
QSet<QString> m_traits;

View File

@ -283,6 +283,8 @@ QStringList OneSixInstance::verboseDescription(AuthSessionPtr session)
printLibFile(file);
}
printLibFile(mainJarPath());
out << "";
out << "Native libraries:";
for(auto file: nativeJars)
{
printLibFile(file);

View File

@ -35,11 +35,11 @@ void LibrariesTask::executeTask()
downloadJob.reset(job);
}
auto libs = profile->getLibraries();
auto metacache = ENV.metacache();
QList<LibraryPtr> brokenLocalLibs;
QStringList failedFiles;
auto createJobs = [&](const QList<LibraryPtr> & libs)
{
for (auto lib : libs)
{
auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath());
@ -48,6 +48,10 @@ void LibrariesTask::executeTask()
downloadJob->addNetAction(dl);
}
}
};
createJobs(profile->getLibraries());
createJobs(profile->getNativeLibraries());
// FIXME: this is never filled!!!!
if (!brokenLocalLibs.empty())
{