NOISSUE fix issue with the narrator feature by splitting java and native libraries
This commit is contained in:
		| @@ -30,14 +30,15 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na | |||||||
| 	}; | 	}; | ||||||
| 	if(m_mojangDownloads) | 	if(m_mojangDownloads) | ||||||
| 	{ | 	{ | ||||||
| 		if(m_mojangDownloads->artifact) |  | ||||||
| 		{ |  | ||||||
| 			auto artifact = m_mojangDownloads->artifact; |  | ||||||
| 			jar += actualPath(artifact->path); |  | ||||||
| 		} |  | ||||||
| 		if(!isNative()) | 		if(!isNative()) | ||||||
| 			return; | 		{ | ||||||
| 		if(m_nativeClassifiers.contains(system)) | 			if(m_mojangDownloads->artifact) | ||||||
|  | 			{ | ||||||
|  | 				auto artifact = m_mojangDownloads->artifact; | ||||||
|  | 				jar += actualPath(artifact->path); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		else if(m_nativeClassifiers.contains(system)) | ||||||
| 		{ | 		{ | ||||||
| 			auto nativeClassifier = m_nativeClassifiers[system]; | 			auto nativeClassifier = m_nativeClassifiers[system]; | ||||||
| 			if(nativeClassifier.contains("${arch}")) | 			if(nativeClassifier.contains("${arch}")) | ||||||
|   | |||||||
| @@ -234,7 +234,7 @@ slots: | |||||||
| 		auto test = readMojangJson("data/lib-native.json"); | 		auto test = readMojangJson("data/lib-native.json"); | ||||||
| 		QStringList jar, native, native32, native64; | 		QStringList jar, native, native32, native64; | ||||||
| 		test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString()); | 		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(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(native32, {}); | ||||||
| 		QCOMPARE(native64, {}); | 		QCOMPARE(native64, {}); | ||||||
|   | |||||||
| @@ -491,20 +491,29 @@ void MinecraftProfile::applyLibrary(LibraryPtr library) | |||||||
| 	{ | 	{ | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	QList<LibraryPtr> * list = &m_libraries; | ||||||
|  | 	if(library->isNative()) | ||||||
|  | 	{ | ||||||
|  | 		list = &m_nativeLibraries; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	auto libraryCopy = Library::limitedCopy(library); | ||||||
|  |  | ||||||
| 	// find the library by name. | 	// 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. | 	// library not found? just add it. | ||||||
| 	if (index < 0) | 	if (index < 0) | ||||||
| 	{ | 	{ | ||||||
| 		m_libraries.append(Library::limitedCopy(library)); | 		list->append(libraryCopy); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	auto existingLibrary = m_libraries.at(index); |  | ||||||
|  | 	auto existingLibrary = list->at(index); | ||||||
| 	// if we are higher it means we should update | 	// if we are higher it means we should update | ||||||
| 	if (Version(library->version()) > Version(existingLibrary->version())) | 	if (Version(library->version()) > Version(existingLibrary->version())) | ||||||
| 	{ | 	{ | ||||||
| 		auto libraryCopy = Library::limitedCopy(library); | 		list->replace(index, libraryCopy); | ||||||
| 		m_libraries.replace(index, libraryCopy); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -581,6 +590,11 @@ const QList<LibraryPtr> & MinecraftProfile::getLibraries() const | |||||||
| 	return m_libraries; | 	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 | void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath) const | ||||||
| { | { | ||||||
| 	QStringList native32, native64; | 	QStringList native32, native64; | ||||||
| @@ -590,6 +604,10 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& | |||||||
| 	{ | 	{ | ||||||
| 		lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); | 		lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); | ||||||
| 	} | 	} | ||||||
|  | 	for (auto lib : getNativeLibraries()) | ||||||
|  | 	{ | ||||||
|  | 		lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); | ||||||
|  | 	} | ||||||
| 	if(architecture == "32") | 	if(architecture == "32") | ||||||
| 	{ | 	{ | ||||||
| 		nativeJars.append(native32); | 		nativeJars.append(native32); | ||||||
|   | |||||||
| @@ -115,6 +115,7 @@ public: /* getters for profile variables */ | |||||||
| 	const QStringList & getTweakers() const; | 	const QStringList & getTweakers() const; | ||||||
| 	const QList<JarmodPtr> & getJarMods() const; | 	const QList<JarmodPtr> & getJarMods() const; | ||||||
| 	const QList<LibraryPtr> & getLibraries() const; | 	const QList<LibraryPtr> & getLibraries() const; | ||||||
|  | 	const QList<LibraryPtr> & getNativeLibraries() const; | ||||||
| 	void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars, const QString & overridePath) const; | 	void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars, const QString & overridePath) const; | ||||||
| 	QString getMainJarUrl() const; | 	QString getMainJarUrl() const; | ||||||
| 	bool hasTrait(const QString & trait) const; | 	bool hasTrait(const QString & trait) const; | ||||||
| @@ -169,6 +170,9 @@ private: /* data */ | |||||||
| 	/// the list of libraries | 	/// the list of libraries | ||||||
| 	QList<LibraryPtr> m_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) | 	/// traits, collected from all the version files (version files can only add) | ||||||
| 	QSet<QString> m_traits; | 	QSet<QString> m_traits; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -283,6 +283,8 @@ QStringList OneSixInstance::verboseDescription(AuthSessionPtr session) | |||||||
| 			printLibFile(file); | 			printLibFile(file); | ||||||
| 		} | 		} | ||||||
| 		printLibFile(mainJarPath()); | 		printLibFile(mainJarPath()); | ||||||
|  | 		out << ""; | ||||||
|  | 		out << "Native libraries:"; | ||||||
| 		for(auto file: nativeJars) | 		for(auto file: nativeJars) | ||||||
| 		{ | 		{ | ||||||
| 			printLibFile(file); | 			printLibFile(file); | ||||||
|   | |||||||
| @@ -35,19 +35,23 @@ void LibrariesTask::executeTask() | |||||||
| 		downloadJob.reset(job); | 		downloadJob.reset(job); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	auto libs = profile->getLibraries(); |  | ||||||
|  |  | ||||||
| 	auto metacache = ENV.metacache(); | 	auto metacache = ENV.metacache(); | ||||||
| 	QList<LibraryPtr> brokenLocalLibs; | 	QList<LibraryPtr> brokenLocalLibs; | ||||||
| 	QStringList failedFiles; | 	QStringList failedFiles; | ||||||
| 	for (auto lib : libs) | 	auto createJobs = [&](const QList<LibraryPtr> & libs) | ||||||
| 	{ | 	{ | ||||||
| 		auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath()); | 		for (auto lib : libs) | ||||||
| 		for(auto dl : dls) |  | ||||||
| 		{ | 		{ | ||||||
| 			downloadJob->addNetAction(dl); | 			auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath()); | ||||||
|  | 			for(auto dl : dls) | ||||||
|  | 			{ | ||||||
|  | 				downloadJob->addNetAction(dl); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	}; | ||||||
|  | 	createJobs(profile->getLibraries()); | ||||||
|  | 	createJobs(profile->getNativeLibraries()); | ||||||
|  |  | ||||||
| 	// FIXME: this is never filled!!!! | 	// FIXME: this is never filled!!!! | ||||||
| 	if (!brokenLocalLibs.empty()) | 	if (!brokenLocalLibs.empty()) | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Petr Mrázek
					Petr Mrázek