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

Feature: consistent project names #1193

Closed
Andrei-Pozolotin opened this issue Mar 8, 2018 · 4 comments
Closed

Feature: consistent project names #1193

Andrei-Pozolotin opened this issue Mar 8, 2018 · 4 comments

Comments

@Andrei-Pozolotin
Copy link
Contributor

  1. motivation: sbt> eclipse produces short project names,
    which conflict with existing eclipse workspace projects with high probability:

  2. solution: we suggest consistent project names with pattern based on project.id:

// Provide consistent project name pattern.
lazy val nameSettings = Seq(
  normalizedName := projectName(thisProject.value), // Maven <artifactId>
  name := s"Scala.native ${projectName(thisProject.value)}" // Maven <name>
)

// Generate project name from project id.
def projectName(project: sbt.ResolvedProject) : String = {
  convertCamelKebab(project.id)
}

// Convert "SomeName" to "some-name".
def convertCamelKebab(name: String) : String = {
  name.replaceAll( "([a-z])([A-Z]+)", "$1-$2" ).toLowerCase
}
  1. for example:
  • before
sbt> eclipse
[info] Successfully created Eclipse project files for project(s):
[info] nscplugin
[info] benchmarks
[info] util
[info] testingCompiler
[info] test-interface
[info] scalalib
[info] tests
[info] javalib
[info] test-interface-sbt-defs
[info] tools
[info] nir
[info] test-interface-serialization
[info] testingCompilerInterface
[info] auxlib
[info] nativelib
[info] sandbox
[info] sbtScalaNative

pom.xml

<name>scalalib</name>
<description>scalalib</description>
  • after
sbt> eclipse
[info] Successfully created Eclipse project files for project(s):
[info] Scala.native nscplugin
[info] Scala.native benchmarks
[info] Scala.native util
[info] Scala.native testing-compiler
[info] Scala.native test-interface
[info] Scala.native scalalib
[info] Scala.native tests
[info] Scala.native javalib
[info] Scala.native test-interface-sbt-defs
[info] Scala.native tools
[info] Scala.native nir
[info] Scala.native test-interface-serialization
[info] Scala.native testing-compiler-interface
[info] Scala.native auxlib
[info] Scala.native nativelib
[info] Scala.native sandbox
[info] Scala.native sbt-scala-native

pom.xml

<name>Scala.native scalalib</name>
<description>Scala.native scalalib</description>
@ekrich
Copy link
Member

ekrich commented Mar 9, 2018

I think it might make more sense to enhance the sbt/sbteclipse plugin to add a prefix argument or setting rather than change Scala Native. This would be useful for anyone using Eclipse. Scala Native already publishes under org.scala-native and the artifact names need to be stable. If I am not missing something the names would change under this proposal thus making everyone change their build files.

@Andrei-Pozolotin
Copy link
Contributor Author

  1. thank you for the idea
  2. this pr helps beyond eclipse
  3. no, <artifactId> stays the same

@densh
Copy link
Member

densh commented Mar 12, 2018

Suggestion sounds good to me apart from the Scala.native. It should be Scala Native instead.

@ekrich
Copy link
Member

ekrich commented Jun 3, 2020

This changed the Manifest entries to "Scala Native nativelib" where they normally would be "nativelib" for example so the comment I had above was appropriate. See #1637

-- listing properties --
Manifest-Version=1.0
Implementation-Title=Scala Native nativelib
Implementation-Vendor=org.scala-native
Specification-Version=0.4.0-SNAPSHOT
Specification-Title=Scala Native nativelib
Implementation-Vendor-Id=org.scala-native
Specification-Vendor=org.scala-native
Implementation-Version=0.4.0-SNAPSHOT
Implementation-URL=http://www.scala-native.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants