From 3bde413da72139f4cca2dff323d9f173cb36bfe0 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 10 Jan 2025 13:43:09 +0100 Subject: [PATCH 1/2] Better detection for Enso's NI when launching LS Previosly we were wrongly relying on the presence of the file. That way, a bash script meant that NI integration was wrongly used. This change uses Tika, but it has already been present in other subprojects so no additional dependency shall be added. Follow up on #11880. --- build.sbt | 2 ++ .../runner/NativeExecCommand.scala | 22 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 9552eef688ae..09bceca9754e 100644 --- a/build.sbt +++ b/build.sbt @@ -4495,10 +4495,12 @@ lazy val `runtime-version-manager` = project libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.apache.tika" % "tika-core" % tikaVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), Compile / moduleDependencies ++= Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeExecCommand.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeExecCommand.scala index 33beca0aa1c3..6cac2a90025b 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeExecCommand.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeExecCommand.scala @@ -4,6 +4,9 @@ import org.enso.cli.OS import org.enso.distribution.{DistributionManager, Environment} import org.enso.runtimeversionmanager.components.Engine +import org.apache.tika.config.TikaConfig +import org.apache.tika.Tika + import java.nio.file.Path case class NativeExecCommand(executablePath: Path) extends ExecCommand { @@ -26,7 +29,22 @@ object NativeExecCommand { val fullExecPath = dm.paths.engines.resolve(version).resolve("bin").resolve(execName) - if (fullExecPath.toFile.exists()) Some(NativeExecCommand(fullExecPath)) - else None + if (fullExecPath.toFile.exists() && isBinary(fullExecPath)) { + Some(NativeExecCommand(fullExecPath)) + } else None + } + + private def isBinary(path: Path): Boolean = { + try { + val config = TikaConfig.getDefaultConfig() + val tika = new Tika(config) + val mimeTypes = config.getMimeRepository + val mime = tika.detect(path); + val tpe = mimeTypes.forName(mime).getType.getType + tpe != null && tpe == "application" + } catch { + case _: Throwable => + false + } } } From cdcd4e89416c512d8c9fc3d38e7a4abfde78613b Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 10 Jan 2025 13:58:46 +0100 Subject: [PATCH 2/2] legal --- distribution/launcher/THIRD-PARTY/NOTICE | 5 +++ .../org.apache.tika.tika-core-2.4.1/NOTICE | 8 +++++ .../org.apache.tika.tika-core-2.4.1/NOTICES | 9 ++++++ .../project-manager/THIRD-PARTY/NOTICE | 5 +++ .../org.apache.tika.tika-core-2.4.1/NOTICE | 8 +++++ .../org.apache.tika.tika-core-2.4.1/NOTICES | 9 ++++++ tools/legal-review/engine/report-state | 2 +- .../copyright-ignore | 32 +++++++++++++++++++ .../copyright-keep-context | 1 + .../files-ignore | 1 + .../files-keep | 1 + tools/legal-review/launcher/report-state | 4 +-- .../copyright-ignore | 32 +++++++++++++++++++ .../copyright-keep-context | 1 + .../files-ignore | 1 + .../files-keep | 1 + .../legal-review/project-manager/report-state | 4 +-- 17 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE create mode 100644 distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES create mode 100644 distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE create mode 100644 distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES create mode 100644 tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-ignore create mode 100644 tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-keep-context create mode 100644 tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-ignore create mode 100644 tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-keep create mode 100644 tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-ignore create mode 100644 tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-keep-context create mode 100644 tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-ignore create mode 100644 tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-keep diff --git a/distribution/launcher/THIRD-PARTY/NOTICE b/distribution/launcher/THIRD-PARTY/NOTICE index ebad4a4fe07a..bdb3e52cff70 100644 --- a/distribution/launcher/THIRD-PARTY/NOTICE +++ b/distribution/launcher/THIRD-PARTY/NOTICE @@ -91,6 +91,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-compress-1.23.0`. +'tika-core', licensed under the Apache License, Version 2.0, is distributed with the launcher. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `org.apache.tika.tika-core-2.4.1`. + + 'scala-java8-compat_2.13', licensed under the Apache-2.0, is distributed with the launcher. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.modules.scala-java8-compat_2.13-1.0.0`. diff --git a/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE b/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE new file mode 100644 index 000000000000..cb2e5cab6f6d --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE @@ -0,0 +1,8 @@ + +Apache Tika core +Copyright 2007-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + diff --git a/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES b/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES new file mode 100644 index 000000000000..20a492fc0c1e --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES @@ -0,0 +1,9 @@ + /** + * Information about rights held in and over the resource. Typically, + * a Rights element will contain a rights management statement for + * the resource, or reference a service providing such information. + * Rights information often encompasses Intellectual Property Rights + * (IPR), Copyright, and various Property Rights. If the Rights element + * is absent, no assumptions can be made about the status of these and + * other rights with respect to the resource. + */ diff --git a/distribution/project-manager/THIRD-PARTY/NOTICE b/distribution/project-manager/THIRD-PARTY/NOTICE index d3cbb48532ce..7a8e75ef211a 100644 --- a/distribution/project-manager/THIRD-PARTY/NOTICE +++ b/distribution/project-manager/THIRD-PARTY/NOTICE @@ -356,6 +356,11 @@ The license information can be found along with the copyright notices. Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-lang3-3.12.0`. +'tika-core', licensed under the Apache License, Version 2.0, is distributed with the project-manager. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `org.apache.tika.tika-core-2.4.1`. + + 'reactive-streams', licensed under the CC0, is distributed with the project-manager. The license file can be found at `licenses/CC0`. Copyright notices related to this dependency can be found in the directory `org.reactivestreams.reactive-streams-1.0.3`. diff --git a/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE b/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE new file mode 100644 index 000000000000..cb2e5cab6f6d --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICE @@ -0,0 +1,8 @@ + +Apache Tika core +Copyright 2007-2022 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + + diff --git a/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES b/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES new file mode 100644 index 000000000000..20a492fc0c1e --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.apache.tika.tika-core-2.4.1/NOTICES @@ -0,0 +1,9 @@ + /** + * Information about rights held in and over the resource. Typically, + * a Rights element will contain a rights management statement for + * the resource, or reference a service providing such information. + * Rights information often encompasses Intellectual Property Rights + * (IPR), Copyright, and various Property Rights. If the Rights element + * is absent, no assumptions can be made about the status of these and + * other rights with respect to the resource. + */ diff --git a/tools/legal-review/engine/report-state b/tools/legal-review/engine/report-state index 4a4951f5435e..4d3be9751dda 100644 --- a/tools/legal-review/engine/report-state +++ b/tools/legal-review/engine/report-state @@ -1,3 +1,3 @@ -6EB80DB9BFB5BAC58FFE8EAB48A509A40EAC27733FCD0F46BC5FC3FDDB82339C +1C7BD42739A2FD536962BEEA3DC052C025F06FFA1E25E9D7BA0D41E9714BCD24 29565A85352D2C3F92648DF46C368298D320747F00AE06FD83197DD6E4CC1DF7 0 diff --git a/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-ignore b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-ignore new file mode 100644 index 000000000000..ad95e9f3eda9 --- /dev/null +++ b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-ignore @@ -0,0 +1,32 @@ +"The copyright information." +ARTWORK_OR_OBJECT_DETAIL_COPYRIGHT_NOTICE, ARTWORK_OR_OBJECT_DETAIL_CREATOR, +COPYRIGHT_OWNER_ID, COPYRIGHT_OWNER_NAME, IMAGE_CREATOR_ID, IMAGE_CREATOR_NAME, +Contains any necessary copyright notice for claiming the intellectual +Copyright 2016 Norconex Inc. +Copyright Owner, Image Supplier and Licensor may be the same or different +Copyright ownership can be expressed in a more controlled way using the +DATE_CREATED, DESCRIPTION_WRITER, INSTRUCTIONS, JOB_ID, TITLE, COPYRIGHT_NOTICE, +Owner or owners of the copyright in the licensed image. +PREFIX_IPTC_EXT + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "AOCopyrightNotice"); +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwner"); +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerID"), +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerId"; +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerName"); +Property ARTWORK_OR_OBJECT_DETAIL_COPYRIGHT_NOTICE = Property.internalTextBag( +Property COPYRIGHT = Property.externalText("xmpDM:copyright"); +Property COPYRIGHT_NOTICE = DublinCore.RIGHTS; +Property COPYRIGHT_OWNER = Property.internalTextBag( +Property COPYRIGHT_OWNER_ID = Property.composite(Property.internalTextBag( +Property COPYRIGHT_OWNER_NAME = Property.internalTextBag( +Serves to identify the rights holder/s for the image. The Copyright +String COPYRIGHT_OWNER_ID_WRONG_CASE = +The ID of the owner or owners of the copyright in the licensed image. +The name of the owner or owners of the copyright in the licensed image. +current owner of the copyright of this work with associated intellectual +in the CopyrightNotice. +new Property[]{Property.internalTextBag(IPTC.COPYRIGHT_OWNER_ID_WRONG_CASE)}); +regarding copyright ownership. The ASF licenses this file +the copyrights of this image other rights properties may be used. +standard. These parts Copyright 2010 International Press Telecommunications +this work for additional information regarding copyright ownership. +@deprecated use {@link IPTC#COPYRIGHT_OWNER_ID} diff --git a/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-keep-context b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-keep-context new file mode 100644 index 000000000000..981efc123a6d --- /dev/null +++ b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/copyright-keep-context @@ -0,0 +1 @@ +(IPR), Copyright, and various Property Rights. If the Rights element diff --git a/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-ignore b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-ignore new file mode 100644 index 000000000000..b9005a4d5ae7 --- /dev/null +++ b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-ignore @@ -0,0 +1 @@ +META-INF/LICENSE diff --git a/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-keep b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-keep new file mode 100644 index 000000000000..0d1c51375183 --- /dev/null +++ b/tools/legal-review/launcher/org.apache.tika.tika-core-2.4.1/files-keep @@ -0,0 +1 @@ +META-INF/NOTICE diff --git a/tools/legal-review/launcher/report-state b/tools/legal-review/launcher/report-state index e8c6a6e0e72b..e6eef402d4d5 100644 --- a/tools/legal-review/launcher/report-state +++ b/tools/legal-review/launcher/report-state @@ -1,3 +1,3 @@ -AB38B719F515D34ED9C306CFCCE5B436B8CAC50023F5ACE621D45CBB89AC4C8A -61C62A70B9F4C08AE1C1779CA8F11375E197064992F5E0535EB8AD9679A8DE72 +0D98680156DAEE1AF045DF3CC156B9646A0CACA43BC631F9174F8BEAA10B40C9 +279C45838441742F8D12E7FCB9546C7AD404AE8DE401A80DE5E341B7481FECB9 0 diff --git a/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-ignore b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-ignore new file mode 100644 index 000000000000..b488ab25cb50 --- /dev/null +++ b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-ignore @@ -0,0 +1,32 @@ +"The copyright information." +ARTWORK_OR_OBJECT_DETAIL_COPYRIGHT_NOTICE, ARTWORK_OR_OBJECT_DETAIL_CREATOR, +COPYRIGHT_OWNER_ID, COPYRIGHT_OWNER_NAME, IMAGE_CREATOR_ID, IMAGE_CREATOR_NAME, +Contains any necessary copyright notice for claiming the intellectual +Copyright 2016 Norconex Inc. +Copyright Owner, Image Supplier and Licensor may be the same or different +Copyright ownership can be expressed in a more controlled way using the +DATE_CREATED, DESCRIPTION_WRITER, INSTRUCTIONS, JOB_ID, TITLE, COPYRIGHT_NOTICE, +PREFIX_IPTC_EXT + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "AOCopyrightNotice"); +Owner or owners of the copyright in the licensed image. +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwner"); +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerID"), +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerId"; +PREFIX_PLUS + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER + "CopyrightOwnerName"); +Property ARTWORK_OR_OBJECT_DETAIL_COPYRIGHT_NOTICE = Property.internalTextBag( +Property COPYRIGHT = Property.externalText("xmpDM:copyright"); +Property COPYRIGHT_NOTICE = DublinCore.RIGHTS; +Property COPYRIGHT_OWNER = Property.internalTextBag( +Property COPYRIGHT_OWNER_ID = Property.composite(Property.internalTextBag( +Property COPYRIGHT_OWNER_NAME = Property.internalTextBag( +Serves to identify the rights holder/s for the image. The Copyright +String COPYRIGHT_OWNER_ID_WRONG_CASE = +The ID of the owner or owners of the copyright in the licensed image. +The name of the owner or owners of the copyright in the licensed image. +current owner of the copyright of this work with associated intellectual +in the CopyrightNotice. +new Property[]{Property.internalTextBag(IPTC.COPYRIGHT_OWNER_ID_WRONG_CASE)}); +regarding copyright ownership. The ASF licenses this file +standard. These parts Copyright 2010 International Press Telecommunications +the copyrights of this image other rights properties may be used. +this work for additional information regarding copyright ownership. +@deprecated use {@link IPTC#COPYRIGHT_OWNER_ID} diff --git a/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-keep-context b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-keep-context new file mode 100644 index 000000000000..981efc123a6d --- /dev/null +++ b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/copyright-keep-context @@ -0,0 +1 @@ +(IPR), Copyright, and various Property Rights. If the Rights element diff --git a/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-ignore b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-ignore new file mode 100644 index 000000000000..b9005a4d5ae7 --- /dev/null +++ b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-ignore @@ -0,0 +1 @@ +META-INF/LICENSE diff --git a/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-keep b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-keep new file mode 100644 index 000000000000..0d1c51375183 --- /dev/null +++ b/tools/legal-review/project-manager/org.apache.tika.tika-core-2.4.1/files-keep @@ -0,0 +1 @@ +META-INF/NOTICE diff --git a/tools/legal-review/project-manager/report-state b/tools/legal-review/project-manager/report-state index 584b24118729..9e886b68e49b 100644 --- a/tools/legal-review/project-manager/report-state +++ b/tools/legal-review/project-manager/report-state @@ -1,3 +1,3 @@ -8FAA9FD449B96C40ED702C5EE532FCCBF853A848FE372026EB4E1FE8A52A7ACE -9A28F6CA5CA670813F858F51F213FD37A3902E1B49017AEE7EED5A6C04C6C5C4 +84814B3648653F7BE53D330E8D7DBB23B5F2F564F37406A90D21A41A382C71F4 +4093B05996A6AF7CA3312C75DD7E42FFB01D783B0E77773BC0EB358322686452 0