diff --git a/build.gradle b/build.gradle index a2323707c3..159eb7dd7b 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ if ("32".equals(System.getProperty("sun.arch.data.model"))) { * Identify supported Python command ***************************************************************************************/ project.ext.PYTHON3 = findPython3(true) -project.ext.PYTHON_DEPS = new HashSet() +project.ext.PYTHON_DEPS = new HashMap>() /********************************************************************************* * Define the location of bin repo diff --git a/gradle/hasPythonPackage.gradle b/gradle/hasPythonPackage.gradle index 14516ce0b0..6e7ea6d6cd 100644 --- a/gradle/hasPythonPackage.gradle +++ b/gradle/hasPythonPackage.gradle @@ -87,8 +87,13 @@ rootProject.assembleDistribution { } ext.distributePyDep = { name -> + Set wheelFiles = PYTHON_DEPS.get(project) + if (wheelFiles == null) { + wheelFiles = new HashSet<>() + PYTHON_DEPS.put(project, wheelFiles) + } File dep = findPyDep(name) - PYTHON_DEPS.add(dep) + wheelFiles.add(dep) def zipPath = getZipPath(project) rootProject.assembleDistribution { into ("${zipPath}/pypkg/dist") { diff --git a/gradle/support/ip.gradle b/gradle/support/ip.gradle index be221a90d9..bedd453246 100644 --- a/gradle/support/ip.gradle +++ b/gradle/support/ip.gradle @@ -45,6 +45,9 @@ task ip { // gets the external libs from gradle and verifies they are accounted for in the Module.manifest file checkExternalLibsInMap(moduleManifestIpMap, p) + // gets the declared external python wheels and verifies they are accounted for in the Module.manifest file + checkExternalPythonWheelsInMap(moduleManifestIpMap, p) + // adds the ip info from the Module.manifest file to the map generated from scanning the module files. addModuleManifestIp(ipToFileMap, moduleManifestIpMap) @@ -107,6 +110,18 @@ def checkExternalLibsInMap(Map map, Project project) { } } +/********************************************************************************** + * Gets the python dependences and makes sure each external wheel is accounted for in + * the map from the Module.manifest file + *********************************************************************************/ +def checkExternalPythonWheelsInMap(Map map, Project project) { + PYTHON_DEPS.getOrDefault(project, List.of()).each { dep -> + String name = dep.getName() // get just the filename without the path + String relativePath = "pypkg/dist/"+name; + assert map.containsKey(relativePath) : "No License specified for external python wheel: "+relativePath+ " in module "+project.projectDir + } +} + /********************************************************************************* * Examines all the files in the module, reads their ip from the header, verifies * that the ip is allowed, and adds an entry to a mapping of the ip to a list of